Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 1 | # Copyright 2013 OpenStack Foundation |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
| 16 | import netaddr |
Dongcan Ye | a71b834 | 2018-05-02 06:56:26 +0000 | [diff] [blame] | 17 | |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 18 | from tempest.common import utils as tutils |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 19 | from tempest.lib.common.utils import data_utils |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 20 | from tempest.lib import decorators |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 21 | |
Chandan Kumar | 667d3d3 | 2017-09-22 12:24:06 +0530 | [diff] [blame] | 22 | from neutron_tempest_plugin.api import base |
| 23 | from neutron_tempest_plugin.api import base_routers |
| 24 | from neutron_tempest_plugin.common import utils |
| 25 | from neutron_tempest_plugin import config |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 26 | |
| 27 | CONF = config.CONF |
| 28 | |
| 29 | |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 30 | class RoutersTest(base_routers.BaseRouterTest): |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 31 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 32 | required_extensions = ['router'] |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 33 | |
| 34 | @classmethod |
| 35 | def resource_setup(cls): |
| 36 | super(RoutersTest, cls).resource_setup() |
| 37 | cls.tenant_cidr = ( |
| 38 | config.safe_get_config_value('network', 'project_network_cidr') |
| 39 | if cls._ip_version == 4 else |
| 40 | config.safe_get_config_value('network', 'project_network_v6_cidr')) |
| 41 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 42 | @decorators.idempotent_id('c72c1c0c-2193-4aca-eeee-b1442640eeee') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 43 | @tutils.requires_ext(extension="standard-attr-description", |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 44 | service="network") |
| 45 | def test_create_update_router_description(self): |
| 46 | body = self.create_router(description='d1', router_name='test') |
| 47 | self.assertEqual('d1', body['description']) |
| 48 | body = self.client.show_router(body['id'])['router'] |
| 49 | self.assertEqual('d1', body['description']) |
| 50 | body = self.client.update_router(body['id'], description='d2') |
| 51 | self.assertEqual('d2', body['router']['description']) |
| 52 | body = self.client.show_router(body['router']['id'])['router'] |
| 53 | self.assertEqual('d2', body['description']) |
| 54 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 55 | @decorators.idempotent_id('847257cc-6afd-4154-b8fb-af49f5670ce8') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 56 | @tutils.requires_ext(extension='ext-gw-mode', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 57 | def test_create_router_with_default_snat_value(self): |
| 58 | # Create a router with default snat rule |
| 59 | name = data_utils.rand_name('router') |
| 60 | router = self._create_router( |
| 61 | name, external_network_id=CONF.network.public_network_id) |
| 62 | self._verify_router_gateway( |
| 63 | router['id'], {'network_id': CONF.network.public_network_id, |
| 64 | 'enable_snat': True}) |
| 65 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 66 | @decorators.idempotent_id('ea74068d-09e9-4fd7-8995-9b6a1ace920f') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 67 | @tutils.requires_ext(extension='ext-gw-mode', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 68 | def test_create_router_with_snat_explicit(self): |
| 69 | name = data_utils.rand_name('snat-router') |
| 70 | # Create a router enabling snat attributes |
| 71 | enable_snat_states = [False, True] |
| 72 | for enable_snat in enable_snat_states: |
| 73 | external_gateway_info = { |
| 74 | 'network_id': CONF.network.public_network_id, |
| 75 | 'enable_snat': enable_snat} |
| 76 | create_body = self.admin_client.create_router( |
| 77 | name, external_gateway_info=external_gateway_info) |
| 78 | self.addCleanup(self.admin_client.delete_router, |
| 79 | create_body['router']['id']) |
| 80 | # Verify snat attributes after router creation |
| 81 | self._verify_router_gateway(create_body['router']['id'], |
| 82 | exp_ext_gw_info=external_gateway_info) |
| 83 | |
| 84 | def _verify_router_gateway(self, router_id, exp_ext_gw_info=None): |
| 85 | show_body = self.admin_client.show_router(router_id) |
| 86 | actual_ext_gw_info = show_body['router']['external_gateway_info'] |
| 87 | if exp_ext_gw_info is None: |
| 88 | self.assertIsNone(actual_ext_gw_info) |
| 89 | return |
| 90 | # Verify only keys passed in exp_ext_gw_info |
fpxie | aa3bace | 2017-04-07 17:12:15 +0800 | [diff] [blame] | 91 | for k, v in exp_ext_gw_info.items(): |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 92 | self.assertEqual(v, actual_ext_gw_info[k]) |
| 93 | |
| 94 | def _verify_gateway_port(self, router_id): |
| 95 | list_body = self.admin_client.list_ports( |
| 96 | network_id=CONF.network.public_network_id, |
| 97 | device_id=router_id) |
| 98 | self.assertEqual(len(list_body['ports']), 1) |
| 99 | gw_port = list_body['ports'][0] |
| 100 | fixed_ips = gw_port['fixed_ips'] |
| 101 | self.assertGreaterEqual(len(fixed_ips), 1) |
| 102 | public_net_body = self.admin_client.show_network( |
| 103 | CONF.network.public_network_id) |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 104 | public_subnet_ids = public_net_body['network']['subnets'] |
| 105 | for fixed_ip in fixed_ips: |
| 106 | self.assertIn(fixed_ip['subnet_id'], |
| 107 | public_subnet_ids) |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 108 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 109 | @decorators.idempotent_id('b386c111-3b21-466d-880c-5e72b01e1a33') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 110 | @tutils.requires_ext(extension='ext-gw-mode', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 111 | def test_update_router_set_gateway_with_snat_explicit(self): |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 112 | router = self._create_router(data_utils.rand_name('router')) |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 113 | self.admin_client.update_router_with_snat_gw_info( |
| 114 | router['id'], |
| 115 | external_gateway_info={ |
| 116 | 'network_id': CONF.network.public_network_id, |
| 117 | 'enable_snat': True}) |
| 118 | self._verify_router_gateway( |
| 119 | router['id'], |
| 120 | {'network_id': CONF.network.public_network_id, |
| 121 | 'enable_snat': True}) |
| 122 | self._verify_gateway_port(router['id']) |
| 123 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 124 | @decorators.idempotent_id('96536bc7-8262-4fb2-9967-5c46940fa279') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 125 | @tutils.requires_ext(extension='ext-gw-mode', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 126 | def test_update_router_set_gateway_without_snat(self): |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 127 | router = self._create_router(data_utils.rand_name('router')) |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 128 | self.admin_client.update_router_with_snat_gw_info( |
| 129 | router['id'], |
| 130 | external_gateway_info={ |
| 131 | 'network_id': CONF.network.public_network_id, |
| 132 | 'enable_snat': False}) |
| 133 | self._verify_router_gateway( |
| 134 | router['id'], |
| 135 | {'network_id': CONF.network.public_network_id, |
| 136 | 'enable_snat': False}) |
| 137 | self._verify_gateway_port(router['id']) |
| 138 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 139 | @decorators.idempotent_id('f2faf994-97f4-410b-a831-9bc977b64374') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 140 | @tutils.requires_ext(extension='ext-gw-mode', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 141 | def test_update_router_reset_gateway_without_snat(self): |
| 142 | router = self._create_router( |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 143 | data_utils.rand_name('router'), |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 144 | external_network_id=CONF.network.public_network_id) |
| 145 | self.admin_client.update_router_with_snat_gw_info( |
| 146 | router['id'], |
| 147 | external_gateway_info={ |
| 148 | 'network_id': CONF.network.public_network_id, |
| 149 | 'enable_snat': False}) |
| 150 | self._verify_router_gateway( |
| 151 | router['id'], |
| 152 | {'network_id': CONF.network.public_network_id, |
| 153 | 'enable_snat': False}) |
| 154 | self._verify_gateway_port(router['id']) |
| 155 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 156 | @decorators.idempotent_id('db3093b1-93b6-4893-be83-c4716c251b3e') |
Kevin Benton | c66aa80 | 2016-07-23 22:36:37 -0700 | [diff] [blame] | 157 | def test_router_interface_status(self): |
| 158 | network = self.create_network() |
| 159 | subnet = self.create_subnet(network) |
| 160 | # Add router interface with subnet id |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 161 | router = self._create_router(data_utils.rand_name('router'), True) |
Kevin Benton | c66aa80 | 2016-07-23 22:36:37 -0700 | [diff] [blame] | 162 | intf = self.create_router_interface(router['id'], subnet['id']) |
Brian Haley | 33ef460 | 2018-04-26 14:37:49 -0400 | [diff] [blame] | 163 | |
| 164 | def _status_active(): |
| 165 | return self.client.show_port( |
| 166 | intf['port_id'])['port']['status'] == 'ACTIVE' |
| 167 | |
| 168 | utils.wait_until_true(_status_active, exception=AssertionError) |
Kevin Benton | c66aa80 | 2016-07-23 22:36:37 -0700 | [diff] [blame] | 169 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 170 | @decorators.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 171 | @tutils.requires_ext(extension='extraroute', service='network') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 172 | def test_update_extra_route(self): |
| 173 | self.network = self.create_network() |
| 174 | self.name = self.network['name'] |
| 175 | self.subnet = self.create_subnet(self.network) |
| 176 | # Add router interface with subnet id |
| 177 | self.router = self._create_router( |
| 178 | data_utils.rand_name('router-'), True) |
| 179 | self.create_router_interface(self.router['id'], self.subnet['id']) |
| 180 | self.addCleanup( |
| 181 | self._delete_extra_routes, |
| 182 | self.router['id']) |
| 183 | # Update router extra route, second ip of the range is |
| 184 | # used as next hop |
| 185 | cidr = netaddr.IPNetwork(self.subnet['cidr']) |
| 186 | next_hop = str(cidr[2]) |
| 187 | destination = str(self.subnet['cidr']) |
| 188 | extra_route = self.client.update_extra_routes(self.router['id'], |
| 189 | next_hop, destination) |
| 190 | self.assertEqual(1, len(extra_route['router']['routes'])) |
| 191 | self.assertEqual(destination, |
| 192 | extra_route['router']['routes'][0]['destination']) |
| 193 | self.assertEqual(next_hop, |
| 194 | extra_route['router']['routes'][0]['nexthop']) |
| 195 | show_body = self.client.show_router(self.router['id']) |
| 196 | self.assertEqual(destination, |
| 197 | show_body['router']['routes'][0]['destination']) |
| 198 | self.assertEqual(next_hop, |
| 199 | show_body['router']['routes'][0]['nexthop']) |
| 200 | |
| 201 | def _delete_extra_routes(self, router_id): |
| 202 | self.client.delete_extra_routes(router_id) |
| 203 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 204 | @decorators.idempotent_id('01f185d1-d1a6-4cf9-abf7-e0e1384c169c') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 205 | def test_network_attached_with_two_routers(self): |
| 206 | network = self.create_network(data_utils.rand_name('network1')) |
| 207 | self.create_subnet(network) |
| 208 | port1 = self.create_port(network) |
| 209 | port2 = self.create_port(network) |
| 210 | router1 = self._create_router(data_utils.rand_name('router1')) |
| 211 | router2 = self._create_router(data_utils.rand_name('router2')) |
| 212 | self.client.add_router_interface_with_port_id( |
| 213 | router1['id'], port1['id']) |
| 214 | self.client.add_router_interface_with_port_id( |
| 215 | router2['id'], port2['id']) |
| 216 | self.addCleanup(self.client.remove_router_interface_with_port_id, |
| 217 | router1['id'], port1['id']) |
| 218 | self.addCleanup(self.client.remove_router_interface_with_port_id, |
| 219 | router2['id'], port2['id']) |
| 220 | body = self.client.show_port(port1['id']) |
| 221 | port_show1 = body['port'] |
| 222 | body = self.client.show_port(port2['id']) |
| 223 | port_show2 = body['port'] |
| 224 | self.assertEqual(port_show1['network_id'], network['id']) |
| 225 | self.assertEqual(port_show2['network_id'], network['id']) |
| 226 | self.assertEqual(port_show1['device_id'], router1['id']) |
| 227 | self.assertEqual(port_show2['device_id'], router2['id']) |
| 228 | |
| 229 | |
| 230 | class RoutersIpV6Test(RoutersTest): |
| 231 | _ip_version = 6 |
| 232 | |
| 233 | |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 234 | class DvrRoutersTest(base_routers.BaseRouterTest): |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 235 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 236 | required_extensions = ['dvr'] |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 237 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 238 | @decorators.idempotent_id('141297aa-3424-455d-aa8d-f2d95731e00a') |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 239 | def test_create_distributed_router(self): |
| 240 | name = data_utils.rand_name('router') |
| 241 | create_body = self.admin_client.create_router( |
| 242 | name, distributed=True) |
| 243 | self.addCleanup(self._delete_router, |
| 244 | create_body['router']['id'], |
| 245 | self.admin_client) |
| 246 | self.assertTrue(create_body['router']['distributed']) |
| 247 | |
Dongcan Ye | a71b834 | 2018-05-02 06:56:26 +0000 | [diff] [blame] | 248 | |
| 249 | class DvrRoutersTestToCentralized(base_routers.BaseRouterTest): |
| 250 | |
| 251 | required_extensions = ['dvr', 'l3-ha'] |
| 252 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 253 | @decorators.idempotent_id('644d7a4a-01a1-4b68-bb8d-0c0042cb1729') |
Kailun Qin | ce246d0 | 2018-07-20 21:38:07 +0800 | [diff] [blame] | 254 | def test_convert_distributed_router_back_to_centralized(self): |
| 255 | # Convert a centralized router to distributed firstly |
Brian Haley | 198a2d9 | 2017-06-16 16:23:44 -0400 | [diff] [blame] | 256 | router_args = {'tenant_id': self.client.tenant_id, |
| 257 | 'distributed': False, 'ha': False} |
| 258 | router = self.admin_client.create_router( |
| 259 | data_utils.rand_name('router'), admin_state_up=False, |
| 260 | **router_args)['router'] |
| 261 | self.addCleanup(self.admin_client.delete_router, |
| 262 | router['id']) |
| 263 | self.assertFalse(router['distributed']) |
| 264 | self.assertFalse(router['ha']) |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 265 | update_body = self.admin_client.update_router(router['id'], |
| 266 | distributed=True) |
| 267 | self.assertTrue(update_body['router']['distributed']) |
| 268 | show_body = self.admin_client.show_router(router['id']) |
| 269 | self.assertTrue(show_body['router']['distributed']) |
Kailun Qin | ce246d0 | 2018-07-20 21:38:07 +0800 | [diff] [blame] | 270 | self.assertFalse(show_body['router']['ha']) |
| 271 | # Then convert the distributed router back to centralized |
| 272 | update_body = self.admin_client.update_router(router['id'], |
| 273 | distributed=False) |
| 274 | self.assertFalse(update_body['router']['distributed']) |
| 275 | show_body = self.admin_client.show_router(router['id']) |
| 276 | self.assertFalse(show_body['router']['distributed']) |
| 277 | self.assertFalse(show_body['router']['ha']) |
Daniel Mellado | 3c0aeab | 2016-01-29 11:30:25 +0000 | [diff] [blame] | 278 | show_body = self.client.show_router(router['id']) |
| 279 | self.assertNotIn('distributed', show_body['router']) |
Brian Haley | 198a2d9 | 2017-06-16 16:23:44 -0400 | [diff] [blame] | 280 | self.assertNotIn('ha', show_body['router']) |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 281 | |
| 282 | |
Matt Welch | ffe9be8 | 2019-07-02 13:24:29 +0000 | [diff] [blame^] | 283 | class DvrRoutersTestUpdateDistributedExtended(base_routers.BaseRouterTest): |
| 284 | |
| 285 | required_extensions = ['dvr', 'l3-ha', |
| 286 | 'router-admin-state-down-before-update'] |
| 287 | |
| 288 | @decorators.idempotent_id('0ffb9973-0c1a-4b76-a1f2-060178057661') |
| 289 | def test_convert_centralized_router_to_distributed_extended(self): |
| 290 | router_args = {'tenant_id': self.client.tenant_id, |
| 291 | 'distributed': False, 'ha': False} |
| 292 | router = self.admin_client.create_router( |
| 293 | data_utils.rand_name('router'), admin_state_up=True, |
| 294 | **router_args)['router'] |
| 295 | self.addCleanup(self.admin_client.delete_router, |
| 296 | router['id']) |
| 297 | self.assertTrue(router['admin_state_up']) |
| 298 | self.assertFalse(router['distributed']) |
| 299 | # take router down to allow setting the router to distributed |
| 300 | update_body = self.admin_client.update_router(router['id'], |
| 301 | admin_state_up=False) |
| 302 | self.assertFalse(update_body['router']['admin_state_up']) |
| 303 | # set the router to distributed |
| 304 | update_body = self.admin_client.update_router(router['id'], |
| 305 | distributed=True) |
| 306 | self.assertTrue(update_body['router']['distributed']) |
| 307 | # bring the router back up |
| 308 | update_body = self.admin_client.update_router(router['id'], |
| 309 | admin_state_up=True) |
| 310 | self.assertTrue(update_body['router']['admin_state_up']) |
| 311 | self.assertTrue(update_body['router']['distributed']) |
| 312 | |
| 313 | @decorators.idempotent_id('e9a8f55b-c535-44b7-8b0a-20af6a7c2921') |
| 314 | def test_convert_distributed_router_to_centralized_extended(self): |
| 315 | router_args = {'tenant_id': self.client.tenant_id, |
| 316 | 'distributed': True, 'ha': False} |
| 317 | router = self.admin_client.create_router( |
| 318 | data_utils.rand_name('router'), admin_state_up=True, |
| 319 | **router_args)['router'] |
| 320 | self.addCleanup(self.admin_client.delete_router, |
| 321 | router['id']) |
| 322 | self.assertTrue(router['admin_state_up']) |
| 323 | self.assertTrue(router['distributed']) |
| 324 | # take router down to allow setting the router to centralized |
| 325 | update_body = self.admin_client.update_router(router['id'], |
| 326 | admin_state_up=False) |
| 327 | self.assertFalse(update_body['router']['admin_state_up']) |
| 328 | # set router to centralized |
| 329 | update_body = self.admin_client.update_router(router['id'], |
| 330 | distributed=False) |
| 331 | self.assertFalse(update_body['router']['distributed']) |
| 332 | # bring router back up |
| 333 | update_body = self.admin_client.update_router(router['id'], |
| 334 | admin_state_up=True) |
| 335 | self.assertTrue(update_body['router']['admin_state_up']) |
| 336 | self.assertFalse(update_body['router']['distributed']) |
| 337 | |
| 338 | |
Dongcan Ye | 6d8ec4a | 2017-05-03 15:07:36 +0800 | [diff] [blame] | 339 | class HaRoutersTest(base_routers.BaseRouterTest): |
| 340 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 341 | required_extensions = ['l3-ha'] |
Dongcan Ye | 6d8ec4a | 2017-05-03 15:07:36 +0800 | [diff] [blame] | 342 | |
| 343 | @decorators.idempotent_id('77db8eae-3aa3-4e61-bf2a-e739ce042e53') |
| 344 | def test_convert_legacy_router(self): |
| 345 | router = self._create_router(data_utils.rand_name('router')) |
| 346 | self.assertNotIn('ha', router) |
| 347 | update_body = self.admin_client.update_router(router['id'], |
| 348 | ha=True) |
| 349 | self.assertTrue(update_body['router']['ha']) |
| 350 | show_body = self.admin_client.show_router(router['id']) |
| 351 | self.assertTrue(show_body['router']['ha']) |
| 352 | show_body = self.client.show_router(router['id']) |
| 353 | self.assertNotIn('ha', show_body['router']) |
| 354 | |
| 355 | |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 356 | class RoutersSearchCriteriaTest(base.BaseSearchCriteriaTest): |
| 357 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 358 | required_extensions = ['router'] |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 359 | resource = 'router' |
| 360 | |
| 361 | @classmethod |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 362 | def resource_setup(cls): |
| 363 | super(RoutersSearchCriteriaTest, cls).resource_setup() |
| 364 | for name in cls.resource_names: |
| 365 | cls.create_router(router_name=name) |
| 366 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 367 | @decorators.idempotent_id('03a69efb-90a7-435b-bb5c-3add3612085a') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 368 | def test_list_sorts_asc(self): |
| 369 | self._test_list_sorts_asc() |
| 370 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 371 | @decorators.idempotent_id('95913d30-ff41-4b17-9f44-5258c651e78c') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 372 | def test_list_sorts_desc(self): |
| 373 | self._test_list_sorts_desc() |
| 374 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 375 | @decorators.idempotent_id('7f7d40b1-e165-4817-8dc5-02f8e2f0dff3') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 376 | def test_list_pagination(self): |
| 377 | self._test_list_pagination() |
| 378 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 379 | @decorators.idempotent_id('a5b83e83-3d98-45bb-a2c7-0ee179ffd42c') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 380 | def test_list_pagination_with_marker(self): |
| 381 | self._test_list_pagination_with_marker() |
| 382 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 383 | @decorators.idempotent_id('40804af8-c25d-45f8-b8a8-b4c70345215d') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 384 | def test_list_pagination_with_href_links(self): |
| 385 | self._test_list_pagination_with_href_links() |
| 386 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 387 | @decorators.idempotent_id('77b9676c-d3cb-43af-a0e8-a5b8c6099e70') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 388 | def test_list_pagination_page_reverse_asc(self): |
| 389 | self._test_list_pagination_page_reverse_asc() |
| 390 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 391 | @decorators.idempotent_id('3133a2c5-1bb9-4fc7-833e-cf9a1d160255') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 392 | def test_list_pagination_page_reverse_desc(self): |
| 393 | self._test_list_pagination_page_reverse_desc() |
| 394 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 395 | @decorators.idempotent_id('8252e2f0-b3da-4738-8e25-f6f8d878a2da') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 396 | def test_list_pagination_page_reverse_with_href_links(self): |
| 397 | self._test_list_pagination_page_reverse_with_href_links() |
| 398 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 399 | @decorators.idempotent_id('fb102124-20f8-4cb3-8c81-f16f5e41d192') |
Ihar Hrachyshka | 44d1d3f | 2016-06-14 11:51:37 +0200 | [diff] [blame] | 400 | def test_list_no_pagination_limit_0(self): |
| 401 | self._test_list_no_pagination_limit_0() |