4.2. CIM objects

CIM objects are local representations of CIM instances, classes, properties, etc., as Python objects. They are used as input to and output from WBEM operations:

CIM object Purpose
CIMInstanceName Instance path of a CIM instance
CIMInstance CIM instance
CIMClassName Name of a CIM class, optionally with class path
CIMClass CIM class
CIMProperty CIM property, both as property value in a CIM instance and as property declaration in a CIM class
CIMMethod CIM method declaration in a CIM class
CIMParameter CIM parameter, both as a parameter value in a method invocation and as a parameter declaration in a CIM method declaration in a CIM class
CIMQualifier CIM qualifier value
CIMQualifierDeclaration CIM qualifier type/declaration

4.2.1. Putting CIM objects in sets

Using sets for holding the result of WBEM operations is not uncommon, because that allows comparison of results without regard to the (undefined) order in which the objects are returned.

CIM objects are mutable and unchanged-hashable. This requires some caution when putting them in sets, or using them in any other way that relies on their hash values.

The caution that is needed is that the public attributes, and therefore the state of the CIM objects, must not change as long as they are a member of a set, or used in any other way that relies on their hash values.

The following example shows what happens if a CIM object is modified while being a member of a set:

import pywbem

s = set()

# Create CIM object c1 and show its identity and hash value:
c1 = pywbem.CIMClass('C')
print(id(c1), hash(c1))  # (140362966049680, -7623128493967117119)

# Add c1 to the set and verify the set content:
s.add(c1)
print([id(c) for c in s])  # [140362966049680]

# Modify the c1 object; it now has changed its hash value:
c1.superclass = 'B'
print(id(c1), hash(c1))  # (140362966049680, 638672161836520435)

# Create a CIM object c2 with the same attribute values as c1, and show
# that they compare equal and that c2 has the same hash value as c1 now has:
c2 = pywbem.CIMClass('C', superclass='B')
print(c1 == c2)  # True
print(id(c2), hash(c2))  # (140362970983696, 638672161836520435)

# Add c2 to the set and verify the set content:
s.add(c2)
print([id(c) for c in s])  # [140362966049680, 140362970983696] !!

At the end, the set contains both objects even though they have the same hash value. This is not what one would expect from set types.

The reason is that at the time the object c1 was added to the set, it had a different hash value, and the set uses the hash value it found at insertion time of its member for identifying the object. When the second object is added, it finds it has a yet unknown hash value, and adds it.

While the set type in this particular Python implementation was able to still look up the first member object even though its hash value has changed meanwhile, other collection types or other Python implementations may not be as forgiving and may not even be able to look up the object once its hash value has changed.

Therefore, always make sure that the public attributes of CIM objects that are put into a set remain unchanged while the object is in the set. The same applies to any other usage of CIM objects that relies on their hash values.

4.2.2. Order of CIM child objects

CIM objects have zero or more lists of child objects. For example, a CIM class (the parent object) has a list of CIM properties, CIM methods and CIM qualifiers (the child objects).

In pywbem, the parent CIM object allows initializing each list of child objects via an init parameter. For example, the CIMClass init method has a parameter named properties that allows specifying the CIM properties of the CIM class.

Once the parent CIM object exists, each list of child objects can be modified via a settable attribute. For example, the CIMClass class has a properties attribute for its list of CIM properties.

For such attributes and init parameters that specify lists of child objects, pywbem supports a number of different ways the child objects can be specified.

Some of these ways preserve the order of child objects and some don’t.

This section uses CIM properties in CIM classes as an example, but it applies to all kinds of child objects in CIM objects.

The possible input objects for the properties init parameter and for the properties attribute of CIMClass is described in the type properties input object, and must be one of these objects:

  • iterable of CIMProperty
  • iterable of tuple(key, value)
  • OrderedDict with key and value
  • dict with key and value (will not preserve order)

The keys are always the property names, and the values are always CIMProperty objects (at least when initializing classes).

Even though the OrderedDict class preserves the order of its items, intializing the dictionary with keyword arguments causes the order of items to be lost before the dictionary is even initialized (before Python 3.6). The only way to initialize a dictionary without loosing order of items is by providing a list of tuples(key,value).

The following examples work but loose the order of properties in the class:

# Examples where order of properties in class is not as specified:


# Using an OrderedDict object, initialized with keyword arguments
# (before Python 3.6):

c1_props = OrderedDict(
    Prop1=CIMProperty('Prop1', value='abc'),
    Prop2=CIMProperty('Prop2', value=None, type='string'),
)


# Using a dict object, initialized with keyword arguments (This time
# specified using key:value notation):

c1_props = {
    'Prop1': CIMProperty('Prop1', value='abc'),
    'Prop2': CIMProperty('Prop2', value=None, type='string'),
}


# Using a dict object, initialized with list of tuple(key,value):

c1_props = dict([
    ('Prop1', CIMProperty('Prop1', value='abc')),
    ('Prop2', CIMProperty('Prop2', value=None, type='string')),
])


# Any of the above objects can be used to initialize the class properties:

c1 = CIMClass('CIM_Foo', properties=c1_props)

The following examples all preserve the order of properties in the class:

# Examples where order of properties in class is as specified:


# Using a list of CIMProperty objects (starting with pywbem 0.12):

c1_props = [
    CIMProperty('Prop1', value='abc'),
    CIMProperty('Prop2', value=None, type='string'),
]


# Using an OrderedDict object, initialized with list of tuple(key,value):

c1_props = OrderedDict([
    ('Prop1', CIMProperty('Prop1', value='abc')),
    ('Prop2', CIMProperty('Prop2', value=None, type='string')),
])


# Using a list of tuple(key,value):

c1_props = [
    ('Prop1', CIMProperty('Prop1', value='abc')),
    ('Prop2', CIMProperty('Prop2', value=None, type='string')),
]


# Any of the above objects can be used to initialize the class properties:

c1 = CIMClass('CIM_Foo', properties=c1_props)

4.2.3. NocaseDict

Class NocaseDict is a dictionary implementation with case-insensitive but case-preserving keys, and with preservation of the order of its items.

It is used for lists of child objects of CIM objects (e.g. the list of CIM properties in a CIM class, or the list of CIM parameters in a CIM method).

Users of pywbem will notice NocaseDict objects only as a result of pywbem functions. Users cannot create NocaseDict objects.

Except for the case-insensitivity of its keys, it behaves like the built-in OrderedDict. Therefore, NocaseDict is not described in detail in this documentation.

Deprecated: In pywbem 0.9, support for comparing two NocaseDict instances with the >, >, <=, >= operators has been deprecated.

4.2.4. CIMInstanceName

class pywbem.CIMInstanceName(classname, keybindings=None, host=None, namespace=None)[source]

A CIM instance path (aka CIM instance name).

A CIM instance path references a CIM instance in a CIM namespace in a WBEM server. Namespace and WBEM server may be unspecified.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

Parameters:
  • classname (string) –

    Name of the creation class of the referenced instance.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • keybindings (keybindings input object) – Keybindings for the instance path (that is, the key property values of the referenced instance).
  • host (string) –

    Host and optionally port of the WBEM server containing the CIM namespace of the referenced instance.

    The format of the string must be:

    host[:port]

    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.

    None means that the WBEM server is unspecified, and the host attribute will also be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • namespace (string) –

    Name of the CIM namespace containing the referenced instance.

    None means that the namespace is unspecified, and the namespace attribute will also be None.

    Leading and trailing slash characters will be stripped. The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

Raises:
  • ValueError – An error in the provided argument values.
  • ValueError – A keybinding value is None and the config variable IGNORE_NULL_KEY_VALUE is False
  • TypeError – An error in the provided argument types.

Methods

copy Return a new CIMInstanceName object that is a copy of this CIM instance path.
from_instance Return a new CIMInstanceName object from the key property values in a CIM instance and the key property definitions in a CIM class.
from_wbem_uri Return a new CIMInstanceName object from the specified WBEM URI string.
get Return the value of a particular keybinding of this CIM instance path, or a default value.
has_key Return a boolean indicating whether this CIM instance path has a particular keybinding.
items Return a copied list of the keybinding names and values of this CIM instance path.
iteritems Iterate through the keybinding names and values of this CIM instance path.
iterkeys Iterate through the keybinding names of this CIM instance path.
itervalues Iterate through the keybinding values of this CIM instance path.
keys Return a copied list of the keybinding names of this CIM instance path.
to_wbem_uri Return the (untyped) WBEM URI string of this CIM instance path.
tocimxml Return the CIM-XML representation of this CIM instance path, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM instance path, as a unicode string.
update Update the keybindings of this CIM instance path.
values Return a copied list of the keybinding values of this CIM instance path.

Attributes

classname Class name of this CIM instance path, identifying the creation class of the referenced instance.
host Host and optionally port of this CIM instance path, identifying the WBEM server of the referenced instance.
keybindings Keybindings of this CIM instance path, identifying the key properties of the referenced instance.
namespace Namespace name of this CIM instance path, identifying the namespace of the referenced instance.

Details

classname

Class name of this CIM instance path, identifying the creation class of the referenced instance.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
keybindings

Keybindings of this CIM instance path, identifying the key properties of the referenced instance.

Will not be None.

Each dictionary item specifies one keybinding, with:

  • key (unicode string): Keybinding name. Its lexical case was preserved.
  • value (CIM data type or number): Keybinding value. If the config variable IGNORE_NULL_KEY_VALUE is True, None is allowed as a key value.

The order of keybindings in the instance path is preserved.

The keybinding name may be None in objects of this class that are created by pywbem, in the special case a WBEM server has returned an instance path with an unnamed keybinding (i.e. a KEYVALUE or VALUE.REFERENCE element without a parent KEYBINDINGS element). This is allowed as per DSP0201. When creating objects of this class, it is not allowed to specify unnamed keybindings, i.e. the keybinding name must not be None.

This attribute is settable; setting it will cause the current keybindings to be replaced with the new keybindings. For details, see the description of the same-named init parameter of this class.

The keybindings can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value must be specified as a CIM data type or as number:

instpath = CIMInstanceName(...)
v1 = "abc"  # must be a CIM data type or Python number type

instpath.keybindings['k1'] = v1  # Set "k1" to v1 (add if needed)
v1 = instpath.keybindings['k1']  # Access value of "k1"
del instpath.keybindings['k1']  # Delete "k1" from the inst. path

In addition, the keybindings can be accessed and manipulated one by one by using the entire CIMInstanceName object like a dictionary. Again, the provided input value must be specified as a CIM data type or as number:

instpath = CIMInstanceName(...)
v2 = 42  # must be a CIM data type or Python number type

instpath['k2'] = v2  # Set "k2" to v2 (add if needed)
v2 = instpath['k2']  # Access value of "k2"
del instpath['k2']  # Delete "k2" from the instance path
Type:NocaseDict
namespace

Namespace name of this CIM instance path, identifying the namespace of the referenced instance.

None means that the namespace is unspecified.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
host

Host and optionally port of this CIM instance path, identifying the WBEM server of the referenced instance.

For details about the string format, see the same-named init parameter of this class.

None means that the host and port are unspecified.

This attribute is settable. For details, see the description of the same-named init parameter.

Type:unicode string
__str__()[source]

Return the WBEM URI string of this CIM instance path.

The returned WBEM URI string is in the historical format returned by to_wbem_uri().

For new code, it is recommended that the standard format is used; it is returned by to_wbem_uri() as the default format.

Examples (for the historical format):

  • With host and namespace:

    //acme.com/cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
    
  • Without host but with namespace:

    cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
    
  • Without host and without namespace:

    CIM_RegisteredProfile.InstanceID="acme.1"
    
__repr__()[source]

Return a string representation of this CIM instance path, that is suitable for debugging.

The key bindings will be ordered by their names in the result.

copy()[source]

Return a new CIMInstanceName object that is a copy of this CIM instance path.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

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

Update the keybindings of this CIM instance path.

Existing keybindings will be updated, and new keybindings will be added.

Parameters:
  • *args (list) – Keybindings for updating the keybindings of the instance path, specified as positional arguments. Each positional argument must be a tuple (key, value), where key and value are described for setting the keybindings property.
  • **kwargs (dict) – Keybindings for updating the keybindings of the instance path, specified as keyword arguments. The name and value of the keyword arguments are described as key and value for setting the keybindings property.
has_key(key)[source]

Return a boolean indicating whether this CIM instance path has a particular keybinding.

Parameters:key (string) – Name of the keybinding (in any lexical case).
Returns:Boolean indicating whether this CIM instance path has the keybinding.
Return type:bool
get(key, default=None)[source]

Return the value of a particular keybinding of this CIM instance path, or a default value.

New in pywbem 0.8.

Parameters:
  • key (string) – Name of the keybinding (in any lexical case).
  • default (CIM data type) – Default value that is returned if a keybinding with the specified name does not exist in the instance path.
Returns:

Value of the keybinding, or the default value.

Return type:

CIM data type

keys()[source]

Return a copied list of the keybinding names of this CIM instance path.

The keybinding names have their original lexical case.

The order of keybindings is preserved.

values()[source]

Return a copied list of the keybinding values of this CIM instance path.

The order of keybindings is preserved.

items()[source]

Return a copied list of the keybinding names and values of this CIM instance path.

Each item in the returned list is a tuple of keybinding name (in the original lexical case) and keybinding value.

The order of keybindings is preserved.

iterkeys()[source]

Iterate through the keybinding names of this CIM instance path.

The keybinding names have their original lexical case.

The order of keybindings is preserved.

itervalues()[source]

Iterate through the keybinding values of this CIM instance path.

The order of keybindings is preserved.

iteritems()[source]

Iterate through the keybinding names and values of this CIM instance path.

Each iteration item is a tuple of the keybinding name (in the original lexical case) and the keybinding value.

The order of keybindings is preserved.

tocimxml(ignore_host=False, ignore_namespace=False)[source]

Return the CIM-XML representation of this CIM instance path, as an object of an appropriate subclass of Element.

If the instance path has no namespace specified or if ignore_namespace is True, the returned CIM-XML representation is an INSTANCENAME element consistent with DSP0201.

Otherwise, if the instance path has no host specified or if ignore_host is True, the returned CIM-XML representation is a LOCALINSTANCEPATH element consistent with DSP0201.

Otherwise, the returned CIM-XML representation is a INSTANCEPATH element consistent with DSP0201.

The order of keybindings in the returned CIM-XML representation is preserved from the CIMInstanceName object.

Parameters:
  • ignore_host (bool) – Ignore the host of the instance path, even if a host is specified.
  • ignore_namespace (bool) – Ignore the namespace and host of the instance path, even if a namespace and/or host is specified.
Returns:

The CIM-XML representation, as an object of an appropriate subclass of Element.

tocimxmlstr(indent=None, ignore_host=False, ignore_namespace=False)[source]

Return the CIM-XML representation of this CIM instance path, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:
  • indent (string or integer) –

    None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

    Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

  • ignore_host (bool) – Ignore the host of the instance path, even if a host is specified.
  • ignore_namespace (bool) – Ignore the namespace and host of the instance path, even if a namespace and/or host is specified.
Returns:

The CIM-XML representation of the value, as a unicode string.

static from_wbem_uri(wbem_uri)[source]

Return a new CIMInstanceName object from the specified WBEM URI string.

New in pywbem 0.12.

The WBEM URI string must be a CIM instance path in untyped WBEM URI format, as defined in DSP0207, with these extensions:

  • DSP0207 restricts the namespace types (URI schemes) to be one of http, https, cimxml-wbem, or cimxml-wbems. Pywbem tolerates any namespace type, but issues a UserWarning if it is not one of the namespace types defined in DSP0207.
  • DSP0207 requires a slash before the namespace name. For local WBEM URIs (no namespace type, no authority), that slash is the first character of the WBEM URI. For historical reasons, pywbem tolerates a missing leading slash for local WBEM URIs. Note that pywbem requires the slash (consistent with DSP0207) when the WBEM URI is not local.
  • DSP0207 requires a colon before the class name. For historical reasons, pywbem tolerates a missing colon before the class name, if it would have been the first character of the string.
  • DSP0207 requires datetime values in keybindings to be surrounded by double quotes. For historical reasons, pywbem tolerates datetime values that are not surrounded by double quotes, but issues a UserWarning.
  • DSP0207 does not allow the special float values INF, -INF, and NaN in WBEM URIs (according to realValue in DSP0004). However, the CIM-XML protocol supports representation of these special values, so to be on the safe side, pywbem supports these special values as keybindings in WBEM URIs.

Keybindings that are references are supported, recursively.

CIM instance paths in the typed WBEM URI format defined in DSP0207 are not supported.

The untyped WBEM URI format defined in DSP0207 has the following limitations when interpreting a WBEM URI string:

  • It cannot distinguish string-typed keys with a value that is a datetime value from datetime-typed keys with such a value. Pywbem treats such values as datetime-typed keys.
  • It cannot distinguish string-typed keys with a value that is a WBEM URI from reference-typed keys with such a value. Pywbem treats such values as reference-typed keys.

Examples:

https://jdd:test@acme.com:5989/cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
//jdd:test@acme.com:5989/cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
/cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
cimv2/test:CIM_RegisteredProfile.InstanceID="acme.1"
/:CIM_RegisteredProfile.InstanceID="acme.1"
:CIM_RegisteredProfile.InstanceID="acme.1"
CIM_RegisteredProfile.InstanceID="acme.1"
http://acme.com/root/cimv2:CIM_ComputerSystem.CreationClassName="ACME_CS",Name="sys1"
/:CIM_SubProfile.Main="/:CIM_RegisteredProfile.InstanceID="acme.1"",Sub="/:CIM_RegisteredProfile.InstanceID="acme.2""
Parameters:wbem_uri (string) – WBEM URI for an instance path.
Returns:The instance path created from the specified WBEM URI string.
Return type:CIMInstanceName
Raises:ValueError – Invalid WBEM URI format for an instance path. This includes typed WBEM URIs.
to_wbem_uri(format='standard')[source]

Return the (untyped) WBEM URI string of this CIM instance path.

The returned WBEM URI contains its components as follows:

  • it does not contain a namespace type (URI scheme).
  • it contains an authority (host) component according to the host attribute, if that is not None. Otherwise, it does not contain the authority component.
  • it contains a namespace component according to the namespace attribute, if that is not None. Otherwise, it does not contain the namespace component.
  • it contains a class name component according to the classname attribute.
  • it contains keybindings according to the keybindings attribute, with the order of keybindings preserved, and the lexical case of keybinding names preserved (except when using the format “canonical”).

Note that when you do not want some of these components to show up in the resulting WBEM URI string, you can set them to None before calling this method.

Except when using the format “canonical”, this method should not be used to compare instance paths for equality: DSP0004 defines defines several components of an instance path to be compared case insensitively, including the names of keybindings. In addition, it defines that the order of keybindings in instance paths does not matter for the comparison. All WBEM URI formats returned by this method except for the format “canonical” return a WBEM URI string that preserves the order of keybindings (relative to how the keybindings were first added to the CIMInstanceName object) and that preserves the lexical case of any components. Therefore, two instance paths that are considered equal according to DSP0004 may not have equal WBEM URI strings as returned by this method.

Instead, equality of instance paths represented by CIMInstanceName objects should be determined by using the == operator, which performs the comparison conformant to DSP0004. If you have WBEM URI strings without the corresponding CIMInstanceName object, such an object can be created by using the static method from_wbem_uri().

Parameters:format (string) –

Format for the generated WBEM URI string, using one of the following values:

  • "standard" - Standard format that is conformant to untyped WBEM URIs for instance paths defined in DSP0207.
  • "canonical" - Like "standard", except that the following items have been converted to lower case: host, namespace, classname, and the names of any keybindings, and except that the order of keybindings is in lexical order of the (lower-cased) keybinding names. This format guarantees that two instance paths that are considered equal according to DSP0004 result in equal WBEM URI strings. Therefore, the returned WBEM URI is suitable to be used as a key in dictionaries of CIM instances.
  • "cimobject" - Format for the CIMObject header field in CIM-XML messages for representing instance paths (used internally, see DSP0200).
  • "historical" - Historical format for WBEM URIs (used by __str__(); should not be used by new code). The historical format has the following differences to the standard format:
    • If the host component is not present, the slash after the host is also omitted. In the standard format, that slash is always present.
    • If the namespace component is not present, the colon after the namespace is also omitted. In the standard format, that colon is always present.

Keybindings that are references use the specified format recursively.

Examples:

  • With host and namespace, standard format:

    //ACME.com/cimv2/Test:CIM_RegisteredProfile.InstanceID="Acme.1"
    
  • With host and namespace, canonical format:

    //acme.com/cimv2/test:cim_registeredprofile.instanceid="Acme.1"
    
  • Without host but with namespace, standard format:

    /cimv2/Test:CIM_RegisteredProfile.InstanceID="Acme.1"
    
  • Without host but with namespace, canonical format:

    /cimv2/test:cim_registeredprofile.instanceid="Acme.1"
    
  • Without host and without namespace, standard format:

    /:CIM_RegisteredProfile.InstanceID="Acme.1"
    
Returns:

Untyped WBEM URI of the CIM instance path, in the specified format.

