diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-10-20 08:09:33 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-10-20 08:09:33 +0000 |
commit | cca0eb07361c2837ed1cedd29f6d3d7feabf3ca9 (patch) | |
tree | a2b4e915bb4f9fb979b38203536258314fa57232 | |
parent | e59f0fffb28a1b98476e3cc7dfaaed33f469711b (diff) | |
parent | dba59f9a5c4abd17fff766bf74a865f0fbe76e9a (diff) | |
download | tempest-cca0eb07361c2837ed1cedd29f6d3d7feabf3ca9.tar.gz |
Merge "Port API Tests Enhancements"
-rw-r--r-- | tempest/api/network/test_ports.py | 35 | ||||
-rw-r--r-- | tempest/services/network/xml/network_client.py | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py index cdd3a2952..d6db64d64 100644 --- a/tempest/api/network/test_ports.py +++ b/tempest/api/network/test_ports.py @@ -151,6 +151,41 @@ class PortsTestJSON(base.BaseNetworkTest): port = self.update_port(port, fixed_ips=fixed_ip_1) self.assertEqual(1, len(port['fixed_ips'])) + def _update_port_with_security_groups(self, security_groups_names): + post_body = {"network_id": self.network['id']} + self.create_subnet(self.network) + security_groups_list = list() + for name in security_groups_names: + _, group_create_body = self.client.create_security_group( + name=name) + self.addCleanup(self.client.delete_security_group, + group_create_body['security_group']['id']) + security_groups_list.append(group_create_body['security_group'] + ['id']) + # Create a port + _, body = self.client.create_port(**post_body) + self.addCleanup(self.client.delete_port, body['port']['id']) + port = body['port'] + # Update the port with security groups + update_body = {"security_groups": security_groups_list} + _, body = self.client.update_port( + port['id'], **update_body) + # Verify the security groups updated to port + port_show = body['port'] + for security_group in security_groups_list: + self.assertIn(security_group, port_show['security_groups']) + + @test.attr(type='smoke') + def test_update_port_with_security_group(self): + self._update_port_with_security_groups( + [data_utils.rand_name('secgroup')]) + + @test.attr(type='smoke') + def test_update_port_with_two_security_groups(self): + self._update_port_with_security_groups( + [data_utils.rand_name('secgroup'), + data_utils.rand_name('secgroup')]) + class PortsTestXML(PortsTestJSON): _interface = 'xml' diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py index c65390e61..4a8dddc18 100644 --- a/tempest/services/network/xml/network_client.py +++ b/tempest/services/network/xml/network_client.py @@ -26,7 +26,7 @@ class NetworkClientXML(client_base.NetworkClientBase): PLURALS = ['dns_nameservers', 'host_routes', 'allocation_pools', 'fixed_ips', 'extensions', 'extra_dhcp_opts', 'pools', 'health_monitors', 'vips', 'members', 'allowed_address_pairs', - 'firewall_rules'] + 'firewall_rules', 'security_groups'] def get_rest_client(self, auth_provider): rc = rest_client.RestClient(auth_provider) |