Merge "API tests: Check MTU sanity of trunk/subport"
This commit is contained in:
commit
2be2d97d11
@ -67,6 +67,7 @@ case $VENV in
|
|||||||
load_conf_hook quotas
|
load_conf_hook quotas
|
||||||
load_rc_hook qos
|
load_rc_hook qos
|
||||||
load_rc_hook trunk
|
load_rc_hook trunk
|
||||||
|
load_conf_hook mtu
|
||||||
load_conf_hook osprofiler
|
load_conf_hook osprofiler
|
||||||
if [[ "$VENV" =~ "dsvm-scenario" ]]; then
|
if [[ "$VENV" =~ "dsvm-scenario" ]]; then
|
||||||
load_conf_hook iptables_verify
|
load_conf_hook iptables_verify
|
||||||
|
9
neutron/tests/contrib/hooks/mtu
Normal file
9
neutron/tests/contrib/hooks/mtu
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[[post-extra|$TEMPEST_CONFIG]]
|
||||||
|
|
||||||
|
[neutron_plugin_options]
|
||||||
|
available_type_drivers=flat,geneve,vlan,gre,local,vxlan
|
||||||
|
|
||||||
|
[[post-config|/$Q_PLUGIN_CONF_FILE]]
|
||||||
|
|
||||||
|
[ml2]
|
||||||
|
type_drivers=flat,geneve,vlan,gre,local,vxlan
|
@ -12,11 +12,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest.lib.common.utils import test_utils
|
from tempest.lib.common.utils import test_utils
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
from tempest import test
|
from tempest import test
|
||||||
|
|
||||||
from neutron.tests.tempest.api import base
|
from neutron.tests.tempest.api import base
|
||||||
|
from neutron.tests.tempest import config
|
||||||
|
|
||||||
|
|
||||||
def trunks_cleanup(client, trunks):
|
def trunks_cleanup(client, trunks):
|
||||||
@ -206,6 +208,85 @@ class TrunkTestJSON(TrunkTestJSONBase):
|
|||||||
self.assertEqual(1, len(observed_subports))
|
self.assertEqual(1, len(observed_subports))
|
||||||
|
|
||||||
|
|
||||||
|
class TrunkTestMtusJSONBase(TrunkTestJSONBase):
|
||||||
|
|
||||||
|
required_extensions = ['provider', 'trunk']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def skip_checks(cls):
|
||||||
|
super(TrunkTestMtusJSONBase, cls).skip_checks()
|
||||||
|
for ext in cls.required_extensions:
|
||||||
|
if not test.is_extension_enabled(ext, 'network'):
|
||||||
|
msg = "%s extension not enabled." % ext
|
||||||
|
raise cls.skipException(msg)
|
||||||
|
|
||||||
|
if any(t
|
||||||
|
not in config.CONF.neutron_plugin_options.available_type_drivers
|
||||||
|
for t in ['gre', 'vxlan']):
|
||||||
|
msg = "Either vxlan or gre type driver not enabled."
|
||||||
|
raise cls.skipException(msg)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TrunkTestMtusJSONBase, self).setUp()
|
||||||
|
|
||||||
|
# VXLAN autocomputed MTU (1450) is smaller than that of GRE (1458)
|
||||||
|
vxlan_kwargs = {'network_name': data_utils.rand_name('vxlan-net-'),
|
||||||
|
'provider:network_type': 'vxlan'}
|
||||||
|
self.smaller_mtu_net = self.create_shared_network(**vxlan_kwargs)
|
||||||
|
|
||||||
|
gre_kwargs = {'network_name': data_utils.rand_name('gre-net-'),
|
||||||
|
'provider:network_type': 'gre'}
|
||||||
|
self.larger_mtu_net = self.create_shared_network(**gre_kwargs)
|
||||||
|
|
||||||
|
self.smaller_mtu_port = self.create_port(self.smaller_mtu_net)
|
||||||
|
self.smaller_mtu_port_2 = self.create_port(self.smaller_mtu_net)
|
||||||
|
self.larger_mtu_port = self.create_port(self.larger_mtu_net)
|
||||||
|
|
||||||
|
|
||||||
|
class TrunkTestMtusJSON(TrunkTestMtusJSONBase):
|
||||||
|
|
||||||
|
@test.idempotent_id('0f05d98e-41f5-4629-ac29-9aee269c9602')
|
||||||
|
def test_create_trunk_with_mtu_greater_than_subport(self):
|
||||||
|
subports = [{'port_id': self.smaller_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
trunk = self.client.create_trunk(self.larger_mtu_port['id'], subports)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
@test.idempotent_id('2004c5c6-e557-4c43-8100-c820ad4953e8')
|
||||||
|
def test_add_subport_with_mtu_smaller_than_trunk(self):
|
||||||
|
subports = [{'port_id': self.smaller_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
trunk = self.client.create_trunk(self.larger_mtu_port['id'], None)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
self.client.add_subports(trunk['trunk']['id'], subports)
|
||||||
|
|
||||||
|
@test.idempotent_id('22725101-f4bc-4e00-84ec-4e02cd7e0500')
|
||||||
|
def test_create_trunk_with_mtu_equal_to_subport(self):
|
||||||
|
subports = [{'port_id': self.smaller_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'],
|
||||||
|
subports)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
@test.idempotent_id('175b05ae-66ad-44c7-857a-a12d16f1058f')
|
||||||
|
def test_add_subport_with_mtu_equal_to_trunk(self):
|
||||||
|
subports = [{'port_id': self.smaller_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
trunk = self.client.create_trunk(self.smaller_mtu_port_2['id'], None)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
self.client.add_subports(trunk['trunk']['id'], subports)
|
||||||
|
|
||||||
|
|
||||||
class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest):
|
class TrunksSearchCriteriaTest(base.BaseSearchCriteriaTest):
|
||||||
|
|
||||||
resource = 'trunk'
|
resource = 'trunk'
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import testtools
|
||||||
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
from tempest import test
|
from tempest import test
|
||||||
@ -235,3 +237,35 @@ class TrunkTestJSON(test_trunk.TrunkTestJSONBase):
|
|||||||
self._create_trunk_with_network_and_parent(subports)
|
self._create_trunk_with_network_and_parent(subports)
|
||||||
self.assertRaises(lib_exc.Conflict, self.client.delete_port,
|
self.assertRaises(lib_exc.Conflict, self.client.delete_port,
|
||||||
port['id'])
|
port['id'])
|
||||||
|
|
||||||
|
|
||||||
|
class TrunkTestMtusJSON(test_trunk.TrunkTestMtusJSONBase):
|
||||||
|
|
||||||
|
required_extensions = (
|
||||||
|
['net-mtu'] + test_trunk.TrunkTestMtusJSONBase.required_extensions)
|
||||||
|
|
||||||
|
@test.attr(type='negative')
|
||||||
|
@test.idempotent_id('228380ef-1b7a-495e-b759-5b1f08e3e858')
|
||||||
|
def test_create_trunk_with_mtu_smaller_than_subport(self):
|
||||||
|
subports = [{'port_id': self.larger_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
with testtools.ExpectedException(lib_exc.Conflict):
|
||||||
|
trunk = self.client.create_trunk(self.smaller_mtu_port['id'],
|
||||||
|
subports)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
@test.attr(type='negative')
|
||||||
|
@test.idempotent_id('3b32bf77-8002-403e-ad01-6f4cf018daa5')
|
||||||
|
def test_add_subport_with_mtu_greater_than_trunk(self):
|
||||||
|
subports = [{'port_id': self.larger_mtu_port['id'],
|
||||||
|
'segmentation_type': 'vlan',
|
||||||
|
'segmentation_id': 2}]
|
||||||
|
|
||||||
|
trunk = self.client.create_trunk(self.smaller_mtu_port['id'], None)
|
||||||
|
self.trunks.append(trunk['trunk'])
|
||||||
|
|
||||||
|
self.assertRaises(lib_exc.Conflict,
|
||||||
|
self.client.add_subports,
|
||||||
|
trunk['trunk']['id'], subports)
|
||||||
|
@ -22,7 +22,12 @@ NeutronPluginOptions = [
|
|||||||
cfg.BoolOpt('specify_floating_ip_address_available',
|
cfg.BoolOpt('specify_floating_ip_address_available',
|
||||||
default=True,
|
default=True,
|
||||||
help='Allow passing an IP Address of the floating ip when '
|
help='Allow passing an IP Address of the floating ip when '
|
||||||
'creating the floating ip')]
|
'creating the floating ip'),
|
||||||
|
cfg.ListOpt('available_type_drivers',
|
||||||
|
default=[],
|
||||||
|
help='List of network types available to neutron, '
|
||||||
|
'e.g. vxlan,vlan,gre.'),
|
||||||
|
]
|
||||||
|
|
||||||
# TODO(amuller): Redo configuration options registration as part of the planned
|
# TODO(amuller): Redo configuration options registration as part of the planned
|
||||||
# transition to the Tempest plugin architecture
|
# transition to the Tempest plugin architecture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user