Return type:

unicode string

Raises:
static from_instance(class_, instance, namespace=None, host=None, strict=False)[source]

Return a new CIMInstanceName object from the key property values in a CIM instance and the key property definitions in a CIM class.

If the strict parameter is False, and a property value does not exist in the instance that entry is not included in the constructed CIMInstanceName

If the strict parameter is True all key properties in the class_ must exist in the instance or a ValueError exception is raised.

Parameters:
  • class_ (CIMClass) –

    The CIM class with the key properties.

    In strict mode, that class and the instance must contain all key properties that are required to create the CIMInstanceName object. Thus, for example, if the class were retrieved from a server, generally, the LocalOnly parameter in the request should be False to assure that superclass properties are retrieved and IncludeQualifiers parameter should be set to True to assure that qualifiers are retrieved.

    In non-strict mode, that class and instance may have missing key properties. Any missing key properties will result in missing key bindings in the created CIMInstanceName object.

    The specified class does not need to be the creation class of the instance. Thus, it could be a superclass as long as it has the required key properties.

  • instance (CIMInstance) – The CIM instance with the key property values.
  • namespace (string) – Namespace to include in the created CIMInstanceName or None.
  • host (string) – Host name to include in created CIMInstanceName or None.
  • strict (bool) – Strict mode (see description of class_ parameter).
Returns:

CIMInstanceName built from the key properties in the class_ parameter using the key property values in the instance parameter.

Return type:

CIMInstanceName

Raises:

ValueError – The strict attribute is True and a key property does not exist in the instance.

4.2.5. CIMInstance

class pywbem.CIMInstance(classname, properties=None, qualifiers=None, path=None, property_list=None)[source]

A representation of a CIM instance in a CIM namespace in a WBEM server, optionally including its instance path.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

Parameters:
  • classname (string) –

    Name of the creation class for the instance.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • properties (properties input object) –

    The property values for the instance.

    If the specified path has keybindings that correspond to these properties, the values of these keybindings will be updated to match the property values.

  • qualifiers (qualifiers input object) –

    The qualifiers for the instance.

    Note that DSP0200 has deprecated the presence of qualifiers on CIM instances.

  • path (CIMInstanceName) –

    Instance path for the instance.

    The provided object will be copied before being stored in the CIMInstance object.

    If this path has keybindings that correspond to the specified properties, the values of the keybindings in (the copy of) this path will be updated to match the property values.

    None means that the instance path is unspecified, and the path attribute will also be None.

  • property_list (iterable of string) –

    Deprecated: List of property names for use as a filter by some operations on the instance.

    This parameter has been deprecated in pywbem 0.12. Set only the desired properties on the object, instead of working with this property filter.

    The property names may have any lexical case.

    A copy of the provided iterable will be stored in the CIMInstance object, and the property names will be converted to lower case.

    None means that the properties are not filtered, and the property_list attribute will also be None.

Raises:
  • ValueError – classname is None, a property or qualifier name is None, or a property or qualifier name does not match its dictionary key.
  • TypeError – a numeric Python type was used for a property or qualifier value.

Methods

copy Return a new CIMInstance object that is a copy of this CIM instance.
from_class Return a new CIMInstance object from specified key property values and from the key property definitions in a class.
get Return the value of a particular property of this CIM instance, or a default value.
has_key Return a boolean indicating whether this CIM instance has a particular property.
items Return a copied list of the property names and values of this CIM instance.
iteritems Iterate through the property names and values of this CIM instance.
iterkeys Iterate through the property names of this CIM instance.
itervalues Iterate through the property values of this CIM instance.
keys Return a copied list of the property names of this CIM instance.
tocimxml Return the CIM-XML representation of this CIM instance, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM instance, as a unicode string.
tomof Return a MOF string with the specification of this CIM instance.
update Update the properties of this CIM instance.
update_existing Update already existing properties of this CIM instance.
values Return a copied list of the property values of this CIM instance.

Attributes

classname Name of the creation class of this CIM instance.
path Instance path of this CIM instance.
properties Properties of this CIM instance.
property_list Deprecated: List of property names for use as a filter by some operations on this CIM instance.
qualifiers Qualifiers (qualifier values) of this CIM instance.

Details

classname

Name of the creation class of this CIM instance.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
properties

Properties of this CIM instance.

Will not be None.

Each dictionary item specifies one property value, with:

The order of properties in the CIM instance is preserved.

This attribute is settable; setting it will cause the current CIM properties to be replaced with the new properties, and will also cause the values of corresponding keybindings in the instance path (if set) to be updated. For details, see the description of the same-named init parameter. Note that the property value may be specified as a CIM data type or as a CIMProperty object.

The CIM property values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. In that case, the provided input value must be a CIMProperty object. A corresponding keybinding in the instance path (if set) will not (!) be updated in this case:

inst = CIMInstance(...)
p1 = CIMProperty('p1', ...)  # must be CIMProperty

inst.properties['p1'] = p1  # Set "p1" to p1 (add if needed)
p1 = inst.properties['p1']  # Access "p1"
del inst.properties['p1']  # Delete "p1" from the instance

In addition, the CIM properties can be accessed and manipulated one by one by using the entire CIMInstance object like a dictionary. In that case, the provided input value may be specified as a CIM data type or as a CIMProperty object. The value of a corresponding keybinding in the instance path (if set) will be updated to the new property value:

inst = CIMInstance(...)
p2 = Uint32(...)  # may be CIM data type or CIMProperty

inst['p2'] = p2  # Set "p2" to p2 (add if needed)
p2 = inst['p2']  # Access "p2"
del inst['p2']  # Delete "p2" from the instance
Type:NocaseDict
qualifiers

Qualifiers (qualifier values) of this CIM instance.

Will not be None.

Each dictionary item specifies one qualifier value, with:

The order of qualifiers in the CIM instance is preserved.

This attribute is settable; setting it will cause the current qualifiers to be replaced with the new qualifiers. For details, see the description of the same-named init parameter of this class.

The qualifier values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary.

Note that DSP0200 has deprecated the presence of qualifier values on CIM instances.

Type:NocaseDict
path

Instance path of this CIM instance.

None means that the instance path is unspecified.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:CIMInstanceName
property_list

Deprecated: List of property names for use as a filter by some operations on this CIM instance.

This attribute has been deprecated in pywbem 0.12. Set only the desired properties on the object, instead of working with this property filter.

The property names are specified in lower case.

None means that the properties are not filtered.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:list of unicode string
__str__()[source]

Return a short string representation of this CIM instance, for human consumption.

__repr__()[source]

Return a string representation of this CIM instance, that is suitable for debugging.

The properties and qualifiers will be ordered by their names in the result.

copy()[source]

Return a new CIMInstance object that is a copy of this CIM instance.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

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

Update the properties of this CIM instance.

Existing properties will be updated, and new properties will be added.

Parameters:
  • *args (list) – Properties for updating the properties of the instance, specified as positional arguments. Each positional argument must be a tuple (key, value), where key and value are described for setting the properties property.
  • **kwargs (dict) – Properties for updating the properties of the instance, specified as keyword arguments. The name and value of the keyword arguments are described as key and value for setting the properties property.
update_existing(*args, **kwargs)[source]

Update already existing properties of this CIM instance.

Existing properties will be updated, and new properties will be ignored without further notice.

Parameters:
  • *args (list) – Properties for updating the properties of the instance, specified as positional arguments. Each positional argument must be a tuple (key, value), where key and value are described for setting the properties property.
  • **kwargs (dict) – Properties for updating the properties of the instance, specified as keyword arguments. The name and value of the keyword arguments are described as key and value for setting the properties property.
has_key(key)[source]

Return a boolean indicating whether this CIM instance has a particular property.

Parameters:key (string) – Name of the property (in any lexical case).
Returns:Boolean indicating whether the instance has the property.
Return type:bool
get(key, default=None)[source]

Return the value of a particular property of this CIM instance, or a default value.

New in pywbem 0.8.

Parameters:
  • key (string) – Name of the property (in any lexical case).
  • default (CIM data type) – Default value that is returned if a property with the specified name does not exist in the instance.
Returns:

Value of the property, or the default value.

Return type:

CIM data type

keys()[source]

Return a copied list of the property names of this CIM instance.

The property names have their original lexical case.

The order of properties is preserved.

values()[source]

Return a copied list of the property values of this CIM instance.

The order of properties is preserved.

items()[source]

Return a copied list of the property names and values of this CIM instance.

Each item in the returned list is a tuple of property name (in the original lexical case) and property value.

The order of properties is preserved.

iterkeys()[source]

Iterate through the property names of this CIM instance.

The property names have their original lexical case.

The order of properties is preserved.

itervalues()[source]

Iterate through the property values of this CIM instance.

The order of properties is preserved.

iteritems()[source]

Iterate through the property names and values of this CIM instance.

Each iteration item is a tuple of the property name (in the original lexical case) and the property value.

The order of properties is preserved.

tocimxml(ignore_path=False)[source]

Return the CIM-XML representation of this CIM instance, as an object of an appropriate subclass of Element.

If the instance has no instance path specified or if ignore_path is True, the returned CIM-XML representation is an INSTANCE element consistent with DSP0201. This is the required element for representing embedded instances.

Otherwise, if the instance path of the instance has no namespace specified, the returned CIM-XML representation is an VALUE.NAMEDINSTANCE element consistent with DSP0201.

Otherwise, if the instance path of the instance has no host specified, the returned CIM-XML representation is a VALUE.OBJECTWITHLOCALPATH element consistent with DSP0201.

Otherwise, the returned CIM-XML representation is a VALUE.INSTANCEWITHPATH element consistent with DSP0201.

The order of properties and qualifiers in the returned CIM-XML representation is preserved from the CIMInstance object.

Parameters:ignore_path (bool) – Ignore the path of the instance, even if a path is specified.
Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None, ignore_path=False)[source]

Return the CIM-XML representation of this CIM instance, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:
  • indent (string or integer) –

    None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

    Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

  • ignore_path (bool) – Ignore the path of the instance, even if a path is specified.
Returns:

The CIM-XML representation of the object, as a unicode string.

tomof(indent=0, maxline=80)[source]

Return a MOF string with the specification of this CIM instance.

The returned MOF string conforms to the instanceDeclaration ABNF rule defined in DSP0004, with the following limitations:

  • Pywbem does not support instance aliases, so the returned MOF string does not define an alias name for the instance.
  • Even though pywbem supports qualifiers on CIMInstance objects, and on CIMProperty objects that are used as property values within an instance, the returned MOF string does not contain any qualifier values on the instance or on its property values.

The order of properties and qualifiers is preserved.

