diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_routers.py b/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_routers.py index 4ce10c9..f7484d6 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_routers.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_nsx_routers.py @@ -129,9 +129,69 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest): body = self.create_router( router_name=router_name, admin_state_up=True, 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']) self.assertEqual(body['name'], router_name) self.assertIsNotNone(nsx_router) self.assertEqual( nsx_router.get('allocation_profile').get( '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)