diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index 522aa43336..48eaf2bf98 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -989,6 +989,10 @@ def _create_router(self, client=None, tenant_id=None, self.addCleanup(self.delete_wrapper, router.delete) return router + def _update_router_admin_state(self, router, admin_state_up): + router.update(admin_state_up=admin_state_up) + self.assertEqual(admin_state_up, router.admin_state_up) + def create_networks(self, client=None, tenant_id=None): """Create a network with a subnet connected to a router. diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py index bac955d845..6d1692904a 100644 --- a/tempest/scenario/test_network_basic_ops.py +++ b/tempest/scenario/test_network_basic_ops.py @@ -170,8 +170,9 @@ def _check_tenant_network_connectivity(self): server, ssh_login, self._get_server_key(server), servers_for_debug=self.servers) - def check_public_network_connectivity(self, should_connect=True, - msg=None): + def check_public_network_connectivity( + self, should_connect=True, msg=None, + should_check_floating_ip_status=True): """Verifies connectivty to a VM via public network and floating IP, and verifies floating IP has resource status is correct. @@ -180,6 +181,8 @@ def check_public_network_connectivity(self, should_connect=True, :param msg: Failure message to add to Error message. Should describe the place in the test scenario where the method was called, to indicate the context of the failure + :param should_check_floating_ip_status: bool. should status of + floating_ip be checked or not """ ssh_login = CONF.compute.image_ssh_user floating_ip, server = self.floating_ip_tuple @@ -193,7 +196,8 @@ def check_public_network_connectivity(self, should_connect=True, super(TestNetworkBasicOps, self).check_public_network_connectivity( ip_address, ssh_login, private_key, should_connect, msg, self.servers) - self.check_floating_ip_status(floating_ip, floatingip_status) + if should_check_floating_ip_status: + self.check_floating_ip_status(floating_ip, floatingip_status) def _disassociate_floating_ips(self): floating_ip, server = self.floating_ip_tuple @@ -393,3 +397,31 @@ def test_hotplug_nic(self): self._create_new_network() self._hotplug_server() self._check_network_internal_connectivity(network=self.new_net) + + @test.attr(type='smoke') + @test.services('compute', 'network') + def test_update_router_admin_state(self): + """ + 1. Check public connectivity before updating + admin_state_up attribute of router to False + 2. Check public connectivity after updating + admin_state_up attribute of router to False + 3. Check public connectivity after updating + admin_state_up attribute of router to True + """ + self._setup_network_and_servers() + self.check_public_network_connectivity( + should_connect=True, msg="before updating " + "admin_state_up of router to False") + self._update_router_admin_state(self.router, False) + # TODO(alokmaurya): Remove should_check_floating_ip_status=False check + # once bug 1396310 is fixed + + self.check_public_network_connectivity( + should_connect=False, msg="after updating " + "admin_state_up of router to False", + should_check_floating_ip_status=False) + self._update_router_admin_state(self.router, True) + self.check_public_network_connectivity( + should_connect=True, msg="after updating " + "admin_state_up of router to True")