Parameters:indent (integer) – This parameter has been deprecated in pywbem 0.12. A value other than 0 causes a deprecation warning to be issued. Otherwise, the parameter is ignored and the returned MOF instance specification is not indented.
Returns:MOF string.
Return type:unicode string
static from_class(klass, namespace=None, property_values=None, include_missing_properties=True, include_path=True, include_class_origin=False)[source]

Return a new CIMInstance object from specified key property values and from the key property definitions in a class.

The properties in the returned instance do not have any qualifiers.

Parameters:
  • klass (CIMClass) – CIMClass from which the instance will be constructed. This class must include qualifiers and should include properties from any superclasses in the model insure it includes all properties that are to be built into the instance, in particular any key properties if the include+path parameter is True. See from_class() for further requirements on the class.
  • namespace (string) – Namespace to be included in the path component of the returned CIMInstance if include_path parameter is True.
  • property_values (dict or NocaseDict) – Dictionary containing name/value pairs where the names are the names of properties in the class and the properties are the property values to be set into the instance properties. The values must match the type defined for the property in the class. If a property is in the property_values dictionary but not in the class a ValueError exception is raised. Not all properties in the class need to be defined in property_values.
  • include_missing_properties

    Determines if properties not in the property_values parameter are included in the instance.

    If True all properties from the class are included in the new instance including those not defined in property_values parameter with with the default value defined in the class if one is defined, or otherwise None”.

    If False only properties in the property_values parameter are included in the new instance.

Returns:

A CIM instance created from klass and property_values parameters with the defined properties and optionally the path component set.

No qualifiers are included in the returned instance and the existence of the class origin attribute depends on the include_class_origin parameter.

All other attributes of each property are the same as the corresponding class property.

Return type:

CIMInstance

Raises:
  • ValueError – Conflicts between the class properties and
  • property_values parameter or the instance does
  • not include all key properties defined in the class.
  • TypeError – Mismatch between types of the property values in
  • property_values parameter and the property type in the
  • corresponding class property

4.2.6. CIMClassName

class pywbem.CIMClassName(classname, host=None, namespace=None)[source]

A CIM class path (aka CIM class name).

A CIM class path references a CIM class in a CIM namespace in a WBEM server. Namespace and WBEM server may be unspecified.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

Parameters:
  • classname (string) –

    Class name of the referenced class.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • host (string) –

    Host and optionally port of the WBEM server containing the CIM namespace of the referenced class.

    The format of the string must be:

    host[:port]

    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.

    None means that the WBEM server is unspecified, and the host attribute will also be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • namespace (string) –

    Name of the CIM namespace containing the referenced class.

    None means that the namespace is unspecified, and the namespace attribute will also be None.

    Leading and trailing slash characters will be stripped. The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

Raises:

ValueError – classname is None.

Methods

copy Return a new CIMClassName object that is a copy of this CIM class path.
from_wbem_uri Return a new CIMClassName object from the specified WBEM URI string.
to_wbem_uri Return the (untyped) WBEM URI string of this CIM class path.
tocimxml Return the CIM-XML representation of this CIM class path, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM class path, as a unicode string.

Attributes

classname Class name of this CIM class path, identifying the referenced class.
host Host and optionally port of this CIM class path, identifying the WBEM server of the referenced class.
namespace Namespace name of this CIM class path, identifying the namespace of the referenced class.

Details

classname

Class name of this CIM class path, identifying the referenced class.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
namespace

Namespace name of this CIM class path, identifying the namespace of the referenced class.

None means that the namespace is unspecified.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
host

Host and optionally port of this CIM class path, identifying the WBEM server of the referenced class.

For details about the string format, see the same-named init parameter of this class.

None means that the host and port are unspecified.

This attribute is settable. For details, see the description of the same-named init parameter.

Type:unicode string
copy()[source]

Return a new CIMClassName object that is a copy of this CIM class path.

Objects of this class have no mutable types in any attributes, so modifications of the original object will not affect the returned copy, and vice versa.

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

__str__()[source]

Return a WBEM URI string of this CIM class path.

The returned WBEM URI string is in the historical format returned by to_wbem_uri().

For new code, it is recommended that the standard format is used; it is returned by to_wbem_uri() as the default format.

If you want to access the class name, use the classname attribute, instead of relying on the coincidence that the historical format of a WBEM URI without host and namespace happens to be the class name.

Examples (for the historical format):

  • With host and namespace:

    //acme.com/cimv2/test:CIM_RegisteredProfile
    
  • Without host but with namespace:

    cimv2/test:CIM_RegisteredProfile
    
  • Without host and without namespace:

    CIM_RegisteredProfile
    
__repr__()[source]

Return a string representation of this CIM class path, that is suitable for debugging.

tocimxml(ignore_host=False, ignore_namespace=False)[source]

Return the CIM-XML representation of this CIM class path, as an object of an appropriate subclass of Element.

If the class path has no namespace specified or if ignore_namespace is True, the returned CIM-XML representation is a CLASSNAME element consistent with DSP0201.

Otherwise, if the class path has no host specified or if ignore_host is True, the returned CIM-XML representation is a LOCALCLASSPATH element consistent with DSP0201.

Otherwise, the returned CIM-XML representation is a CLASSPATH element consistent with DSP0201.

Parameters:
  • ignore_host (bool) – Ignore the host of the class path, even if a host is specified.
  • ignore_namespace (bool) – Ignore the namespace and host of the class path, even if a namespace and/or host is specified.
Returns:

The CIM-XML representation, as an object of an appropriate subclass of Element.

tocimxmlstr(indent=None, ignore_host=False, ignore_namespace=False)[source]

Return the CIM-XML representation of this CIM class path, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:
  • indent (string or integer) –

    None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

    Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

  • ignore_host (bool) – Ignore the host of the class path, even if a host is specified.
  • ignore_namespace (bool) – Ignore the namespace and host of the class path, even if a namespace and/or host is specified.
Returns:

The CIM-XML representation of the object, as a unicode string.

static from_wbem_uri(wbem_uri)[source]

Return a new CIMClassName object from the specified WBEM URI string.

New in pywbem 0.12.

The WBEM URI string must be a CIM class path in untyped WBEM URI format, as defined in DSP0207, with these extensions:

  • DSP0207 restricts the namespace types (URI schemes) to be one of http, https, cimxml-wbem, or cimxml-wbems. Pywbem tolerates any namespace type, but issues a UserWarning if it is not one of the namespace types defined in DSP0207.
  • DSP0207 requires a slash before the namespace name. For local WBEM URIs (no namespace type, no authority), that slash is the first character of the WBEM URI. For historical reasons, pywbem tolerates a missing leading slash for local WBEM URIs. Note that pywbem requires the slash (consistent with DSP0207) when the WBEM URI is not local.
  • DSP0207 requires a colon before the class name. For historical reasons, pywbem tolerates a missing colon before the class name, if it would have been the first character of the string.

CIM class paths in the typed WBEM URI format defined in DSP0207 are not supported.

Examples:

https://jdd:test@acme.com:5989/cimv2/test:CIM_RegisteredProfile
http://acme.com/root/cimv2:CIM_ComputerSystem
http:/root/cimv2:CIM_ComputerSystem
/root/cimv2:CIM_ComputerSystem
root/cimv2:CIM_ComputerSystem
/:CIM_ComputerSystem
:CIM_ComputerSystem
CIM_ComputerSystem
Parameters:wbem_uri (string) – WBEM URI for a class path.
Returns:The class path created from the specified WBEM URI string.
Return type:CIMClassName
Raises:ValueError – Invalid WBEM URI format for a class path. This includes typed WBEM URIs.
to_wbem_uri(format='standard')[source]

Return the (untyped) WBEM URI string of this CIM class path.

The returned WBEM URI contains its components as follows:

  • it does not contain a namespace type (URI scheme).
  • it contains an authority (host) component according to the host attribute, if that is not None. Otherwise, it does not contain the authority component.
  • it contains a namespace component according to the namespace attribute, if that is not None. Otherwise, it does not contain the namespace component.
  • it contains a class name component according to the classname attribute.

Note that when you do not want some of these components to show up in the resulting WBEM URI string, you can set them to None before calling this method.

Except when using the format “canonical”, this method should not be used to compare class paths for equality: DSP0004 defines several components of a class path to be compared case insensitively. All WBEM URI formats returned by this method except for the format “canonical” return a WBEM URI string that preserves the lexical case of any components. Therefore, two class paths that are considered equal according to DSP0004 may not have equal WBEM URI strings as as returned by this method.

Instead, equality of class paths represented by CIMClassName objects should be determined by using the == operator, which performs the comparison conformant to DSP0004. If you have WBEM URI strings without the corresponding CIMClassName object, such an object can be created by using the static method from_wbem_uri().

Parameters:format (string) –

Format for the generated WBEM URI string, using one of the following values:

  • "standard" - Standard format that is conformant to untyped WBEM URIs for class paths defined in DSP0207.
  • "canonical" - Like "standard", except that the following items have been converted to lower case: host, namespace, and classname. This format guarantees that two class paths that are considered equal according to DSP0004 result in equal WBEM URI strings. Therefore, the returned WBEM URI is suitable to be used as a key in dictionaries of CIM classes.
  • "cimobject" - Format for the CIMObject header field in CIM-XML messages for representing class paths (used internally, see DSP0200).
  • "historical" - Historical format for WBEM URIs (used by __str__(); should not be used by new code). The historical format has the following differences to the standard format:
    • If the host component is not present, the slash after the host is also omitted. In the standard format, that slash is always present.
    • If the namespace component is not present, the colon after the namespace is also omitted. In the standard format, that colon is always present.

Examples:

  • With host and namespace, standard format:

    //ACME.com/cimv2/Test:CIM_RegisteredProfile
    
  • With host and namespace, canonical format:

    //acme.com/cimv2/test:cim_registeredprofile
    
  • Without host but with namespace, standard format:

    /cimv2/Test:CIM_RegisteredProfile
    
  • Without host but with namespace, canonical format:

    /cimv2/test:cim_registeredprofile
    
  • Without host and without namespace, standard format:

    /:CIM_RegisteredProfile
    
Returns:Untyped WBEM URI of the CIM class path, in the specified format.
Return type:unicode string
Raises:ValueError – Invalid format

4.2.7. CIMClass

class pywbem.CIMClass(classname, properties=None, methods=None, superclass=None, qualifiers=None, path=None)[source]

A representation of a CIM class in a CIM namespace in a WBEM server, optionally including its class path.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

Parameters:
  • classname (string) –

    Class name of the class.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • properties (properties input object) – The property declarations for the class.
  • methods (methods input object) – The method declarations for the class.
  • superclass (string) –

    Name of the superclass for the class.

    None means that the class is a top-level class, and the superclass attribute will also be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • qualifiers (qualifiers input object) – The qualifiers for the class.
  • path (CIMClassName) –

    Class path for the class.

    New in pywbem 0.11.

    The provided object will be copied before being stored in the CIMClass object.

    None means that the instance path is unspecified, and the path attribute will also be None.

    This parameter has been added in pywbem 0.11 as a convenience for the user in order so that CIMClass objects can be self-contained w.r.t. their class path.

Raises:
  • ValueError – classname is None, a property, method or qualifier name is None, or a property, method or qualifier name does not match its dictionary key.
  • TypeError – a numeric Python type was used for a qualifier value.

Methods

copy Return a new CIMClass object that is a copy of this CIM class.
tocimxml Return the CIM-XML representation of this CIM class, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM class, as a unicode string.
tomof Return a MOF string with the declaration of this CIM class.

Attributes

classname Class name of this CIM class.
methods Methods (declarations) of this CIM class.
path Class path of this CIM class.
properties Properties (declarations) of this CIM class.
qualifiers Qualifiers (qualifier values) of this CIM class.
superclass Class name of the superclass of this CIM class.

Details

classname

Class name of this CIM class.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
superclass

Class name of the superclass of this CIM class.

None means that the class is a top-level class.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
properties

Properties (declarations) of this CIM class.

Will not be None.

Each dictionary item specifies one property declaration, with:

The order of properties in the CIM class is preserved.

This attribute is settable; setting it will cause the current CIM properties to be replaced with the new properties. For details, see the description of the same-named init parameter of this class.

The CIM properties can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value must be a CIMProperty object:

cls = CIMClass(...)
p1 = CIMProperty('p1', ...)  # must be a CIMProperty

cls.properties['p1'] = p1  # Set "p1" to p1 (add if needed)
p1 = cls.properties['p1']  # Access "p1"
del cls.properties['p1']  # Delete "p1" from the class
Type:NocaseDict
methods

Methods (declarations) of this CIM class.

Will not be None.

Each dictionary item specifies one method, with:

The order of methods in the CIM class is preserved.

This attribute is settable; setting it will cause the current CIM methods to be replaced with the new methods. For details, see the description of the same-named init parameter of this class.

The CIM methods can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value must be a CIMMethod object:

cls = CIMClass(...)
m1 = CIMMethod('m1', ...)  # must be a CIMMethod

cls.methods['m1'] = m1  # Set "m1" to m1 (add if needed)
m1 = cls.methods['m1']  # Access "m1"
del cls.methods['m1']  # Delete "m1" from the class
Type:NocaseDict
qualifiers

Qualifiers (qualifier values) of this CIM class.

Will not be None.

Each dictionary item specifies one qualifier value, with:

The order of qualifiers in the CIM class is preserved.

This attribute is settable; setting it will cause the current qualifiers to be replaced with the new qualifiers. For details, see the description of the same-named init parameter of this class.

The qualifier values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value may be specified as a CIM data type or as a CIMQualifier object:

cls = CIMClass(...)
q1 = Uint32(...)  # may be CIM data type or CIMQualifier

cls.qualifiers['q1'] = q1  # Set "q1" to q1 (add if needed)
q1 = cls.qualifiers['q1']  # Access "q1"
del cls.qualifiers['q1']  # Delete "q1" from the class
Type:NocaseDict
path

Class path of this CIM class.

New in pywbem 0.11.

None means that the class path is unspecified.

This attribute has been added in pywbem 0.11 as a convenience for the user in order so that CIMClass objects can be self-contained w.r.t. their class path.

This attribute will be set in in any CIMClass objects returned by WBEMConnection methods, based on information in the response from the WBEM server.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:CIMClassName
__str__()[source]

Return a short string representation of this CIM class, for human consumption.

__repr__()[source]

Return a string representation of this CIM class, that is suitable for debugging.

The order of properties, method and qualifiers will be preserved in the result.

copy()[source]

Return a new CIMClass object that is a copy of this CIM class.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

tocimxml()[source]

Return the CIM-XML representation of this CIM class, as an object of an appropriate subclass of Element.

The returned CIM-XML representation is a CLASS element consistent with DSP0201. This is the required element for representing embedded classes.

If the class has a class path specified, it will be ignored.

The order of properties, methods, parameters, and qualifiers in the returned CIM-XML representation is preserved from the CIMClass object.

Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None)[source]

Return the CIM-XML representation of this CIM class, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:indent (string or integer) –

None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

Returns:The CIM-XML representation of the object, as a unicode string.
tomof(maxline=80)[source]

Return a MOF string with the declaration of this CIM class.

The returned MOF string conforms to the classDeclaration ABNF rule defined in DSP0004.

The order of properties, methods, parameters, and qualifiers is preserved.

The path attribute of this object will not be included in the returned MOF string.

Consistent with that, class path information is not included in the returned MOF string.

Returns:MOF string.
Return type:unicode string

4.2.8. CIMProperty

class pywbem.CIMProperty(name, value, type=None, class_origin=None, array_size=None, propagated=None, is_array=None, reference_class=None, qualifiers=None, embedded_object=None)[source]

A CIM property (value or declaration).

This object can be used in a CIMInstance object for representing a property value, or in a CIMClass object for representing a property declaration.

For property values in CIM instances:

  • The value attribute is the actual value of the property.
  • Qualifiers are not allowed.

For property declarations in CIM classes:

  • The value attribute is the default value of the property declaration.
  • Qualifiers are allowed.

Scalar (=non-array) properties may have a value of NULL (= None), any primitive CIM data type, reference type, and string type with embedded instance or embedded object.

Array properties may be Null or may have elements with a value of NULL, any primitive CIM data type, and string type with embedded instance or embedded object. Reference types are not allowed in property arrays in CIM, as per DSP0004.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

The init method infers optional parameters that are not specified (for example, it infers type from the Python type of value and other information). If the specified parameters are inconsistent, an exception is raised. If an optional parameter is needed for some reason, an exception is raised.

Parameters:
  • name (string) –

    Name of the property.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • value (CIM data type or other suitable types) –

    Value of the property.

    The property value is interpreted as an actual property value when the CIM property is used in a CIM instance, and as default value when the CIM property is used in a CIM class.

    None means that the property is Null, and the same-named attribute in the CIMProperty object will also be None.

    The specified value will be converted to a CIM data type using the rules documented in the description of cimvalue(), taking into account the type parameter.

  • type (string) –

    Name of the CIM data type of the property (e.g. "uint8").

    None will cause the type to be inferred from the value parameter, raising ValueError if it cannot be inferred (for example when value is None or a Python integer).

    ValueError is raised if the type is not a valid CIM data type (see CIM data types).

  • class_origin (string) –

    The CIM class origin of the property (the name of the most derived class that defines or overrides the property in the class hierarchy of the class owning the property).

    None means that class origin information is not available, and class_origin attribute will also be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • array_size (integer) –

    The size of the array property, for fixed-size arrays.

    None means that the array property has variable size, and array_size attribute will also be None.

  • propagated (bool) –

    If not None, specifies whether the property declaration has been propagated from a superclass, or the property value has been propagated from the creation class.

    None means that propagation information is not available, and propagated attribute will also be None.

  • is_array (bool) –

    A boolean indicating whether the property is an array (True) or a scalar (False).

    If None, the is_array attribute will be inferred from the value parameter. If the value parameter is None, a scalar is assumed.

  • reference_class (string) –

    For reference properties, the name of the class referenced by the property, or None indicating that the referenced class is unspecified.

    For non-reference properties, must be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

    Note: Prior to pywbem 0.11, the corresponding attribute was inferred from the creation class name of a referenced instance. This was incorrect and has been fixed in pywbem 0.11.

  • qualifiers (qualifiers input object) – The qualifiers for the property declaration. Has no meaning for property values.
  • embedded_object (string) –

    A string value indicating the kind of embedded object represented by the property value. Has no meaning for property declarations.

    For details about the possible values, see the corresponding attribute.

    None means that the value is unspecified, causing the same-named attribute in the CIMProperty object to be inferred. An exception is raised if it cannot be inferred.

    False means the property value is not an embedded object, and is stored as None.

Examples:

# a string property:
CIMProperty("MyString", "abc")

# a uint8 property:
CIMProperty("MyNum", 42, "uint8")

# a uint8 property:
CIMProperty("MyNum", Uint8(42))

# a uint8 array property:
CIMProperty("MyNumArray", [1, 2, 3], "uint8")

# a reference property:
CIMProperty("MyRef", CIMInstanceName("Foo"))

# an embedded object property containing a class:
CIMProperty("MyEmbObj", CIMClass("Foo"))

# an embedded object property containing an instance:
CIMProperty("MyEmbObj", CIMInstance("Foo"),
            embedded_object="object")

# an embedded instance property:
CIMProperty("MyEmbInst", CIMInstance("Foo"))

# a string property that is Null:
CIMProperty("MyString", None, "string")

# a uint8 property that is Null:
CIMProperty("MyNum", None, "uint8")

# a reference property that is Null:
CIMProperty("MyRef", None, "reference", reference_class="MyClass")

# an embedded object property that is Null:
CIMProperty("MyEmbObj", None, "string", embedded_object="object")

# an embedded instance property that is Null:
CIMProperty("MyEmbInst", None, "string",
            embedded_object="instance")

Methods

copy Return a new CIMProperty object that is a copy of this CIM property.
tocimxml Return the CIM-XML representation of this CIM property, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM property, as a unicode string.
tomof Return a MOF string with the declaration of this CIM property for use in a CIM class, or the specification of this CIM property for use in a CIM instance.

Attributes

array_size The size of the fixed-size array of this CIM property.
class_origin The class origin of this CIM property, identifying the most derived class that defines or overrides the property in the class hierarchy of the class owning the property.
embedded_object A string value indicating the kind of embedded object represented by this CIM property value.
is_array Boolean indicating that this CIM property is an array (as opposed to a scalar).
name Name of this CIM property.
propagated Boolean indicating that the property declaration has been propagated from a superclass, or that the property value has been propagated from the creation class.
qualifiers Qualifiers (qualifier values) of this CIM property declaration.
reference_class The name of the class referenced by this CIM reference property.
type Name of the CIM data type of this CIM property.
value Value of this CIM property.

Details

name

Name of this CIM property.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
value

Value of this CIM property.

The property value is interpreted as an actual property value when this CIM property is used in a CIM instance, and as default value when this CIM property is used in a CIM class.

None means that the value is Null.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:CIM data type
type

Name of the CIM data type of this CIM property.

Example: "uint8"

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
reference_class

The name of the class referenced by this CIM reference property.

Will be None for non-reference properties or if the referenced class is unspecified in reference properties.

Note that in CIM instances returned from a WBEM server, DSP0201 recommends this attribute not to be set. For CIM classes returned from a WBEM server, DSP0201 requires this attribute to be set.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
embedded_object

A string value indicating the kind of embedded object represented by this CIM property value.

Has no meaning for CIM property declarations.

The following values are defined for this parameter:

  • "instance": The property is declared with the EmbeddedInstance qualifier, indicating that the property value is an embedded instance of the class specified as the value of the EmbeddedInstance qualifier. The property value must be a CIMInstance object, or None.
  • "object": The property is declared with the EmbeddedObject qualifier, indicating that the property value is an embedded object (instance or class) of which the class name is not known. The property value must be a CIMInstance or CIMClass object, or None.
  • None, for properties not representing embedded objects.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
is_array

Boolean indicating that this CIM property is an array (as opposed to a scalar).

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
array_size

The size of the fixed-size array of this CIM property.

None means that the array has variable size, or that the property is a scalar.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:integer
class_origin

The class origin of this CIM property, identifying the most derived class that defines or overrides the property in the class hierarchy of the class owning the property.

None means that class origin information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
propagated

Boolean indicating that the property declaration has been propagated from a superclass, or that the property value has been propagated from the creation class.

None means that propagation information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
qualifiers

Qualifiers (qualifier values) of this CIM property declaration.

Will not be None.

Each dictionary item specifies one qualifier value, with:

The order of qualifiers in the property is preserved.

This attribute is settable; setting it will cause the current qualifiers to be replaced with the new qualifiers. For details, see the description of the same-named init parameter of this class.

The qualifier values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value may be specified as a CIM data type or as a CIMQualifier object:

prop = CIMProperty(...)
q1 = CIMQualifier('q1', ...) # may be CIM data type or CIMQualifier

prop.qualifiers['q1'] = q1  # Set "q1" to q1 (add if needed)
q1 = prop.qualifiers['q1']  # Access "q1"
del prop.qualifiers['q1']  # Delete "q1" from the class
Type:NocaseDict
copy()[source]

Return a new CIMProperty object that is a copy of this CIM property.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

__str__()[source]

Return a short string representation of this CIM property, for human consumption.

__repr__()[source]

Return a string representation of this CIM property, that is suitable for debugging.

The order of qualifiers will be preserved in the result.

tocimxml()[source]

Return the CIM-XML representation of this CIM property, as an object of an appropriate subclass of Element.

The returned CIM-XML representation is a PROPERTY, PROPERTY.REFERENCE, or PROPERTY.ARRAY element dependent on the property type, and consistent with DSP0201. Note that array properties cannot be of reference type.

The order of qualifiers in the returned CIM-XML representation is preserved from the CIMProperty object.

Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None)[source]

Return the CIM-XML representation of this CIM property, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:indent (string or integer) –

None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

Returns:The CIM-XML representation of the object, as a unicode string.
tomof(is_instance=True, indent=0, maxline=80, line_pos=0)[source]

Return a MOF string with the declaration of this CIM property for use in a CIM class, or the specification of this CIM property for use in a CIM instance.

New in pywbem 0.9.

Even though pywbem supports qualifiers on CIMProperty objects that are used as property values within an instance, the returned MOF string for property values in instances does not contain any qualifier values.

The order of qualifiers is preserved.

Parameters:
  • is_instance (bool) – If True, return MOF for a property value in a CIM instance. Else, return MOF for a property definition in a CIM class.
  • indent (integer) – Number of spaces to indent each line of the returned string, counted in the line with the property name.
Returns:

MOF string.

Return type:

unicode string

4.2.9. CIMMethod

class pywbem.CIMMethod(name=None, return_type=None, parameters=None, class_origin=None, propagated=None, qualifiers=None, methodname=None)[source]

A method (declaration) in a CIM class.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

The init method stores the input parameters as-is and does not infer unspecified parameters from the others (like CIMProperty does).

Parameters:
  • name (string) –

    Deprecated: Name of this CIM method (just the method name, without class name or parenthesis).

    This argument has been named methodname before pywbem 0.9. Using methodname as a named argument still works, but has been deprecated in pywbem 0.9.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • return_type (string) –

    Name of the CIM data type of the method return type (e.g. "uint32").

    Must not be None or "reference".

    ValueError is raised if the type is None, "reference", or not a valid CIM data type (see CIM data types).

    Support for void return types: Pywbem also does not support void return types, consistent with the CIM architecture and MOF syntax (see DSP0004). Note that void return types could be represented in CIM-XML (see DSP0201).

    Support for reference return types: Pywbem does not support reference return types of methods. The CIM architecture and MOF syntax support reference return types, and the CIM-XML protocol supports the invocation of methods with reference return types. However, CIM-XML does not support the representation of class declarations with methods that have reference return types.

    Support for array return types: Pywbem does not support array return types of methods, consistent with the CIM architecture, MOF syntax and CIM-XML.

  • parameters (parameters input object) – Parameter declarations for the method.
  • class_origin (string) –

    The CIM class origin of the method (the name of the most derived class that defines or overrides the method in the class hierarchy of the class owning the method).

    None means that class origin information is not available, and the class_origin attribute will also be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • propagated (bool) –

    If not None, specifies whether the method has been propagated from a superclass.

    None means that propagation information is not available, and the the propagated attribute will also be None.

  • qualifiers (qualifiers input object) – The qualifiers for the method.

Methods

copy Return a new CIMMethod object that is a copy of this CIM method.
tocimxml Return the CIM-XML representation of this CIM method, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM method, as a unicode string.
tomof Return a MOF string with the declaration of this CIM method for use in a CIM class declaration.

Attributes

class_origin The class origin of this CIM method, identifying the most derived class that defines or overrides the method in the class hierarchy of the class owning the method.
name Name of this CIM method.
parameters Parameters of this CIM method.
propagated Boolean indicating that this CIM method has been propagated from a superclass.
qualifiers Qualifiers (qualifier values) of this CIM method.
return_type Name of the CIM data type of the return type of this CIM method.

Details

name

Name of this CIM method.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
return_type

Name of the CIM data type of the return type of this CIM method.

Example: "uint32"

Will not be None or "reference".

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
class_origin

The class origin of this CIM method, identifying the most derived class that defines or overrides the method in the class hierarchy of the class owning the method.

None means that class origin information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
propagated

Boolean indicating that this CIM method has been propagated from a superclass.

None means that propagation information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
parameters

Parameters of this CIM method.

Will not be None.

Each dictionary item specifies one parameter, with:

The order of parameters in the method is preserved.

This attribute is settable; setting it will cause the current parameters to be replaced with the new parameters. For details, see the description of the same-named init parameter of this class.

The parameters can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value must be a CIMParameter object:

meth = CIMMethod(...)
p1 = CIMParameter('p1', ...)  # must be a CIMParameter

meth.parameters['p1'] = p1  # Set "p1" to p1 (add if needed)
p1 = meth.parameters['p1']  # Access "p1"
del meth.parameters['p1']  # Delete "p1" from the class
Type:NocaseDict
qualifiers

Qualifiers (qualifier values) of this CIM method.

Will not be None.

Each dictionary item specifies one qualifier value, with:

The order of qualifiers in the method is preserved.

This attribute is settable; setting it will cause the current qualifiers to be replaced with the new qualifiers. For details, see the description of the same-named init parameter of this class.

The qualifier values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value may be specified as a CIM data type or as a CIMQualifier object:

meth = CIMMethod(...)
q1 = "..."  # may be CIM data type or CIMQualifier

meth.qualifiers['q1'] = q1  # Set "q1" to q1 (add if needed)
q1 = meth.qualifiers['q1']  # Access "q1"
del meth.qualifiers['q1']  # Delete "q1" from the class
Type:NocaseDict
__str__()[source]

Return a short string representation of this CIM method, for human consumption.

__repr__()[source]

Return a string representation of this CIM method, that is suitable for debugging.

The order of parameters and qualifiers will be preserved in the result.

copy()[source]

Return a new CIMMethod object that is a copy of this CIM method.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

tocimxml()[source]

Return the CIM-XML representation of this CIM method, as an object of an appropriate subclass of Element.

The returned CIM-XML representation is a METHOD element consistent with DSP0201.

The order of parameters and qualifiers in the returned CIM-XML representation is preserved from the CIMMethod object.

Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None)[source]

Return the CIM-XML representation of this CIM method, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:indent (string or integer) –

None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

Returns:The CIM-XML representation of the object, as a unicode string.
tomof(indent=0, maxline=80)[source]

Return a MOF string with the declaration of this CIM method for use in a CIM class declaration.

The order of parameters and qualifiers is preserved.

Parameters:indent (integer) – Number of spaces to indent each line of the returned string, counted in the line with the method name.
Returns:MOF string.
Return type:unicode string

4.2.10. CIMParameter

class pywbem.CIMParameter(name, type, reference_class=None, is_array=None, array_size=None, qualifiers=None, value=None, embedded_object=None)[source]

A CIM parameter (value or declaration).

This object can be used as parameter value in the InvokeMethod() operation, and as a parameter declaration in a CIMMethod object.

For parameter values in method invocations:

  • The value attribute is the actual value of the parameter.
  • Qualifiers are not allowed.

For parameter declarations in method declarations:

  • The value attribute is ignored.
  • Qualifiers are allowed.

Scalar (=non-array) parameters and items in array parameters may have a value of NULL (= None), any primitive CIM data type, reference type, or string type with embedded instance or embedded object.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

The init method stores the input parameters as-is and does not infer unspecified parameters from the others (like CIMProperty does).

Parameters:
  • name (string) –

    Name of this CIM parameter.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • type (string) –

    Name of the CIM data type of this CIM parameter.

    Example: "uint8"

    Must not be None.

    ValueError is raised if the type is None or not a valid CIM data type (see CIM data types).

  • reference_class (string) –

    For reference parameters, the name of the class referenced by the parameter, or None indicating that the referenced class is unspecified.

    For non-reference parameters, must be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • is_array (bool) –

    A boolean indicating whether the parameter is an array (True) or a scalar (False).

    If None, the is_array attribute will be inferred from the value parameter. If the value parameter is None, a scalar is assumed.

  • array_size (integer) –

    The size of the array parameter, for fixed-size arrays.

    None means that the array parameter has variable size, and the array_size attribute will also be None.

  • qualifiers (qualifiers input object) – The qualifiers for the parameter.
  • value

    The value of the CIM method parameter for the method invocation. Has no meaning for parameter declarations.

    The specified value will be converted to a CIM data type using the rules documented in the description of cimvalue(), taking into account the type parameter.

  • embedded_object (string) –

    A string value indicating the kind of embedded object represented by the parameter value (i.e. the value parameter). Has no meaning for parameter declarations.

    For details about the possible values, see the corresponding attribute.

    None means that the value is unspecified, causing the same-named attribute in the CIMParameter object to be inferred from the parameter value (i.e. the value parameter). An exception is raised if it cannot be inferred.

    False means the parameter value is not an embedded object, and is stored as None.

