Package pywbem :: Module cim_operations :: Class WBEMConnection

[frames] | no frames]

# Class WBEMConnection

source code

    object --+
             |
            WBEMConnection

A client's connection to a WBEM server. This is the main class of the PyWBEM client.

The connection object knows a default CIM namespace, which is used when no namespace is specified on subsequent CIM operations (that support specifying namespaces). Thus, the connection object can be used as a connection to multiple CIM namespaces on a WBEM server (when the namespace is specified on subsequent operations), or as a connection to only the default namespace (this allows omitting the namespace on subsequent operations).

As usual in HTTP, there is no persistent TCP connection; the connectedness provided by this class is only conceptual. That is, the creation of the connection object does not cause any interaction with the WBEM server, and each subsequent CIM operation performs an independent, state-less HTTP/HTTPS request.

After creating a WBEMConnection object, various methods may be called on the object, which cause CIM operations to be invoked on the WBEM server. All these methods take regular Python objects or objects defined in cim_types as arguments, and return the same. The caller does not need to know about the CIM-XML encoding that is used underneath (It should be possible to use a different transport below this layer without disturbing any callers).

The connection remembers the XML of the last request and last reply if debugging is turned on via the debug instance variable of the connection object. This may be useful in debugging: If a problem occurs, you can examine the last_request and last_reply instance variables of the connection object. These are the prettified XML of request and response, respectively. The real request and response that are sent and received are available in the last_raw_request and last_raw_reply instance variables of the connection object.

The methods of this class may raise the following exceptions:

- Exceptions indicating processing errors:

  - pywbem.ConnectionError - A connection with the WBEM server could not be established or broke down.
  - pywbem.AuthError - Authentication failed with the WBEM server.
  - pywbem.ParseError - The response from the WBEM server cannot be parsed (for example, invalid characters or UTF-8 sequences, ill-formed XML, or invalid CIM-XML).
  - pywbem.CIMError - The WBEM server returned an error response with a CIM status code.
  - pywbem.TimeoutError - The WBEM server did not respond in time and the client timed out.

- Exceptions indicating programming errors:

  - `TypeError`
  - `KeyError`
  - `ValueError`
  - ... possibly others ...

  Exceptions indicating programming errors should not happen and should be reported as bugs, unless caused by the code using this class.

Instance Methods

__init__(self, url, creds=None, default_namespace=`'``root/cimv2``'`, x509=None, verify_callback=None, ca_certs=None, no_verification=False, timeout=None) Initialize the WBEMConnection object. | source code

__repr__(self) Return a representation of the connection object with the major instance variables, except for the password in the credentials. | source code

imethodcall(self, methodname, namespace, **params) Perform an intrinsic method call (= CIM operation). | source code

methodcall(self, methodname, localobject, Params=None, **params) Perform an extrinsic method call (= CIM method invocation). | source code

EnumerateInstanceNames(self, ClassName, namespace=None, **params) Enumerate the instance paths of instances of a class (including instances of its subclasses). | source code

EnumerateInstances(self, ClassName, namespace=None, **params) Enumerate the instances of a class (including instances of its subclasses). | source code

GetInstance(self, InstanceName, **params) Retrieve an instance. | source code

DeleteInstance(self, InstanceName, **params) Delete an instance. | source code

CreateInstance(self, NewInstance, **params) Create an instance. | source code

ModifyInstance(self, ModifiedInstance, **params) Modify the property values of an instance. | source code

ExecQuery(self, QueryLanguage, Query, namespace=None) Execute a query in a namespace. | source code

EnumerateClassNames(self, namespace=None, **params) Enumerate the names of subclasses of a class, or of the top-level classes in a namespace. | source code

EnumerateClasses(self, namespace=None, **params) Enumerate the subclasses of a class, or the top-level classes in a namespace. | source code

GetClass(self, ClassName, namespace=None, **params) Retrieve a class. | source code

DeleteClass(self, ClassName, namespace=None, **params) Delete a class. | source code

ModifyClass(self, ModifiedClass, namespace=None, **params) Modify a class. | source code

CreateClass(self, NewClass, namespace=None, **params) Create a class. | source code

Associators(self, ObjectName, **params) Retrieve the instances (or classes) associated to a source instance (or source class). | source code

AssociatorNames(self, ObjectName, **params) Retrieve the instance paths of the instances (or class paths of the classes) associated to a source instance (or source class). | source code

References(self, ObjectName, **params) Retrieve the association instances (or association classes) that reference a source instance (or source class). | source code

ReferenceNames(self, ObjectName, **params) Retrieve the instance paths of the association instances (or class paths of the association classes) that reference a source instance (or source class). | source code

InvokeMethod(self, MethodName, ObjectName, Params=None, **params) Invoke a method on a target instance or on a target class. | source code

EnumerateQualifiers(self, namespace=None, **params) Enumerate qualifier types. | source code

GetQualifier(self, QualifierName, namespace=None, **params) Retrieve a qualifier type. | source code

SetQualifier(self, QualifierDeclaration, namespace=None, **params) Create or modify a qualifier type. | source code

DeleteQualifier(self, QualifierName, namespace=None, **params) Delete a qualifier type. | source code

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

Instance Variables
| ... All parameters of __init__ are set as instance variables.
`bool` | debug A boolean indicating whether logging of the last request and last reply is enabled.
`unicode` | last_raw_reply CIM-XML data of the last response received from the WBEM server on this connection, formatted as it was received.
`unicode` | last_raw_request CIM-XML data of the last request sent to the WBEM server on this connection, formatted as it was sent.
`unicode` | last_reply CIM-XML data of the last response received from the WBEM server on this connection, formatted as prettified XML.
`unicode` | last_request CIM-XML data of the last request sent to the WBEM server on this connection, formatted as prettified XML.

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, url, creds=None, default_namespace=`'``root/cimv2``'`, x509=None, verify_callback=None, ca_certs=None, no_verification=False, timeout=None)
(Constructor)

source code

Initialize the WBEMConnection object.

Parameters:

  - `url` (string) - URL of the WBEM server (e.g. `"https://10.11.12.13:6988"`).

    TODO: Describe supported formats.

  - `creds` - Credentials for authenticating with the WBEM server. Currently, that is always a tuple of `(userid, password)`, where:

    - `userid` is a string that is the userid to be used for authenticating with the WBEM server.
    - `password` is a string that is the password for that userid.

  - `default_namespace` (string) - Optional: Name of the CIM namespace to be used by default (if no namespace is specified for an operation).

    Default: See method definition.

  - `x509` (dictionary) - Optional: X.509 certificates for HTTPS to be used instead of the credentials provided in the `creds` parameter. This parameter is used only when the `url` parameter specifies a scheme of `https`.

    If `None`, certificates are not used (and credentials are used instead).

    Otherwise, certificates are used instead of the credentials, and this parameter must be a dictionary containing the following key/value pairs:

    - `'cert_file'` : The file path of a file containing an X.509 certificate.
    - `'key_file'` : The file path of a file containing the private key belonging to the public key that is part of the X.509 certificate file.

    Default: `None`.

  - `verify_callback` (function) - Optional: Registers a callback function that will be called to verify the certificate returned by the WBEM server during the SSL handshake, in addition to the verification alreay performed by `M2Crypto`.

    If `None`, no such callback function will be registered.

    The specified function will be called for the returned certificate, and for each of the certificates in its chain of trust.

    See `M2Crypto.SSL.Context.set_verify` for details, as well as http://blog.san-ss.com.ar/2012/05/validating-ssl-certificate-in-python.html):

    The callback function must take five parameters:

    - the `M2Crypto.SSL.Connection` object that triggered the verification.
    - an `OpenSSL.crypto.X509` object representing the certificate to be validated (the returned certificate or one of the certificates in its chain of trust).
    - an integer containing the error number (0 in case no error) of any validation error detected by `M2Crypto`. You can find their meaning in the OpenSSL documentation.
    - an integer indicating the depth (=position) of the certificate to be validated (the one in the second parameter) in the chain of trust of the returned certificate. A value of 0 indicates that the returned is currently validated; any other value indicates the distance of the currently validated certificate to the returned certificate in its chain of trust.
    - an integer that indicates whether the validation of the certificate specified in the second argument passed or did not pass the validation by `M2Crypto`. A value of 1 indicates a successful validation and 0 an unsuccessful one.

    The callback function must return `True` if the verification passes and `False` otherwise.

    Default: `None`.

  - `ca_certs` (string) - Optional: Location of CA certificates (trusted certificates) for verification purposes.

    The parameter value is either the directory path of a directory prepared using the `c_rehash` tool included with OpenSSL, or the file path of a file in PEM format.

    If `None`, the default system path will be used.

    Default: `None`.

  - `no_verification` (`bool`) - Optional: Indicates that verification of the certificate returned by the WBEM server is disabled (both by `M2Crypto` and by the callback function specified in `verify_callback`).

    Disabling the verification is insecure and should be avoided.

    If `True`, verification is disabled; otherwise, it is enabled.

    Default: `False`.

  - `timeout` (number) - Timeout in seconds, for requests sent to the server. If the server did not respond within the timeout duration, the socket for the connection will be closed, causing a TimeoutError to be raised.

    A value of `None` means there is no timeout.

    A value of `0` means the timeout is very short, and does not really make any sense.

    Note that not all situations can be handled within this timeout, so for some issues, operations may take longer before raising an exception.

Overrides: object.__init__

Exceptions: See the list of exceptions described in WBEMConnection.

### __repr__(self)
(Representation operator)

source code

Return a representation of the connection object with the major instance variables, except for the password in the credentials.

TODO: Change to show all instance variables.

Overrides: object.__repr__

### imethodcall(self, methodname, namespace, **params)

source code

Perform an intrinsic method call (= CIM operation).

This is a low-level function that is used by the operation-specific methods of this class (e.g. EnumerateInstanceNames). In general, clients should call these operation-specific methods instead of this function.

The parameters are automatically converted to the right CIM-XML elements.

Returns:
  A tupletree (see tupletree module) with an `IRETURNVALUE` element at the root.

Exceptions: See the list of exceptions described in WBEMConnection.

### methodcall(self, methodname, localobject, Params=None, **params)

source code

Perform an extrinsic method call (= CIM method invocation).

This is a low-level function that is used by the 'InvokeMethod' method of this class. In general, clients should use 'InvokeMethod' instead of this function.

The Python method parameters are automatically converted to the right CIM-XML elements. See InvokeMethod for details.

Returns:
  A tupletree (see tupletree module) with a `RETURNVALUE` element at the root.

Exceptions: See the list of exceptions described in WBEMConnection.

### EnumerateInstanceNames(self, ClassName, namespace=None, **params)

source code

Enumerate the instance paths of instances of a class (including instances of its subclasses).

This method performs the EnumerateInstanceNames CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `ClassName` (string) - Name of the class to be enumerated.

  - `namespace` (string) - Optional: Name of the CIM namespace to be used. The value `None` causes the default namespace of the connection object to be used.

    Default: `None`.

Returns:
  A list of CIMInstanceName objects that are the enumerated instance paths.

Exceptions: See the list of exceptions described in WBEMConnection.

### EnumerateInstances(self, ClassName, namespace=None, **params)

source code

Enumerate the instances of a class (including instances of its subclasses).

This method performs the EnumerateInstances CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `ClassName` (string) - Name of the class to be enumerated.

  - `namespace` (string) - Optional: Name of the CIM namespace to be used. The value `None` causes the default namespace of the connection object to be used.

    Default: `None`.

  - `LocalOnly` (`bool`) - Optional: Controls the exclusion of inherited properties from the returned instances, as follows:

    - If `False`, inherited properties are not excluded.
    - If `True`, the behavior is WBEM server specific.

    Default: `True`.

    This parameter has been deprecated in CIM-XML and should be set to `False` by the caller.

  - `DeepInheritance` (`bool`) - Optional: Indicates that properties added by subclasses of the specified class are to be included in the returned instances. Note, the semantics of this parameter differs between instance and class level operations.

    Default: `True`.

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned instance.

    Default: `False`.

    This parameter has been deprecated in CIM-XML. Clients cannot rely on it being implemented by WBEM servers.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property in the returned instances.

    Default: `False`.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be included in the returned instances. An empty iterable indicates to include no properties. A value of `None` for this parameter indicates to include all properties.

    Default: `None`.

Returns:
  A list of CIMInstance objects that are representations of the enumerated instances.

Exceptions: See the list of exceptions described in WBEMConnection.

### GetInstance(self, InstanceName, **params)

source code

Retrieve an instance.

