Return correct value for default neutron_driver

After we switch to ovn we need to return correct value
for neutron_driver when it is not set.
Previous behaviour builded images for openvswitch as a default.

Change-Id: Ie11050917ea9749140356adfeeece2df280de9f0
Closes-Bug: #1818161
This commit is contained in:
Kamil Sambor 2019-03-04 10:59:31 +01:00
parent 6b10061115
commit 8762866b8d
3 changed files with 10 additions and 6 deletions

View File

@ -18,10 +18,10 @@ parameter_defaults:
name_suffix: ''
tag: current-tripleo
# Substitute neutron images based on driver. Can be <null>, 'ovn' or
# Substitute neutron images based on driver. Can be 'other', 'ovn' or
# 'odl'. This is usually set automatically by detecting if odl or ovn
# services are deployed.
neutron_driver: null
neutron_driver: 'ovn'
# Container image name components for Ceph images.
# Only used if Ceph is deployed.

View File

@ -112,12 +112,16 @@ def set_neutron_driver(pd, mapping_args):
:param mapping_args: Dict to set neutron_driver value on
"""
if not pd or 'NeutronMechanismDrivers' not in pd:
# we should set default neutron driver
mapping_args['neutron_driver'] = 'ovn'
return
nmd = pd['NeutronMechanismDrivers']
if 'opendaylight_v2' in nmd:
mapping_args['neutron_driver'] = 'odl'
elif 'ovn' in nmd:
mapping_args['neutron_driver'] = 'ovn'
else:
mapping_args['neutron_driver'] = 'other'
def container_images_prepare_multi(environment, roles_data, dry_run=False,

View File

@ -254,7 +254,7 @@ class TestKollaImageBuilderTemplate(base.TestCase):
'name_prefix': 'centos-binary-',
'name_suffix': '',
'tag': 'current-tripleo',
'neutron_driver': None,
'neutron_driver': 'ovn',
'openshift_namespace': 'docker.io/openshift',
'openshift_tag': 'v3.11.0',
'openshift_prefix': 'origin',
@ -1250,18 +1250,18 @@ class TestPrepare(base.TestCase):
def test_set_neutron_driver(self):
mapping_args = {}
kb.set_neutron_driver(None, mapping_args)
self.assertNotIn('neutron_driver', mapping_args)
self.assertEqual('ovn', mapping_args['neutron_driver'])
mapping_args = {}
kb.set_neutron_driver({}, mapping_args)
self.assertNotIn('neutron_driver', mapping_args)
self.assertEqual('ovn', mapping_args['neutron_driver'])
mapping_args = {}
kb.set_neutron_driver(
{'NeutronMechanismDrivers': ['sriovnicswitch', 'openvswitch']},
mapping_args
)
self.assertNotIn('neutron_driver', mapping_args)
self.assertEqual('other', mapping_args['neutron_driver'])
mapping_args = {}
kb.set_neutron_driver(