Merge "Clean up network class resources via addClassResourceCleanup"
diff --git a/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py b/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
index 8e2bc49..ecf2ec2 100644
--- a/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
@@ -39,11 +39,9 @@
         cls.namespace = cls.namespaces_client.create_namespace(
             namespace=data_utils.rand_name(
                 cls.__name__ + '-namespace'))['namespace']
-
-    @classmethod
-    def resource_cleanup(cls):
-        cls.namespaces_client.delete_namespace(cls.namespace)
-        super(NamespaceTagsRbacTest, cls).resource_cleanup()
+        cls.addClassResourceCleanup(
+            cls.namespaces_client.delete_namespace,
+            cls.namespace)
 
     def _create_namespace_tag(self, multiple=False):
         tag_count = 2 if multiple else 1
diff --git a/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py b/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
index 456e10b..701e345 100644
--- a/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
@@ -31,13 +31,9 @@
         cls.namespaces_client.create_namespace(
             namespace=cls.namespace_name,
             protected=False)
-
-    @classmethod
-    def resource_cleanup(cls):
-        test_utils.call_and_ignore_notfound_exc(
-            cls.namespaces_client.delete_namespace,
-            cls.namespace_name)
-        super(ImageResourceTypesRbacTest, cls).resource_cleanup()
+        cls.addClassResourceCleanup(
+            test_utils.call_and_ignore_notfound_exc,
+            cls.namespaces_client.delete_namespace, cls.namespace_name)
 
     @rbac_rule_validation.action(service="glance",
                                  rule="list_metadef_resource_types")
diff --git a/patrole_tempest_plugin/tests/api/volume/rbac_base.py b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
index 6db364e..f4531df 100644
--- a/patrole_tempest_plugin/tests/api/volume/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
@@ -41,24 +41,17 @@
         cls.group_types_client = cls.os_primary.group_types_v3_client
 
     @classmethod
-    def resource_setup(cls):
-        super(BaseVolumeRbacTest, cls).resource_setup()
-        cls.volume_types = []
-
-    @classmethod
-    def resource_cleanup(cls):
-        super(BaseVolumeRbacTest, cls).resource_cleanup()
-        # Allow volumes to be cleared first, so only clear volume types
-        # after super's resource_cleanup.
-        cls.clear_volume_types()
-
-    @classmethod
     def create_volume_type(cls, name=None, **kwargs):
         """Create a test volume-type"""
         name = name or data_utils.rand_name(cls.__name__ + '-volume-type')
         volume_type = cls.volume_types_client.create_volume_type(
             name=name, **kwargs)['volume_type']
-        cls.volume_types.append(volume_type)
+        cls.addClassResourceCleanup(
+            cls.volume_types_client.wait_for_resource_deletion,
+            volume_type['id'])
+        cls.addClassResourceCleanup(
+            test_utils.call_and_ignore_notfound_exc,
+            cls.volume_types_client.delete_volume_type, volume_type['id'])
         return volume_type
 
     def create_group_type(self, name=None, ignore_notfound=False, **kwargs):
@@ -77,14 +70,3 @@
                             group_type['id'])
 
         return group_type
-
-    @classmethod
-    def clear_volume_types(cls):
-        for vol_type in cls.volume_types:
-            test_utils.call_and_ignore_notfound_exc(
-                cls.volume_types_client.delete_volume_type, vol_type['id'])
-
-        for vol_type in cls.volume_types:
-            test_utils.call_and_ignore_notfound_exc(
-                cls.volume_types_client.wait_for_resource_deletion,
-                vol_type['id'])