Methods

copy Return a new CIMParameter object that is a copy of this CIM parameter.
tocimxml Return the CIM-XML representation of this CIM parameter, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM parameter, as a unicode string.
tomof Return a MOF string with the declaration of this CIM parameter for use in a CIM method declaration.

Attributes

array_size The size of the fixed-size array of this CIM parameter.
embedded_object A string value indicating the kind of embedded object represented by this CIM parameter value.
is_array Boolean indicating that this CIM parameter is an array (as opposed to a scalar).
name Name of this CIM parameter.
qualifiers Qualifiers (qualifier values) of this CIM parameter.
reference_class The name of the class referenced by this CIM reference parameter.
type Name of the CIM data type of this CIM parameter.
value The value of this CIM parameter for the method invocation.

Details

name

Name of this CIM parameter.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
type

Name of the CIM data type of this CIM parameter.

Example: "uint8"

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
reference_class

The name of the class referenced by this CIM reference parameter.

Will be None for non-reference parameters or if the referenced class is unspecified in reference parameters.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
is_array

Boolean indicating that this CIM parameter is an array (as opposed to a scalar).

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
array_size

The size of the fixed-size array of this CIM parameter.

None means that the array has variable size, or that the parameter is a scalar.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:integer
qualifiers

Qualifiers (qualifier values) of this CIM parameter.

Will not be None.

Each dictionary item specifies one qualifier value, with:

The order of qualifiers in the parameter is preserved.

This attribute is settable; setting it will cause the current qualifiers to be replaced with the new qualifiers. For details, see the description of the same-named init parameter of this class.

The qualifier values can also be accessed and manipulated one by one because the attribute value is a modifiable dictionary. The provided input value may be specified as a CIM data type or as a CIMQualifier object:

parm = CIMParameter(...)
q1 = True  # may be CIM data type or CIMQualifier

parm.qualifiers['q1'] = q1  # Set "q1" to q1 (add if needed)
q1 = parm.qualifiers['q1']  # Access "q1"
del parm.qualifiers['q1']  # Delete "q1" from the class
Type:NocaseDict
value

The value of this CIM parameter for the method invocation.

Has no meaning for parameter declarations.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

embedded_object

A string value indicating the kind of embedded object represented by this CIM parameter value.

Has no meaning for CIM parameter declarations.

The following values are defined for this parameter:

  • "instance": The parameter is declared with the EmbeddedInstance qualifier, indicating that the parameter value is an embedded instance of the class specified as the value of the EmbeddedInstance qualifier. The property value must be a CIMInstance object, or None.
  • "object": The parameter is declared with the EmbeddedObject qualifier, indicating that the parameter value is an embedded object (instance or class) of which the class name is not known. The parameter value must be a CIMInstance or CIMClass object, or None.
  • None, for parameters not representing embedded objects.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
__str__()[source]

Return a short string representation of this CIM parameter, for human consumption.

__repr__()[source]

Return a string representation of this CIM parameter, that is suitable for debugging.

The order of qualifiers will be preserved in the result.

copy()[source]

Return a new CIMParameter object that is a copy of this CIM parameter.

This is a middle-deep copy; any mutable types in attributes except the following are copied, so besides these exceptions, modifications of the original object will not affect the returned copy, and vice versa. The following mutable types are not copied and are therefore shared between original and copy:

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

tocimxml(as_value=False)[source]

Return the CIM-XML representation of this CIM parameter, as an object of an appropriate subclass of Element.

The returned CIM-XML representation can be created either as a parameter declaration for use in a method declaration, or as a parameter value for use in a method invocation.

If a parameter value is to be returned, the returned CIM-XML representation is a PARAMVALUE element with child elements dependent on the parameter type, and consistent with DSP0201.

If a parameter declaration is to be returned, the returned CIM-XML representation is a PARAMETER, PARAMETER.REFERENCE, PARAMETER.ARRAY, or PARAMETER.REFARRAY element dependent on the parameter type, and consistent with DSP0201.

The order of qualifiers in the returned CIM-XML representation of a parameter declaration is preserved from the CIMParameter object.

Parameters:as_value (bool) – If True, return the object as a parameter value. Otherwise, return the object as a parameter declaration.
Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None, as_value=False)[source]

Return the CIM-XML representation of this CIM parameter, as a unicode string.

New in pywbem 0.9.

The returned CIM-XML representation can be created either as a parameter declaration for use in a method declaration, or as a parameter value for use in a method invocation.

For the returned CIM-XML representation, see tocimxml().

Parameters:
  • indent (string or integer) –

    None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

    Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

  • as_value (bool) – If True, return the object as a parameter value. Otherwise, return the object as a parameter declaration.
Returns:

The CIM-XML representation of the object, as a unicode string.

tomof(indent=0, maxline=80)[source]

Return a MOF string with the declaration of this CIM parameter for use in a CIM method declaration.

The object is always interpreted as a parameter declaration; so the value and embedded_object attributes are ignored.

The order of qualifiers is preserved.

Parameters:indent (integer) – Number of spaces to indent each line of the returned string, counted in the line with the parameter name.
Returns:MOF string.
Return type:unicode string

4.2.11. CIMQualifier

class pywbem.CIMQualifier(name, value, type=None, propagated=None, overridable=None, tosubclass=None, toinstance=None, translatable=None)[source]

A CIM qualifier value.

A qualifier represents metadata on a class, method, property, etc., and specifies information such as a documentation string or whether a property is a key.

CIMQualifier objects can be used to represent the qualifier values that are specified on a CIM element (e.g. on a CIM class). In that case, the propagated property is always False, and the effective values of applicable but unspecified qualifiers need to be determined by users, by considering the default value of the corresponding qualifier type, the propagation and override flavors of the qualifier, and the qualifier values that have been specified in the class ancestry of the CIM element in question.

CIMQualifier objects can also be used to represent the effective values of all applicable qualifiers on a CIM element, including those that have not been specified, e.g. in the MOF declaration of the CIM element. In this case, the CIMQualifier objects for qualifier values that are specified in MOF represent the specified values, and their propagated property is False. The CIMQualifier objects for qualifier values that are not specified in MOF represent the effective values, and their propagated property is True.

Whether a set of CIMQualifier objects on a CIM object represents just the specified qualifiers or all applicable qualifiers needs to be known from the context.

CIMQualifier has properties that represent qualifier flavors (tosubclass, toinstance, overridable, and translatable). If any of these flavor properties is not None, the qualifier value represented by the CIMQualifier object implicitly defines a qualifier type. Implicitly defined qualifier types have been deprecated in DSP0004. The implicitly defined qualifier type is conceptual and is not materialized as a CIMQualifierDeclaration object.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

The init method infers optional parameters that are not specified (for example, it infers type from the Python type of value and other information). If the specified parameters are inconsistent, an exception is raised. If an optional parameter is needed for some reason, an exception is raised.

Parameters:
  • name (string) –

    Name of the qualifier.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • value (CIM data type or other suitable types) –

    Value of the qualifier.

    None means that the qualifier is Null, and the same-named attribute in the CIMQualifier object will also be None.

    The specified value will be converted to a CIM data type using the rules documented in the description of cimvalue(), taking into account the type parameter.

  • type (string) –

    Name of the CIM data type of the qualifier (e.g. "uint8").

    None will cause the type to be inferred from the value parameter, raising ValueError if it cannot be inferred (for example when value is None or a Python integer).

    ValueError is raised if the type is not a valid CIM data type (see CIM data types).

  • propagated (bool) –

    If not None, specifies whether the qualifier value has been propagated from a superclass.

    None means that this information is not available, and the propagated attribute will also be None.

  • overridable (bool) –

    If not None, specifies whether the qualifier value is overridable in subclasses.

    None means that this information is not available, and the overridable attribute will also be None.

  • tosubclass (bool) –

    If not None, specifies whether the qualifier value propagates to subclasses.

    None means that this information is not available, and the tosubclass attribute will also be None.

  • toinstance (bool) –

    If not None, specifies whether the qualifier value propagates to instances.

    None means that this information is not available, and the toinstance attribute will also be None.

    Note that DSP0200 has deprecated the presence of qualifier values on CIM instances.

  • translatable (bool) –

    If not None, specifies whether the qualifier is translatable.

    None means that this information is not available, and the translatable attribute will also be None.

Examples:

# a string qualifier:
CIMQualifier("MyString", "abc")

# a uint8 qualifier:
CIMQualifier("MyNum", 42, "uint8")

# a uint8 qualifier:
CIMQualifier("MyNum", Uint8(42))

# a uint8 array qualifier:
CIMQualifier("MyNumArray", [1, 2, 3], "uint8")

# a string qualifier that is Null:
CIMQualifier("MyString", None, "string")

# a uint8 qualifier that is Null:
CIMQualifier("MyNum", None, "uint8")

Methods

copy Return a new CIMQualifier object that is a copy of this CIM qualifier.
tocimxml Return the CIM-XML representation of this CIM qualifier, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM qualifier, as a unicode string.
tomof Return a MOF string with the specification of this CIM qualifier as a qualifier value.

Attributes

name Name of this CIM qualifier.
overridable If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.
propagated Boolean indicating that the qualifier value has been propagated from a superclass.
toinstance If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.
tosubclass If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.
translatable If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.
type Name of the CIM data type of this CIM qualifier.
value Value of this CIM qualifier.

Details

name

Name of this CIM qualifier.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
type

Name of the CIM data type of this CIM qualifier.

Example: "uint8"

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
value

Value of this CIM qualifier.

None means that the value is Null.

For CIM data types string and char16, this attribute will be a unicode string, even when specified as a byte string.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:CIM data type
propagated

Boolean indicating that the qualifier value has been propagated from a superclass.

None means that propagation information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
tosubclass

If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.

If True, specifies the ToSubclass flavor (the qualifier value propagates to subclasses); if False specifies the Restricted flavor (the qualifier values does not propagate to subclasses).

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
toinstance

If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.

If True specifies the ToInstance flavor(the qualifier value propagates to instances. If False, specifies that qualifier values do not propagate to instances. There is no flavor corresponding to toinstance=False.

None means that this information is not available.

Note that DSP0200 has deprecated the presence of qualifier values on CIM instances.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
overridable

If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.

If True, specifies the EnableOverride flavor(the qualifier value is overridable in subclasses); if False specifies the DisableOverride flavor(the qualifier value is not overridable in subclasses).

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
translatable

If not None, causes an implicit qualifier type to be defined for this qualifier that has the specified flavor.

If True, specifies the Translatable flavor (the qualifier is translatable); if False specifies that the qualfier is not translatable. There is no flavor corresponding to translatable=False.

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
__str__()[source]

Return a short string representation of this CIM qualifier, for human consumption.

__repr__()[source]

Return a string representation of this CIM qualifier, that is suitable for debugging.

copy()[source]

Return a new CIMQualifier object that is a copy of this CIM qualifier.

Objects of this class have no mutable types in any attributes, so modifications of the original object will not affect the returned copy, and vice versa.

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

tocimxml()[source]

Return the CIM-XML representation of this CIM qualifier, as an object of an appropriate subclass of Element.

The returned CIM-XML representation is a QUALIFIER element consistent with DSP0201.

Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None)[source]

Return the CIM-XML representation of this CIM qualifier, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:indent (string or integer) –

None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

Returns:The CIM-XML representation of the object, as a unicode string.
tomof(indent=3, maxline=80, line_pos=0)[source]

Return a MOF string with the specification of this CIM qualifier as a qualifier value.

The items of array values are tried to keep on the same line. If the generated line would exceed the maximum MOF line length, the value is split into multiple lines, on array item boundaries, and/or within long strings on word boundaries.

If a string value (of a scalar value, or of an array item) is split into multiple lines, the first line of the value is put onto a line on its own.

Parameters:indent (integer) – For a multi-line result, the number of spaces to indent each line except the first line (on which the qualifier name appears). For a single-line result, ignored.
Returns:MOF string.
Return type:unicode string

4.2.12. CIMQualifierDeclaration

class pywbem.CIMQualifierDeclaration(name, type, value=None, is_array=False, array_size=None, scopes=None, overridable=None, tosubclass=None, toinstance=None, translatable=None)[source]

A CIM qualifier type is the declaration of a qualifier and defines the attributes of qualifier name, qualifier type, value, scopes, and flavors for the qualifier.

The scope of a qualifer determines the kinds of schema elements on which it can be specified.

Value specifies the default value for the qualifier.

Flavors specify certain characteristics of the qualifier such as its value propagation from the ancestry of the qualified element and its translatability.

Flavors attributes must be specifically set on construction of the CIMQualifierDeclaration or they will be set to None. This differs from the DMTF specification DSP0004 where default values are defined as follows:

  • Has the EnableOverride flavor; overridable = True
  • Has the ToSubClass flavor; tosubclass = True
  • Does not have theTranslatable flavor; translatable = False
  • Does not have ToInstance flavor; toinstance = False. Not defined in DSP0004 and deprecated in the DMTF protocol specification DSP0200

Because None is allowed as a value for the flavors attributes in constructing a CIMQualifierDeclaration, the user must insure that any flavor which has the value None is set to its default value if required for subsequent processing.

The pywbem MOF compiler supplies all of the flavor values so that those which were not specified in the MOF are set to the DMTF defined default values.

Two objects of this class compare equal if their public attributes compare equal. Objects of this class are unchanged-hashable, with the hash value being based on its public attributes. Therefore, objects of this class can be used as members in a set (or as dictionary keys) only during periods in which their public attributes remain unchanged.

Parameters:
  • name (string) –

    Name of the qualifier.

    Must not be None.

    The lexical case of the string is preserved. Object comparison and hash value calculation are performed case-insensitively.

  • type (string) –

    Name of the CIM data type of the qualifier (e.g. "uint8").

    Must not be None.

    ValueError is raised if the type is None or not a valid CIM data type (see CIM data types).

  • value (CIM data type or other suitable types) –

    Default value of the qualifier.

    None means a default value of Null, and the value attribute will also be None.

    The specified value will be converted to a CIM data type using the rules documented in the description of cimvalue(), taking into account the type parameter.

  • is_array (bool) –

    A boolean indicating whether the qualifier is an array (True) or a scalar (False).

    If None, the is_array attribute will be inferred from the value parameter. If the value parameter is None, a scalar is assumed.

  • array_size (integer) –

    The size of the array qualifier, for fixed-size arrays.

    None means that the array qualifier has variable size, and the array_size attribute will also be None.

  • scopes (dict or NocaseDict) –

    Scopes of the qualifier.

    A shallow copy of the provided dictionary will be stored in the CIMQualifierDeclaration object.

    Each dictionary item specifies one scope value, with:

    • key (string): Scope name, in upper case.

      Must not be None.

    • value (bool): Scope value, specifying whether the qualifier has that scope (i.e. can be applied to a CIM element of that kind).

    Valid scope names are “CLASS”, “ASSOCIATION”, “REFERENCE”, “PROPERTY”, “METHOD”, “PARAMETER”, “INDICATION”, and “ANY”.

    None is interpreted as an empty set of scopes.

    For details about the dictionary items, see the corresponding attribute.

  • overridable (bool) –

    If not None, defines the flavor that defines whether the qualifier value is overridable in subclasses.

    None means that this information is not available, and the overridable attribute will also be None.

  • tosubclass (bool) –

    If not None, specifies the flavor that defines whether the qualifier value propagates to subclasses.

    None means that this information is not available, and the tosubclass attribute will also be None.

  • toinstance (bool) –

    If not None, specifies the flavor that defines whether the qualifier value propagates to instances.

    None means that this information is not available, and the toinstance attribute will also be None.

    Note that DSP0200 has deprecated the presence of qualifier values on CIM instances and this flavor is not defined in DSP0004

  • translatable (bool) –

    If not None, specifies the flavor that defines whether the qualifier is translatable.

    None means that this information is not available, and the translatable attribute will also be None.

Methods

copy Return a new CIMQualifierDeclaration object that is a copy of this CIM qualifier type.
tocimxml Return the CIM-XML representation of this CIM qualifier type, as an object of an appropriate subclass of Element.
tocimxmlstr Return the CIM-XML representation of this CIM qualifier type, as a unicode string.
tomof Return a MOF string with the declaration of this CIM qualifier type.

Attributes

array_size The size of the fixed-size array of this CIM qualifier type.
is_array Boolean indicating that this CIM qualifier type is an array (as opposed to a scalar).
name Name of this CIM qualifier type.
overridable If True, specifies the EnableOverride flavor (the qualifier value is overridable in subclasses); if False specifies the DisableOverride flavor (the qualifier value is not overridable in subclasses).
scopes Scopes of this CIM qualifier type.
toinstance If True, specifies the ToInstance flavor.
tosubclass If True specifies the ToSubclass flavor (the qualifier value propagates to subclasses); if False specifies the Restricted flavor (the qualifier value does not propagate to subclasses).
translatable If True, specifies the Translatable flavor.
type Name of the CIM data type of this CIM qualifier type.
value Default value of this CIM qualifier type.

Details

name

Name of this CIM qualifier type.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
type

Name of the CIM data type of this CIM qualifier type.

Example: "uint8".

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:unicode string
value

Default value of this CIM qualifier type.

None means that the value is Null.

For CIM data types string and char16, this attribute will be a unicode string, even when specified as a byte string.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:CIM data type
is_array

Boolean indicating that this CIM qualifier type is an array (as opposed to a scalar).

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
array_size

The size of the fixed-size array of this CIM qualifier type.

None means that the array has variable size (or that the qualifier type is not an array).

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:integer
scopes

Scopes of this CIM qualifier type.

Each dictionary item specifies one scope value, with:

  • key (unicode string): Scope name, in upper case.
  • value (bool): Scope value, specifying whether the qualifier has that scope (i.e. can be applied to a CIM element of that kind).

Valid scope names are “CLASS”, “ASSOCIATION”, “INDICATION”, “PROPERTY”, “REFERENCE”, “METHOD”, “PARAMETER”, and “ANY”.

Will not be None.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:NocaseDict
tosubclass

If True specifies the ToSubclass flavor (the qualifier value propagates to subclasses); if False specifies the Restricted flavor (the qualifier value does not propagate to subclasses).

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
toinstance

If True, specifies the ToInstance flavor. This flavor specifies that the qualifier value propagates to instances. If False, specifies that qualifier values do not propagate to instances. There is no flavor corresponding to toinstance=False.

None means that this information is not available.

Note that DSP0200 has deprecated the presence of qualifier values on CIM instances.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
overridable

If True, specifies the EnableOverride flavor (the qualifier value is overridable in subclasses); if False specifies the DisableOverride flavor (the qualifier value is not overridable in subclasses).

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
translatable

If True, specifies the Translatable flavor. This flavor specifies that the qualifier is translatable. If False, specifies that the qualfier is not translatable. There is no flavor corresponding to translatable=False.

None means that this information is not available.

This attribute is settable. For details, see the description of the same-named init parameter of this class.

Type:bool
__str__()[source]

Return a short string representation of this CIM qualifier type, for human consumption.

__repr__()[source]

Return a string representation of this CIM qualifier type, that is suitable for debugging.

The scopes will be ordered by their names in the result.

copy()[source]

Return a new CIMQualifierDeclaration object that is a copy of this CIM qualifier type.

Objects of this class have no mutable types in any attributes, so modifications of the original object will not affect the returned copy, and vice versa.

Note that the Python functions copy.copy() and copy.deepcopy() can be used to create completely shallow or completely deep copies of objects of this class.

tocimxml()[source]

Return the CIM-XML representation of this CIM qualifier type, as an object of an appropriate subclass of Element.

The returned CIM-XML representation is a QUALIFIER.DECLARATION element consistent with DSP0201.

Returns:The CIM-XML representation, as an object of an appropriate subclass of Element.
tocimxmlstr(indent=None)[source]

Return the CIM-XML representation of this CIM qualifier type, as a unicode string.

New in pywbem 0.9.

For the returned CIM-XML representation, see tocimxml().

Parameters:indent (string or integer) –

None indicates that a single-line version of the XML should be returned, without any whitespace between the XML elements.

Other values indicate that a prettified, multi-line version of the XML should be returned. A string value specifies the indentation string to be used for each level of nested XML elements. An integer value specifies an indentation string of so many blanks.

Returns:The CIM-XML representation of the object, as a unicode string.
tomof(maxline=80)[source]

Return a MOF string with the declaration of this CIM qualifier type.

The returned MOF string conforms to the qualifierDeclaration ABNF rule defined in DSP0004.

Qualifier flavors are included in the returned MOF string only when the information is available (i.e. the value of the corresponding attribute is not None).

Because DSP0004 does not support instance qualifiers, and thus does not define a flavor keyword for the toinstance attribute, that flavor is not included in the returned MOF string.

Returns:MOF string.
Return type:unicode string