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
This commit is contained in:
Balazs Gibizer 2021-09-15 12:00:20 +02:00
parent ae41052a51
commit 20514ef504
1 changed files with 14 additions and 3 deletions

View File

@ -176,6 +176,7 @@ class MinBwAllocationPlacementTest(manager.NetworkScenarioTest):
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 @@ class MinBwAllocationPlacementTest(manager.NetworkScenarioTest):
# 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')