This method performs the GetInstance CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `InstanceName` (CIMInstanceName) - Instance path of the instance to be retrieved.

  - `LocalOnly` (`bool`) - Optional: Controls the exclusion of inherited properties from the returned instance, as follows:

    - If `False`, inherited properties are not excluded.
    - If `True`, the behavior is WBEM server specific.

    Default: `True`.

    This parameter has been deprecated in CIM-XML and should be set to `False` by the caller.

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned instance.

    Default: `False`.

    This parameter has been deprecated in CIM-XML. Clients cannot rely on it being implemented by WBEM servers.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property in the returned instance.

    Default: `False`.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be included in the returned instances. An empty iterable indicates to include no properties. A value of `None` for this parameter indicates to include all properties.

    Default: `None`.

Returns:
  A CIMInstance object that is a representation of the retrieved instance.

Exceptions: See the list of exceptions described in WBEMConnection.

### DeleteInstance(self, InstanceName, **params)

source code

Delete an instance.

This method performs the DeleteInstance CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `InstanceName` (CIMInstanceName) - Instance path of the instance to be deleted.

Exceptions: See the list of exceptions described in WBEMConnection.

### CreateInstance(self, NewInstance, **params)

source code

Create an instance.

This method performs the CreateInstance CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `NewInstance` (CIMInstance) - A representation of the instance to be created.

    The `namespace` and `classname` instance variables of this object specify CIM namespace and creation class for the new instance, respectively. An instance path specified using the `path` instance variable of this object will be ignored.

    The `properties` instance variable of this object specifies initial property values for the new instance.

    Instance-level qualifiers have been deprecated in CIM, so any qualifier values specified using the `qualifiers` instance variable of this object will be ignored.

Returns:
  CIMInstanceName object that is the instance path of the new instance.

Exceptions: See the list of exceptions described in WBEMConnection.

### ModifyInstance(self, ModifiedInstance, **params)

source code

Modify the property values of an instance.

This method performs the ModifyInstance CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `ModifiedInstance` (CIMInstance) - A representation of the modified instance. This object needs to contain any new property values and the instance path of the instance to be modified. Missing properties (relative to the class declaration) and properties provided with a value of `None` will be set to NULL. Typically, this object has been retrieved by other operations, such as GetInstance.

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be modified as specified in the `ModifiedInstance` parameter.

    Default: `True`.

    This parameter has been deprecated in CIM-XML. Clients cannot rely on it being implemented by WBEM servers.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be modified. An empty iterable indicates to modify no properties. A value of `None` for this parameter indicates to modify all properties.

    Default: `None`.

Exceptions: See the list of exceptions described in WBEMConnection.

### ExecQuery(self, QueryLanguage, Query, namespace=None)

source code

Execute a query in a namespace.

This method performs the ExecQuery CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `QueryLanguage` (string) - Name of the query language used in the `Query` parameter.
  - `Query` (string) - Query string in the query language specified in the `QueryLanguage` parameter.

  - `namespace` (string) - Optional: Name of the CIM namespace to be used. The value `None` causes the default namespace of the connection object to be used.

    Default: `None`.

Returns:
  A list of CIMInstance objects that represents the query result. These instances have their `path` instance variable set to identify their creation class and the target namespace of the query, but they are not addressable instances.

Exceptions: See the list of exceptions described in WBEMConnection.

### EnumerateClassNames(self, namespace=None, **params)

source code

Enumerate the names of subclasses of a class, or of the top-level classes in a namespace.

This method performs the EnumerateClassNames CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `namespace` (string) - Optional: Name of the namespace of the class, as a string. The value `None` causes the default namespace of the connection to be used.

    Default: `None`

  - `ClassName` (string) - Optional: Name of the class whose subclasses are to be retrieved. The value `None` causes the top-level classes in the namespace to be retrieved.

    Default: `None`

  - `DeepInheritance` (`bool`) - Optional: Indicates that all (direct and indirect) subclasses of the specified class or of the top-level classes are to be included in the result. `False` indicates that only direct subclasses of the specified class or ony top-level classes are to be included in the result.

    Note, the semantics of this parameter differs between instance and class level operations.

    Default: `False`.

Returns:
  A list of strings that are the class names of the enumerated classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### EnumerateClasses(self, namespace=None, **params)

source code

Enumerate the subclasses of a class, or the top-level classes in a namespace.

