LMIWSMANClient

class lmi.shell.LMIWSMANClient.LMIWSMANClient(uri, username='', password='', interactive=False, verify_server_cert=True, key_file=None, cert_file=None)[source]

WS-MAN client.

Parameters:
  • uri (string) – URI of the CIMOM
  • username (string) – account, under which, the CIM calls will be performed
  • password (string) – user’s password
  • verify_server_cert (bool) – indicates, whether a server side certificate needs to be verified, if SSL used; default value is True
  • key_file (string) – path to x509 key file; default value is None
  • cert_file (string) – path to x509 cert file; default value is None
association(instance, relationship, result_cls, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, limit=-1)[source]

Enumerates association instance (names).

Parameters:
  • instance

    object, for which the association objects will be enumerated. The object needs to be instance of following classes:

  • relationshipLMIWSMANClient.ASSOC_ASSOCIATORS or LMIWSMANClient.ASSOC_REFERENCES
  • result_clsLMIWSMANClient.RES_INSTANCE or LMIWSMANClient.RES_INSTANCE_NAME
  • AssocClass (string) – valid CIM association class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an instance of this class or one of its subclasses.
  • ResultClass (string) – valid CIM class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be either an instance of this class (or one of its subclasses) or be this class (or one of its subclasses).
  • Role (string) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the source object plays the specified role. That is, the name of the property in the association class that refers to the source object shall match the value of this parameter.
  • ResultRole (string) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the named returned object plays the specified role. That is, the name of the property in the association class that refers to the returned object shall match the value of this parameter.
  • limit (int) – enumeration limit
Returns:

list of association objects

call_method(instance, method, **params)[source]

Executes a method within a given instance.

Parameters:
  • instance

    object, on which the method will be executed. The object needs to be instance of following classes:

  • method (string) – string containing a method name
  • params (dictionary) – parameters passed to the method call
Returns:

LMIReturnValue object with rval set to return value of the method call, rparams set to returned parameters from the method call, if no error occurs; otherwise rval is set to -1 and errorstr to appropriate error string

Raises:

CIMError

connect()[source]

Compatibility method present due to LMICIMXMLClient.

create_instance(*args, **kwargs)[source]

Not supported.

delete_instance(*args, **kwargs)[source]

Not supported.

disconnect()[source]

Compatibility method present due to LMICIMXMLClient.

dummy()[source]

Sends a “dummy” request to verify credentials.

Returns:LMIReturnValue with rval set to True, if provided credentials are OK; False otherwise. If LMIShell uses exceptions, CIMError will be raised.
Raises:CIMError
enumerate(result_cls, classname, namespace=None, inst_filter=None, limit=-1, **kwargs)[source]

Enumerates instance (names).

Parameters:
  • result_cls (int) – either LMIWSMANClient.RES_INSTANCE or LMIWSMANClient.RES_INSTANCE_NAME
  • classname (str) – class name to enumerate
  • namespace (str) – namespace where the class is located
  • inst_filter (dict) – dictionary containing keys and values for the filter
  • limit (int) – enumeration limit
  • kwargs – keyword arguments used for inst_filter
Return type:

list containing wbem.CIMInstance of wbem.CIMInstanceName

Raises:

CIMError

enumerate_iter(classname, namespace, filt, options=None, limit=-1)[source]

Enumerates instance (names).

Parameters:
  • filt (pywsman.Filter) – filter for enumeration
  • options (pywsman.ClientOptions) – options for enumeration
  • limit (int) – enumeration limit
Return type:

list containing wbem.CIMInstance of wbem.CIMInstanceName

Raises:

CIMError

enumerate_iter_with_uri(uri, filt, options=None, limit=-1)[source]

Enumerates instance (names).

Parameters:
  • uri (str) – URI of the resource
  • filt (pywsman.Filter) – filter for enumeration
  • options (pywsman.ClientOptions) – options for enumeration
  • limit (int) – enumeration limit
Return type:

list containing wbem.CIMInstance of wbem.CIMInstanceName

Raises:

CIMError

exec_query(*args, **kwargs)[source]

Executes a query and returns a list of wbem.CIMInstance objects.

Parameters:
  • query_lang (string) – query language
  • query (string) – query to execute
  • namespace (string) – target namespace for the query
Returns:

LMIReturnValue object with rval set to list of wbem.CIMInstance objects, if no error occurs; otherwise rval is set to None and errorstr is set to corresponding error string

Raises:

CIMError

get_associator_names(*args, **kwargs)[source]

Returns a list of associated wbem.CIMInstanceName objects with an input instance.

Parameters:
  • instance

    for this object the list of associated wbem.CIMInstanceName will be returned. The object needs to be instance of following classes:

  • AssocClass (string) – valid CIM association class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an instance of this class or one of its subclasses.
  • ResultClass (string) – valid CIM class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be either an instance of this class (or one of its subclasses) or be this class (or one of its subclasses).
  • Role (string) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the source object plays the specified role. That is, the name of the property in the association class that refers to the source object shall match the value of this parameter.
  • ResultRole (string) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the named returned object plays the specified role. That is, the name of the property in the association class that refers to the returned object shall match the value of this parameter.
  • limit (int) – enumeration limit
Returns:

list of associated wbem.CIMInstanceName objects with an input instance, if no error occurs; otherwise en empty list is returned

Raises:

CIMError

get_associators(*args, **kwargs)[source]

Returns a list of associated wbem.CIMInstance objects with an input instance.

Parameters:
  • instance

    for this object the list of associated wbem.CIMInstance objects will be returned. The object needs to be instance of following classes:

  • AssocClass (string) – valid CIM association class name. It acts as a filter on the returned set of objects by mandating that each returned object shall be associated to the source object through an instance of this class or one of its subclasses. Default value is None.
  • ResultClass (string) – valid CIM class name. It acts as a filter on the returned set of objects by mandating that each returned object shall be either an instance of this class (or one of its subclasses) or be this class (or one of its subclasses). Default value is None.
  • Role (string) – valid property name. It acts as a filter on the returned set of objects by mandating that each returned object shall be associated with the source object through an association in which the source object plays the specified role. That is, the name of the property in the association class that refers to the source object shall match the value of this parameter. Default value is None.
  • ResultRole (string) – valid property name. It acts as a filter on the returned set of objects by mandating that each returned object shall be associated to the source object through an association in which the returned object plays the specified role. That is, the name of the property in the association class that refers to the returned object shall match the value of this parameter. Default value is None.
  • IncludeQualifiers – unused
  • IncludeClassOrigin – unused
  • PropertyList – unused
  • limit (int) – enumeration limit
Returns:

list of associated wbem.CIMInstance objects with an input instance, if no error occurs; otherwise an empty list is returned

Raises:

CIMError

get_class(*args, **kwargs)[source]

Not supported.

get_class_names(*args, **kwargs)[source]

Not supported.

get_instance(instance, LocalOnly=True, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None)[source]

Returns a wbem.CIMInstance object.

Parameters:
  • instance

    path of the object, which is about to be retrieved. The object needs to be instance of following classes:

  • LocalOnly – unused
  • IncludeQualifiers – unused
  • IncludeClassOrigin – unused
  • PropertyList – unused
Returns:

LMIReturnValue object, where rval is set to wbem.CIMInstance object, if no error occurs; otherwise errorstr is set to corresponding error string

Raises:

CIMError

get_instance_names(classname, namespace=None, inst_filter=None, limit=-1, **kwargs)[source]

Returns a list of wbem.CIMInstanceName objects.

Parameters:
  • classname (string) – class name
  • namespace (string) – namespace name, where the instance names live
  • inst_filter (dict) – dictionary containing filter values. The key corresponds to the primary key of the wbem.CIMInstanceName; value contains the filtering value.
  • limit (int) – enumeration limit
  • kwargs (dictionary) –

    supported keyword arguments (these are deprecated)

    • Key or key (string) – filtering key, see above
    • Value or value (string) – filtering value, see above
Returns:

LMIReturnValue object with rval contains a list of wbem.CIMInstanceName objects, if no error occurs; otherwise rval is set to None and errorstr contains appropriate error string

Raises:

CIMError

get_instances(*args, **kwargs)[source]

Returns a list of wbem.CIMInstance objects.

Parameters:
  • classname (string) – class name
  • namespace (string) – namespace, where the instances live
  • inst_filter (dictionary) – dictionary containing filter values. The key corresponds to the primary key of the wbem.CIMInstanceName; value contains the filtering value.
  • client_filtering (bool) – if True, client-side filtering will be performed, otherwise the filtering will be done by a CIMOM. Default value is False.
  • limit (int) – enumeration limit
  • kwargs (dictionary) –

    supported keyword arguments (these are deprecated)

    • Key or key (string) – filtering key, see above
    • Value or value (string) – filtering value, see above
Returns:

LMIReturnValue object with rval set to a list of wbem.CIMIntance objects, if no error occurs; otherwise rval is set to None and errorstr is set to corresponding error string.

Raises:

CIMError

get_reference_names(*args, **kwargs)[source]

Returns a list of association wbem.CIMInstanceName objects with an input instance.

Parameters:
  • instance

    for this object the association wbem.CIMInstanceName objects will be returned. The object needs to be instance of following classes:

  • ResultClass (string) – valid CIM class name. It acts as a filter on the returned set of object names by mandating that each returned Object Name identify an instance of this class (or one of its subclasses) or this class (or one of its subclasses).
  • Role (string) – valid property name. It acts as a filter on the returned set of object names by mandating that each returned object name shall identify an object that refers to the target instance through a property with a name that matches the value of this parameter.
  • limit (int) – enumeration limit
Returns:

list of association wbem.CIMInstanceName objects with an input instance, if no error occurs; otherwise an empty list is returned

Raises:

CIMError

get_references(*args, **kwargs)[source]

Returns a list of association wbem.CIMInstance objects with an input instance.

Parameters:
  • instance

    for this object the association wbem.CIMInstances objects will be returned. The object needs to be instance of following classes:

  • ResultClass (string) – valid CIM class name. It acts as a filter on the returned set of objects by mandating that each returned object shall be an instance of this class (or one of its subclasses) or this class (or one of its subclasses). Default value is None.
  • Role (string) – valid property name. It acts as a filter on the returned set of objects by mandating that each returned object shall refer to the target object through a property with a name that matches the value of this parameter. Default value is None.
  • IncludeQualifiers – unused
  • IncludeClassOrigin – unused
  • PropertyList – unused
  • limit (int) – enumeration limit
Returns:

list of association wbem.CIMInstance objects with an input instance, if no error occurs; otherwise an empty list is returned

Raises:

CIMError

get_superclass(*args, **kwargs)[source]

Not supported.

hostname[source]
Returns:hostname of CIMOM
Return type:string
modify_instance(*args, **kwargs)[source]

Not supported.

uri[source]
Returns:URI of the CIMOM
Return type:string
username[source]
Returns:user name as a part of provided credentials
Return type:string