Allow to configure max vlans for trunk port tests

In NFV baremetal deployments, the number of vlans available for trunk
ports may be constrained. This patch allows to configure
max_networks_per_project to accommodate for those environments.

Change-Id: Ie0f04649313aed41498cf60f7de0eb44cee17b1c
This commit is contained in:
Yariv Rachmani 2017-12-19 11:55:25 +02:00
parent badccb80af
commit fed6f86894
2 changed files with 9 additions and 1 deletions

View File

@ -38,6 +38,11 @@ NeutronPluginOptions = [
help='The availability zone for all agents in the deployment. '
'Configure this only when the single value is used by '
'all agents in the deployment.'),
cfg.IntOpt('max_networks_per_project',
default=4,
help='Max number of networks per project. '
'Configure this only when project is limited with real '
'vlans in deployment.'),
]
# TODO(amuller): Redo configuration options registration as part of the planned

View File

@ -173,9 +173,12 @@ class TrunkTest(base.BaseTempestTestCase):
exception=RuntimeError("Timed out waiting for trunk %s to "
"transition to ACTIVE." % trunk2_id))
# create a few more networks and ports for subports
# check limit of networks per project
max_vlan = 3 + CONF.neutron_plugin_options.max_networks_per_project
allowed_vlans = range(3, max_vlan)
subports = [{'port_id': self.create_port(self.create_network())['id'],
'segmentation_type': 'vlan', 'segmentation_id': seg_id}
for seg_id in range(3, 7)]
for seg_id in allowed_vlans]
# add all subports to server1
self.client.add_subports(trunk1_id, subports)
# ensure trunk transitions to ACTIVE