LR HA Relocation testcase

Change-Id: Ibd8c6ba92feda52443707f5680d2f5d2dd2aec5b
This commit is contained in:
Nilesh Lokhande 2019-05-21 14:20:35 +00:00
parent f067351397
commit 34ae8e3545

View File

@ -129,9 +129,69 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
body = self.create_router( body = self.create_router(
router_name=router_name, admin_state_up=True, router_name=router_name, admin_state_up=True,
external_network_id=CONF.network.public_network_id) external_network_id=CONF.network.public_network_id)
if CONF.network.backend == 'nsxp':
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(nsx_router.get('enable_standby_relocation'), True)
nsx_router = self.nsx.get_logical_router(body['name'], body['id']) nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name) self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router) self.assertIsNotNone(nsx_router)
self.assertEqual( self.assertEqual(
nsx_router.get('allocation_profile').get( nsx_router.get('allocation_profile').get(
'enable_standby_relocation'), True) 'enable_standby_relocation'), True)
@decorators.attr(type='nsxv3')
@decorators.idempotent_id('6f49b69c-0830-4c83-b1f8-5953e6bfeea5')
def test_deploy_router_ha_with_relocation_enable_disable(self):
# Check Standby relocation is enabled on backend after T1 Router got
# deployed.
router_name = data_utils.rand_name('router-')
body = self.create_router(
router_name=router_name, admin_state_up=True)
if CONF.network.backend == 'nsxp':
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(nsx_router.get(
'enable_standby_relocation'), False)
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(
nsx_router.get('allocation_profile').get(
'enable_standby_relocation'), False)
public_network_info = {"external_gateway_info":
dict(network_id=CONF.network.public_network_id)}
self.routers_client.update_router(body['id'], **public_network_info)
if CONF.network.backend == 'nsxp':
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(nsx_router.get('enable_standby_relocation'), True)
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(
nsx_router.get('allocation_profile').get(
'enable_standby_relocation'), True)
public_network_info = {"external_gateway_info": {}}
self.routers_client.update_router(body['id'], **public_network_info)
if CONF.network.backend == 'nsxp':
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(nsx_router.get(
'enable_standby_relocation'), False)
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
self.assertEqual(
nsx_router.get('allocation_profile').get(
'enable_standby_relocation'), False)