This method performs the EnumerateClasses CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `namespace` (string) - Optional: Name of the namespace of the class, as a string. The value `None` causes the default namespace of the connection to be used.

    Default: `None`

  - `ClassName` (string) - Optional: Name of the class whose subclasses are to be retrieved. The value `None` causes the top-level classes in the namespace to be retrieved.

    Default: `None`

  - `DeepInheritance` (`bool`) - Optional: Indicates that all (direct and indirect) subclasses of the specified class or of the top-level classes are to be included in the result. `False` indicates that only direct subclasses of the specified class or ony top-level classes are to be included in the result.

    Note, the semantics of this parameter differs between instance and class level operations.

    Default: `False`.

  - `LocalOnly` (`bool`) - Optional: Indicates that inherited properties, methods, and qualifiers are to be excluded from the returned classes.

    Default: `True`.

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned classes.

    Default: `False`.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property and method in the returned classes.

    Default: `False`.

Returns:
  A list of CIMClass objects that are representations of the enumerated classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### GetClass(self, ClassName, namespace=None, **params)

source code

Retrieve a class.

This method performs the GetClass CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  - `ClassName` (string) - Name of the class to be retrieved.

  - `namespace` (string) - Optional: Name of the namespace of the class, as a string. The value `None` causes the default namespace of the connection to be used.

    Default: `None`

  - `LocalOnly` (`bool`) - Optional: Indicates that inherited properties, methods, and qualifiers are to be excluded from the returned class.

    Default: `True`.

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned class.

    Default: `False`.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property and method in the returned class.

    Default: `False`.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be included in the returned class. An empty iterable indicates to include no properties. A value of `None` for this parameter indicates to include all properties.

    Default: `None`.

Returns:
  A CIMClass object that is a representation of the retrieved class.

Exceptions: See the list of exceptions described in WBEMConnection.

### DeleteClass(self, ClassName, namespace=None, **params)

source code

Delete a class.

This method performs the DeleteClass CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

TODO This method is UNSUPPORTED right now. Test and verify description.

Parameters:
  - `ClassName` (string) - Name of the class to be deleted.

  - `namespace` (string) - Optional: Name of the namespace of the class, as a string. The value `None` causes the default namespace of the connection to be used.

    Default: `None`

Exceptions: See the list of exceptions described in WBEMConnection.

### ModifyClass(self, ModifiedClass, namespace=None, **params)

source code

Modify a class.

This method performs the ModifyClass CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

TODO This method is UNSUPPORTED right now. Test and verify description.

Parameters:
  - `ModifiedClass` (CIMClass) - A representation of the modified class. This object needs to contain any modified properties, methods and qualifiers and the class path of the class to be modified. Typically, this object has been retrieved by other operations, such as GetClass.

Exceptions: See the list of exceptions described in WBEMConnection.

### CreateClass(self, NewClass, namespace=None, **params)

source code

Create a class.

This method performs the ModifyClass CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

TODO This method is UNSUPPORTED right now. Test and verify description.

Parameters:
  - `NewClass` (CIMClass) - A representation of the class to be created. This object needs to contain any properties, methods, qualifiers, superclass name, and the class name of the class to be created. The class path in this object (`path` instance variable) will be ignored.

  - `namespace` (string) - Optional: Name of the namespace in which the class is to be created. The value `None` causes the default namespace of the connection to be used.

    Default: `None`

Exceptions: See the list of exceptions described in WBEMConnection.

### Associators(self, ObjectName, **params)

source code

Retrieve the instances (or classes) associated to a source instance (or source class).

This method performs the Associators CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `ObjectName` - For instance level usage: The instance path of the source instance, as a CIMInstanceName object. If that object does not specify a namespace, the default namespace of the connection is used.

    For class level usage: The class path of the source class, as a string or as a CIMClassName object. If specified as a string, the string is interpreted as a class name in the default namespace of the connection. If specified as a CIMClassName object that does not specify a namespace, the default namespace of the connection is used.

  - `AssocClass` (string or CIMClassName) - Optional: Class name of an association class, to filter the result to include only traversals of that association class (or subclasses).

    Default: `None` (no filtering).

  - `ResultClass` (string or CIMClassName) - Optional: Class name of an associated class, to filter the result to include only traversals to that associated class (or subclasses).

    Default: `None` (no filtering).

  - `Role` (string) - Optional: Role name (= property name) of the source end, to filter the result to include only traversals from that source role.

    Default: `None` (no filtering).

  - `ResultRole` - Optional: Role name (= property name) of the far end, to filter the result to include only traversals to that far role.

    Default: `None` (no filtering).

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned instances (or classes).

    Default: `False`.

    This parameter has been deprecated in CIM-XML. Clients cannot rely on it being implemented by WBEM servers.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property or method in the returned instances (or classes).

    Default: `False`.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be included in the returned instances (or classes). An empty iterable indicates to include no properties. A value of `None` for this parameter indicates to include all properties.

    Default: `None`.

Returns:

  For instance level usage, a list of CIMInstance objects that are representations of the associated instances.

  For class level usage, a list of CIMClass objects that are representations the associated classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### AssociatorNames(self, ObjectName, **params)

source code

Retrieve the instance paths of the instances (or class paths of the classes) associated to a source instance (or source class).

This method performs the AssociatorNames CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `ObjectName` - For instance level usage: The instance path of the source instance, as a CIMInstanceName object. If that object does not specify a namespace, the default namespace of the connection is used.

    For class level usage: The class path of the source class, as a string or as a CIMClassName object. If specified as a string, the string is interpreted as a class name in the default namespace of the connection. If specified as a CIMClassName object that does not specify a namespace, the default namespace of the connection is used.

  - `AssocClass` (string or CIMClassName) - Optional: Class name of an association class, to filter the result to include only traversals of that association class (or subclasses).

    Default: `None` (no filtering).

  - `ResultClass` (string or CIMClassName) - Optional: Class name of an associated class, to filter the result to include only traversals to that associated class (or subclasses).

    Default: `None` (no filtering).

  - `Role` (string) - Optional: Role name (= property name) of the source end, to filter the result to include only traversals from that source role.

    Default: `None` (no filtering).

  - `ResultRole` - Optional: Role name (= property name) of the far end, to filter the result to include only traversals to that far role.

    Default: `None` (no filtering).

Returns:

  For instance level usage, a list of CIMInstanceName objects that are the instance paths of the associated instances.

  For class level usage, a list of CIMClassName objects that are the class paths of the associated classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### References(self, ObjectName, **params)

source code

Retrieve the association instances (or association classes) that reference a source instance (or source class).

This method performs the References CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `ObjectName` - For instance level usage: The instance path of the source instance, as a CIMInstanceName object. If that object does not specify a namespace, the default namespace of the connection is used.

    For class level usage: The class path of the source class, as a string or as a CIMClassName object. If specified as a string, the string is interpreted as a class name in the default namespace of the connection. If specified as a CIMClassName object that does not specify a namespace, the default namespace of the connection is used.

  - `ResultClass` (string or CIMClassName) - Optional: Class name of an association class, to filter the result to include only traversals of that association class (or subclasses).

    Default: `None` (no filtering).

  - `Role` (string) - Optional: Role name (= property name) of the source end, to filter the result to include only traversals from that source role.

    Default: `None` (no filtering).

  - `IncludeQualifiers` (`bool`) - Optional: Indicates that qualifiers are to be included in the returned instances (or classes).

    Default: `False`.

    This parameter has been deprecated in CIM-XML. Clients cannot rely on it being implemented by WBEM servers.

  - `IncludeClassOrigin` (`bool`) - Optional: Indicates that class origin information is to be included on each property or method in the returned instances (or classes).

    Default: `False`.

  - `PropertyList` (iterable of string) - Optional: An iterable specifying the names of the properties to be included in the returned instances (or classes). An empty iterable indicates to include no properties. A value of `None` for this parameter indicates to include all properties.

    Default: `None`.

Returns:

  For instance level usage, a list of CIMInstance objects that are representations of the referencing association instances.

  For class level usage, a list of CIMClass objects that are representations the referencing association classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### ReferenceNames(self, ObjectName, **params)

source code

Retrieve the instance paths of the association instances (or class paths of the association classes) that reference a source instance (or source class).

This method performs the ReferenceNames CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:

  - `ObjectName` - For instance level usage: The instance path of the source instance, as a CIMInstanceName object. If that object does not specify a namespace, the default namespace of the connection is used.

    For class level usage: The class path of the source class, as a string or as a CIMClassName object. If specified as a string, the string is interpreted as a class name in the default namespace of the connection. If specified as a CIMClassName object that does not specify a namespace, the default namespace of the connection is used.

  - `ResultClass` (string or CIMClassName) - Optional: Class name of an association class, to filter the result to include only traversals of that association class (or subclasses).

    Default: `None` (no filtering).

  - `Role` (string) - Optional: Role name (= property name) of the source end, to filter the result to include only traversals from that source role.

    Default: `None` (no filtering).

