diff --git a/container-images/container_image_prepare_defaults.yaml b/container-images/container_image_prepare_defaults.yaml index a6da18a08..13ad72076 100644 --- a/container-images/container_image_prepare_defaults.yaml +++ b/container-images/container_image_prepare_defaults.yaml @@ -18,10 +18,10 @@ parameter_defaults: name_suffix: '' tag: current-tripleo - # Substitute neutron images based on driver. Can be , '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. diff --git a/tripleo_common/image/kolla_builder.py b/tripleo_common/image/kolla_builder.py index 4468fa3cd..b572b1063 100644 --- a/tripleo_common/image/kolla_builder.py +++ b/tripleo_common/image/kolla_builder.py @@ -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, diff --git a/tripleo_common/tests/image/test_kolla_builder.py b/tripleo_common/tests/image/test_kolla_builder.py index 2cae8e5a4..9ead830a5 100644 --- a/tripleo_common/tests/image/test_kolla_builder.py +++ b/tripleo_common/tests/image/test_kolla_builder.py @@ -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(