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 | |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 15 | from tempest.common import utils |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 16 | from tempest.lib.common.utils import data_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 |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 19 | |
Chandan Kumar | 667d3d3 | 2017-09-22 12:24:06 +0530 | [diff] [blame] | 20 | from neutron_tempest_plugin.api import base |
| 21 | from neutron_tempest_plugin import config |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 22 | |
| 23 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 24 | CONF = config.CONF |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 25 | |
| 26 | |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 27 | class TrunkTestJSONBase(base.BaseAdminNetworkTest): |
| 28 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 29 | required_extensions = ['trunk'] |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 30 | |
| 31 | def setUp(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 32 | base.BaseAdminNetworkTest.setUp(self) |
| 33 | # This avoids problems due to user quotas |
| 34 | self.resource_setup() |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 35 | self.addCleanup(self.resource_cleanup) |
Armando Migliaccio | d26a274 | 2016-07-13 08:57:50 -0700 | [diff] [blame] | 36 | |
Jakub Libosvar | 7352054 | 2017-12-19 17:46:42 +0000 | [diff] [blame] | 37 | @classmethod |
| 38 | def is_type_driver_enabled(cls, type_driver): |
| 39 | return (type_driver in |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 40 | CONF.neutron_plugin_options.available_type_drivers) |
Jakub Libosvar | 7352054 | 2017-12-19 17:46:42 +0000 | [diff] [blame] | 41 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 42 | @classmethod |
| 43 | def _create_trunk_with_network_and_parent(cls, subports=None, |
| 44 | parent_network_type=None, |
| 45 | **kwargs): |
Jakub Libosvar | 7352054 | 2017-12-19 17:46:42 +0000 | [diff] [blame] | 46 | client = None |
| 47 | network_kwargs = {} |
| 48 | if parent_network_type: |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 49 | client = cls.admin_client |
Jakub Libosvar | 7352054 | 2017-12-19 17:46:42 +0000 | [diff] [blame] | 50 | network_kwargs = {"provider:network_type": parent_network_type, |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 51 | "tenant_id": cls.client.tenant_id} |
| 52 | network = cls.create_network(client=client, **network_kwargs) |
| 53 | parent_port = cls.create_port(network) |
| 54 | return cls.create_trunk(parent_port, subports, **kwargs) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 55 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 56 | @classmethod |
| 57 | def _show_trunk(cls, trunk): |
| 58 | client = trunk.get('client') or cls.client |
| 59 | return client.show_trunk(trunk['id'])['trunk'] |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 60 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 61 | @classmethod |
| 62 | def _update_trunk(cls, trunk, **kwargs): |
| 63 | client = trunk.get('client') or cls.client |
| 64 | return client.update_trunk(trunk['id'], **kwargs)['trunk'] |
| 65 | |
| 66 | @classmethod |
| 67 | def _list_trunks(cls): |
| 68 | return cls.client.list_trunks()['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) |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 75 | observed_trunk = self._show_trunk(trunk) |
| 76 | self.assertEqual(trunk, dict(observed_trunk, client=trunk['client'])) |
Armando Migliaccio | 71d3470 | 2016-08-29 22:50:44 -0700 | [diff] [blame] | 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): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 88 | trunk = self._create_trunk_with_network_and_parent() |
| 89 | observed_trunk = self._show_trunk(trunk) |
| 90 | self.assertEqual(trunk, dict(observed_trunk, client=trunk['client'])) |
| 91 | self.delete_trunk(trunk) |
| 92 | self.assertRaises(lib_exc.NotFound, self._show_trunk, trunk) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 93 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 94 | @decorators.idempotent_id('8d83a6ca-662d-45b8-8062-d513077296aa') |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 95 | @utils.requires_ext(extension="project-id", service="network") |
Henry Gessau | fa6c78d | 2016-10-09 19:56:09 -0400 | [diff] [blame] | 96 | def test_show_trunk_has_project_id(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 97 | trunk = self._create_trunk_with_network_and_parent() |
| 98 | observed_trunk = self._show_trunk(trunk) |
| 99 | for key in ['project_id', 'tenant_id']: |
| 100 | self.assertIn(key, observed_trunk) |
| 101 | self.assertEqual(self.client.tenant_id, observed_trunk[key]) |
Henry Gessau | fa6c78d | 2016-10-09 19:56:09 -0400 | [diff] [blame] | 102 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 103 | @decorators.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32') |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 104 | def test_create_update_trunk(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 105 | trunk = self._create_trunk_with_network_and_parent() |
| 106 | observed_trunk = self._show_trunk(trunk) |
| 107 | self.assertTrue(observed_trunk['admin_state_up']) |
| 108 | self.assertEqual(trunk['revision_number'], |
| 109 | observed_trunk['revision_number']) |
| 110 | self.assertEqual("", observed_trunk['name']) |
| 111 | self.assertEqual("", observed_trunk['description']) |
| 112 | updated_trunk = self._update_trunk(trunk, name='foo', |
| 113 | admin_state_up=False) |
| 114 | self.assertFalse(updated_trunk['admin_state_up']) |
| 115 | self.assertEqual("foo", updated_trunk['name']) |
| 116 | self.assertGreater(updated_trunk['revision_number'], |
| 117 | trunk['revision_number']) |
Armando Migliaccio | 89a24f1 | 2016-07-12 11:59:02 -0700 | [diff] [blame] | 118 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 119 | @decorators.idempotent_id('5ff46c22-a2b6-5559-bc5a-0ef2463cab32') |
Armando Migliaccio | 4273831 | 2016-08-29 22:04:21 -0700 | [diff] [blame] | 120 | def test_create_update_trunk_with_description(self): |
| 121 | trunk = self._create_trunk_with_network_and_parent( |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 122 | description="foo description") |
| 123 | self.assertEqual("foo description", trunk['description']) |
| 124 | updated_trunk = self._update_trunk(trunk, description='') |
| 125 | self.assertEqual('', updated_trunk['description']) |
Armando Migliaccio | 4273831 | 2016-08-29 22:04:21 -0700 | [diff] [blame] | 126 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 127 | @decorators.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 128 | def test_list_trunks(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 129 | trunk1 = self._create_trunk_with_network_and_parent() |
| 130 | trunk2 = self._create_trunk_with_network_and_parent() |
| 131 | expected_trunks = {trunk1['id']: trunk1, |
| 132 | trunk2['id']: trunk2} |
| 133 | observed_trunks = {trunk['id']: dict(trunk, client=self.client) |
| 134 | for trunk in self._list_trunks() |
| 135 | if trunk['id'] in expected_trunks} |
| 136 | self.assertEqual(expected_trunks, observed_trunks) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 137 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 138 | @decorators.idempotent_id('bb5fcead-09b5-484a-bbe6-46d1e06d6cc0') |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 139 | def test_add_subports(self): |
| 140 | trunk = self._create_trunk_with_network_and_parent() |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 141 | network = self.create_network() |
| 142 | port = self.create_port(network) |
| 143 | subports = [{'port_id': port['id'], |
| 144 | 'segmentation_type': 'vlan', |
| 145 | 'segmentation_id': 2}] |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 146 | added_subports = self.client.add_subports(trunk['id'], |
| 147 | subports)['sub_ports'] |
| 148 | self.assertEqual(subports, added_subports) |
| 149 | observed_trunk = self._show_trunk(trunk) |
| 150 | self.assertEqual(subports, observed_trunk['sub_ports']) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 151 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 152 | @decorators.idempotent_id('ee5fcead-1abf-483a-bce6-43d1e06d6aa0') |
Armando Migliaccio | 232642c | 2016-07-20 16:28:24 -0700 | [diff] [blame] | 153 | def test_delete_trunk_with_subport_is_allowed(self): |
| 154 | network = self.create_network() |
| 155 | port = self.create_port(network) |
| 156 | subports = [{'port_id': port['id'], |
| 157 | 'segmentation_type': 'vlan', |
| 158 | 'segmentation_id': 2}] |
| 159 | trunk = self._create_trunk_with_network_and_parent(subports) |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 160 | self.client.delete_trunk(trunk['id']) |
Armando Migliaccio | 232642c | 2016-07-20 16:28:24 -0700 | [diff] [blame] | 161 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 162 | @decorators.idempotent_id('96eea398-a03c-4c3e-a99e-864392c2ca53') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 163 | def test_remove_subport(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 164 | subport1 = {'port_id': self.create_port(self.create_network())['id'], |
| 165 | 'segmentation_type': 'vlan', |
| 166 | 'segmentation_id': 2} |
| 167 | subport2 = {'port_id': self.create_port(self.create_network())['id'], |
| 168 | 'segmentation_type': 'vlan', |
| 169 | 'segmentation_id': 4} |
| 170 | trunk = self._create_trunk_with_network_and_parent([subport1, |
| 171 | subport2]) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 172 | |
| 173 | # Remove the subport and validate PUT response |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 174 | subports_after_remove = self.client.remove_subports( |
| 175 | trunk['id'], [subport2])['sub_ports'] |
| 176 | self.assertEqual([subport1], subports_after_remove) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 177 | |
| 178 | # Validate the results of a subport list |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 179 | observed_trunk = self._show_trunk(trunk) |
| 180 | self.assertEqual([subport1], observed_trunk['sub_ports']) |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 181 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 182 | @decorators.idempotent_id('bb5fcaad-09b5-484a-dde6-4cd1ea6d6ff0') |
Ryan Tidwell | 9b9be44 | 2016-02-18 17:34:43 +0800 | [diff] [blame] | 183 | def test_get_subports(self): |
| 184 | network = self.create_network() |
| 185 | port = self.create_port(network) |
| 186 | subports = [{'port_id': port['id'], |
| 187 | 'segmentation_type': 'vlan', |
| 188 | 'segmentation_id': 2}] |
| 189 | trunk = self._create_trunk_with_network_and_parent(subports) |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 190 | observed_subports = self.client.get_subports(trunk['id'])['sub_ports'] |
| 191 | self.assertEqual(subports, observed_subports) |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 192 | |
| 193 | |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 194 | class TrunkTestInheritJSONBase(TrunkTestJSONBase): |
| 195 | |
| 196 | required_extensions = ['provider', 'trunk'] |
| 197 | |
| 198 | @classmethod |
| 199 | def skip_checks(cls): |
| 200 | super(TrunkTestInheritJSONBase, cls).skip_checks() |
lianghao | b738084 | 2017-04-18 15:07:01 +0800 | [diff] [blame] | 201 | if ("vlan" not in |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 202 | CONF.neutron_plugin_options.available_type_drivers): |
lianghao | b738084 | 2017-04-18 15:07:01 +0800 | [diff] [blame] | 203 | raise cls.skipException("VLAN type_driver is not enabled") |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 204 | if not CONF.neutron_plugin_options.provider_vlans: |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 205 | raise cls.skipException("No provider VLAN networks available") |
| 206 | |
| 207 | def create_provider_network(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 208 | foo_net = CONF.neutron_plugin_options.provider_vlans[0] |
Federico Ressi | 2d7db2c | 2018-07-06 08:11:20 +0200 | [diff] [blame] | 209 | return self.create_network(name=data_utils.rand_name('vlan-net'), |
| 210 | provider_network_type='vlan', |
| 211 | provider_physical_network=foo_net) |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 212 | |
| 213 | @decorators.idempotent_id('0f05d98e-41f5-4629-dada-9aee269c9602') |
| 214 | def test_add_subport(self): |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 215 | parent_network = self.create_provider_network() |
| 216 | parent_port = self.create_port(parent_network) |
| 217 | subport_network1 = self.create_provider_network() |
| 218 | segmentation_id1 = subport_network1['provider:segmentation_id'] |
| 219 | subport_network2 = self.create_provider_network() |
| 220 | segmentation_id2 = subport_network2['provider:segmentation_id'] |
| 221 | subport1 = self.create_port(subport_network1) |
| 222 | subport2 = self.create_port(subport_network2) |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 223 | subports = [{'port_id': subport1['id'], |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 224 | 'segmentation_type': 'inherit'}, |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 225 | {'port_id': subport2['id'], |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 226 | 'segmentation_type': 'inherit'}] |
| 227 | |
| 228 | trunk = self.create_trunk(parent_port, subports) |
| 229 | |
| 230 | expected_subports = [{'port_id': subport1['id'], |
| 231 | 'segmentation_type': 'vlan', |
| 232 | 'segmentation_id': segmentation_id1}, |
| 233 | {'port_id': subport2['id'], |
| 234 | 'segmentation_type': 'vlan', |
| 235 | 'segmentation_id': segmentation_id2}] |
| 236 | |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 237 | # Validate that subport got segmentation details from the network |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 238 | self.assertEqual(expected_subports, trunk['sub_ports']) |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 239 | |
| 240 | |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 241 | class TrunkTestMtusJSONBase(TrunkTestJSONBase): |
| 242 | |
| 243 | required_extensions = ['provider', 'trunk'] |
| 244 | |
| 245 | @classmethod |
| 246 | def skip_checks(cls): |
| 247 | super(TrunkTestMtusJSONBase, cls).skip_checks() |
Jakub Libosvar | 7352054 | 2017-12-19 17:46:42 +0000 | [diff] [blame] | 248 | if not all(cls.is_type_driver_enabled(t) for t in ['gre', 'vxlan']): |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 249 | msg = "Either vxlan or gre type driver not enabled." |
| 250 | raise cls.skipException(msg) |
| 251 | |
| 252 | def setUp(self): |
| 253 | super(TrunkTestMtusJSONBase, self).setUp() |
| 254 | |
| 255 | # VXLAN autocomputed MTU (1450) is smaller than that of GRE (1458) |
Federico Ressi | 2d7db2c | 2018-07-06 08:11:20 +0200 | [diff] [blame] | 256 | self.smaller_mtu_net = self.create_network( |
| 257 | name=data_utils.rand_name('vxlan-net'), |
| 258 | provider_network_type='vxlan') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 259 | |
Federico Ressi | 2d7db2c | 2018-07-06 08:11:20 +0200 | [diff] [blame] | 260 | self.larger_mtu_net = self.create_network( |
| 261 | name=data_utils.rand_name('gre-net'), |
| 262 | provider_network_type='gre') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 263 | |
| 264 | self.smaller_mtu_port = self.create_port(self.smaller_mtu_net) |
| 265 | self.smaller_mtu_port_2 = self.create_port(self.smaller_mtu_net) |
| 266 | self.larger_mtu_port = self.create_port(self.larger_mtu_net) |
| 267 | |
| 268 | |
| 269 | class TrunkTestMtusJSON(TrunkTestMtusJSONBase): |
| 270 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 271 | @decorators.idempotent_id('0f05d98e-41f5-4629-ac29-9aee269c9602') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 272 | def test_create_trunk_with_mtu_greater_than_subport(self): |
| 273 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 274 | 'segmentation_type': 'vlan', |
| 275 | 'segmentation_id': 2}] |
| 276 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 277 | self.create_trunk(self.larger_mtu_port, subports) |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 278 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 279 | @decorators.idempotent_id('2004c5c6-e557-4c43-8100-c820ad4953e8') |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 280 | def test_add_subport_with_mtu_greater_than_subport(self): |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 281 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 282 | 'segmentation_type': 'vlan', |
| 283 | 'segmentation_id': 2}] |
| 284 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 285 | trunk = self.create_trunk(self.larger_mtu_port) |
| 286 | self.client.add_subports(trunk['id'], subports) |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 287 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 288 | @decorators.idempotent_id('22725101-f4bc-4e00-84ec-4e02cd7e0500') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 289 | def test_create_trunk_with_mtu_equal_to_subport(self): |
| 290 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 291 | 'segmentation_type': 'vlan', |
| 292 | 'segmentation_id': 2}] |
| 293 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 294 | self.create_trunk(self.smaller_mtu_port_2, subports) |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 295 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 296 | @decorators.idempotent_id('175b05ae-66ad-44c7-857a-a12d16f1058f') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 297 | def test_add_subport_with_mtu_equal_to_trunk(self): |
| 298 | subports = [{'port_id': self.smaller_mtu_port['id'], |
| 299 | 'segmentation_type': 'vlan', |
| 300 | 'segmentation_id': 2}] |
| 301 | |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 302 | trunk = self.create_trunk(self.smaller_mtu_port_2) |
| 303 | self.client.add_subports(trunk['id'], subports) |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 304 | |
| 305 | |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 306 | class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest): |
| 307 | |
Jakub Libosvar | 1982aa1 | 2017-05-30 11:15:33 +0000 | [diff] [blame] | 308 | required_extensions = ['trunk'] |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 309 | resource = 'trunk' |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 310 | |
| 311 | @classmethod |
| 312 | def resource_setup(cls): |
| 313 | super(TrunksSearchCriteriaTest, cls).resource_setup() |
| 314 | net = cls.create_network(network_name='trunk-search-test-net') |
| 315 | for name in cls.resource_names: |
| 316 | parent_port = cls.create_port(net) |
Federico Ressi | c9f5ec5 | 2018-07-05 13:10:42 +0200 | [diff] [blame] | 317 | cls.create_trunk(parent_port, name=name) |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 318 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 319 | @decorators.idempotent_id('fab73df4-960a-4ae3-87d3-60992b8d3e2d') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 320 | def test_list_sorts_asc(self): |
| 321 | self._test_list_sorts_asc() |
| 322 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 323 | @decorators.idempotent_id('a426671d-7270-430f-82ff-8f33eec93010') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 324 | def test_list_sorts_desc(self): |
| 325 | self._test_list_sorts_desc() |
| 326 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 327 | @decorators.idempotent_id('b202fdc8-6616-45df-b6a0-463932de6f94') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 328 | def test_list_pagination(self): |
| 329 | self._test_list_pagination() |
| 330 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 331 | @decorators.idempotent_id('c4723b8e-8186-4b9a-bf9e-57519967e048') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 332 | def test_list_pagination_with_marker(self): |
| 333 | self._test_list_pagination_with_marker() |
| 334 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 335 | @decorators.idempotent_id('dcd02a7a-f07e-4d5e-b0ca-b58e48927a9b') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 336 | def test_list_pagination_with_href_links(self): |
| 337 | self._test_list_pagination_with_href_links() |
| 338 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 339 | @decorators.idempotent_id('eafe7024-77ab-4cfe-824b-0b2bf4217727') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 340 | def test_list_no_pagination_limit_0(self): |
| 341 | self._test_list_no_pagination_limit_0() |
| 342 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 343 | @decorators.idempotent_id('f8857391-dc44-40cc-89b7-2800402e03ce') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 344 | def test_list_pagination_page_reverse_asc(self): |
| 345 | self._test_list_pagination_page_reverse_asc() |
| 346 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 347 | @decorators.idempotent_id('ae51e9c9-ceae-4ec0-afd4-147569247699') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 348 | def test_list_pagination_page_reverse_desc(self): |
| 349 | self._test_list_pagination_page_reverse_desc() |
| 350 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 351 | @decorators.idempotent_id('b4293e59-d794-4a93-be09-38667199ef68') |
Armando Migliaccio | 57581c6 | 2016-07-01 10:13:19 -0700 | [diff] [blame] | 352 | def test_list_pagination_page_reverse_with_href_links(self): |
| 353 | self._test_list_pagination_page_reverse_with_href_links() |