From ce246d0b487d9ddc66aa0abe749ab54fca8476a9 Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Fri, 20 Jul 2018 21:38:07 +0800 Subject: [PATCH] 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 --- neutron_tempest_plugin/api/test_routers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/neutron_tempest_plugin/api/test_routers.py b/neutron_tempest_plugin/api/test_routers.py index 4637dd60..5c98c8b6 100644 --- a/neutron_tempest_plugin/api/test_routers.py +++ b/neutron_tempest_plugin/api/test_routers.py @@ -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'])