Returns:

  For instance level usage, a list of CIMInstanceName objects that are the instance paths of the referencing association instances.

  For class level usage, a list of CIMClassName objects that are the class paths of the referencing association classes.

Exceptions: See the list of exceptions described in WBEMConnection.

### InvokeMethod(self, MethodName, ObjectName, Params=None, **params)

source code

Invoke a method on a target instance or on a target class.

The methods that can be invoked are static and non-static methods defined in a class (also known as extrinsic methods). Static methods can be invoked on instances and on classes. Non-static methods can be invoked only on instances.

This method performs the InvokeMethod CIM-XML operation. If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Input parameters for the CIM method can be specified in a order-preserving way using the `Params` parameter, and in a order-agnostic way using the `**params` keyword parameters.

Returns:

  A tuple of `(returnvalue, outparams)`, where:

  > - `returnvalue` : Return value of the CIM method, as a CIM typed value as described in cim_types.
  > - `outparams` : Output parameters of the CIM method, as a NocaseDict dictionary containing all CIM method output parameters, where the dictionary items have:
  >   - a key that is the CIM parameter name, as a string.
  >   - a value that is the CIM parameter value, as a CIM typed value as described in cim_types.

Parameters:

MethodName : string
  Name of the method to be invoked (without parenthesis or any parameter signature).
ObjectName

  For instance level usage: The instance path of the target instance, as a CIMInstanceName object. If that object does not specify a namespace, the default namespace of the connection is used.

  For class level usage: The class path of the target class, as a string or as a CIMClassName object. If specified as a string, the string is interpreted as a class name in the default namespace of the connection. If specified as a CIMClassName object that does not specify a namespace, the default namespace of the connection is used.

Params

  A list of input parameters for the CIM method.

  Each list item represents a single input parameter for the CIM method and must be a `tuple(name,value)`, where `name` is the parameter name in any lexical case, and `value` is the parameter value as a CIM typed value as described in cim_types.

**params

  Keyword parameters for the input parameters for the CIM method.

  Each keyword parameter represents a single input parameter for the CIM method, where the key is the parameter name in any lexical case, and the value is the parameter value as a CIM typed value as described in cim_types.

  The overall list of input parameters represented in the CIM-XML request message that is sent to the WBEM server is formed from the list of parameters specified in `Params` preserving its order, followed by the set of parameters specified in `**params` in any order. There is no checking for duplicate parameter names in the PyWBEM client.

Exceptions: See the list of exceptions described in WBEMConnection.

### EnumerateQualifiers(self, namespace=None, **params)

source code

Enumerate qualifier types.

Returns a list of CIMQualifier objects.

TODO Complete this description.

### GetQualifier(self, QualifierName, namespace=None, **params)

source code

Retrieve a qualifier type.

Returns a CIMQualifier object.

TODO Complete this description.

### SetQualifier(self, QualifierDeclaration, namespace=None, **params)

source code

Create or modify a qualifier type.

TODO Complete this description.

### DeleteQualifier(self, QualifierName, namespace=None, **params)

source code

Delete a qualifier type.

TODO Complete this description.

Instance Variable Details

### debug

A boolean indicating whether logging of the last request and last reply is enabled.

The initial value of this instance variable is `False`. Debug logging can be enabled for future operations by setting this instance variable to `True`.

Type:
  `bool`

### last_raw_reply

CIM-XML data of the last response received from the WBEM server on this connection, formatted as it was received. Prior to sending the very first request on this connection object, while waiting for any response, it is `None`.

Type:
  `unicode`

### last_raw_request

CIM-XML data of the last request sent to the WBEM server on this connection, formatted as it was sent. Prior to sending the very first request on this connection object, it is `None`.

Type:
  `unicode`

### last_reply

CIM-XML data of the last response received from the WBEM server on this connection, formatted as prettified XML. Prior to sending the very first request on this connection object, while waiting for any response, it is `None`.

Type:
  `unicode`

### last_request

CIM-XML data of the last request sent to the WBEM server on this connection, formatted as prettified XML. Prior to sending the very first request on this connection object, it is `None`.

Type:
  `unicode`