X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_object.py;h=088cc39ce0a90742e0022c433881a01ac764b74b;hb=a44d6b133bfb7ee0fb11d6ae8d9f0f00e57f242c;hp=0d74baa53aba86350d95ac4581ba3876ba1e72b2;hpb=acb9b8e8c3394d06964ad0f8387b764c01f43152;p=vpp.git diff --git a/test/vpp_object.py b/test/vpp_object.py index 0d74baa53ab..088cc39ce0a 100644 --- a/test/vpp_object.py +++ b/test/vpp_object.py @@ -46,9 +46,16 @@ class VppObjectRegistry(object): if obj.object_id() not in self._object_dict: self._object_registry.append(obj) self._object_dict[obj.object_id()] = obj + logger.debug("REG: registering %s" % obj) else: logger.debug("REG: duplicate add, ignoring (%s)" % obj) + def unregister_all(self, logger): + """ Remove all object registrations from registry. """ + logger.debug("REG: removing all object registrations") + self._object_registry = [] + self._object_dict = dict() + def remove_vpp_config(self, logger): """ Remove configuration (if present) from vpp and then remove all objects @@ -59,20 +66,18 @@ class VppObjectRegistry(object): return logger.info("REG: Removing VPP configuration for registered objects") # remove the config in reverse order as there might be dependencies + failed = [] for obj in reversed(self._object_registry): if obj.query_vpp_config(): logger.info("REG: Removing configuration for %s" % obj) obj.remove_vpp_config() + if obj.query_vpp_config(): + failed.append(obj) else: logger.info( "REG: Skipping removal for %s, configuration not present" % obj) - failed = [] - for obj in self._object_registry: - if obj.query_vpp_config(): - failed.append(obj) - self._object_registry = [] - self._object_dict = dict() + self.unregister_all(logger) if failed: logger.error("REG: Couldn't remove configuration for object(s):") for obj in failed: