Ensure subnet for port security group tests
This change simply adds a subnet to the networks in tests
verifying creation or update of a port without a security
group. This is being done because there are slight differences
across neutron plugins logic for managing association between
ports and security groups. For instance, the VMware NSX plugin
which also implements the "port security" extension, requires
an IP address on a port in order to associate it with the
default security group.
Adding a subnet to the network used in the test ensures the
test exercises a use case which is common to all plugins.
This patch simply adds the subnet to the network without
changing the remaining logic of the modified tests.
Change-Id: Ic1f725f5a307ac74acfb13b831db09025025ea2c
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 80097db..7ab5ebd 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -221,13 +221,17 @@
@test.attr(type='smoke')
def test_create_port_with_no_securitygroups(self):
- port = self.create_port(self.create_network(), security_groups=[])
+ network = self.create_network()
+ self.create_subnet(network)
+ port = self.create_port(network, security_groups=[])
self.assertIsNotNone(port['security_groups'])
self.assertEmpty(port['security_groups'])
@test.attr(type='smoke')
def test_update_port_with_no_securitygroups(self):
- port = self.create_port(self.create_network())
+ network = self.create_network()
+ self.create_subnet(network)
+ port = self.create_port(network)
# Verify that port is created with default security group
self.assertIsNotNone(port['security_groups'])
self.assertNotEmpty(port['security_groups'])