trunk: Create vxlan network when testing inherit
The inherit segmentation type fails only when parent network has a not supported network type. In case default is a supported one, e.g. vlan, then inherit correctly returns vlan as subport segmentation type. This patch forces to use vxlan as a network type for test validating inherit option. Change-Id: Idf6935e4da426ff50457483a8f08a9ae3e403f75 Closes-bug: #1739227
This commit is contained in:
parent
badccb80af
commit
7352054bb3
@ -54,8 +54,20 @@ class TrunkTestJSONBase(base.BaseAdminNetworkTest):
|
|||||||
trunks_cleanup(cls.client, cls.trunks)
|
trunks_cleanup(cls.client, cls.trunks)
|
||||||
super(TrunkTestJSONBase, cls).resource_cleanup()
|
super(TrunkTestJSONBase, cls).resource_cleanup()
|
||||||
|
|
||||||
def _create_trunk_with_network_and_parent(self, subports, **kwargs):
|
@classmethod
|
||||||
network = self.create_network()
|
def is_type_driver_enabled(cls, type_driver):
|
||||||
|
return (type_driver in
|
||||||
|
config.CONF.neutron_plugin_options.available_type_drivers)
|
||||||
|
|
||||||
|
def _create_trunk_with_network_and_parent(
|
||||||
|
self, subports, parent_network_type=None, **kwargs):
|
||||||
|
client = None
|
||||||
|
network_kwargs = {}
|
||||||
|
if parent_network_type:
|
||||||
|
client = self.admin_client
|
||||||
|
network_kwargs = {"provider:network_type": parent_network_type,
|
||||||
|
"tenant_id": self.client.tenant_id}
|
||||||
|
network = self.create_network(client=client, **network_kwargs)
|
||||||
parent_port = self.create_port(network)
|
parent_port = self.create_port(network)
|
||||||
trunk = self.client.create_trunk(parent_port['id'], subports, **kwargs)
|
trunk = self.client.create_trunk(parent_port['id'], subports, **kwargs)
|
||||||
self.trunks.append(trunk['trunk'])
|
self.trunks.append(trunk['trunk'])
|
||||||
@ -266,9 +278,7 @@ class TrunkTestMtusJSONBase(TrunkTestJSONBase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
super(TrunkTestMtusJSONBase, cls).skip_checks()
|
super(TrunkTestMtusJSONBase, cls).skip_checks()
|
||||||
if any(t
|
if not all(cls.is_type_driver_enabled(t) for t in ['gre', 'vxlan']):
|
||||||
not in config.CONF.neutron_plugin_options.available_type_drivers
|
|
||||||
for t in ['gre', 'vxlan']):
|
|
||||||
msg = "Either vxlan or gre type driver not enabled."
|
msg = "Either vxlan or gre type driver not enabled."
|
||||||
raise cls.skipException(msg)
|
raise cls.skipException(msg)
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
|
from tempest.common import utils
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
import testtools
|
import testtools
|
||||||
@ -103,8 +104,14 @@ class TrunkTestJSON(test_trunk.TrunkTestJSONBase):
|
|||||||
|
|
||||||
@decorators.attr(type='negative')
|
@decorators.attr(type='negative')
|
||||||
@decorators.idempotent_id('40aed9be-e976-47d0-dada-bde2c7e74e57')
|
@decorators.idempotent_id('40aed9be-e976-47d0-dada-bde2c7e74e57')
|
||||||
|
@utils.requires_ext(extension="provider", service="network")
|
||||||
def test_create_subport_invalid_inherit_network_segmentation_type(self):
|
def test_create_subport_invalid_inherit_network_segmentation_type(self):
|
||||||
trunk = self._create_trunk_with_network_and_parent([])
|
if not self.is_type_driver_enabled('vxlan'):
|
||||||
|
msg = "Vxlan type driver must be enabled for this test."
|
||||||
|
raise self.skipException(msg)
|
||||||
|
|
||||||
|
trunk = self._create_trunk_with_network_and_parent(
|
||||||
|
subports=[], parent_network_type='vxlan')
|
||||||
subport_network = self.create_network()
|
subport_network = self.create_network()
|
||||||
parent_port = self.create_port(subport_network)
|
parent_port = self.create_port(subport_network)
|
||||||
self.assertRaises(lib_exc.BadRequest, self.client.add_subports,
|
self.assertRaises(lib_exc.BadRequest, self.client.add_subports,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user