Prepare MinBwAllocationPlacementTest for new neutron API ext
The port-resource-request-groups neutron API extension proposed in
I99a49b107b1872ddf83d1d8497a26a8d728feb07 changes the format of the
port.binding:profile.allocation value. The existing tests are depending
on the format so they are adapted now to accept both format.
blueprint: qos-minimum-guaranteed-packet-rate
Change-Id: I7c5ecfe1015dba4ad0b70bbdcacc079503c50e65
diff --git a/tempest/scenario/test_minbw_allocation_placement.py b/tempest/scenario/test_minbw_allocation_placement.py
index 81bd24d..1dc18c3 100644
--- a/tempest/scenario/test_minbw_allocation_placement.py
+++ b/tempest/scenario/test_minbw_allocation_placement.py
@@ -176,6 +176,7 @@
consumer)['allocations']
self.assertGreater(len(allocations), 0)
bw_resource_in_alloc = False
+ allocation_rp = None
for rp, resources in allocations.items():
if self.INGRESS_RESOURCE_CLASS in resources['resources']:
self.assertEqual(
@@ -190,9 +191,19 @@
# the rp uuid
for port_id in port_ids:
port = self.os_admin.ports_client.show_port(port_id)
- self.assertEqual(
- allocation_rp,
- port['port']['binding:profile']['allocation'])
+ port_binding_alloc = port['port']['binding:profile'][
+ 'allocation']
+ # NOTE(gibi): the format of the allocation key depends on the
+ # existence of port-resource-request-groups API extension.
+ # TODO(gibi): drop the else branch once tempest does not need
+ # to support Xena release any more.
+ if utils.is_extension_enabled(
+ 'port-resource-request-groups', 'network'):
+ self.assertEqual(
+ {allocation_rp},
+ set(port_binding_alloc.values()))
+ else:
+ self.assertEqual(allocation_rp, port_binding_alloc)
@decorators.idempotent_id('78625d92-212c-400e-8695-dd51706858b8')
@utils.services('compute', 'network')