Package pywbem :: Module cim_provider2 :: Class CIMProvider2 |
[frames] | no frames]

# Class CIMProvider2

source code

    object --+
             |
            CIMProvider2

    Base class for CIM Providers.

    A derived class might normally override the following:
    - enum_instances
    - get_instance
    - set_instance
    - delete_instance
    - references

    If the provider is a "read-only" instance provider, set_instance and
    delete_instance need not be overridden.

    Only association providers need to override references.

    A method provider should implement a method of the form:
        def cim_method_<method_name>(self, env, object_name, method,
                                     param_<input_param_1>,
                                     param_<input_param_2>,
                                     ...):
        Where <method_name> is the name of the method from the CIM schema.
        <method_name> needs to be all lowercase, regardless of the case of
        the method name in the CIM schema (CIM method names are case
        insensitive).

        Keyword arguments:
        env -- Provider Environment (pycimmb.ProviderEnvironment)
        object_name -- A pywbem.CIMInstanceName or pywbem.CIMClassname
            specifying the object on which the method is to be invoked.
        method -- A pywbem.CIMMethod, representing the method to execute.
        param_<param_name> -- Corresponds to the input parameter <param_name>
            from the CIM schema.  <param_name> needs to be all lowercase,
            regardless of the case of the parameter name in the CIM schema
            (CIM parameter names are case insensitive).

        The method returns a two-tuple containing the return value of the
        method, and a dictionary containing the output parameters.

    Example:
        def cim_method_requeststatechange(self, env, object_name, method,
                                          param_requestedstate,
                                          param_timeoutperiod):
            # do stuff.
            out_params = {'job': pywbem.CIMInstanceName(...)}
            rval = pywbem.Uint32(0)
            return (rval, out_params)

    The methods prefixed with "MI_" correspond to the WBEM operations
    from http://www.dmtf.org/standards/published_documents/DSP200.html
    The default implementations of these methods call the methods
    described above.  These will not normally be overridden or extended
    by a subclass.

Instance Methods
get_instance(self, env, model) Return an instance. | source code
enum_instances(self, env, model, keys_only) Enumerate instances. | source code
set_instance(self, env, instance, modify_existing) Return a newly created or modified instance. | source code
delete_instance(self, env, instance_name) Delete an instance. | source code
references(self, env, object_name, model, result_class_name, role, result_role, keys_only) Instrument Associations. | source code
simple_refs(self, env, object_name, model, result_class_name, role, result_role, keys_only) | source code
paths_equal(self, lhs, rhs) If one object path doesn't inlcude a host, don't include the hosts in the comparison | source code
MI_enumInstanceNames(self, env, objPath) Return instance names of a given CIM class | source code
MI_enumInstances(self, env, objPath, propertyList) Return instances of a given CIM class | source code
MI_getInstance(self, env, instanceName, propertyList) Return a specific CIM instance | source code
MI_createInstance(self, env, instance) Create a CIM instance, and return its instance name | source code
MI_modifyInstance(self, env, modifiedInstance, propertyList) Modify a CIM instance | source code
MI_deleteInstance(self, env, instanceName) Delete a CIM instance | source code
MI_associators(self, env, objectName, assocClassName, resultClassName, role, resultRole, propertyList) Return instances associated to a given object. | source code
MI_associatorNames(self, env, objectName, assocClassName, resultClassName, role, resultRole) Return instances names associated to a given object. | source code
MI_references(self, env, objectName, resultClassName, role, propertyList) Return instances of an association class. | source code
MI_referenceNames(self, env, objectName, resultClassName, role) Return instance names of an association class. | source code
MI_invokeMethod(self, env, objectName, methodName, inputParams) Invoke an extrinsic method. | source code
filter_instance(self, inst, plist) Remove properties from an instance that aren't in the PropertyList | source code
authorize_filter(env, filter, ns, classes, owner) Allow or disallow an indication subscription request. | source code
activate_filter(env, filter, ns, classes, first_activation) Activate an indication subscription. | source code
deactivate_filter(env, filter, ns, classes, last_activation) Deactivate an indication subscription. | source code
enable_indications(env) Enable indications. | source code
disable_indications(env) Disable indications. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### get_instance(self, env, model) | source code
    Return an instance.

    Keyword arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    model -- A template of the pywbem.CIMInstance to be returned.  The
        key properties are set on this instance to correspond to the
        instanceName that was requested.  The properties of the model
        are already filtered according to the PropertyList from the
        request.  Only properties present in the model need to be
        given values.  If you prefer, you can set all of the
        values, and the instance will be filtered for you.

    Possible Errors:
    CIM_ERR_ACCESS_DENIED
    CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
        or otherwise incorrect parameters)
    CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
        Instance does not exist in the specified namespace)
    CIM_ERR_FAILED (some other unspecified error occurred)

### enum_instances(self, env, model, keys_only) | source code
    Enumerate instances.

    The WBEM operations EnumerateInstances and EnumerateInstanceNames
    are both mapped to this method.
    This method is a python generator

    Keyword arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    model -- A template of the pywbem.CIMInstances to be generated.
        The properties of the model are already filtered according to
        the PropertyList from the request.  Only properties present in
        the model need to be given values.  If you prefer, you can
        always set all of the values, and the instance will be filtered
        for you.
    keys_only -- A boolean.  True if only the key properties should be
        set on the generated instances.

    Possible Errors:
    CIM_ERR_FAILED (some other unspecified error occurred)

### set_instance(self, env, instance, modify_existing) | source code
    Return a newly created or modified instance.

    Keyword arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    instance -- The new pywbem.CIMInstance.  If modifying an existing
        instance, the properties on this instance have been filtered by
        the PropertyList from the request.
    modify_existing -- True if ModifyInstance, False if CreateInstance

    Return the new instance.  The keys must be set on the new instance.

    Possible Errors:
    CIM_ERR_ACCESS_DENIED
    CIM_ERR_NOT_SUPPORTED
    CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
        or otherwise incorrect parameters)
    CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
        valid if modify_existing is False, indicating that the operation
        was CreateInstance)
    CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
        if modify_existing is True, indicating that the operation
        was ModifyInstance)
    CIM_ERR_FAILED (some other unspecified error occurred)

### delete_instance(self, env, instance_name) | source code
    Delete an instance.

    Keyword arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    instance_name -- A pywbem.CIMInstanceName specifying the instance
        to delete.

    Possible Errors:
    CIM_ERR_ACCESS_DENIED
    CIM_ERR_NOT_SUPPORTED
    CIM_ERR_INVALID_NAMESPACE
    CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
        or otherwise incorrect parameters)
    CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
        namespace)
    CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
        Instance does not exist in the specified namespace)
    CIM_ERR_FAILED (some other unspecified error occurred)

### references(self, env, object_name, model, result_class_name, role, result_role, keys_only) | source code
    Instrument Associations.

    All four association-related operations (Associators, AssociatorNames,
    References, ReferenceNames) are mapped to this method.
    This method is a python generator

    Keyword arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    object_name -- A pywbem.CIMInstanceName that defines the source
        CIM Object whose associated Objects are to be returned.
    model -- A template pywbem.CIMInstance to serve as a model
        of the objects to be returned.  Only properties present on this
        model need to be set.
    result_class_name -- If not empty, this string acts as a filter on
        the returned set of Instances by mandating that each returned
        Instances MUST represent an association between object_name
        and an Instance of a Class whose name matches this parameter
        or a subclass.
    role -- If not empty, MUST be a valid Property name. It acts as a
        filter on the returned set of Instances by mandating that each
        returned Instance MUST refer to object_name via a Property
        whose name matches the value of this parameter.
    result_role -- If not empty, MUST be a valid Property name. It acts
        as a filter on the returned set of Instances by mandating that
        each returned Instance MUST represent associations of
        object_name to other Instances, where the other Instances play
        the specified result_role in the association (i.e. the
        name of the Property in the Association Class that refers to
        the Object related to object_name MUST match the value of this
        parameter).
    keys_only -- A boolean.  True if only the key properties should be
        set on the generated instances.

    The following diagram may be helpful in understanding the role,
    result_role, and result_class_name parameters.
    +------------------------+                    +-------------------+
    | object_name.classname  |                    | result_class_name |
    | ~~~~~~~~~~~~~~~~~~~~~  |                    | ~~~~~~~~~~~~~~~~~ |
    +------------------------+                    +-------------------+
       |              +-----------------------------------+      |
       |              |  [Association] model.classname    |      |
       | object_name  |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    |      |
       +--------------+ object_name.classname REF role    |      |
    (CIMInstanceName) | result_class_name REF result_role +------+
                      |                                   |(CIMInstanceName)
                      +-----------------------------------+

    Possible Errors:
    CIM_ERR_ACCESS_DENIED
    CIM_ERR_NOT_SUPPORTED
    CIM_ERR_INVALID_NAMESPACE
    CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
        or otherwise incorrect parameters)
    CIM_ERR_FAILED (some other unspecified error occurred)

### MI_enumInstanceNames(self, env, objPath) | source code
Return instance names of a given CIM class Implements the WBEM operation EnumerateInstanceNames in terms of the enum_instances method. A derived class will not normally override this method.

### MI_enumInstances(self, env, objPath, propertyList) | source code
Return instances of a given CIM class Implements the WBEM operation EnumerateInstances in terms of the enum_instances method. A derived class will not normally override this method.

### MI_getInstance(self, env, instanceName, propertyList) | source code
Return a specific CIM instance Implements the WBEM operation GetInstance in terms of the get_instance method. A derived class will not normally override this method.

### MI_createInstance(self, env, instance) | source code
Create a CIM instance, and return its instance name Implements the WBEM operation CreateInstance in terms of the set_instance method. A derived class will not normally override this method.

### MI_modifyInstance(self, env, modifiedInstance, propertyList) | source code
Modify a CIM instance Implements the WBEM operation ModifyInstance in terms of the set_instance method. A derived class will not normally override this method.

### MI_deleteInstance(self, env, instanceName) | source code
Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally override this method.

### MI_associators(self, env, objectName, assocClassName, resultClassName, role, resultRole, propertyList) | source code
Return instances associated to a given object. Implements the WBEM operation Associators in terms of the references method. A derived class will not normally override this method.

### MI_associatorNames(self, env, objectName, assocClassName, resultClassName, role, resultRole) | source code
Return instances names associated to a given object. Implements the WBEM operation AssociatorNames in terms of the references method. A derived class will not normally override this method.

### MI_references(self, env, objectName, resultClassName, role, propertyList) | source code
Return instances of an association class. Implements the WBEM operation References in terms of the references method. A derived class will not normally override this method.

### MI_referenceNames(self, env, objectName, resultClassName, role) | source code
Return instance names of an association class. Implements the WBEM operation ReferenceNames in terms of the references method. A derived class will not normally override this method.

### MI_invokeMethod(self, env, objectName, methodName, inputParams) | source code
    Invoke an extrinsic method.

    Implements the InvokeMethod WBEM operation by calling the
    method on a derived class called cim_method_<method_name>,
    where <method_name> is the name of the CIM method, in all
    lower case.

    Arguments:
    env -- Provider Environment (pycimmb.ProviderEnvironment)
    objectName -- The InstanceName or ClassName of the object on
    which the method is invoked.
    methodName -- The name of the method to be invoked.
    inputParams -- A Dictionary where the key is the parameter name
        and the value is the parameter value.

    The return value for invokeMethod must be a tuple of size 2
    where:
    element 0 is a tuple of size 2 where element 0 is the return
        data type name and element 1 is the actual data value.
    element 1 is a dictionary where the key is the output
        parameter name and the value is a tuple of size 2 where
        element 0 is the data type name for the output parameter
        and element 1 is the actual value of the output parameter.

    A derived class will not normally override this method.

### filter_instance(self, inst, plist) | source code
    Remove properties from an instance that aren't in the PropertyList

    inst -- The CIMInstance
    plist -- The property List, or None.  The list items must be all
        lowercase.

### authorize_filter(env, filter, ns, classes, owner) | source code
Allow or disallow an indication subscription request. Arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) filter -- The WQL select statement namespace -- The namepace where the indication is registered for classes -- The classpath of the indication registered for owner -- The name of the principal (cimom user)

### activate_filter(env, filter, ns, classes, first_activation) | source code
Activate an indication subscription. Arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) filter -- The WQL select statement namespace -- The namepace where the indication is registered for classes -- The classpath of the indication registered for first_activation -- boolean - whether first activation

### deactivate_filter(env, filter, ns, classes, last_activation) | source code
Deactivate an indication subscription. Arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) filter -- The WQL select statement ns -- The namepace where the indication is registered for classes -- The classpath of the indication registered for last_activation -- boolean - whether last activation

### enable_indications(env) | source code
Enable indications. Arguments: env -- Provider Environment (pycimmb.ProviderEnvironment)

### disable_indications(env) | source code
Disable indications. Arguments: env -- Provider Environment (pycimmb.ProviderEnvironment)