Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 1 | # Copyright 2016 Hewlett Packard Enterprise Development Company LP |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 15 | from tempest.lib.common.utils import data_utils |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 16 | from tempest.lib.common.utils import test_utils |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 17 | from tempest.lib import decorators |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 18 | from tempest.lib import exceptions as lib_exc |
| 19 | from tempest import test |
| 20 | |
Chandan Kumar | 667d3d3 | 2017-09-22 12:24:06 +0530 | [diff] [blame] | 21 | from neutron_tempest_plugin.api import base |
| 22 | from neutron_tempest_plugin import config |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 23 | |
| 24 | |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 25 | def trunks_cleanup(client, trunks): |
| 26 | for trunk in trunks: |
Armando Migliaccio | 232642c | 2016-07-20 16:28:24 -0700 | [diff] [blame] | 27 | # NOTE(armax): deleting a trunk with subports is permitted, however |
| 28 | # for testing purposes it is safer to be explicit and clean all the |
| 29 | # resources associated with the trunk beforehand. |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 30 | subports = test_utils.call_and_ignore_notfound_exc( |
| 31 | client.get_subports, trunk['id']) |
| 32 | if subports: |
| 33 | client.remove_subports( |
| 34 | trunk['id'], subports['sub_ports']) |
| 35 | test_utils.call_and_ignore_notfound_exc( |
| 36 | client.delete_trunk, trunk['id']) |
| 37 | |
| 38 | |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 39 | class TrunkTestJSONBase(base.BaseAdminNetworkTest): |
| 40 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 41 | required_extensions = ['trunk'] |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 42 | |
| 43 | def setUp(self): |
| 44 | self.addCleanup(self.resource_cleanup) |
| 45 | super(TrunkTestJSONBase, self).setUp() |
| 46 | |
| 47 | @classmethod |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 48 | def resource_setup(cls): |
| 49 | super(TrunkTestJSONBase, cls).resource_setup() |
| 50 | cls.trunks = [] |
| 51 | |
| 52 | @classmethod |
| 53 | def resource_cleanup(cls): |
| 54 | trunks_cleanup(cls.client, cls.trunks) |
| 55 | super(TrunkTestJSONBase, cls).resource_cleanup() |
| 56 | |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 57 | def _create_trunk_with_network_and_parent(self, subports, **kwargs): |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 58 | network = self.create_network() |
| 59 | parent_port = self.create_port(network) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 60 | trunk = self.client.create_trunk(parent_port['id'], subports, **kwargs) |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 61 | self.trunks.append(trunk['trunk']) |
| 62 | return trunk |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 63 | |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 64 | def _show_trunk(self, trunk_id): |
Armando Migliaccio | 5b60664 | 2016-09-02 11:45:56 -0700 | [diff] [blame] | 65 | return self.client.show_trunk(trunk_id) |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 66 | |
| 67 | def _list_trunks(self): |
Armando Migliaccio | 5b60664 | 2016-09-02 11:45:56 -0700 | [diff] [blame] | 68 | return self.client.list_trunks() |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 69 | |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 70 | |
| 71 | class TrunkTestJSON(TrunkTestJSONBase): |
| 72 | |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 73 | def _test_create_trunk(self, subports): |
| 74 | trunk = self._create_trunk_with_network_and_parent(subports) |
| 75 | observed_trunk = self._show_trunk(trunk['trunk']['id']) |
| 76 | self.assertEqual(trunk, observed_trunk) |
| 77 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 78 | @decorators.idempotent_id('e1a6355c-4768-41f3-9bf8-0f1d192bd501') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 79 | def test_create_trunk_empty_subports_list(self): |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 80 | self._test_create_trunk([]) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 81 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 82 | @decorators.idempotent_id('382dfa39-ca03-4bd3-9a1c-91e36d2e3796') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 83 | def test_create_trunk_subports_not_specified(self): |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 84 | self._test_create_trunk(None) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 85 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 86 | @decorators.idempotent_id('7de46c22-e2b6-4959-ac5a-0e624632ab32') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 87 | def test_create_show_delete_trunk(self): |
| 88 | trunk = self._create_trunk_with_network_and_parent(None) |
| 89 | trunk_id = trunk['trunk']['id'] |
| 90 | parent_port_id = trunk['trunk']['port_id'] |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 91 | res = self._show_trunk(trunk_id) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 92 | self.assertEqual(trunk_id, res['trunk']['id']) |
| 93 | self.assertEqual(parent_port_id, res['trunk']['port_id']) |
| 94 | self.client.delete_trunk(trunk_id) |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 95 | self.assertRaises(lib_exc.NotFound, self._show_trunk, trunk_id) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 96 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 97 | @decorators.idempotent_id('8d83a6ca-662d-45b8-8062-d513077296aa') |
Henry Gessau | fa6c78d | 2016-10-09 19:56:09 -0400 | [diff] [blame] | 98 | @test.requires_ext(extension="project-id", service="network") |
| 99 | def test_show_trunk_has_project_id(self): |
| 100 | trunk = self._create_trunk_with_network_and_parent(None) |
| 101 | body = self._show_trunk(trunk['trunk']['id']) |
| 102 | show_trunk = body['trunk'] |
| 103 | self.assertIn('project_id', show_trunk) |
| 104 | self.assertIn('tenant_id', show_trunk) |
| 105 | self.assertEqual(self.client.tenant_id, show_trunk['project_id']) |
| 106 | self.assertEqual(self.client.tenant_id, show_trunk['tenant_id']) |
| 107 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 108 | @decorators.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32') |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 109 | def test_create_update_trunk(self): |
| 110 | trunk = self._create_trunk_with_network_and_parent(None) |
Kevin Benton | 8f7ddc7 | 2017-06-14 15:36:55 -0700 | [diff] [blame] | 111 | rev = trunk['trunk']['revision_number'] |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 112 | trunk_id = trunk['trunk']['id'] |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 113 | res = self._show_trunk(trunk_id) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 114 | self.assertTrue(res['trunk']['admin_state_up']) |
Kevin Benton | 8f7ddc7 | 2017-06-14 15:36:55 -0700 | [diff] [blame] | 115 | self.assertEqual(rev, res['trunk']['revision_number']) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 116 | self.assertEqual("", res['trunk']['name']) |
Armando Migliaccio | 4273831 | 2016-08-29 22:04:21 -0700 | [diff] [blame] | 117 | self.assertEqual("", res['trunk']['description']) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 118 | res = self.client.update_trunk( |
| 119 | trunk_id, name='foo', admin_state_up=False) |
| 120 | self.assertFalse(res['trunk']['admin_state_up']) |
| 121 | self.assertEqual("foo", res['trunk']['name']) |
Kevin Benton | 8f7ddc7 | 2017-06-14 15:36:55 -0700 | [diff] [blame] | 122 | self.assertGreater(res['trunk']['revision_number'], rev) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 123 | # enable the trunk so that it can be managed |
| 124 | self.client.update_trunk(trunk_id, admin_state_up=True) |
| 125 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 126 | @decorators.idempotent_id('5ff46c22-a2b6-5559-bc5a-0ef2463cab32') |
Armando Migliaccio | 4273831 | 2016-08-29 22:04:21 -0700 | [diff] [blame] | 127 | def test_create_update_trunk_with_description(self): |
| 128 | trunk = self._create_trunk_with_network_and_parent( |
| 129 | None, description="foo description") |
| 130 | trunk_id = trunk['trunk']['id'] |
| 131 | self.assertEqual("foo description", trunk['trunk']['description']) |
| 132 | trunk = self.client.update_trunk(trunk_id, description='') |
| 133 | self.assertEqual('', trunk['trunk']['description']) |
| 134 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 135 | @decorators.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 136 | def test_list_trunks(self): |
| 137 | trunk1 = self._create_trunk_with_network_and_parent(None) |
| 138 | trunk2 = self._create_trunk_with_network_and_parent(None) |
| 139 | expected_trunks = {trunk1['trunk']['id']: trunk1['trunk'], |
| 140 | trunk2['trunk']['id']: trunk2['trunk']} |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 141 | trunk_list = self._list_trunks()['trunks'] |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 142 | matched_trunks = [x for x in trunk_list if x['id'] in expected_trunks] |
| 143 | self.assertEqual(2, len(matched_trunks)) |
| 144 | for trunk in matched_trunks: |
| 145 | self.assertEqual(expected_trunks[trunk['id']], trunk) |
| 146 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 147 | @decorators.idempotent_id('bb5fcead-09b5-484a-bbe6-46d1e06d6cc0') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 148 | def test_add_subport(self): |
| 149 | trunk = self._create_trunk_with_network_and_parent([]) |
| 150 | network = self.create_network() |
| 151 | port = self.create_port(network) |
| 152 | subports = [{'port_id': port['id'], |
| 153 | 'segmentation_type': 'vlan', |
| 154 | 'segmentation_id': 2}] |
| 155 | self.client.add_subports(trunk['trunk']['id'], subports) |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 156 | trunk = self._show_trunk(trunk['trunk']['id']) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 157 | observed_subports = trunk['trunk']['sub_ports'] |
| 158 | self.assertEqual(1, len(observed_subports)) |
| 159 | created_subport = observed_subports[0] |
| 160 | self.assertEqual(subports[0], created_subport) |
| 161 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 162 | @decorators.idempotent_id('ee5fcead-1abf-483a-bce6-43d1e06d6aa0') |
Armando Migliaccio | 232642c | 2016-07-20 16:28:24 -0700 | [diff] [blame] | 163 | def test_delete_trunk_with_subport_is_allowed(self): |
| 164 | network = self.create_network() |
| 165 | port = self.create_port(network) |
| 166 | subports = [{'port_id': port['id'], |
| 167 | 'segmentation_type': 'vlan', |
| 168 | 'segmentation_id': 2}] |
| 169 | trunk = self._create_trunk_with_network_and_parent(subports) |
| 170 | self.client.delete_trunk(trunk['trunk']['id']) |
| 171 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 172 | @decorators.idempotent_id('96eea398-a03c-4c3e-a99e-864392c2ca53') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 173 | def test_remove_subport(self): |
| 174 | subport_parent1 = self.create_port(self.create_network()) |
| 175 | subport_parent2 = self.create_port(self.create_network()) |
| 176 | subports = [{'port_id': subport_parent1['id'], |
| 177 | 'segmentation_type': 'vlan', |
| 178 | 'segmentation_id': 2}, |
| 179 | {'port_id': subport_parent2['id'], |
| 180 | 'segmentation_type': 'vlan', |
| 181 | 'segmentation_id': 4}] |
| 182 | trunk = self._create_trunk_with_network_and_parent(subports) |
| 183 | removed_subport = trunk['trunk']['sub_ports'][0] |
| 184 | expected_subport = None |
| 185 | |
| 186 | for subport in subports: |
| 187 | if subport['port_id'] != removed_subport['port_id']: |
| 188 | expected_subport = subport |
| 189 | break |
| 190 | |
| 191 | # Remove the subport and validate PUT response |
| 192 | res = self.client.remove_subports(trunk['trunk']['id'], |
| 193 | [removed_subport]) |
| 194 | self.assertEqual(1, len(res['sub_ports'])) |
| 195 | self.assertEqual(expected_subport, res['sub_ports'][0]) |
| 196 | |
| 197 | # Validate the results of a subport list |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 198 | trunk = self._show_trunk(trunk['trunk']['id']) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 199 | observed_subports = trunk['trunk']['sub_ports'] |
| 200 | self.assertEqual(1, len(observed_subports)) |
| 201 | self.assertEqual(expected_subport, observed_subports[0]) |
| 202 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 203 | @decorators.idempotent_id('bb5fcaad-09b5-484a-dde6-4cd1ea6d6ff0') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 204 | def test_get_subports(self): |
| 205 | network = self.create_network() |
| 206 | port = self.create_port(network) |
| 207 | subports = [{'port_id': port['id'], |
| 208 | 'segmentation_type': 'vlan', |
| 209 | 'segmentation_id': 2}] |
| 210 | trunk = self._create_trunk_with_network_and_parent(subports) |
| 211 | trunk = self.client.get_subports(trunk['trunk']['id']) |
| 212 | observed_subports = trunk['sub_ports'] |
| 213 | self.assertEqual(1, len(observed_subports)) |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 214 | |
| 215 | |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 216 | class TrunkTestInheritJSONBase(TrunkTestJSONBase): |
| 217 | |
| 218 | required_extensions = ['provider', 'trunk'] |
| 219 | |
| 220 | @classmethod |
| 221 | def skip_checks(cls): |
| 222 | super(TrunkTestInheritJSONBase, cls).skip_checks() |
lianghao | b738084 | 2017-04-18 15:07:01 +0800 | [diff] [blame] | 223 | if ("vlan" not in |
| 224 | config.CONF.neutron_plugin_options.available_type_drivers): |
| 225 | raise cls.skipException("VLAN type_driver is not enabled") |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 226 | if not config.CONF.neutron_plugin_options.provider_vlans: |
| 227 | raise cls.skipException("No provider VLAN networks available") |
| 228 | |
| 229 | def create_provider_network(self): |
| 230 | foo_net = config.CONF.neutron_plugin_options.provider_vlans[0] |
| 231 | post_body = {'network_name': data_utils.rand_name('vlan-net-'), |
| 232 | 'provider:network_type': 'vlan', |
| 233 | 'provider:physical_network': foo_net} |
| 234 | return self.create_shared_network(**post_body) |
| 235 | |
| 236 | @decorators.idempotent_id('0f05d98e-41f5-4629-dada-9aee269c9602') |
| 237 | def test_add_subport(self): |
| 238 | trunk_network = self.create_provider_network() |
| 239 | trunk_port = self.create_port(trunk_network) |
| 240 | subport_networks = [ |
| 241 | self.create_provider_network(), |
| 242 | self.create_provider_network(), |
| 243 | ] |
| 244 | subport1 = self.create_port(subport_networks[0]) |
| 245 | subport2 = self.create_port(subport_networks[1]) |
| 246 | subports = [{'port_id': subport1['id'], |
| 247 | 'segmentation_type': 'inherit', |
| 248 | 'segmentation_id': subport1['id']}, |
| 249 | {'port_id': subport2['id'], |
| 250 | 'segmentation_type': 'inherit', |
| 251 | 'segmentation_id': subport2['id']}] |
| 252 | trunk = self.client.create_trunk(trunk_port['id'], subports)['trunk'] |
| 253 | self.trunks.append(trunk) |
| 254 | # Validate that subport got segmentation details from the network |
| 255 | for i in range(2): |
| 256 | self.assertEqual(subport_networks[i]['provider:network_type'], |
| 257 | trunk['sub_ports'][i]['segmentation_type']) |
| 258 | self.assertEqual(subport_networks[i]['provider:segmentation_id'], |
| 259 | trunk['sub_ports'][i]['segmentation_id']) |
| 260 | |
| 261 | |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 262 | class TrunkTestMtusJSONBase(TrunkTestJSONBase): |
| 263 | |
| 264 | required_extensions = ['provider', 'trunk'] |
| 265 | |
| 266 | @classmethod |
| 267 | def skip_checks(cls): |
| 268 | super(TrunkTestMtusJSONBase, cls).skip_checks() |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 269 | if any(t |
| 270 | not in config.CONF.neutron_plugin_options.available_type_drivers |
| 271 | for t in ['gre', 'vxlan']): |
| 272 | msg = "Either vxlan or gre type driver not enabled." |
| 273 | raise cls.skipException(msg) |
| 274 | |
| 275 | def setUp(self): |
| 276 | super(TrunkTestMtusJSONBase, self).setUp() |
| 277 | |
| 278 | # VXLAN autocomputed MTU (1450) is smaller than that of GRE (1458) |
| 279 | vxlan_kwargs = {'network_name': data_utils.rand_name('vxlan-net-'), |
| 280 | 'provider:network_type': 'vxlan'} |
| 281 | self.smaller_mtu_net = self.create_shared_network(**vxlan_kwargs) |
| 282 | |
| 283 | gre_kwargs = {'network_name': data_utils.rand_name('gre-net-'), |
| 284 | 'provider:network_type': 'gre'} |
| 285 | self.larger_mtu_net = self.create_shared_network(**gre_kwargs) |
| 286 | |
| 287 | self.smaller_mtu_port = self.create_port(self.smaller_mtu_net) |
| 288 | self.smaller_mtu_port_2 = self.create_port(self.smaller_mtu_net) |
| 289 | self.larger_mtu_port = self.create_port(self.larger_mtu_net) |
| 290 | |
| 291 | |
| 292 | class TrunkTestMtusJSON(TrunkTestMtusJSONBase): |
| 293 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 294 | @decorators.idempotent_id('0f05d98e-41f5-4629-ac29-9aee269c9602') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 295 | def test_create_trunk_with_mtu_greater_than_subport(self): |
| 296 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 297 | 'segmentation_type': 'vlan', |
| 298 | 'segmentation_id': 2}] |
| 299 | |
| 300 | trunk = self.client.create_trunk(self.larger_mtu_port['id'], subports) |
| 301 | self.trunks.append(trunk['trunk']) |
| 302 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 303 | @decorators.idempotent_id('2004c5c6-e557-4c43-8100-c820ad4953e8') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 304 | def test_add_subport_with_mtu_smaller_than_trunk(self): |
| 305 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 306 | 'segmentation_type': 'vlan', |
| 307 | 'segmentation_id': 2}] |
| 308 | |
| 309 | trunk = self.client.create_trunk(self.larger_mtu_port['id'], None) |
| 310 | self.trunks.append(trunk['trunk']) |
| 311 | |
| 312 | self.client.add_subports(trunk['trunk']['id'], subports) |
| 313 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 314 | @decorators.idempotent_id('22725101-f4bc-4e00-84ec-4e02cd7e0500') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 315 | def test_create_trunk_with_mtu_equal_to_subport(self): |
| 316 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 317 | 'segmentation_type': 'vlan', |
| 318 | 'segmentation_id': 2}] |
| 319 | |
| 320 | trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'], |
| 321 | subports) |
| 322 | self.trunks.append(trunk['trunk']) |
| 323 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 324 | @decorators.idempotent_id('175b05ae-66ad-44c7-857a-a12d16f1058f') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 325 | def test_add_subport_with_mtu_equal_to_trunk(self): |
| 326 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 327 | 'segmentation_type': 'vlan', |
| 328 | 'segmentation_id': 2}] |
| 329 | |
| 330 | trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'], None) |
| 331 | self.trunks.append(trunk['trunk']) |
| 332 | |
| 333 | self.client.add_subports(trunk['trunk']['id'], subports) |
| 334 | |
| 335 | |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 336 | class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest): |
| 337 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 338 | required_extensions = ['trunk'] |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 339 | resource = 'trunk' |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 340 | |
| 341 | @classmethod |
| 342 | def resource_setup(cls): |
| 343 | super(TrunksSearchCriteriaTest, cls).resource_setup() |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 344 | cls.trunks = [] |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 345 | net = cls.create_network(network_name='trunk-search-test-net') |
| 346 | for name in cls.resource_names: |
| 347 | parent_port = cls.create_port(net) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 348 | trunk = cls.client.create_trunk(parent_port['id'], [], name=name) |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 349 | cls.trunks.append(trunk['trunk']) |
| 350 | |
| 351 | @classmethod |
| 352 | def resource_cleanup(cls): |
| 353 | trunks_cleanup(cls.client, cls.trunks) |
| 354 | super(TrunksSearchCriteriaTest, cls).resource_cleanup() |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 355 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 356 | @decorators.idempotent_id('fab73df4-960a-4ae3-87d3-60992b8d3e2d') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 357 | def test_list_sorts_asc(self): |
| 358 | self._test_list_sorts_asc() |
| 359 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 360 | @decorators.idempotent_id('a426671d-7270-430f-82ff-8f33eec93010') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 361 | def test_list_sorts_desc(self): |
| 362 | self._test_list_sorts_desc() |
| 363 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 364 | @decorators.idempotent_id('b202fdc8-6616-45df-b6a0-463932de6f94') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 365 | def test_list_pagination(self): |
| 366 | self._test_list_pagination() |
| 367 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 368 | @decorators.idempotent_id('c4723b8e-8186-4b9a-bf9e-57519967e048') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 369 | def test_list_pagination_with_marker(self): |
| 370 | self._test_list_pagination_with_marker() |
| 371 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 372 | @decorators.idempotent_id('dcd02a7a-f07e-4d5e-b0ca-b58e48927a9b') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 373 | def test_list_pagination_with_href_links(self): |
| 374 | self._test_list_pagination_with_href_links() |
| 375 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 376 | @decorators.idempotent_id('eafe7024-77ab-4cfe-824b-0b2bf4217727') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 377 | def test_list_no_pagination_limit_0(self): |
| 378 | self._test_list_no_pagination_limit_0() |
| 379 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 380 | @decorators.idempotent_id('f8857391-dc44-40cc-89b7-2800402e03ce') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 381 | def test_list_pagination_page_reverse_asc(self): |
| 382 | self._test_list_pagination_page_reverse_asc() |
| 383 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 384 | @decorators.idempotent_id('ae51e9c9-ceae-4ec0-afd4-147569247699') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 385 | def test_list_pagination_page_reverse_desc(self): |
| 386 | self._test_list_pagination_page_reverse_desc() |
| 387 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 388 | @decorators.idempotent_id('b4293e59-d794-4a93-be09-38667199ef68') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 389 | def test_list_pagination_page_reverse_with_href_links(self): |
| 390 | self._test_list_pagination_page_reverse_with_href_links() |