4.1. WBEM operations

Objects of the WBEMConnection class represent a connection to a WBEM server. All WBEM operations defined in DSP0200 can be issued across this connection. Each method of this class corresponds directly to a WBEM operation.

WBEMConnection method Purpose
EnumerateInstances() Enumerate the instances of a class (including instances of its subclasses)
EnumerateInstanceNames() Enumerate the instance paths of instances of a class (including instances of its subclasses).
GetInstance() Retrieve an instance
ModifyInstance() Modify the property values of an instance
CreateInstance() Create an instance
DeleteInstance() Delete an instance
Associators() Retrieve the instances (or classes) associated to a source instance (or source class)
AssociatorNames() Retrieve the instance paths of the instances (or classes) associated to a source instance (or source class)
References() Retrieve the association instances (or association classes) that reference a source instance (or source class)
ReferenceNames() Retrieve the instance paths of the association instances (or association classes) that reference a source instance (or source class)
InvokeMethod() Invoke a method on a target instance or on a target class
ExecQuery() Execute a query in a namespace
IterEnumerateInstances() Iterator API that uses either OpenEnumerateInstances and PullInstancesWithPath or EnumerateInstances depending on the attributes and existence of pull operations in the server.
IterEnumerateInstancePaths() Iterator API that uses either OpenEnumerateInstances and PullInstancesWithPath or EnumerateInstances depending on the attributes and existence of pull operations in the server.
IterAssociatorInstances() Iterator API that uses either OpenAssociatorInstances and PullInstancesWithPath or Associators depending on the attributes and existence of pull operations in the server.
IterAssociatorInstancePaths() Iterator API that uses either OpenAssociatorInstances and PullInstancesWithPath or Associators depending on the attributes and existence of pull operations in the server.
IterReferenceInstances() Iterator API that uses either OpenReferenceInstances and PullInstancesWithPath or References depending on the attributes and existence of pull operations in the server.
IterReferenceInstancePaths() Iterator API that uses either OpenReferenceInstances and PullInstancesWithPath or References depending on the attributes and existence of pull operations in the server.
IterQueryInstances() Iterator API that uses either OpenQueryInstances and PullInstances or ExecQuery depending on the attributes and existence of pull operations in the server.
OpenEnumerateInstances() Open enumeration session to retrieve instances of of a class (including instances of its subclass)
OpenEnumerateInstancePaths() Open enumeration session to retrieve instances of a class (including instances of its subclass)
OpenAssociatorInstances() Open enumeration session to retrieve the instances associated to a source instance
OpenAssociatorInstancePaths() Open enumeration session to retrieve the instances associated to a source instance
OpenReferenceInstances() Open enumeration session to retrieve the instances that reference a source instance
OpenReferenceInstancePaths() Open enumeration session to retrieve the instances that reference a source instance
OpenQueryInstances() Open query request to retrieve instances defined by the query parameter in a namespace
PullInstancesWithPath() Continue enumeration session opened with OpenEnumerateInstances, OpenAssociatorInstances, or OpenReferenceinstances
PullInstancePaths() Continue enumeration session opened with OpenEnumerateInstancePaths, OpenAssociatorInstancePaths, or OpenReferenceInstancePaths
PullInstances() Continue enumeration of enumeration session opened with OpenExecQuery
CloseEnumeration() Close an enumeration session in process.
EnumerateClasses() Enumerate the subclasses of a class, or the top-level classes in a namespace
EnumerateClassNames() Enumerate the names of subclasses of a class, or of the top-level classes in a namespace
GetClass() Retrieve a class
ModifyClass() Modify a class
CreateClass() Create a class
DeleteClass() Delete a class
EnumerateQualifiers() Enumerate qualifier declarations
GetQualifier() Retrieve a qualifier declaration
SetQualifier() Create or modify a qualifier declaration
DeleteQualifier() Delete a qualifier declaration

NOTE: The method EnumerationCount is to be deprecated from the DMTF specs and has not been implemented by any WBEM servers so was not implemented in pywbem.

4.1.1. WBEMConnection

class pywbem.WBEMConnection(url, creds=None, default_namespace=None, x509=None, verify_callback=None, ca_certs=None, no_verification=False, timeout=None, use_pull_operations=False, stats_enabled=False)[source]

A client’s connection to a WBEM server. This is the main class of the WBEM client library API.

The connection object knows a default CIM namespace, which is used when no namespace is specified on subsequent WBEM 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 WBEM operation performs an independent, state-less HTTP/HTTPS request.

After creating a WBEMConnection object, various methods may be called on the object, which cause WBEM operations to be issued to the WBEM server. See WBEM operations for a list of these methods.

CIM elements such as instances or classes are represented as Python objects (see CIM objects). The caller does not need to know about the CIM-XML encoding of CIM elements and protocol payload that is used underneath (It should be possible to use a different WBEM protocol 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 attribute of the connection object. This may be useful in debugging: If a problem occurs, you can examine the last_request and last_reply attributes 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 attributes of the connection object.

WBEMConnection objects can record the operations performed by calling WBEMConnection methods that interact with a WBEM server using operation recorders, at the level of method calls and returns, and at the level of CIM-XML requests and responses. The LogOperationRecorder class records the operations in the Python logging facility. This recorder is activated through the connection parameter of configure_logger(). The TestClientRecorder class records the operations in a file in the YAML format suitable for the test_client.py unit test program. Before version 0.11.0, pywbem supported only a single operation recorder and activating/deactivating the recorder was a simple matter of setting the operation_recorder attribute. Starting with pywbem version 0.11.0, pywbem added support for multiple operation recorders and deprecated the operation_recorder attribute. The add_operation_recorder() method is now used to add an operation recorder to a connection, and the operation_recorders property is used to retrieve the current operation recorders of a connection.

The methods of this class may raise the following exceptions:

  • Exceptions indicating operational errors:

    • ConnectionError - A connection with the WBEM server could not be established or broke down.
    • AuthError - Authentication failed with the WBEM server.
    • TimeoutError - The WBEM server did not respond in time and the client timed out.

    Such exceptions can typically be resolved by the client user or server admin.

  • Exceptions indicating server-side issues:

    • HTTPError - HTTP error (bad status code) received from WBEM server.
    • CIMXMLParseError - The response from the WBEM server cannot be parsed because it is invalid CIM-XML (for example, a required attribute is missing on an XML element).
    • XMLParseError - The response from the WBEM server cannot be parsed because it is invalid XML (for example, invalid characters or UTF-8 sequences, or ill-formed XML).

    Such exceptions nearly always indicate an issue with the implementation of the WBEM server.

  • Other exceptions:

    • CIMError - The WBEM server returned an error response with a CIM status code.

    Depending on the nature of the request, and on the CIM status code, the reason may be a client user error (e.g. incorrect class name) or a server side issue (e.g. some internal error in the server).

  • Exceptions indicating programming errors (in pywbem or by the user):

    Exceptions indicating programming errors should not happen. If you think the reason such an exception is raised lies in pywbem, report a bug.

Parameters:
  • url (string) –

    URL of the WBEM server, in the format:

    [{scheme}://]{host}[:{port}]

    The following URL schemes are supported:

    • https: Causes HTTPS to be used.
    • http: Causes HTTP to be used.

    The host can be specified in any of the usual formats:

    • a short or fully qualified DNS hostname
    • a literal (= dotted) IPv4 address
    • a literal IPv6 address, formatted as defined in RFC3986 with the extensions for zone identifiers as defined in RFC6874, supporting - (minus) for the delimiter before the zone ID string, as an additional choice to %25.

    If no port is specified in the URL, the default ports are:

    • If HTTPS is used, port 5989.
    • If HTTP is used, port 5988.

    Examples for some URL formats:

    • "https://10.11.12.13:6988": Use HTTPS to port 6988 on host 10.11.12.13
    • "https://mysystem.acme.org": Use HTTPS to port 5989 on host mysystem.acme.org
    • "10.11.12.13": Use HTTP to port 5988 on host 10.11.12.13
    • "http://[2001:db8::1234]:15988": Use HTTP to port 15988 on host 2001:db8::1234
    • "http://[::ffff.10.11.12.13]": Use HTTP to port 5988 on host ::ffff.10.11.12.13 (an IPv4-mapped IPv6 address)
    • "http://[2001:db8::1234%25eth0]" or "http://[2001:db8::1234-eth0]": Use HTTP to port 5988 to host 2001:db8::1234 (a link-local IPv6 address) using zone identifier eth0
  • creds (tuple() of userid, password) –

    Credentials for HTTP authentication with the WBEM server, as a tuple(userid, password), with:

    • userid (string): Userid for authenticating with the WBEM server.
    • password (string): Password for that userid.

    If None, the client will not generate Authorization headers in the HTTP request. Otherwise, the client will generate an Authorization header using HTTP Basic Authentication.

    See Authentication types for an overview.

  • default_namespace (string) –

    Default CIM namespace for this connection.

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection will be set to the built-in default namespace "root/cimv2".

    The default namespace of the connection is used if no namespace or a namespace of None is specified for an operation.

  • x509 (dict) –

    X.509 client certificate and key file to be presented to the WBEM server during the TLS/SSL handshake.

    This parameter is ignored when HTTP is used.

    If None, no client certificate is presented to the server, resulting in 1-way authentication to be used.

    Otherwise, the client certificate is presented to the server, resulting in 2-way authentication to be used. This parameter must be a dictionary containing the following two items:

    • "cert_file" (string): The file path of a file containing an X.509 client certificate.
    • "key_file" (string): The file path of a file containing the private key belonging to the public key that is part of the X.509 certificate file.

    See Authentication types for an overview.

  • verify_callback (callable) –

    Registers a callback function that will be called to verify the X.509 server certificate returned by the WBEM server during the TLS/SSL handshake, in addition to the validation already performed by the TLS/SSL support.

    This parameter is ignored when HTTP is used.

    Note that the validation performed by the TLS/SSL support already includes the usual validation, so that normally a callback function does not need to be used. See Verification of the X.509 server certificate for details.

    Warning: This parameter is not used when the python environment is Python 3 because the ssl module does not support it.

    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 https://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 certificate 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 parameter 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.

  • ca_certs (string) –

    Location of CA certificates (trusted certificates) for verifying the X.509 server certificate returned by the WBEM server.

    This parameter is ignored when HTTP is used.

    The parameter value must be one of:

    • a path to a file containing one or more CA certificates in PEM format. See the description of CAfile in the OpenSSL SSL_CTX_load_verify_locations function for details.
    • a path to a directory with files each of which contains one CA certificate in PEM format. See the description of CApath in the OpenSSL SSL_CTX_load_verify_locations function for details.

    If None, the directory path of the first existing directory from the list in DEFAULT_CA_CERT_PATHS will be used as a default.

  • no_verification (bool) –

    Disables verification of the X.509 server certificate returned by the WBEM server during TLS/SSL handshake, disables verification of the hostname, and disables the invocation of a verification function specified in verify_callback.

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

    This parameter is ignored when HTTP is used.

    Disabling the verification of the server certificate is insecure and should be avoided!

  • timeout (number) –

    Timeout in seconds, for requests sent to the server.

    New in pywbem 0.8.

    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 that the connection uses the standard timeout behavior of Python sockets, which can be between several minutes and much longer. Because this is somewhat unpredictable, it is recommended to specify a value for the 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.

  • use_pull_operations (bool) –

    Controls the use of pull operations in any Iter…() methods.

    New in pywbem 0.11 as experimental and finalized in 0.13.

    None means that the Iter…() methods will attempt a pull operation first, and if the WBEM server does not support it, will use a traditional operation from then on, on this connection. This detection is performed for each pull operation separately, in order to accomodate WBEM servers that support only some of the pull operations. This will work on any WBEM server whether it supports no, some, or all pull operations.

    True means that the Iter…() methods will only use pull operations. If the WBEM server does not support pull operations, a CIMError with status code CIM_ERR_NOT_SUPPORTED will be raised.

    False (default) means that the Iter…() methods will only use traditional operations.

  • stats_enabled (bool) –

    Initial enablement status for maintaining statistics about the WBEM operations executed via this connection.

    New in pywbem 0.11 as experimental, renamed from `enable_stats` and finalized in 0.12.

    See the WBEM operation statistics section for details.

Methods

AssociatorNames Retrieve the instance paths of the instances associated to a source instance, or the class paths of the classes associated to a source class.
Associators Retrieve the instances associated to a source instance, or the classes associated to a source class.
CloseEnumeration Close an open enumeration session, causing an early termination of an incomplete enumeration session.
CreateClass Create a class in a namespace.
CreateInstance Create an instance in a namespace.
DeleteClass Delete a class.
DeleteInstance Delete an instance.
DeleteQualifier Delete a qualifier type (= qualifier declaration).
EnumerateClassNames Enumerate the names of subclasses of a class, or of the top-level classes in a namespace.
EnumerateClasses Enumerate the subclasses of a class, or the top-level classes in a namespace.
EnumerateInstanceNames Enumerate the instance paths of instances of a class (including instances of its subclasses) in a namespace.
EnumerateInstances Enumerate the instances of a class (including instances of its subclasses) in a namespace.
EnumerateQualifiers Enumerate the qualifier types (= qualifier declarations) in a namespace.
ExecQuery Execute a query in a namespace.
GetClass Retrieve a class.
GetInstance Retrieve an instance.
GetQualifier Retrieve a qualifier type (= qualifier declaration).
InvokeMethod Invoke a method on a target instance or on a target class.
IterAssociatorInstancePaths Retrieve the instance paths of the instances associated to a source instance, using the Python generator idiom to return the result.
IterAssociatorInstances Retrieve the instances associated to a source instance, using the Python generator idiom to return the result.
IterEnumerateInstancePaths Enumerate the instance paths of instances of a class (including instances of its subclasses) in a namespace, using the Python generator idiom to return the result.
IterEnumerateInstances Enumerate the instances of a class (including instances of its subclasses) in a namespace, using the Python generator idiom to return the result.
IterQueryInstances Execute a query in a namespace, using the Python generator idiom to return the result.
IterReferenceInstancePaths Retrieve the instance paths of the association instances that reference a source instance, using the Python generator idiom to return the result.
IterReferenceInstances Retrieve the association instances that reference a source instance, using the Python generator idiom to return the result.
ModifyClass Modify a class.
ModifyInstance Modify the property values of an instance.
OpenAssociatorInstancePaths Open an enumeration session to retrieve the instance paths of the instances associated to a source instance.
OpenAssociatorInstances Open an enumeration session to retrieve the instances associated to a source instance.
OpenEnumerateInstancePaths Open an enumeration session to enumerate the instance paths of instances of a class (including instances of its subclasses) in a namespace.
OpenEnumerateInstances Open an enumeration session to enumerate the instances of a class (including instances of its subclasses) in a namespace.
OpenQueryInstances Open an enumeration session to execute a query in a namespace and to retrieve the instances representing the query result.
OpenReferenceInstancePaths Open an enumeration session to retrieve the instance paths of the association instances that reference a source instance.
OpenReferenceInstances Open an enumeration session to retrieve the association instances that reference a source instance.
PullInstancePaths Retrieve the next set of instance paths from an open enumeration session.
PullInstances Retrieve the next set of instances (without instance paths) from an open enumeration session.
PullInstancesWithPath Retrieve the next set of instances (with instance paths) from an open enumeration session.
ReferenceNames Retrieve the instance paths of the association instances that reference a source instance, or the class paths of the association classes that reference a source class.
References Retrieve the association instances that reference a source instance, or the association classes that reference a source class.
SetQualifier Create or modify a qualifier type (= qualifier declaration) in a namespace.
add_operation_recorder Experimental: Add an operation recorder to this connection.
imethodcall Deprecated: Low-level method used by the operation-specific methods of this class.
methodcall Deprecated: Low-level method used by the InvokeMethod() method of this class.
operation_recorder_reset Experimental: Low-level method used by the operation-specific methods of this class.
operation_recorder_stage_pywbem_args Experimental: Low-level method used by the operation-specific methods of this class.
operation_recorder_stage_result Experimental: Low-level method used by the operation-specific methods of this class.

Attributes

ca_certs Location of CA certificates (trusted certificates) for verifying the X.509 server certificate returned by the WBEM server.
conn_id Connection ID (a unique ID) of this connection.
creds Credentials for HTTP authentication with the WBEM server.
debug Boolean indicating that debug is enabled for this connection.
default_namespace Name of the CIM namespace to be used by default (if no namespace is specified for an operation).
host The {host}[:{port}] component of the WBEM server’s URL, as specified in the url attribute.
last_operation_time Elapsed time of the last operation that was executed via this connection in seconds or None.
last_raw_reply CIM-XML data of the last response received from the WBEM server on this connection, formatted as it was received (=raw).
last_raw_request CIM-XML data of the last request sent to the WBEM server on this connection, formatted as it was sent (=raw).
last_reply CIM-XML data of the last response received from the WBEM server on this connection, formatted as prettified XML.
last_reply_len The size of the HTTP body in the CIM-XML response of the last operation, in Bytes.
last_request CIM-XML data of the last request sent to the WBEM server on this connection, formatted as prettified XML.
last_request_len The size of the HTTP body in the CIM-XML request of the last operation, in Bytes.
last_server_response_time Server-measured response time of the last request, or None.
no_verification Boolean indicating that verifications are disabled for this connection.
operation_recorder Deprecated: The operation recorder that was last added to the connection, or None if the connection does not currently have any recorders.
operation_recorder_enabled Experimental: Enablement status for all operation recorders of the connection.
operation_recorders Experimental: The operation recorders of this connection.
statistics Statistics for this connection.
stats_enabled Statistics enablement status for this connection.
timeout Timeout in seconds, for requests sent to the server.
url URL of the WBEM server.
use_pull_operations Boolean indicating that the client should attempt the use of pull operations in any Iter…() methods.
verify_callback Callback function that will be called to verify the X.509 server certificate returned by the WBEM server during the TLS/SSL handshake, in addition to the validation already performed by the TLS/SSL support.
x509 X.509 client certificate and key file to be presented to the WBEM server during the TLS/SSL handshake.

Details

url

URL of the WBEM server.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:unicode string
creds

Credentials for HTTP authentication with the WBEM server.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:tuple()
default_namespace

Name of the CIM namespace to be used by default (if no namespace is specified for an operation).

For details, see the description of the same-named init parameter of this class.

This attribute is settable.

Type:unicode string
x509

X.509 client certificate and key file to be presented to the WBEM server during the TLS/SSL handshake.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:dict
verify_callback

Callback function that will be called to verify the X.509 server certificate returned by the WBEM server during the TLS/SSL handshake, in addition to the validation already performed by the TLS/SSL support.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:callable
ca_certs

Location of CA certificates (trusted certificates) for verifying the X.509 server certificate returned by the WBEM server.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:string
no_verification

Boolean indicating that verifications are disabled for this connection.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:bool
timeout

Timeout in seconds, for requests sent to the server.

New in pywbem 0.8.

For details, see the description of the same-named init parameter of this class.

This attribute is settable, but setting it has been deprecated.

Type:number
operation_recorders
Experimental: The operation recorders of this connection.

New in pywbem 0.12 as experimental.

Type:Tuple of BaseOperationRecorder subclass objects
operation_recorder

Deprecated: The operation recorder that was last added to the connection, or None if the connection does not currently have any recorders.

New in pywbem 0.9 as experimental. Deprecated since pywbem 0.12.

Instead of using this deprecated property, the operation_recorders property should be used to retrieve the recorders of the connection, and the add_operation_recorder() method should be used to add a recorder.

This property is settable; setting this property will cause the specified operation recorder to be added to the connection as if add_operation_recorder() was used. None is not permitted as a new value for this property.

Raises:
  • ValueError – Operation recorder must not be None.
  • ValueError – Cannot add the same recorder class multiple times.
Type:

BaseOperationRecorder

host

The {host}[:{port}] component of the WBEM server’s URL, as specified in the url attribute.

New in pywbem 0.11.

Type:unicode string
operation_recorder_enabled

Experimental: Enablement status for all operation recorders of the connection.

New in pywbem 0.11 as experimental

This is a writeable property; setting this property will change the operation recorder enablement status accordingly for all operation recorders of the connection.

Reading this property returns True if one or more operation recorders of the connection are enabled. Otherwise it returns False, also when the connection has no operation recorders.

Type:bool
stats_enabled

Statistics enablement status for this connection.

New in pywbem 0.11 as experimental and finalized in 0.12.

This is a writeable property; setting this property will change the statistics enablement status accordingly.

The statistics enablement status can also be set when creating a connection, through the stats_enabled init argument of WBEMConnection.

Type:bool
statistics

Statistics for this connection.

New in pywbem 0.11 as experimental and finalized in 0.12.

Statistics are disabled by default and can be enabled via the stats_enabled argument when creating a connection object, or later via modifying the stats_enabled property on this connection object. See the WBEM operation statistics section for more details.

Type:Statistics
last_operation_time

Elapsed time of the last operation that was executed via this connection in seconds or None.

New in pywbem 0.11 as experimental and finalized in 0.12.

This time is available only subsequent to the execution of an operation on this connection, and if the statistics are enabled on this connection. Otherwise, the value is None.

Type:float
last_server_response_time

Server-measured response time of the last request, or None.

New in pywbem 0.11 as experimental and finalized in 0.12.

This time is optionally returned from the server in the HTTP header of the response. This time is available only subsequent to the execution of an operation on this connection if the WBEMServerResponseTime is received from the WBEM server. Otherwise, the value is None.

Type:float
use_pull_operations

Boolean indicating that the client should attempt the use of pull operations in any Iter…() methods.

New in pywbem 0.11 as experimental and finalized in 0.13.

This property reflects the intent of the user as specified in the same-named init parameter of this class. This property is not updated with the status of actually using pull operations. That status is maintained internally for each pull operation separately to accomodate WBEM servers that support only some of the pull operations.

Type:bool
debug

Boolean indicating that debug is enabled for this connection.

When enabled (value True), the prettified last CIM-XML request and response will be stored in the following properties of this class:

When disabled (value False), these properties will be None.

This attribute is writeable. The initial value of this attribute is False.

Note that the following properties will be set regardless of whether debug is enabled for this connection:

Type:bool
last_request

CIM-XML data of the last request sent to the WBEM server on this connection, formatted as prettified XML.

This property is only set when debug is enabled (see debug), and is None otherwise.

Prior to sending the very first request on this connection object, this property is None.

Type:unicode string
last_raw_request

CIM-XML data of the last request sent to the WBEM server on this connection, formatted as it was sent (=raw).

Prior to sending the very first request on this connection object, this property is None.

As of pywbem 0.13, this property is set independently of whether debug is enabled (see debug).

Type:unicode string
last_reply

CIM-XML data of the last response received from the WBEM server on this connection, formatted as prettified XML.

This property is only set when debug is enabled (see debug), and is None otherwise.

This property is set to None in the WBEM operation methods of this class before the request is sent to the WBEM server, and is set to the prettified response when the response has been received from the WBEM server and XML parsed. If the XML parsing fails, this property will be None, but the last_raw_reply property does not depend on XML parsing and will already have been set at that point.

Prior to sending the very first request on this connection object, this property is None.

Type:unicode string
last_raw_reply

CIM-XML data of the last response received from the WBEM server on this connection, formatted as it was received (=raw).

This property is set to None in the WBEM operation methods of this class before the request is sent to the WBEM server, and is set to the prettified response when the response has been received from the WBEM server, and before XML parsing takes place.

Prior to sending the very first request on this connection object, this property is None.

As of pywbem 0.13, this property is set independently of whether debug is enabled (see debug).

Type:unicode string
last_request_len

The size of the HTTP body in the CIM-XML request of the last operation, in Bytes.

Prior to sending the very first request on this connection object, this property is 0.

This property is set independently of whether debug is enabled (see debug).

Type:int
last_reply_len

The size of the HTTP body in the CIM-XML response of the last operation, in Bytes.

This property is set to 0 in the WBEM operation methods of this class before the request is sent to the WBEM server, and is set to the size when the response has been received from the WBEM server, and before XML parsing takes place.

Prior to sending the very first request on this connection object, this property is 0.

This property is set independently of whether debug is enabled (see debug).

Type:int
conn_id

Connection ID (a unique ID) of this connection.

The value for this property is created when the WBEMConnection object is created and remains constant throughout the life of that object.

The connection ID is part of each log entry output to uniquely identify the WBEMConnection object responsible for that log. It also part of the logger name for the “pywbem.api” and “pywbem.http” loggers that create log entries so that logging can be defined separately for different connections.

Type:connection id
__str__()[source]

Return a short representation of the WBEMConnection object for human consumption.

__repr__()[source]

Return a representation of the WBEMConnection object with all attributes (except for the password in the credentials) that is suitable for debugging.

add_operation_recorder(operation_recorder)[source]

Experimental: Add an operation recorder to this connection.

New in pywbem 0.12 as experimental.

If the connection already has a recorder with the same class, the request to add the recorder is ignored.

Parameters:

operation_recorder (BaseOperationRecorder subclass object) – The operation recorder to be added. Must not be None.

Raises:
  • ValueError – Operation recorder must not be None.
  • ValueError – Cannot add the same recorder class multiple times.
operation_recorder_reset(pull_op=False)[source]

Experimental: Low-level method used by the operation-specific methods of this class.

New in pywbem 0.9 as experimental.

It resets the operation processing state of all recorders of this connection, to be ready for processing a new operation call.

operation_recorder_stage_pywbem_args(method, **kwargs)[source]

Experimental: Low-level method used by the operation-specific methods of this class.

New in pywbem 0.9 as experimental.

It forwards the operation method name and arguments to all recorders of this connection.

operation_recorder_stage_result(ret, exc)[source]

Experimental: Low-level method used by the operation-specific methods of this class.

New in pywbem 0.9 as experimental.

It forwards the operation results including exceptions that were raised, to all recorders of this connection, and causes the forwarded information to be recorded by all recorders of this connection.

imethodcall(methodname, namespace, response_params_rqd=False, **params)[source]

Deprecated: Low-level method used by the operation-specific methods of this class.

Deprecated since pywbem 0.12.

Calling this function directly has been deprecated and will issue a DeprecationWarning. Users should call the operation-specific methods (e.g. GetInstance) instead of this method. This method will be removed in the next pywbem release after 0.12.

methodcall(methodname, localobject, Params=None, **params)[source]

Deprecated: Low-level method used by the InvokeMethod() method of this class.

Deprecated since pywbem 0.12.

Calling this function directly has been deprecated and will issue a DeprecationWarning. Users should call InvokeMethod() instead of this method. This method will be removed in the next pywbem release after 0.12.

EnumerateInstances(ClassName, namespace=None, LocalOnly=None, DeepInheritance=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, **extra)[source]

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

This method performs the EnumerateInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • LocalOnly (bool) –

    Controls the exclusion of inherited properties from the returned instances, as follows:

    • If False, inherited properties are not excluded.
    • If True, inherited properties are basically excluded, but the behavior may be WBEM server specific.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    This parameter has been deprecated in DSP0200 and should be set to False by the caller.

  • DeepInheritance (bool) –

    Indicates that properties added by subclasses of the specified class are to be included in the returned instances, as follows:

    • If False, properties added by subclasses are not included.
    • If True, properties added by subclasses are included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    Note, the semantics of the DeepInheritance parameter in EnumerateClasses() and EnumerateClassNames() is different.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. Clients cannot rely on qualifiers to be returned in this operation.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

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

The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

  • classname: Name of the creation class of the instance.
  • keybindings: Keybindings of the instance.
  • namespace: Name of the CIM namespace containing the instance.
  • host: None, indicating the WBEM server is unspecified.

Raises:

Exceptions described in WBEMConnection.

EnumerateInstanceNames(ClassName, namespace=None, **extra)[source]

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

This method performs the EnumerateInstanceNames operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A list of CIMInstanceName objects that are the enumerated instance paths, with its attributes set as follows:

  • classname: Name of the creation class of the instance.
  • keybindings: Keybindings of the instance.
  • namespace: Name of the CIM namespace containing the instance.
  • host: None, indicating the WBEM server is unspecified.

Raises:

Exceptions described in WBEMConnection.

GetInstance(InstanceName, LocalOnly=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, **extra)[source]

Retrieve an instance.

This method performs the GetInstance operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the instance to be retrieved. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • LocalOnly (bool) –

    Controls the exclusion of inherited properties from the returned instance, as follows:

    • If False, inherited properties are not excluded.
    • If True, inherited properties are basically excluded, but the behavior may be WBEM server specific.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    This parameter has been deprecated in DSP0200 and should be set to False by the caller.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instance, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. Clients cannot rely on qualifiers to be returned in this operation.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property in the returned instance, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instance (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A CIMInstance object that is a representation of the retrieved instance. Its path attribute is a CIMInstanceName object with its attributes set as follows:

  • classname: Name of the creation class of the instance.
  • keybindings: Keybindings of the instance.
  • namespace: Name of the CIM namespace containing the instance.
  • host: None, indicating the WBEM server is unspecified.

Raises:

Exceptions described in WBEMConnection.

ModifyInstance(ModifiedInstance, IncludeQualifiers=None, PropertyList=None, **extra)[source]

Modify the property values of an instance.

This method performs the ModifyInstance operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

The PropertyList parameter determines the set of properties that are designated to be modified (see its description for details).

The properties provided in the ModifiedInstance parameter specify the new property values for the properties that are designated to be modified.

Pywbem sends the property values provided in the ModifiedInstance parameter to the WBEM server as provided; it does not add any default values for properties not provided but designated to be modified, nor does it reduce the properties by those not designated to be modified.

The properties that are actually modified by the WBEM server as a result of this operation depend on a number of things:

  • The WBEM server will reject modification requests for key properties and for properties that are not exposed by the creation class of the target instance.

  • The WBEM server may consider some properties as read-only, as a result of requirements at the CIM modeling level (schema or management profiles), or as a result of an implementation decision.

    Note that the WRITE qualifier on a property is not a safe indicator as to whether the property can actually be modified. It is an expression at the level of the CIM schema that may or may not be considered in DMTF management profiles or in implementations. Specifically, a qualifier value of True on a property does not guarantee modifiability of the property, and a value of False does not prevent modifiability.

  • The WBEM server may detect invalid new values or conflicts resulting from the new property values and may reject modification of a property for such reasons.

If the WBEM server rejects modification of a property for any reason, it will cause this operation to fail and will not modify any property on the target instance. If this operation succeeds, all properties designated to be modified have their new values (see the description of the ModifiedInstance parameter for details on how the new values are determined).

Note that properties (including properties not designated to be modified) may change their values as an indirect result of this operation. For example, a property that was not designated to be modified may be derived from another property that was modified, and may show a changed value due to that.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ModifiedInstance (CIMInstance) –

    A representation of the modified instance, also indicating its instance path.

    The path attribute of this object identifies the instance to be modified. Its keybindings attribute is required. If its namespace attribute is None, the default namespace of the connection will be used. Its host attribute will be ignored.

    The classname attribute of the instance path and the classname attribute of the instance must specify the same class name.

    The properties defined in this object specify the new property values (including None for NULL). If a property is designated to be modified but is not specified in this object, the WBEM server will use the default value of the property declaration if specified (including None), and otherwise may update the property to any value (including None).

    Typically, this object has been retrieved by other operations, such as GetInstance().

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be modified as specified in the ModifiedInstance parameter, as follows:

    • If False, qualifiers not modified.
    • If True, qualifiers are modified if the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    This parameter has been deprecated in DSP0200. Clients cannot rely on qualifiers to be modified.

  • PropertyList (string or iterable of string) –

    This parameter defines which properties are designated to be modified.

    This parameter is an iterable specifying the names of the properties, or a string that specifies a single property name. In all cases, the property names are matched case insensitively. The specified properties are designated to be modified. Properties not specified are not designated to be modified.

    An empty iterable indicates that no properties are designated to be modified.

    If None, DSP0200 states that the properties with values different from the current values in the instance are designated to be modified, but for all practical purposes this is equivalent to stating that all properties exposed by the instance are designated to be modified.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

CreateInstance(NewInstance, namespace=None, **extra)[source]

Create an instance in a namespace.

This method performs the CreateInstance operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

The creation class for the new instance is taken from the classname attribute of the NewInstance parameter.

The namespace for the new instance is taken from these sources, in decreasing order of priority:

  • namespace parameter of this method, if not None,
  • namespace in path attribute of the NewInstance parameter, if not None,
  • default namespace of the connection.
Parameters:
  • NewInstance (CIMInstance) –

    A representation of the CIM instance to be created.

    The classname attribute of this object specifies the creation class for the new instance.

    Apart from utilizing its namespace, the path attribute is ignored.

    The properties attribute of this object specifies initial property values for the new CIM instance.

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

  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    New in pywbem 0.9.

    If None, defaults to the namespace in the path attribute of the NewInstance parameter, or to the default namespace of the connection.

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A CIMInstanceName object that is the instance path of the new instance, with classname, keybindings and namespace set.

Raises:

Exceptions described in WBEMConnection.

DeleteInstance(InstanceName, **extra)[source]

Delete an instance.

This method performs the DeleteInstance operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the instance to be deleted. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

Associators(ObjectName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, **extra)[source]

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

This method performs the Associators operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ObjectName

    The object path of the source object, selecting instance-level or class-level use of this operation, as follows:

    • For selecting instance-level use: The instance path of the source instance, as a CIMInstanceName object. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
    • For selecting class-level use: The class path of the source class, as a string or CIMClassName object:

      If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent).

      If specified as a CIMClassName object, its host attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used.

  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances (or classes), as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. Clients cannot rely on qualifiers to be returned in this operation.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances (or classes), as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200 for instance-level use. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (or classes) (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

The returned list of objects depend on the usage:

  • For instance-level use: A list of CIMInstance objects that are representations of the associated instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
  • For class-level use: A list of tuple() of (classpath, class) objects that are representations of the associated classes.

    Each tuple represents one class and has these items:

    • classpath (CIMClassName): The class path of the class, with its attributes set as follows:
      • classname: Name of the class.
      • namespace: Name of the CIM namespace containing the class.
      • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
    • class (CIMClass): The representation of the class, with its path attribute set to the classpath tuple item.

Raises:

Exceptions described in WBEMConnection.

AssociatorNames(ObjectName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, **extra)[source]

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

This method performs the AssociatorNames operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ObjectName

    The object path of the source object, selecting instance-level or class-level use of this operation, as follows:

    • For selecting instance-level use: The instance path of the source instance, as a CIMInstanceName object. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
    • For selecting class-level use: The class path of the source class, as a string or CIMClassName object:

      If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent).

      If specified as a CIMClassName object, its host attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used.

  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

The returned list of objects depend on the usage:

  • For instance-level use: A list of CIMInstanceName objects that are the instance paths of the associated instances, with their attributes set as follows:
    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
  • For class-level use: A list of CIMClassName objects that are the class paths of the associated classes, with their attributes set as follows:
    • classname: Name of the class.
    • namespace: Name of the CIM namespace containing the class.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.

Raises:

Exceptions described in WBEMConnection.

References(ObjectName, ResultClass=None, Role=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, **extra)[source]

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

This method performs the References operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ObjectName

    The object path of the source object, selecting instance-level or class-level use of this operation, as follows:

    • For selecting instance-level use: The instance path of the source instance, as a CIMInstanceName object. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
    • For selecting class-level use: The class path of the source class, as a string or CIMClassName object:

      If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent).

      If specified as a CIMClassName object, its host attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used.

  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances (or classes), as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. Clients cannot rely on qualifiers to be returned in this operation.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances (or classes), as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200 for instance-level use. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (or classes) (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

The returned list of objects depend on the usage:

  • For instance-level use: A list of CIMInstance objects that are representations of the referencing association instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
  • For class-level use: A list of tuple() of (classpath, class) objects that are representations of the referencing association classes.

    Each tuple represents one class and has these items:

    • classpath (CIMClassName): The class path of the class, with its attributes set as follows:
      • classname: Name of the class.
      • namespace: Name of the CIM namespace containing the class.
      • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
    • class (CIMClass): The representation of the class, with its path attribute set to the classpath tuple item.

Raises:

Exceptions described in WBEMConnection.

ReferenceNames(ObjectName, ResultClass=None, Role=None, **extra)[source]

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

This method performs the ReferenceNames operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ObjectName

    The object path of the source object, selecting instance-level or class-level use of this operation, as follows:

    • For selecting instance-level use: The instance path of the source instance, as a CIMInstanceName object. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
    • For selecting class-level use: The class path of the source class, as a string or CIMClassName object:

      If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent).

      If specified as a CIMClassName object, its host attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used.

  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

The returned list of objects depend on the usage:

  • For instance-level use: A list of CIMInstanceName objects that are the instance paths of the referencing association instances, with their attributes set as follows:
    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.
  • For class-level use: A list of CIMClassName objects that are the class paths of the referencing association classes, with their attributes set as follows:
    • classname: Name of the class.
    • namespace: Name of the CIM namespace containing the class.
    • host: Host and optionally port of the WBEM server containing the CIM namespace, or None if the server did not return host information.

Raises:

Exceptions described in WBEMConnection.

InvokeMethod(MethodName, ObjectName, Params=None, **params)[source]

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 extrinsic method invocation operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Input parameters for the CIM method can be specified using the Params parameter, and using keyword parameters. The overall list of input parameters is formed from the list of parameters specified in Params (preserving their order), followed by the set of keyword parameters (not preserving their order). There is no checking for duplicate parameter names.

Parameters:
  • MethodName (string) – Name of the method to be invoked (case independent).
  • ObjectName

    The object path of the target object, as follows:

    • For instance-level use: The instance path of the target instance, as a CIMInstanceName object. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
    • For class-level use: The class path of the target class, as a string or CIMClassName object:

      If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent).

      If specified as a CIMClassName object, its host attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used.

  • Params (iterable) –

    An iterable of input parameter values for the CIM method. Each item in the iterable is a single parameter value and can be any of:

    • CIMParameter representing a parameter value. The name, value, type and embedded_object attributes of this object are used.
    • tuple of name, value, with:
  • **params

    Each keyword parameter is an additional input parameter value for the CIM method, with:

