Package pywbem :: Module cim_provider :: Class CIMProvider
[frames] | no frames]

Class CIMProvider

source code

object --+
         |
        CIMProvider

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, cim_class)
Return an instance.
source code
 
enum_instances(self, env, model, cim_class, keys_only)
Enumerate instances.
source code
 
set_instance(self, env, instance, previous_instance, cim_class)
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, assoc_class, result_class_name, role, result_role, keys_only)
Instrument Associations.
source code
 
MI_enumInstanceNames(self, env, ns, cimClass)
Return instance names of a given CIM class
source code
 
MI_enumInstances(self, env, ns, propertyList, requestedCimClass, cimClass)
Return instances of a given CIM class
source code
 
MI_getInstance(self, env, instanceName, propertyList, cimClass)
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, previousInstance, propertyList, cimClass)
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, metaMethod, inputParams)
Invoke an extrinsic method.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties
  filter_results
Determines if the CIMProvider base class should filter results

Inherited from object: __class__

Method Details

get_instance(self, env, model, cim_class)

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.
cim_class -- The pywbem.CIMClass

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, cim_class, 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.
cim_class -- The pywbem.CIMClass
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, previous_instance, cim_class)

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.
previous_instance -- The previous pywbem.CIMInstance if modifying
    an existing instance.  None if creating a new instance.
cim_class -- The pywbem.CIMClass

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 previous_instance is None, indicating that the operation
    was CreateInstance)
CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
    if previous_instance is not None, 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, assoc_class, 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.
assoc_class -- The pywbem.CIMClass.
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] assoc_class        |      |
   | 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, ns, cimClass)

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, ns, propertyList, requestedCimClass, cimClass)

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, cimClass)

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, previousInstance, propertyList, cimClass)

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, metaMethod, 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.
metaMethod -- The CIMMethod representing 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.


Property Details

filter_results

Determines if the CIMProvider base class should filter results

If True, the subclass of CIMProvider in the provider module does not need to filter returned results based on property_list, and in the case of association providers, role, result_role, and result_class_name. The results will be filtered by the CIMProvider base class.

If False, the CIMProvider base class will do no filtering. Therefore the subclass of CIMProvider in the provider module will have to filter based on property_list, and in the case of association providers, role, result_role, and result_class_name.

Get Method:
_get_filter_results(self)
Set Method:
_set_filter_results(self, value)