Remove "active" attribute from the allowed_address_pairs

Attribute "active" is going to be added to the allowed_address_pairs
in the patch [1] and will not be available in older branches.
To make our existing allowed_address_pairs API tests to be passing in
both cases, with and without that "active" attribute, this patch
removes that field from the allowed_address_pairs which are returned
by the Neutron server.

We could make expected results of those tests to be dependend on the
available Neutron's API extensions but in that case existing tests may
fail randomly as all tests are always using same IP addresses thus
allowed_address_pair may be active=True or active=False.

To properly check active/inactive allowed address pairs there will be
additional tests added to the neutron-tempest-plugin in the follow up
patch.
Similar change is also proposed to the neutron-tempest-plugin in [2].

[1] https://review.opendev.org/c/openstack/neutron/+/601336
[2] https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/794788

Related-Bug: #1928466
Change-Id: I9e3eb3cc06c0a10a48d9309a183b14eda210d40f
This commit is contained in:
Slawek Kaplonski 2021-06-08 15:15:49 +02:00
parent 663787ee79
commit 1c8fe320f6
1 changed files with 12 additions and 0 deletions

View File

@ -97,6 +97,18 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
body = self.ports_client.update_port(
port_id, allowed_address_pairs=allowed_address_pairs)
allowed_address_pair = body['port']['allowed_address_pairs']
# NOTE(slaweq): Attribute "active" is added to the
# allowed_address_pairs in the Xena release.
# To make our existing allowed_address_pairs API tests to be passing in
# both cases, with and without that "active" attribute, we need to
# removes that field from the allowed_address_pairs which are returned
# by the Neutron server.
# We could make expected results of those tests to be dependend on the
# available Neutron's API extensions but in that case existing tests
# may fail randomly as all tests are always using same IP addresses
# thus allowed_address_pair may be active=True or active=False.
for pair in allowed_address_pair:
pair.pop('active', None)
self.assertCountEqual(allowed_address_pair, allowed_address_pairs)
@decorators.idempotent_id('9599b337-272c-47fd-b3cf-509414414ac4')