diff --git a/neutron/common/ovn/utils.py b/neutron/common/ovn/utils.py index f862e63d673..9e42a5fe6e8 100644 --- a/neutron/common/ovn/utils.py +++ b/neutron/common/ovn/utils.py @@ -433,7 +433,7 @@ def validate_and_get_data_from_binding_profile(port): if (constants.OVN_PORT_BINDING_PROFILE not in port or not validators.is_attr_set( port[constants.OVN_PORT_BINDING_PROFILE])): - BPInfo({}, None, []) + return BPInfo({}, None, []) param_set = {} param_dict = {} vnic_type = port.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL) diff --git a/neutron/tests/unit/common/ovn/test_utils.py b/neutron/tests/unit/common/ovn/test_utils.py index e0821d682f9..f5393761f07 100644 --- a/neutron/tests/unit/common/ovn/test_utils.py +++ b/neutron/tests/unit/common/ovn/test_utils.py @@ -756,6 +756,11 @@ class TestValidateAndGetDataFromBindingProfile(base.BaseTestCase): {portbindings.VNIC_TYPE: portbindings.VNIC_DIRECT, constants.OVN_PORT_BINDING_PROFILE: binding_profile})) + def test_valid_input_no_binding_profile(self): + # Confirm that we treat a port without binding:profile as valid + self.assertEqual(utils.BPInfo({}, None, []), + utils.validate_and_get_data_from_binding_profile({})) + def test_unknown_profile_items_pruned(self): # Confirm that unknown profile items are pruned self.assertEqual(