Add api test for DVR coverting back to centralized

This patch adds a test case for DVR routers which converts a centralized
router to distributed firstly, followed by making a transition back to
centralized. It checks whether the attributes are updated or retained as
expected.

Related-Bug: #1780094
Change-Id: Ida6e75d0215283c15b7a1c0ce0f473169afe8a66
This commit is contained in:
Kailun Qin 2018-07-20 21:38:07 +08:00
parent 46be4325b5
commit ce246d0b48
1 changed files with 10 additions and 1 deletions

View File

@ -251,7 +251,8 @@ class DvrRoutersTestToCentralized(base_routers.BaseRouterTest):
required_extensions = ['dvr', 'l3-ha']
@decorators.idempotent_id('644d7a4a-01a1-4b68-bb8d-0c0042cb1729')
def test_convert_centralized_router(self):
def test_convert_distributed_router_back_to_centralized(self):
# Convert a centralized router to distributed firstly
router_args = {'tenant_id': self.client.tenant_id,
'distributed': False, 'ha': False}
router = self.admin_client.create_router(
@ -266,6 +267,14 @@ class DvrRoutersTestToCentralized(base_routers.BaseRouterTest):
self.assertTrue(update_body['router']['distributed'])
show_body = self.admin_client.show_router(router['id'])
self.assertTrue(show_body['router']['distributed'])
self.assertFalse(show_body['router']['ha'])
# Then convert the distributed router back to centralized
update_body = self.admin_client.update_router(router['id'],
distributed=False)
self.assertFalse(update_body['router']['distributed'])
show_body = self.admin_client.show_router(router['id'])
self.assertFalse(show_body['router']['distributed'])
self.assertFalse(show_body['router']['ha'])
show_body = self.client.show_router(router['id'])
self.assertNotIn('distributed', show_body['router'])
self.assertNotIn('ha', show_body['router'])