Add tests for the 'trusted' attribute in port resource
This patch adds admin API tests for the trusted attribute of the port
resources. Tests are checking if port created with 'trusted' attribute
set have it set correctly in 'trusted' attribute and in the
binding:profile. Second test checks the same but using update port API
call.
Depends-On: https://review.opendev.org/c/openstack/neutron/+/926068
Related-Bug: #2060916
Change-Id: Idcadaed240f156312fbe38eb9b20c9699eea3282
diff --git a/neutron_tempest_plugin/api/admin/test_ports.py b/neutron_tempest_plugin/api/admin/test_ports.py
index e26e122..88c35c6 100644
--- a/neutron_tempest_plugin/api/admin/test_ports.py
+++ b/neutron_tempest_plugin/api/admin/test_ports.py
@@ -65,6 +65,42 @@
self.assertNotEqual(current_mac, new_mac)
self.assertTrue(netaddr.valid_mac(new_mac))
+ @decorators.idempotent_id('4d75cc60-99d0-4949-b3ce-5826b81aa0a9')
+ @utils.requires_ext(extension="port-trusted-vif",
+ service="network")
+ def test_port_create_with_trusted_attr_set(self):
+ port = self.admin_client.create_port(
+ network_id=self.network['id'], trusted=True)['port']
+ self.ports.append(port)
+ self.assertTrue(port['trusted'])
+ self.assertTrue(port['binding:profile']['trusted'])
+
+ port = self.admin_client.create_port(
+ network_id=self.network['id'], trusted=False)['port']
+ self.ports.append(port)
+ self.assertFalse(port['trusted'])
+ self.assertFalse(port['binding:profile']['trusted'])
+
+ @decorators.idempotent_id('26c15e2a-55b2-410f-8ed3-84db9406ff3f')
+ @utils.requires_ext(extension="port-trusted-vif",
+ service="network")
+ def test_port_set_trusted_attr(self):
+ port = self.admin_client.create_port(
+ network_id=self.network['id'])['port']
+ self.ports.append(port)
+ self.assertIsNone(port['trusted'])
+ self.assertNotIn('trusted', port['binding:profile'])
+
+ updated_port = self.admin_client.update_port(
+ port['id'], trusted=True)['port']
+ self.assertTrue(updated_port['trusted'])
+ self.assertTrue(updated_port['binding:profile']['trusted'])
+
+ updated_port = self.admin_client.update_port(
+ port['id'], trusted=False)['port']
+ self.assertFalse(updated_port['trusted'])
+ self.assertFalse(updated_port['binding:profile']['trusted'])
+
class PortTestCasesResourceRequest(base.BaseAdminNetworkTest):
diff --git a/zuul.d/master_jobs.yaml b/zuul.d/master_jobs.yaml
index c190906..1508324 100644
--- a/zuul.d/master_jobs.yaml
+++ b/zuul.d/master_jobs.yaml
@@ -98,6 +98,7 @@
- port-resource-request
- port-resource-request-groups
- port-mac-address-regenerate
+ - port-trusted-vif
- port-security
- port-security-groups-filtering
- project-id
@@ -148,6 +149,7 @@
neutron-tag-ports-during-bulk-creation: true
neutron-ndp-proxy: true
neutron-subnet-external-network: true
+ neutron-port-trusted-vif: true
br-ex-tcpdump: true
br-int-flows: true
# Cinder services