Tempest: change way how QoS policies are cleaned
QoS policy can't be removed from Neutron if it is used by
port or network. Because of this restriction there was method
to disassociate QoS policy from network/port and it had to be
called in each test where policy was attached to network/port.
This patch changes order of cleaning resources that QoS rules and
policies are always cleaned after all networks and ports are removed.
Thanks that there is no need to disassociate QoS policy from
network or port manually in each test.
Change-Id: Id9f6952fb68e1ad35fcd9ce99b9602247e3a229a
diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py
index afcbe9c..3fc61cb 100644
--- a/neutron/tests/tempest/api/base.py
+++ b/neutron/tests/tempest/api/base.py
@@ -118,14 +118,6 @@
@classmethod
def resource_cleanup(cls):
if CONF.service_available.neutron:
- # Clean up QoS rules
- for qos_rule in cls.qos_rules:
- cls._try_delete_resource(cls.admin_client.delete_qos_rule,
- qos_rule['id'])
- # Clean up QoS policies
- for qos_policy in cls.qos_policies:
- cls._try_delete_resource(cls.admin_client.delete_qos_policy,
- qos_policy['id'])
# Clean up floating IPs
for floating_ip in cls.floating_ips:
cls._try_delete_resource(cls.client.delete_floatingip,
@@ -194,6 +186,17 @@
cls.admin_client.delete_address_scope,
address_scope['id'])
+ # Clean up QoS rules
+ for qos_rule in cls.qos_rules:
+ cls._try_delete_resource(cls.admin_client.delete_qos_rule,
+ qos_rule['id'])
+ # Clean up QoS policies
+ # as all networks and ports are already removed, QoS policies
+ # shouldn't be "in use"
+ for qos_policy in cls.qos_policies:
+ cls._try_delete_resource(cls.admin_client.delete_qos_policy,
+ qos_policy['id'])
+
super(BaseNetworkTest, cls).resource_cleanup()
@classmethod