Skip to content

Commit

Permalink
Basic networks Scenario Test Enhancements
Browse files Browse the repository at this point in the history
Add test to update router admin_state_up attribute of the router
-Update admin_state_up attribute of router to False and check public
 connectivity
-Update admin_state_up attribute of router back to True and check public
 connectivity again

Change-Id: I3fd56c44411ff6919e15dd1033f6c13e58271f4b
  • Loading branch information
Alok Maurya committed Dec 2, 2014
1 parent 2c8c148 commit 6384bbb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tempest/scenario/manager.py
Expand Up @@ -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.
Expand Down
38 changes: 35 additions & 3 deletions tempest/scenario/test_network_basic_ops.py
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")

0 comments on commit 6384bbb

Please sign in to comment.