From 6da1db7a49085843c8574896fb6d6b2229bbca2d Mon Sep 17 00:00:00 2001 From: kschopmeyer Date: Sun, 22 May 2016 21:56:44 -0500 Subject: [PATCH] WIP Update to remove Enum_Context and clean up tests to match new proposal This push removes the Enum_context and returns 3 arguments from an open or pull (instances, end_of_sequence, enum_context The enum_context is a tuple that contains the serer enum_ctxt and the namespace. This also cleans up most of the documentation. Note that there are a couple of issues around MaxObjectCount to be worked out. This is only a WIP --- pywbem/cim_operations.py | 251 +++++++++++++------------------- pywbem/tupleparse.py | 2 +- testsuite/run_cim_operations.py | 79 +++++----- 3 files changed, 142 insertions(+), 190 deletions(-) diff --git a/pywbem/cim_operations.py b/pywbem/cim_operations.py index 6d9e6bc78..6c44cf245 100644 --- a/pywbem/cim_operations.py +++ b/pywbem/cim_operations.py @@ -54,44 +54,44 @@ :meth:`~pywbem.WBEMConnection.InvokeMethod` Invoke a method on a target instance or on a target class ------------------------------------------------------ -------------------------------------------------------------- :meth:`~pywbem.WBEMConnection.ExecQuery` Execute a query in a namespace ------------------------------------------------------- -------------------------------------------------------------- -:meth:`~pywbem.WBEMConnection.EnumerateClassNames` Enumerate the names of subclasses of a class, or of the - top-level classes in a namespace -:meth:`~pywbem.WBEMConnection.EnumerateClasses` Enumerate the subclasses of a class, or the top-level classes - in a namespace -:meth:`~pywbem.WBEMConnection.GetClass` Retrieve a class -:meth:`~pywbem.WBEMConnection.ModifyClass` Modify a class -:meth:`~pywbem.WBEMConnection.CreateClass` Create a class -:meth:`~pywbem.WBEMConnection.DeleteClass` Delete a class ------------------------------------------------------- -------------------------------------------------------------- -:meth:`~pywbem.WBEMConnection.EnumerateQualifiers` Enumerate qualifier declarations -:meth:`~pywbem.WBEMConnection.GetQualifier` Retrieve a qualifier declaration -:meth:`~pywbem.WBEMConnection.SetQualifier` Create or modify a qualifier declaration -:meth:`~pywbem.WBEMConnection.DeleteQualifier` Delete a qualifier declaration ------------------------------------------------------- --------------------------------------------------------- -:meth:`~pywbem.WBEMConnection.OpenEnumerateInstances` Open an enumeration sequence to retrieve instances of +:meth:`~pywbem.WBEMConnection.OpenEnumerateInstances` Open an enumeration session to retrieve instances of of a class (including instances of its subclass) -:meth:`~pywbem.WBEMConnection.OpenAssocatorInstances` Open an enumeration sequence to retrieve the instances +:meth:`~pywbem.WBEMConnection.OpenAssocatorInstances` Open an enumeration session to retrieve the instances associated to a source instance -:meth:`~pywbem.WBEMConnection.OpenReferenceInstances` Open an enumeration sequence to retrieve the instances +:meth:`~pywbem.WBEMConnection.OpenReferenceInstances` Open an enumeration session to retrieve the instances that reference a source instance -:meth:`~pywbem.WBEMConnection.PullInstancesWithPath` Continue enumeration of an enumeration sequence opened +:meth:`~pywbem.WBEMConnection.PullInstancesWithPath` Continue enumeration of an enumeration session opened with OpenEnumerateInstances, OpenAssociators, or OpenReferences -:meth:`~pywbem.WBEMConnection.OpenEnumerateInstancePaths` Open an enumeration sequence to retrieve instances of +:meth:`~pywbem.WBEMConnection.OpenEnumerateInstancePaths` Open an enumeration session to retrieve instances of of a class (including instances of its subclass) -:meth:`~pywbem.WBEMConnection.OpenAssocatorInstancePaths` Open an enumeration sequence to retrieve the instances +:meth:`~pywbem.WBEMConnection.OpenAssocatorInstancePaths` Open an enumeration session to retrieve the instances associated to a source instance -:meth:`~pywbem.WBEMConnection.OpenReferenceInstancesPaths` Open an enumeration sequence to retrieve the instances +:meth:`~pywbem.WBEMConnection.OpenReferenceInstancesPaths` Open an enumeration session to retrieve the instances that reference a source instance -:meth:`~pywbem.WBEMConnection.PullInstance Paths` Continue enumeration of an enumeration sequence opened +:meth:`~pywbem.WBEMConnection.PullInstance Paths` Continue enumeration of an enumeration session opened with OpenEnumerateInstancePaths, OpenAssociatorInstancePaths, or OpenReferenceInstancePaths :meth:`~pywbem.WBEMConnection.OpenExecQuery` Open query request to retrieve instances defined by the query parameter in a namespace -:meth:`~pywbem.WBEMConnection.PullInstances` Continue enumeration of an enumeration sequence opened +:meth:`~pywbem.WBEMConnection.PullInstances` Continue enumeration of an enumeration session opened with OpenExecQuery -:meth:`~pywbem.WBEMConnection.CloseEnumeration` Close an enumeration sequence in process. +:meth:`~pywbem.WBEMConnection.CloseEnumeration` Close an enumeration session in process. +------------------------------------------------------ -------------------------------------------------------------- +:meth:`~pywbem.WBEMConnection.EnumerateClassNames` Enumerate the names of subclasses of a class, or of the + top-level classes in a namespace +:meth:`~pywbem.WBEMConnection.EnumerateClasses` Enumerate the subclasses of a class, or the top-level classes + in a namespace +:meth:`~pywbem.WBEMConnection.GetClass` Retrieve a class +:meth:`~pywbem.WBEMConnection.ModifyClass` Modify a class +:meth:`~pywbem.WBEMConnection.CreateClass` Create a class +:meth:`~pywbem.WBEMConnection.DeleteClass` Delete a class +------------------------------------------------------ -------------------------------------------------------------- +:meth:`~pywbem.WBEMConnection.EnumerateQualifiers` Enumerate qualifier declarations +:meth:`~pywbem.WBEMConnection.GetQualifier` Retrieve a qualifier declaration +:meth:`~pywbem.WBEMConnection.SetQualifier` Create or modify a qualifier declaration +:meth:`~pywbem.WBEMConnection.DeleteQualifier` Delete a qualifier declaration ====================================================== ============================================================== """ # pylint: enable=line-too-long @@ -124,7 +124,7 @@ from .cim_constants import * # pylint: disable=wildcard-import __all__ = ['WBEMConnection', 'PegasusUDSConnection', 'SFCBUDSConnection', - 'OpenWBEMUDSConnection', 'EnumContext'] + 'OpenWBEMUDSConnection'] if len(u'\U00010122') == 2: @@ -139,42 +139,6 @@ _ILL_FORMED_UTF8_RE = re.compile( b'(\xED[\xA0-\xBF][\x80-\xBF])') # U+D800...U+DFFF -class EnumContext(object): - """ - Container for the current state of an enumeration sequence. - Allows passing parameters between operations of an enumeration - sequence including namespace, max_object_count, and the - state of the previous response (EnumerationContext, etc.) - - """ - - def __init__(self, end_of_sequence, enumeration_context, namespace, \ - max_object_count): - """TODO""" - self.end_of_sequence = end_of_sequence - self.enumeration_context = enumeration_context - self.namespace = namespace - self.max_object_count = max_object_count - - # use the @property on these. - def is_end_of_sequence(self): - """Returns value True if at end of sequence""" - return self.end_of_sequence - - def more(self): - """Returns value True if the sequence is incomplete""" - return not self.end_of_sequence - - def set_max_object_count(self, max_object_count): - """TODO""" - self.max_object_count = max_object_count - # TODO document the above - - def __repr__(self): - return "end_of_sequence=%s, enumeration_context=%s, " \ - "namespace=%s, max_object_count=%s" % \ - (self.end_of_sequence, self.enumeration_context, \ - self.namespace, self.max_object_count) def _check_classname(val): """ @@ -664,7 +628,8 @@ def __repr__(self): self.default_namespace, self.x509, self.verify_callback, self.ca_certs, self.no_verification, self.timeout) - def imethodcall(self, methodname, namespace, pull_op=None, **params): + def imethodcall(self, methodname, namespace, response_params_reqd=None, \ + **params): """ This is a low-level method that is used by the operation-specific methods of this class @@ -680,10 +645,12 @@ def imethodcall(self, methodname, namespace, pull_op=None, **params): warnings.warn( "Calling imethodcall() directly is deprecated", DeprecationWarning) - return self._imethodcall(methodname, namespace, pull_op=pull_op, \ + return self._imethodcall(methodname, namespace, + response_params_reqd=response_params_reqd, **params) - def _imethodcall(self, methodname, namespace, pull_op=None, **params): + def _imethodcall(self, methodname, namespace, response_params_reqd=None, \ + **params): """ Perform an intrinsic CIM-XML operation. """ @@ -827,7 +794,7 @@ def _imethodcall(self, methodname, namespace, pull_op=None, **params): if 'DESCRIPTION' in err[1]: raise CIMError(code, err[1]['DESCRIPTION']) raise CIMError(code, 'Error code %s' % err[1]['CODE']) - if pull_op is None: + if response_params_reqd is None: #expect either ERROR | IRETURNVALUE* err = tup_tree[0] if err[0] != 'IRETURNVALUE': @@ -1341,7 +1308,7 @@ class are to be included in the returned instances, as follows: return instances - def _process_pull_result(self, result): + def _proc_pull_rslt(self, result): """Common processing for pull results to separate end-of-sequence, enum-context, and instances Returns tuple of instances, end_of_sequence, enumeration_context) @@ -1380,7 +1347,7 @@ def OpenEnumerateInstances(self, ClassName, namespace=None, LocalOnly=None, **extra): # pylint: disable=invalid-name """ - Open and enumeration sequence to get instances of a class + Open an enumeration session to get instances of a class (including instances of its subclasses). This method performs the OpenEnumerateInstances operation @@ -1469,18 +1436,26 @@ class are to be included in the returned instances, as follows: used for the Query argument. This argument must exist if the filterQuery argument is provided. - QueryLanguage (:term:`string`): + FilterQuery (:term:`string`): Optional: a String defining the query that is to be sent to the WBEM server. #TODO define typing for this correctly OperationTimeout (term: `Uint32`): + Determines the minimum time in seconds the WBEM Server shall + maintain an open enumeration session after a previous Open or Pull + request is sent to the client. Once this timeout time has + passed, the WBEM server may close the enumeration session. + Optional: If provided it defines a timeout value to be - sent to the WBEM Server - * If `Uint32` value, this value is sent to the server as the - proposed timeout for the operation sequence. If the client - waits longer than this timeout in seconds, the server may - terminate the operation - * if `None` + sent to the WBEM Server. If not provided, this parameter is + not provided to the WBEM server and the server uses its own + default: + * If non-zero `Uint32` value, this value is sent to the server + as the proposed timeout for the enumeration session. + * if value is zero, the server is expected to never timeout + or to reject the open request if this value is not allowed. + * If `None` this parameter is not passed to the WBEM server + and the WBEM server uses its own default. ContinueOnError (:class:`py:bool`): Indicates to the server to continue sending responses @@ -1489,11 +1464,15 @@ class are to be included in the returned instances, as follows: sending an error response. * If `False` the server must not continue sending responses after and error response is sent and must close the enumeration - sequence after sending any error response. - * if `None` this parameter is not sent to the WBEM server and the - WBEM server is to close the enumeration sequence upon error. + session after sending any error response. + * if `None` this parameter is not sent to the WBEM Server and + the WBEM server uses its own default. + NOTE: Not all servers allow this parameter. MaxObjectCount (term: `Uint32`) + Optional Parameter (default None). In this case, nothing is + sent to the WBEM server. The DMTF Specification states that + in this case, the server returns zero instances. Defines a value that sets the maximum number of instances the WBEM server can return for this request. any Uint32 number including zero is valid. @@ -1501,18 +1480,21 @@ class are to be included in the returned instances, as follows: number of instances defined by this value. * If zero the WBEM server must return zero instances. This may be used by a client to restart the timeout. - * If `None` a value of zero is sent to the WBEM server. :Returns: A tuple containing: * A list of :class:`~pywbem.CIMInstance` objects that are representations of the enumerated instances. - * instance of enumeration_context which contains - information about the state returned by the successfully - completed operation. This object may be queried with - the more() method to determine if this response - terminates the enumeration sequence. + end_of-sequence (:class:`py:bool`). If `True` this enumeration + session is complete. The WBEM server has sent all of the + instances possible and has closed the enumeration session. + * enumeration_context (tuple of (:term:`string`) and `namespace`. + Generally this should be considered opaque, It is only provided + if the end-of-sequence == True. + This should be considered as an opaque value and provided + as the required parameter enumeration_context to the subsequent + PullInstancesWith Path or CloseEnumeration request. :Exceptions: @@ -1535,21 +1517,15 @@ class are to be included in the returned instances, as follows: FilterQuery=FilterQuery, ContinueOnError=ContinueOnError, MaxObjectCount=MaxObjectCount, - pull_op=True, + response_params_reqd=True, **extra) # TODO ks 5/16 why are we setting the namespace attribute?? #[setattr(i.path, 'namespace', namespace) for i in instances] - # returns a tuple containing instances and enumeration state - - rslt_tuple = self._process_pull_result(result) - enum_ctxt = EnumContext(rslt_tuple[1], rslt_tuple[2], namespace, - MaxObjectCount) - - rtn_tuple = (rslt_tuple[0], enum_ctxt) + insts, end_of_sequence, enum_ctxt = self._proc_pull_rslt(result) - return rtn_tuple + return (insts, end_of_sequence, (enum_ctxt, namespace)) def OpenEnumerateInstancePaths(self, ClassName, namespace=None, FilterQueryLanguage=None, FilterQuery=None, @@ -1558,7 +1534,8 @@ def OpenEnumerateInstancePaths(self, ClassName, namespace=None, # pylint: disable=invalid-name """ - TODO Fix this + TODO Add this documentation once we agree to the doc in the + openEnumerateInstancesWithPath """ if namespace is None and isinstance(ClassName, CIMClassName): namespace = ClassName.namespace @@ -1573,24 +1550,15 @@ def OpenEnumerateInstancePaths(self, ClassName, namespace=None, FilterQuery=FilterQuery, ContinueOnError=ContinueOnError, MaxObjectCount=MaxObjectCount, - pull_op=True, + response_params_reqd=True, **extra) # TODO ks 5/16 why are we setting the namespace attribute?? #[setattr(i.path, 'namespace', namespace) for i in instances] - # returns a tuple containing instances and enumeration state - - rslt_tuple = self._process_pull_result(result) - - enum_ctxt = EnumContext(rslt_tuple[1], rslt_tuple[2], namespace, - MaxObjectCount) - - rtn_tuple = (rslt_tuple[0], enum_ctxt) - - return rtn_tuple - + insts, end_of_sequence, enum_ctxt = self._proc_pull_rslt(result) + return (insts, end_of_sequence, (enum_ctxt, namespace)) def PullInstancesWithPath(self, enum_context, MaxObjectCount=None, **extra): @@ -1609,25 +1577,19 @@ def PullInstancesWithPath(self, enum_context, MaxObjectCount=None, :Parameters: enum_context (TODO) - The sequence state variable returned from the previous - operation (open or pull) for the enumeration sequence. + The enumeraton session state variable returned from the previous + operation (open or pull) for this enumeration session. MaxObjectCount (term: `Uint32`) + Optional Parameter (default None). In this case, nothing is + sent to the WBEM server. Defines a value that sets the maximum number of instances the - WBEM server can return for this request. any Uint32 number - including zero is valid. This is used only to change the value - from a previous request of the sequence. If the MaxObjectCount - is to be the same as the previous request it is already defined - bu the enum_sequence_state variable. + WBEM server can return for this request. any Uint32 number including + zero is valid. * If non-zero `Uint32` the WBEM server must return no more than the number of instances defined by this value. * If zero the WBEM server must return zero instances. This may be used by a client to restart the timeout. - * If `None` the method uses the max_object_count contained in - the enum_sequence_state object. - - If MaxObjectCount is not `None` the current value is set into - the enum_sequence_state returned from the operation. :Returns: @@ -1646,68 +1608,55 @@ def PullInstancesWithPath(self, enum_context, MaxObjectCount=None, See the list of exceptions described in `WBEMConnection`. """ - if MaxObjectCount is not None: - enum_context = MaxObjectCount result = self._imethodcall( 'PullInstancesWithPath', - namespace=enum_context.namespace, - EnumerationContext=enum_context.enumeration_context, - MaxObjectCount=enum_context.max_object_count, - pull_op=True, + namespace=enum_context[1], + EnumerationContext=enum_context[0], + MaxObjectCount=MaxObjectCount, + response_params_reqd=True, **extra) - rslt_tuple = self._process_pull_result(result) - - # returns a tuple containing instances and enum sequence state - enum_context.end_of_sequence = rslt_tuple[1] - enum_context.enumeration_context = rslt_tuple[2] - - rtn_tuple = (rslt_tuple[0], enum_context) + insts, end_of_sequence, enum_ctxt = self._proc_pull_rslt(result) - return rtn_tuple + return (insts, end_of_sequence, (enum_ctxt, enum_context[1])) - def PullInstancePaths(self, enum_context, MaxObjectCount=None, + def PullInstancePaths(self, enumeration_context, MaxObjectCount=None, \ **extra): # pylint: disable=invalid-name """ TODO """ - if MaxObjectCount is not None: - enum_context = MaxObjectCount result = self._imethodcall( 'PullInstancePaths', - namespace=enum_context.namespace, - enumeration_context=enum_context.enumeration_context, - max_object_count=enum_context.max_object_count, - pull_op=True, + namespace=enumeration_context[1], + enumeration_context=enumeration_context[0], + MaximumObjectCount=MaxObjectCount, + response_params_reqd=True, **extra) - rslt_tuple = self._process_pull_result(result) + insts, end_of_sequence, enum_ctxt = self._proc_pull_rslt(result) - # returns a tuple containing instances and enum sequence state - enum_context.end_of_sequence = rslt_tuple[1] - enum_context.enumeration_context = rslt_tuple[2] + return (insts, end_of_sequence, (enum_ctxt, enumeration_context[1])) - rtn_tuple = (rslt_tuple[0], enum_context) - - return rtn_tuple - - def CloseEnumeration(self, enum_sequence_state, **extra): + def CloseEnumeration(self, enumeration_context, **extra): # pylint: disable=invalid-name """ The CloseEnumeration closes an open enumeration sequence performing and early termination of the enumeration sequence. + It passes the namespace defined in the enumeration_context to + the WBEM Server + This method performs the CloseEnumeration operation (see :term:`DSP0200`). This method should not used if the enumeration sequence terminates normally. - If the operation succeeds, this method returns. Otherwise, this method + If the operation succeeds, this method returns. Otherwise, it raises an exception. :Parameters: @@ -1725,8 +1674,8 @@ def CloseEnumeration(self, enum_sequence_state, **extra): self._imethodcall( 'CloseEnumeration', - enum_sequence_state.namespace, - EnumerationContext=enum_sequence_state.enumeration_context, + namespace=enumeration_context[1], + EnumerationContext=enumeration_context[0], **extra) def GetInstance(self, InstanceName, LocalOnly=None, IncludeQualifiers=None, @@ -2129,6 +2078,8 @@ class (or subclasses). namespace = self._iparam_namespace_from(ObjectName) objectname = self._iparam_objectname(ObjectName) + + print('namespace=%s, objectname=%s, ObjectName=%s' % (namespace, objectname, ObjectName)) result = self._imethodcall( 'AssociatorNames', diff --git a/pywbem/tupleparse.py b/pywbem/tupleparse.py index fd5926c52..2c930ca93 100644 --- a/pywbem/tupleparse.py +++ b/pywbem/tupleparse.py @@ -1640,7 +1640,7 @@ def parse_ireturnvalue(tup_tree): OBJECTPATH* | QUALIFIER.DECLARATION* | VALUE.ARRAY? | VALUE.REFERENCE? | CLASS* | INSTANCE* | VALUE.NAMEDINSTANCE* | - VALUE.INSTANCEWITHPATH)> + VALUE.INSTANCEWITHPATH*)> """ check_node(tup_tree, 'IRETURNVALUE', [], []) diff --git a/testsuite/run_cim_operations.py b/testsuite/run_cim_operations.py index aa8ab70a4..2b03ea4ae 100755 --- a/testsuite/run_cim_operations.py +++ b/testsuite/run_cim_operations.py @@ -21,7 +21,7 @@ from pywbem.cim_constants import * from pywbem import CIMInstance, CIMInstanceName, CIMClass, CIMClassName, \ CIMProperty, CIMQualifier, CIMQualifierDeclaration, \ - CIMMethod, WBEMConnection, EnumContext, CIMError, \ + CIMMethod, WBEMConnection, CIMError, \ Uint8, Uint16, Uint32, Uint64, \ Sint8, Sint16, Sint32, Sint64, \ Real32, Real64, CIMDateTime @@ -205,24 +205,24 @@ def test_enum_complete(self): initial response """ - instances, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, + insts, eos, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, TEST_CLASS, MaxObjectCount=100) - print('returned len=%s' % len(instances)) - print('enum_contest %s' % repr(enum_context)) - self.assertTrue(enum_context.more() is False) + print('returned len=%s' % len(insts)) + print('enum_contest %s, eos=%s' % (repr(enum_context), eos)) + self.assertTrue(eos is True) - self.assertTrue(len(instances) >= 1) + self.assertTrue(len(insts) >= 1) - for i in instances: - self.assertTrue(isinstance(i, CIMInstance)) - self.assertTrue(isinstance(i.path, CIMInstanceName)) - self.assertTrue(len(i.path.namespace) > 0) + for inst in insts: + self.assertTrue(isinstance(inst, CIMInstance)) + self.assertTrue(isinstance(inst.path, CIMInstanceName)) + self.assertTrue(len(inst.path.namespace) > 0) - instances2 = self.cimcall(self.conn.EnumerateInstances, + insts2 = self.cimcall(self.conn.EnumerateInstances, TEST_CLASS) - self.assertTrue(len(instances) == len(instances2)) + self.assertTrue(len(insts) == len(insts2)) ## Call with explicit CIM namespace that exists @@ -234,7 +234,6 @@ def test_bad_namespace(self): """Call with explicit CIM namespace that does not exist""" try: - self.cimcall(self.conn.OpenEnumerateInstances, TEST_CLASS, namespace='root/blah') @@ -246,46 +245,47 @@ def test_bad_namespace(self): def test_zero_open(self): """ TODO """ - instances, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, + insts, eos, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, TEST_CLASS) - print('returned len=%s' % len(instances)) - print('enum_context %s' % repr(enum_context)) - self.assertTrue(enum_context.more() is True) - enum_context.set_max_object_count(100) - print('enum_context %s' % repr(enum_context)) - instances, enum_context = self.cimcall(self.conn.PullInstancesWithPath, - enum_context) - self.assertTrue(enum_context.more() is False) + print('returned len=%s' % len(insts)) + print('enum_context %s, eos=%s' % (repr(enum_context),eos)) + self.assertTrue(eos is False) + instances, eos, enum_context = self.cimcall(self.conn.PullInstancesWithPath, + enum_context, MaxObjectCount=100) + self.assertTrue(eos is True) print('returned len=%s' % len(instances)) - print('enum_contest %s' % repr(enum_context)) + print('enum_context %s, eos=%s' % (repr(enum_context),eos)) def test_close_early(self): """"TODO""" - instances, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, + insts, eos, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, TEST_CLASS) - self.assertTrue(enum_context.more() is True) - self.assertTrue(len(instances) == 0) + self.assertTrue(eos is False) + self.assertTrue(len(insts) == 0) + self.cimcall(self.conn.CloseEnumeration, enum_context) def test_get_onebyone(self): """Get instances with MaxObjectCount = 1)""" - instances, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, + insts, eos, enum_context = self.cimcall(self.conn.OpenEnumerateInstances, 'CIM_ManagedElement', MaxObjectCount=1) - self.assertTrue(len(instances) == 1) + self.assertTrue(len(insts) == 1) - while enum_context.more(): - more_instances, enum_context = self.cimcall( - self.conn.PullInstancesWithPath, enum_context) - self.assertTrue(len(more_instances) == 1) - instances.append(more_instances) + while not eos: + more_insts, eos, enum_context = self.cimcall( + self.conn.PullInstancesWithPath, enum_context, + MaxObjectCount=1) + self.assertTrue(len(more_insts) == 1) + insts.append(more_insts) - instances2 = self.cimcall(self.conn.EnumerateInstances, - 'CIM_ManagedElement') - self.assertTrue(len(instances) == len(instances2)) + # get with EnumInstances and returns + insts2 = self.cimcall(self.conn.EnumerateInstances, + 'CIM_ManagedElement') + self.assertTrue(len(insts) == len(insts2)) class ExecQuery(ClientTest): @@ -666,10 +666,11 @@ def test_all(self): # Call on named instance - inst_names = self.cimcall(self.conn.EnumerateInstanceNames, TEST_CLASS) + inst_names = self.cimcall(self.conn.EnumerateInstanceNames, + TEST_CLASS) self.assertTrue(len(inst_names) >= 1) inst_name = inst_names[0] # Pick the first returned instance - + print('inst_name=%s' % inst_name) names = self.cimcall(self.conn.AssociatorNames, inst_name) for n in names: @@ -682,7 +683,7 @@ def test_all(self): self.assertTrue(n.host is not None) # Call on class name. Returns CIMClassName - + print('TEST_CLASS=%s' % TEST_CLASS) names = self.cimcall(self.conn.AssociatorNames, TEST_CLASS) for n in names: