WBEMConnection¶
- class lmiwbem.lmiwbem_core.WBEMConnection¶
Constructs WBEMConnection object.
Parameters: - url (str) – String containing URL of CIMOM instance
- creds (tuple) – tuple containing two string, where the first one stands for username, second for password
- x509 (dict) – dictionary containing keys ‘cert_file’ and ‘key_file’ The value of ‘cert_file’ must be string specifying a filename of certificate and the value of ‘key_file’ must be string specifying a filename of private key belonging to the certificate.
- no_verification (bool) – set to True, if CIMOM’s X509 certificate shall not be verified; False otherwise. Default value is False.
- connect_locally (bool) – if True, Unix socket will be used. Default value is False.
- AssociatorNames(ObjectName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None)¶
Returns a list of associated CIMInstanceName objects with an input instance name.
Parameters: - ObjectName (CIMInstanceName) – specifies CIM object for which the associated instance names will be enumerated.
- AssocClass (str) – valid CIM association class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an instance of this class or one of its subclasses.
- ResultClass (str) – valid CIM class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be either an instance of this class (or one of its subclasses) or be this class (or one of its subclasses).
- Role (str) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the source object plays the specified role. That is, the name of the property in the association class that refers to the source object shall match the value of this parameter.
- ResultRole (str) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the named returned object plays the specified role. That is, the name of the property in the association class that refers to the returned object shall match the value of this parameter.
Returns: list of associated CIMInstanceName objects with an input instance
Raises: Example: AssociatorNames
- Associators(ObjectName, AssocClass=None, ResultClass=None, Role=None, ResultRole=None, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None)¶
Returns a list of associated CIMInstance objects with an input instance name.
Parameters: - ObjectName (CIMInstanceName) – specifies CIM object for which the associated instances will be enumerated.
- AssocClass (str) – valid CIM association class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an instance of this class or one of its subclasses.
- ResultClass (str) – valid CIM class name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be either an instance of this class (or one of its subclasses) or be this class (or one of its subclasses).
- Role (str) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the source object plays the specified role. That is, the name of the property in the association class that refers to the source object shall match the value of this parameter.
- ResultRole (str) – valid property name. It acts as a filter on the returned set of names by mandating that each returned name identify an object that shall be associated to the source object through an association in which the named returned object plays the specified role. That is, the name of the property in the association class that refers to the returned object shall match the value of this parameter.
- IncludeQualifiers (bool) – indicates, if all qualifiers for each object (including qualifiers on the object and on any returned properties) shall be included as <QUALIFIER> elements in the response. Default value is False.
- IncludeClassOrigin (bool) – indicates, if the CLASSORIGIN attribute shall be present on all appropriate elements in each returned object. Default value is False.
- PropertyList (list) – if not None, the members of the array define one or more property names. Each returned object shall not include elements for any properties missing from this list. If PropertyList is an empty list, no properties are included in each returned object. If it is None, no additional filtering is defined. Default value is None.
Returns: list of associated CIMInstance objects with an input instance
Raises: Example: Associators
- CreateInstance(NewInstance, ns=None)¶
Creates a new CIM instance and returns its instance name.
Parameters: - NewInstance (CIMInstance) – new local CIMInstance
- ns (str) – Namespace in which the CIMInstance will be created. If ns is None, namespace will be used from NewInstance.path.namespace.
Returns: instance name of new CIM instance
Return type: Example: CreateInstance
- DeleteInstance(InstanceName)¶
Deletes a CIM instance identified by CIMInstanceName.
Parameters: InstanceName (CIMInstanceName) – object path of CIM instance Raises: CIMError, ConnectionError Example: DeleteInstance
- EnumerateClassNames(namespace=None, ClassName=None, DeepInheritance=False)¶
Enumerates class names managed by the CIMOM.
Parameters: - namespace (str) – string containing namespace, from which the classes will be retrieved
- ClassName (str) – string containing a class name, which defines the class that is the basis for the enumeration
- DeepInheritance (bool) – indicates, if all subclasses of the specified class should be returned. If the ClassName input parameter is absent, this implies that all classes in the target namespace should be returned. If DeepInheritance is false, only immediate child subclasses are returned. If the ClassName input parameter is None, this implies that all top-level classes (that is, classes with no superclass) in the target namespace should be returned. This definition of DeepInheritance applies only to the EnumerateClasses and EnumerateClassName operations.
Returns: list of strings of class names
Raises: Example: EnumerateClassNames
- EnumerateClasses(namespace=None, ClassName=None, DeepInheritance=False, LocalOnly=True, IncludeQualifiers=True, IncludeClassOrigin=False)¶
Enumerates classes managed by the CIMOM.
Parameters: - namespace (str) – string containing namespace, from which the classes will be retrieved
- ClassName (str) – string containing a class name, which defines the class that is the basis for the enumeration
- DeepInheritance (bool) – indicates, if all subclasses of the specified class should be returned. If the ClassName input parameter is absent, this implies that all classes in the target namespace should be returned. If DeepInheritance is false, only immediate child subclasses are returned. If the ClassName input parameter is None, this implies that all top-level classes (that is, classes with no superclass) in the target namespace should be returned. This definition of DeepInheritance applies only to the EnumerateClasses and EnumerateClassName operations.
- LocalOnly (bool) – indicates, if any CIM elements (properties, methods, and qualifiers) except those added or overridden in the class as specified in the classname input parameter shall not be included in the returned class. If it is false, this parameter defines no additional filtering.
- IncludeQualifiers (bool) – indicates, if all qualifiers for each class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included as <QUALIFIER> XML elements in the response. If it is false, no <QUALIFIER> XML elements are present.
- IncludeClassOrigin (bool) – indicates, if the CLASSORIGIN attribute shall be present on all appropriate elements in each returned class. If it is false, no CLASSORIGIN attributes are present.
Returns: list of CIMClass objects
Raises: Example: EnumerateClasses
- EnumerateInstanceNames(ClassName, namespace=None)¶
Enumerates instance names of a given class name.
Parameters: - ClassName (str) – String containing class name of instance names to be retrieved.
- namespace (str) – String containing namespace, from which the instance names will be retrieved.
Returns: List of CIMInstanceName objects
Raises: Example: EnumerateInstanceNames
- EnumerateInstances(ClassName, namespace=None, LocalOnly=True, DeepInheritance=True, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None)¶
Enumerates instances of a given class name.
Parameters: - ClassName (str) – String containing class name of instances to be retrieved.
- namespace (str) – String containing namespace, from which the instances should be retrieved.
- LocalOnly (bool) – Indicates, if any CIM elements (properties, methods, and qualifiers) except those added oroverridden in the class as specified in the classname input parameter shall not be included in the returned class.
- IncludeQualifiers (bool) – Indicates, if all qualifiers for each class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included as <QUALIFIER> elements in the response.
- IncludeClassOrigin (bool) – Indicates, if the CLASSORIGIN attribute shall be present on all appropriate elements in each returned class.
- PropertyList (list) – if present and not None, the members of the list define one or more property names. The returned class shall not include elements for properties missing from this list. Note that if LocalOnly is specified as True, it acts as an additional filter on the set of properties returned. For example, if property A is included in the PropertyList but LocalOnly is set to True and A is not local to the requested class, it is not included in the response. If the PropertyList input parameter is an empty list, no properties are included in the response. If the PropertyList input parameter is None, no additional filtering is defined. Default value is None.
Returns: List of CIMInstance objects
Raises: Example: EnumerateInstances
- ExecQuery(QueryLanguage, Query, namespace=None)¶
Executes a query and returns a list of CIMInstance objects.
Parameters: - query_lang (str) – query language
- query (str) – query to execute
- namespace (str) – target namespace for the query
Returns: list of CIMInstance objects
Raises: Example: ExecQuery
- GetClass(ClassName, namespace=None, LocalOnly=True, IncludeQualifiers=True, IncludeClassOrigin=False, PropertyList=None)¶
Returns a CIMClass representing the named class.
Parameters: - ClassName (str) – defines the name of the class to be retrieved.
- namespace (str) – string containing namespace, from which the class will be retrieved
- LocalOnly (bool) – indicates, if any CIM elements (properties, methods, and qualifiers), except those added or overridden in the class as specified in the classname input parameter, shall not be included in the returned class. If it is false, no additional filtering is defined.
- IncludeQualifiers (bool) – indicates, if all qualifiers for that class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included as <QUALIFIER> XML elements in the response. If it is false, no <QUALIFIER> XML elements are present in the returned class.
- IncludeClassOrigin (bool) – indicates, if all qualifiers for that class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included as <QUALIFIER> XML elements in the response. If it is false, no <QUALIFIER> XML elements are present in the returned class.
- PropertyList (list) – if not None, the members of the array define one or more property names. The returned class shall not include any properties missing from this list. Note that if LocalOnly is specified as true, it acts as an additional filter on the set of properties returned. For example, if property A is included in PropertyList but LocalOnly is set to true and A is not local to the requested class, it is not included in the response. If the PropertyList input parameter is an empty array, no properties are included in the response. If the PropertyList input parameter is None, no additional filtering is defined.
Returns: CIMClass object
Raises: Example: GetClass
- GetInstance(InstanceName, namespace=None, LocalOnly=True, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None)¶
Fetches a CIMInstance from CIMOM identified by CIMInstanceName.
Parameters: - InstanceName (CIMInstanceName) – CIMInstanceName, which identifies a CIMInstance
- namespace (str) – string containing namespace, from which the instance will be retrieved
- LocalOnly (bool) – indicates, if any CIM elements (properties, methods, and qualifiers) except those added oroverridden in the class as specified in the classname input parameter shall not be included in the returned class.
- IncludeQualifiers (bool) – indicates, if all qualifiers for each class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included as <QUALIFIER> elements in the response.
- IncludeClassOrigin (bool) – indicates, if the CLASSORIGIN attribute shall be present on all appropriate elements in each returned class.
- PropertyList (list) – if present and not None, the members of the list define one or more property names. The returned class shall not include elements for properties missing from this list. Note that if LocalOnly is specified as True, it acts as an additional filter on the set of properties returned. For example, if property A is included in the PropertyList but LocalOnly is set to True and A is not local to the requested class, it is not included in the response. If the PropertyList input parameter is an empty list, no properties are included in the response. If the PropertyList input parameter is None, no additional filtering is defined. Default value is None.
Returns: CIMInstance object
Raises: Example: GetInstance
- InvokeMethod(MethodName, ObjectName, **params)¶
Executes a method within a given instance.
Parameters: - ObjectName (CIMInstanceName) – specifies CIM object within which the method will be called
- MethodName (str) – string containing a method name
- ObjectName – object path
- params (dictionary) – parameters passed to the method call
Returns: tuple containing method’s return value and output parameters
Raises: Example: InvokeMethod
- ModifyInstance(ModifiedInstance, IncludeQualifiers=True, PropertyList=None)¶
Modifies properties of a existing instance.
Parameters: - ModifiedInstance (CIMInstance) – modified instance
- IncludeQualifiers (bool) – Indicates, if the qualifiers are modified as specified in ModifiedInstance. If the parameter is false, qualifiers in ModifiedInstance are ignored and no qualifiers are explicitly modified.
- PropertyList (list) – if present and not None, the members of the list define one or more property names. The properties specified in PropertyList are designated to be modified. Properties of the ModifiedInstance that are missing from PropertyList are not designated to be modified. If PropertyList is an empty array, no properties are designated to be modified. If PropertyList is None, the properties of ModifiedInstance with values different from the current values in the instance are designated to be modified.
Raises: Example: ModifyInstance
- ReferenceNames(ObjectName, ResultClass=None, Role=None)¶
Returns a list of association CIMInstanceName objects with an input instance.
Parameters: - ObjectName (CIMInstanceName) – specifies CIM object for which the association instance names will be enumerated.
- ResultClass (str) – valid CIM class name. It acts as a filter on the returned set of object names by mandating that each returned Object Name identify an instance of this class (or one of its subclasses) or this class (or one of its subclasses).
- Role (str) – valid property name. It acts as a filter on the returned set of object names by mandating that each returned object name shall identify an object that refers to the target instance through a property with a name that matches the value of this parameter.
Returns: list of association CIMInstanceName objects with an input instance
Raises: Example: ReferenceNames
- References(ObjectName, ResultClass=None, Role=None, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None)¶
Returns a list of association CIMInstance objects with an input instance name.
Parameters: - ObjectName (CIMInstanceName) – specifies CIM object for which the association instances will be enumerated.
- ResultClass (str) – valid CIM class name. It acts as a filter on the returned set of objects by mandating that each returned object shall be an instance of this class (or one of its subclasses) or this class (or one of its subclasses). Default value is None.
- Role (str) – valid property name. It acts as a filter on the returned set of objects by mandating that each returned object shall refer to the target object through a property with a name that matches the value of this parameter. Default value is None.
- IncludeQualifiers (bool) – bool flag indicating, if all qualifiers for each object (including qualifiers on the object and on any returned properties) shall be included as <QUALIFIER> elements in the response. Default value is False.
- IncludeClassOrigin (bool) – bool flag indicating, if the CLASSORIGIN attribute shall be present on all appropriate elements in each returned object. Default value is False.
- PropertyList (list) – if not None, the members of the list define one or more property names. Each returned object shall not include elements for any properties missing from this list. If PropertyList is an empty list, no properties are included in each returned object. If PropertyList is None, no additional filtering is defined. Default value is None.
Returns: list of association CIMInstance objects with an input instance
Raises: Example: References
- connect(url=None, username=None, password=None, cert_file=None, key_file=None, no_verification=None)¶
Connects to CIMOM.
Parameters: - url (str) – String containing url of remote CIMOM.
- username (str) – String containing username for authentication.
- password (str) – String containing password for authentication.
- no_verification (bool) – set to True, if CIMOM’s X509 certificate shall not be verified; False otherwise. Default value is False.
Raises: Example: Connecting to CIMOM
- connectLocally()¶
Connect to CIMOM using local Unix socket.
Raises: ConnectionError Example: Connection using Unix Socket
- connect_locally¶
Property storing flag means of connection. If set to True, local Unix socket will be used; HTTP(S) otherwise.
Return type: bool
- creds¶
Property storing user credentials.
Return type: tuple containing username and password
- default_namespace¶
Property storing default CIM namespace used for CIM operations.
Return type: str
- disconnect()¶
Disconnects from CIMOM.
- hostname¶
Property returning CIMOM hostname.
Return type: str
- is_connected¶
Property, which return True, if the client is connected to certain CIMOM.
Return type: bool
- no_verification¶
Property storing X509 certificate verification flag.
Return type: bool
- request_accept_languages¶
Property storing accept languages currently configured for this client.
Return type: list of tuples (lang, q)
- timeout¶
Property storing CIM operations timeout in milliseconds. Default value is 60000ms.
Return type: int