Returns:

A tuple() of (returnvalue, outparams), with these tuple items:

  • returnvalue (CIM data type): Return value of the CIM method.
  • outparams (NocaseDict): Dictionary with all provided output parameters of the CIM method, with:

Raises:

Exceptions described in WBEMConnection.

ExecQuery(QueryLanguage, Query, namespace=None, **extra)[source]

Execute a query in a namespace.

This method performs the ExecQuery operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

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, e.g. “DMTF:CQL” for CIM Query Language, and “WQL” for WBEM Query Language.
  • Query (string) – Query string in the query language specified in the QueryLanguage parameter.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A list of CIMInstance objects that represents the query result.

These instances have their path attribute set to identify their creation class and the target namespace of the query, but they are not addressable instances.

Raises:

Exceptions described in WBEMConnection.

IterEnumerateInstances(ClassName, namespace=None, LocalOnly=None, DeepInheritance=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Enumerate the instances of a class (including instances of its subclasses) in a namespace, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instances from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instances that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenEnumerateInstances() and PullInstancesWithPath()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (EnumerateInstances()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its namespace attribute will be used as a default namespace as described for the namespace parameter, and its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • LocalOnly (bool) –

    Controls the exclusion of inherited properties from the returned instances, as follows:

    • If False, inherited properties are not excluded.
    • If True, the behavior depends on the underlying operation: If pull operations are used, inherited properties are not excluded. If traditional operations are used, inherited properties are basically excluded, but the behavior may be WBEM server specific.
    • If None, the behavior depends on the underlying operation: If pull operations are used, inherited properties are not excluded. If traditional operations are used, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True, i.e. to exclude inherited properties.

    DSP0200 has deprecated this parameter for the traditional operation and does not support it for the pull operation.

    This parameter should be set to False by the caller.

  • DeepInheritance (bool) –

    Indicates that properties added by subclasses of the specified class are to be included in the returned instances, as follows:

    • If False, properties added by subclasses are not included.
    • If True, properties added by subclasses are included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    Note, the semantics of the DeepInheritance parameter in EnumerateClasses() and EnumerateClassNames() is different.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if this method uses traditional operations and the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    If this method uses pull operations, this parameter will be ignored, not passed to the WBEM server, and the returned instances will not contain any qualifiers. If this method uses traditional operations, clients cannot rely on returned instances containing qualifiers, as described in DSP0200.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.

    The choice of MaxObjectCount is client/server dependent but choices between 100 and 1000 typically do not have a significant impact on either memory or overall efficiency.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:
Returns:

A generator object that iterates the resulting CIM instances. These instances include an instance path that has its host and namespace components set.

Return type:

generator iterating CIMInstance

Example:

insts_generator = conn.IterEnumerateInstances('CIM_Blah')
for inst in insts_generator:
    # close if a particular property value found
    if inst.get('thisPropertyName') == 0
        insts_generator.close()
        break
    else:
        print('instance {0}'.format(inst.tomof()))
IterEnumerateInstancePaths(ClassName, namespace=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Enumerate the instance paths of instances of a class (including instances of its subclasses) in a namespace, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation.

This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instance paths from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instance paths that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenEnumerateInstancePaths() and PullInstancePaths()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (EnumerateInstanceNames()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its namespace attribute will be used as a default namespace as described for the namespace parameter, and its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instance paths.
    • Zero is not allowed; it would mean that zero paths are to be returned for every request issued.
    • The default is defined as a system config variable.
    • None is not allowed.

    The choice of MaxObjectCount is client/server dependent but choices between 100 and 1000 typically do not have a significant impact on either memory or overall efficiency.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

Returns:

A generator object that iterates the resulting CIM instance paths. These instance paths have their host and namespace components set.

Return type:

generator iterating CIMInstanceName

Example:

paths_generator = conn.IterEnumerateInstancePaths('CIM_Blah')
for path in paths_generator:
    print('path {0}'.format(path))
IterAssociatorInstances(InstanceName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Retrieve the instances associated to a source instance, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instances from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instances that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenAssociatorInstances() and PullInstancesWithPath()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (Associators()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if this method uses traditional operations and the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    If this method uses pull operations, this parameter will be ignored and the returned instances will not contain any qualifiers. If this method uses traditional operations, clients cannot rely on returned instances containing qualifiers, as described in DSP0200.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.

    Many WBEM servers do not support this request attribute so that setting it to True is NOT recommended except in special cases.

    If this parameter is True and the traditional operation is used by this method, ValueError will be raised.

  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A generator object that iterates the resulting CIM instances. These instances include an instance path that has its host and namespace components set.

Return type:

generator iterating CIMInstance

Raises:

Exceptions described in WBEMConnection.

Example:

insts_generator = conn.IterAssociatorInstances('CIM_Blah.key=1',...)
for inst in insts_generator:
    # close if a particular property value found
    if inst.get('thisPropertyName') == 0
        insts_generator.close()
        break
    else:
        print('instance {0}'.format(inst.tomof()))
IterAssociatorInstancePaths(InstanceName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Retrieve the instance paths of the instances associated to a source instance, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instance paths from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instance paths that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenAssociatorInstancePaths() and PullInstancePaths()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (AssociatorNames()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A generator object that iterates the resulting CIM instance paths. These instance paths have their host and namespace components set.

Return type:

generator iterating CIMInstanceName

Raises:

Exceptions described in WBEMConnection.

Example:

paths_generator = conn.IterAssociatorInstancePaths('CIM_Blah')
for path in paths_generator:
    print('path {0}'.format(path))
IterReferenceInstances(InstanceName, ResultClass=None, Role=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Retrieve the association instances that reference a source instance, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instances from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instances that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenReferenceInstances() and PullInstancesWithPath()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (References()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned instances, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included if this method uses traditional operations and the WBEM server implements support for this parameter.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    If this method uses pull operations, this parameter will be ignored and the returned instances will not contain any qualifiers. If this method uses traditional operations, clients cannot rely on returned instances containing qualifiers, as described in DSP0200.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A generator object that iterates the resulting CIM instances. These instances include an instance path that has its host and namespace components set.

Return type:

generator iterating CIMInstance

Raises:

Exceptions described in WBEMConnection.

Example:

insts_generator = conn.IterReferenceInstances('CIM_Blah.key=1', ...)
for inst in insts_generator:
    # close if a particular property value found
    if inst.get('thisPropertyName') == 0
        insts_generator.close()
        break
    else:
        print('instance {0}'.format(inst.tomof()))
IterReferenceInstancePaths(InstanceName, ResultClass=None, Role=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Retrieve the instance paths of the association instances that reference a source instance, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

This method is a generator function that retrieves instance paths from the WBEM server and returns them one by one (using yield) when the caller iterates through the returned generator object. The number of instance paths that are retrieved from the WBEM server in one request (and thus need to be materialized in this method) is up to the MaxObjectCount parameter if the corresponding pull operations are used, or the complete result set all at once if the corresponding traditional operation is used.

By default, this method attempts to perform the corresponding pull operations (OpenReferenceInstancePaths() and PullInstancePaths()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (ReferenceNames()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Filtering is not supported for the corresponding traditional operation so that setting the FilterQuery or FilterQueryLanguage parameters will be rejected if the corresponding traditional operation is used by this method.

    Note that this limitation is not a disadvantage compared to using the corresponding pull operations directly, because in both cases, the WBEM server must support the pull operations and their filtering capability in order for the filtering to work.

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) –

    The filter query in the query language defined by the FilterQueryLanguage parameter.

    If this parameter is not None and the traditional operation is used by this method, ValueError will be raised.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A generator object that iterates the resulting CIM instance paths. These instance paths have their host and namespace components set.

Return type:

generator iterating CIMInstanceName

Raises:

Exceptions described in WBEMConnection.

Example:

paths_generator = conn.IterReferenceInstancePaths('CIM_Blah')
for path in paths_generator:
    print('path {0}'.format(path))
IterQueryInstances(FilterQueryLanguage, FilterQuery, namespace=None, ReturnQueryResultClass=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=1000, **extra)[source]

Execute a query in a namespace, using the Python generator idiom to return the result.

New in pywbem 0.10 as experimental and finalized in 0.12.

This method uses the corresponding pull operations if supported by the WBEM server or otherwise the corresponding traditional operation. This method is an alternative to using the pull operations directly, that frees the user of having to know whether the WBEM server supports pull operations.

Other than the other Iter…() methods, this method does not return a generator object directly, but as a property of the returned object. The reason for this design is the additionally returned query result class. The generator property in the returned object is a generator object that returns the instances in the query result one by one (using yield) when the caller iterates through the generator object. This design causes the entire query result to be materialized, even if pull operations are used.

By default, this method attempts to perform the corresponding pull operations (OpenQueryInstances() and PullInstances()). If these pull operations are not supported by the WBEM server, this method falls back to using the corresponding traditional operation (ExecQuery()). Whether the WBEM server supports these pull operations is remembered in the WBEMConnection object (by operation type), and avoids unnecessary attempts to try these pull operations on that connection in the future. The use_pull_operations init parameter of WBEMConnection can be used to control the preference for always using pull operations, always using traditional operations, or using pull operations if supported by the WBEM server (the default).

This method provides all of the controls of the corresponding pull operations except for the ability to set different response sizes on each request; the response size (defined by the MaxObjectCount parameter) is the same for all pull operations in the enumeration session.

In addition, some functionality is only available if the corresponding pull operations are used by this method:

  • Setting the ContinueOnError parameter to True will be rejected if the corresponding traditional operation is used by this method.

The enumeration session that is opened with the WBEM server when using pull operations is closed automatically when the returned generator object is exhausted, or when the generator object is closed using its close() method (which may also be called before the generator is exhausted).

Parameters:
  • QueryLanguage (string) – Name of the query language used in the Query parameter, e.g. “DMTF:CQL” for CIM Query Language, and “WQL” for WBEM Query Language. Because this is not a filter query, “DMTF:FQL” is not a valid query language for this request.
  • Query (string) – Query string in the query language specified in the QueryLanguage parameter.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • ReturnQueryResultClass (bool) –

    Controls whether a class definition describing the returned instances will be returned.

    None will cause the server to use its default of False.

    None will cause the server to use its default of False.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If the corresponding traditional operation is used by this method, ValueError will be raised.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for each of the open and pull requests issued during the iterations over the returned generator object.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • Zero is not allowed; it would mean that zero instances are to be returned for open and all pull requests issued to the server.
    • The default is defined as a system config variable.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

An object with the following properties:

  • query_result_class (CIMClass):

    The query result class, if requested via the ReturnQueryResultClass parameter.

    None, if a query result class was not requested.

  • generator (generator iterating CIMInstance):

    A generator object that iterates the CIM instances representing the query result. These instances do not have an instance path set.

Return type:

IterQueryInstancesReturn

Raises:

Exceptions described in WBEMConnection.

Example:

result = conn.IterQueryInstances(
    'DMTF:CQL',
    'SELECT FROM * where pl > 2')
for inst in result.generator:
    print('instance {0}'.format(inst.tomof()))
OpenEnumerateInstances(ClassName, namespace=None, LocalOnly=None, DeepInheritance=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to enumerate the instances of a class (including instances of its subclasses) in a namespace.

New in pywbem 0.9.

This method performs the OpenEnumerateInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instances. Otherwise, this method raises an exception.

Use the PullInstancesWithPath() method to retrieve the next set of instances or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its namespace attribute will be used as a default namespace as described for the namespace parameter, and its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • LocalOnly (bool) –

    Deprecated: Controls the exclusion of inherited properties from the returned instances.

    Deprecated since pywbem 0.14.

    This parameter has been deprecated in pywbem and will be ignored and not passed on to the WBEM server, because this parameter was never defined in DSP0200 and thus will be rejected by WBEM servers.

  • DeepInheritance (bool) –

    Indicates that properties added by subclasses of the specified class are to be included in the returned instances, as follows:

    • If False, properties added by subclasses are not included.
    • If True, properties added by subclasses are included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.

    Note, the semantics of the DeepInheritance parameter in EnumerateClasses() and EnumerateClassNames() is different.

  • IncludeQualifiers (bool) –

    Deprecated: Indicates that qualifiers are to be included in the returned instances.

    Deprecated since pywbem 0.14.

    This parameter has been deprecated in pywbem and will be ignored and not passed on to the WBEM server, because this parameter was never defined in DSP0200 and thus will be rejected by WBEM servers.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) – The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.
  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

Example:

max_object_count = 100
rslt_tuple = conn.OpenEnumerateInstances(
    'CIM_Blah', MaxObjectCount=max_object_count)
insts = rslt_tuple.paths
while not rslt_tuple.eos:
    rslt_tuple = conn.PullInstancesWithPath(rslt_tupl.context,
                                            max_object_count)
    insts.extend(rslt_tupl.paths)
for inst in insts:
    print('instance {0}'.format(inst.tomof()))
OpenEnumerateInstancePaths(ClassName, namespace=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to enumerate the instance paths of instances of a class (including instances of its subclasses) in a namespace.

New in pywbem 0.9.

This method performs the OpenEnumerateInstancePaths operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns status on the enumeration session and optionally instance paths. Otherwise, this method raises an exception.

Use the PullInstancePaths() method to retrieve the next set of instance paths or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be enumerated (case independent). If specified as a CIMClassName object, its namespace attribute will be used as a default namespace as described for the namespace parameter, and its host attribute will be ignored.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • paths (list of CIMInstanceName): Representations of the retrieved instance paths, with their attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

Example:

max_object_count = 100
rslt_tuple = conn.OpenEnumerateInstancePaths(
    'CIM_Blah', MaxObjectCount=max_object_count)
paths = rslt_tuple.paths
while not rslt_tuple.eos:
    rslt_tuple = conn.PullInstancePaths(rslt_tupl.context,
                                        max_object_count)
    paths.extend(rslt_tupl.paths)
for path in paths:
    print('path {0}'.format(path))
OpenAssociatorInstances(InstanceName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to retrieve the instances associated to a source instance.

New in pywbem 0.9.

This method does not support retrieving classes.

This method performs the OpenAssociatorInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instances. Otherwise, this method raises an exception.

Use the PullInstancesWithPath() method to retrieve the next set of instances or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Deprecated: Indicates that qualifiers are to be included in the returned instances.

    Deprecated since pywbem 0.14.

    This parameter has been deprecated in pywbem and will be ignored and not passed on to the WBEM server, because this parameter was never defined in DSP0200 and thus will be rejected by WBEM servers.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) – The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.
  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

OpenAssociatorInstancePaths(InstanceName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to retrieve the instance paths of the instances associated to a source instance.

New in pywbem 0.9.

This method does not support retrieving classes.

This method performs the OpenAssociatorInstancePaths operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instance paths. Otherwise, this method raises an exception.

Use the PullInstancePaths() method to retrieve the next set of instance paths or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • AssocClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • ResultClass (string or CIMClassName) –

    Class name of an associated class (case independent), to filter the result to include only traversals to that associated class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • ResultRole (string) –

    Role name (= property name) of the far end (case independent), to filter the result to include only traversals to that far role.

    None means that no such filtering is peformed.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • paths (list of CIMInstanceName): Representations of the retrieved instance paths, with their attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

OpenReferenceInstances(InstanceName, ResultClass=None, Role=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to retrieve the association instances that reference a source instance.

New in pywbem 0.9.

This method does not support retrieving classes.

This method performs the OpenReferenceInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instances. Otherwise, this method raises an exception.

Use the PullInstancesWithPath() method to retrieve the next set of instances or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • IncludeQualifiers (bool) –

    Deprecated: Indicates that qualifiers are to be included in the returned instances.

    Deprecated since pywbem 0.14.

    This parameter has been deprecated in pywbem and will be ignored and not passed on to the WBEM server, because this parameter was never defined in DSP0200 and thus will be rejected by WBEM servers.

  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property or method in the returned instances, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    This parameter has been deprecated in DSP0200. WBEM servers may either implement this parameter as specified, or may treat any specified value as False.

  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned instances (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • FilterQueryLanguage (string) – The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.
  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

OpenReferenceInstancePaths(InstanceName, ResultClass=None, Role=None, FilterQueryLanguage=None, FilterQuery=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to retrieve the instance paths of the association instances that reference a source instance.

New in pywbem 0.9.

This method does not support retrieving classes.

This method performs the OpenReferenceInstancePaths operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instance paths. Otherwise, this method raises an exception.

Use the PullInstancePaths() method to retrieve the next set of instance paths or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • InstanceName (CIMInstanceName) – The instance path of the source instance. If this object does not specify a namespace, the default namespace of the connection is used. Its host attribute will be ignored.
  • ResultClass (string or CIMClassName) –

    Class name of an association class (case independent), to filter the result to include only traversals of that association class (or subclasses).

    None means that no such filtering is peformed.

  • Role (string) –

    Role name (= property name) of the source end (case independent), to filter the result to include only traversals from that source role.

    None means that no such filtering is peformed.

  • FilterQueryLanguage (string) –

    The name of the filter query language used for the FilterQuery parameter. The DMTF-defined Filter Query Language (see DSP0212) is specified as “DMTF:FQL”.

    Not all WBEM servers support filtering for this operation because it returns instance paths and the act of the server filtering requires that it generate instances just for that purpose and then discard them.

  • FilterQuery (string) – The filter query in the query language defined by the FilterQueryLanguage parameter.
  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • paths (list of CIMInstanceName): Representations of the retrieved instance paths, with their attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

OpenQueryInstances(FilterQueryLanguage, FilterQuery, namespace=None, ReturnQueryResultClass=None, OperationTimeout=None, ContinueOnError=None, MaxObjectCount=None, **extra)[source]

Open an enumeration session to execute a query in a namespace and to retrieve the instances representing the query result.

New in pywbem 0.9.

This method performs the OpenQueryInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally CIM instances representing the query result. Otherwise, this method raises an exception.

Use the PullInstances() method to retrieve the next set of instances or the CloseEnumeration() method to close the enumeration session before it is exhausted.

Parameters:
  • FilterQueryLanguage (string) – Name of the query language used in the FilterQuery parameter, e.g. “DMTF:CQL” for CIM Query Language, and “WQL” for WBEM Query Language. Because this is not a filter query, “DMTF:FQL” is not a valid query language for this request.
  • FilterQuery (string) – Query string in the query language specified in the FilterQueryLanguage parameter.
  • namespace (string) –

    Name of the CIM namespace to be used (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • ReturnQueryResultClass (bool) –

    Controls whether a class definition describing the returned instances will be returned.

    None will cause the server to use its default of False.

  • OperationTimeout (Uint32) –

    Minimum time in seconds the WBEM Server shall maintain an open enumeration session after a previous Open or Pull request is sent to the client. Once this timeout time has expired, the WBEM server may close the enumeration session.

    • If not None, this parameter is sent to the WBEM server as the proposed timeout for the enumeration session. A value of 0 indicates that the server is expected to never time out. The server may reject the proposed value, causing a CIMError to be raised with status code CIM_ERR_INVALID_OPERATION_TIMEOUT.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default timeout to be used.
  • ContinueOnError (bool) –

    Indicates to the WBEM server to continue sending responses after an error response has been sent.

    • If True, the server is to continue sending responses after sending an error response. Not all servers support continuation on error; a server that does not support it must send an error response if True was specified, causing CIMError to be raised with status code CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED.
    • If False, the server is requested to close the enumeration after sending an error response.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is False.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server may return for this request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to leave the handling of any returned instances to a loop of Pull operations.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default behaviour to be used. DSP0200 defines that the server-implemented default is to return zero instances.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is None, because query results are not addressable CIM instances.

  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: The inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

  • query_result_class (CIMClass): If the ReturnQueryResultClass parameter is True, this tuple item contains a class definition that defines the properties of each row (instance) of the query result. Otherwise, None.

Raises:

Exceptions described in WBEMConnection.

PullInstancesWithPath(context, MaxObjectCount, **extra)[source]

Retrieve the next set of instances (with instance paths) from an open enumeration session.

New in pywbem 0.9.

This operation can only be used on enumeration sessions that have been opened by one of the following methods:

This method performs the PullInstancesWithPath operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instances. Otherwise, this method raises an exception.

Parameters:
  • context (tuple() of server_context, namespace) –

    A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must have been returned by the previous open or pull operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace being used for this enumeration session.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server shall return for this request. This parameter is required for each Pull request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to reset the interoperation timer
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is a CIMInstanceName object with its attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

PullInstancePaths(context, MaxObjectCount, **extra)[source]

Retrieve the next set of instance paths from an open enumeration session.

New in pywbem 0.9.

This operation can only be used on enumeration sessions that have been opened by one of the following methods:

This method performs the PullInstancePaths operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instance paths. Otherwise, this method raises an exception.

Parameters:
  • context (tuple() of server_context, namespace) –

    A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must have been returned by the previous open or pull operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace being used for this enumeration session.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server shall return for this request. This parameter is required for each Pull request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to reset the interoperation timer.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • paths (list of CIMInstanceName): Representations of the retrieved instance paths, with their attributes set as follows:

    • classname: Name of the creation class of the instance.
    • keybindings: Keybindings of the instance.
    • namespace: Name of the CIM namespace containing the instance.
    • host: Host and optionally port of the WBEM server containing the CIM namespace.
  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

PullInstances(context, MaxObjectCount, **extra)[source]

Retrieve the next set of instances (without instance paths) from an open enumeration session.

New in pywbem 0.9.

This operation can only be used on enumeration sessions that have been opened by one of the following methods:

This method performs the PullInstances operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns enumeration session status and optionally instances. Otherwise, this method raises an exception.

Parameters:
  • context (tuple() of server_context, namespace) –

    A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must have been returned by the previous open or pull operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace being used for this enumeration session.
  • MaxObjectCount (Uint32) –

    Maximum number of instances the WBEM server shall return for this request. This parameter is required for each Pull request.

    • If positive, the WBEM server is to return no more than the specified number of instances.
    • If zero, the WBEM server is to return no instances. This may be used by a client to reset the interoperation timer.
    • None is not allowed.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A namedtuple() object containing the following named items:

  • instances (list of CIMInstance): Representations of the retrieved instances.

    The path attribute of each CIMInstance object is None, because this operation does not return instance paths.

  • eos (bool): Indicates whether the enumeration session is exhausted after this operation:

    • If True, the enumeration session is exhausted, and the server has closed the enumeration session.
    • If False, the enumeration session is not exhausted and the context item is the context object for the next operation on the enumeration session.
  • context (tuple() of server_context, namespace): A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must be supplied with the next pull or close operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server if the session is not exhausted, or None otherwise. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace that was used for this operation.

    NOTE: This inner tuple hides the need for a CIM namespace on subsequent operations in the enumeration session. CIM operations always require target namespace, but it never makes sense to specify a different one in subsequent operations on the same enumeration session.

Raises:

Exceptions described in WBEMConnection.

CloseEnumeration(context, **extra)[source]

Close an open enumeration session, causing an early termination of an incomplete enumeration session.

New in pywbem 0.9.

This method performs the CloseEnumeration operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

The enumeration session must still be open when this operation is performed.

If the operation succeeds, this method returns. Otherwise, it raises an exception.

Parameters:
  • context (tuple() of server_context, namespace) –

    A context object identifying the open enumeration session, including its current enumeration state, and the namespace. This object must have been returned by the previous open or pull operation for this enumeration session.

    The tuple items are:

    • server_context (string): Enumeration context string returned by the server. This string is opaque for the client.
    • namespace (string): Name of the CIM namespace being used for this enumeration session.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

EnumerateClasses(namespace=None, ClassName=None, DeepInheritance=None, LocalOnly=None, IncludeQualifiers=None, IncludeClassOrigin=None, **extra)[source]

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

This method performs the EnumerateClasses operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • namespace (string) –

    Name of the namespace in which the classes are to be enumerated (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • ClassName (string or CIMClassName) –

    Name of the class whose subclasses are to be retrieved (case independent). If specified as a CIMClassName object, its host attribute will be ignored.

    If None, the top-level classes in the namespace will be retrieved.

  • DeepInheritance (bool) –

    Indicates that all (direct and indirect) subclasses of the specified class or of the top-level classes are to be included in the result, as follows:

    • If False, only direct subclasses of the specified class or only top-level classes are included in the result.
    • If True, all direct and indirect subclasses of the specified class or the top-level classes and all of their direct and indirect subclasses are included in the result.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    Note, the semantics of the DeepInheritance parameter in EnumerateInstances() is different.

  • LocalOnly (bool) –

    Indicates that inherited properties, methods, and qualifiers are to be excluded from the returned classes, as follows.

    • If False, inherited elements are not excluded.
    • If True, inherited elements are excluded.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.
  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned classes, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.
  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property and method in the returned classes, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.
  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A list of CIMClass objects that are representations of the enumerated classes, with their path attributes set.

Raises:

Exceptions described in WBEMConnection.

EnumerateClassNames(namespace=None, ClassName=None, DeepInheritance=None, **extra)[source]

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

This method performs the EnumerateClassNames operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • namespace (string) –

    Name of the namespace in which the class names are to be enumerated (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • ClassName (string or CIMClassName) –

    Name of the class whose subclasses are to be retrieved (case independent). If specified as a CIMClassName object, its host attribute will be ignored.

    If None, the top-level classes in the namespace will be retrieved.

  • DeepInheritance (bool) –

    Indicates that all (direct and indirect) subclasses of the specified class or of the top-level classes are to be included in the result, as follows:

    • If False, only direct subclasses of the specified class or only top-level classes are included in the result.
    • If True, all direct and indirect subclasses of the specified class or the top-level classes and all of their direct and indirect subclasses are included in the result.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.

    Note, the semantics of the DeepInheritance parameter in EnumerateInstances() is different.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A list of unicode string objects that are the class names of the enumerated classes.

Raises:

Exceptions described in WBEMConnection.

GetClass(ClassName, namespace=None, LocalOnly=None, IncludeQualifiers=None, IncludeClassOrigin=None, PropertyList=None, **extra)[source]

Retrieve a class.

This method performs the GetClass operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be retrieved (case independent). If specified as a CIMClassName object, its host attribute will be ignored.
  • namespace (string) –

    Name of the namespace of the class to be retrieved (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • LocalOnly (bool) –

    Indicates that inherited properties, methods, and qualifiers are to be excluded from the returned class, as follows.

    • If False, inherited elements are not excluded.
    • If True, inherited elements are excluded.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.
  • IncludeQualifiers (bool) –

    Indicates that qualifiers are to be included in the returned class, as follows:

    • If False, qualifiers are not included.
    • If True, qualifiers are included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is True.
  • IncludeClassOrigin (bool) –

    Indicates that class origin information is to be included on each property and method in the returned class, as follows:

    • If False, class origin information is not included.
    • If True, class origin information is included.
    • If None, this parameter is not passed to the WBEM server, and causes the server-implemented default to be used. DSP0200 defines that the server-implemented default is False.
  • PropertyList (string or iterable of string) –

    An iterable specifying the names of the properties (or a string that defines a single property) to be included in the returned class (case independent).

    An empty iterable indicates to include no properties.

    If None, all properties are included.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A CIMClass object that is a representation of the retrieved class, with its path attribute set.

Raises:

Exceptions described in WBEMConnection.

ModifyClass(ModifiedClass, namespace=None, **extra)[source]

Modify a class.

This method performs the ModifyClass operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ModifiedClass (CIMClass) –

    A representation of the modified class.

    The properties, methods and qualifiers defined in this object specify what is to be modified.

    Typically, this object has been retrieved by other operations, such as GetClass().

  • namespace (string) –

    Name of the namespace in which the class is to be modified (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

CreateClass(NewClass, namespace=None, **extra)[source]

Create a class in a namespace.

This method performs the CreateClass operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • NewClass (CIMClass) –

    A representation of the class to be created.

    The properties, methods and qualifiers defined in this object specify how the class is to be created.

    Its path attribute is ignored.

  • namespace (string) –

    Name of the namespace in which the class is to be created (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

DeleteClass(ClassName, namespace=None, **extra)[source]

Delete a class.

This method performs the DeleteClass operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • ClassName (string or CIMClassName) – Name of the class to be deleted (case independent). If specified as a CIMClassName object, its host attribute will be ignored.
  • namespace (string) –

    Name of the namespace of the class to be deleted (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the namespace of the ClassName parameter will be used, if specified as a CIMClassName object. If that is also None, the default namespace of the connection will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

EnumerateQualifiers(namespace=None, **extra)[source]

Enumerate the qualifier types (= qualifier declarations) in a namespace.

This method performs the EnumerateQualifiers operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • namespace (string) –

    Name of the namespace in which the qualifier declarations are to be enumerated (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A list of CIMQualifierDeclaration objects that are representations of the enumerated qualifier declarations.

Raises:

Exceptions described in WBEMConnection.

GetQualifier(QualifierName, namespace=None, **extra)[source]

Retrieve a qualifier type (= qualifier declaration).

This method performs the GetQualifier operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • QualifierName (string) – Name of the qualifier declaration to be retrieved (case independent).
  • namespace (string) –

    Name of the namespace of the qualifier declaration (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Returns:

A CIMQualifierDeclaration object that is a representation of the retrieved qualifier declaration.

Raises:

Exceptions described in WBEMConnection.

SetQualifier(QualifierDeclaration, namespace=None, **extra)[source]

Create or modify a qualifier type (= qualifier declaration) in a namespace.

This method performs the SetQualifier operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • QualifierDeclaration (CIMQualifierDeclaration) – Representation of the qualifier declaration to be created or modified.
  • namespace (string) –

    Name of the namespace in which the qualifier declaration is to be created or modified (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.

DeleteQualifier(QualifierName, namespace=None, **extra)[source]

Delete a qualifier type (= qualifier declaration).

This method performs the DeleteQualifier operation (see DSP0200). See WBEM operations for a list of all methods performing such operations.

If the operation succeeds, this method returns. Otherwise, this method raises an exception.

Parameters:
  • QualifierName (string) – Name of the qualifier declaration to be deleted (case independent).
  • namespace (string) –

    Name of the namespace in which the qualifier declaration is to be deleted (case independent).

    Leading and trailing slash characters will be stripped. The lexical case will be preserved.

    If None, the default namespace of the connection object will be used.

  • **extra – Additional keyword arguments are passed as additional operation parameters to the WBEM server. Note that DSP0200 does not define any additional parameters for this operation.
Raises:

Exceptions described in WBEMConnection.