diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py index 0a44c62f4f8..87f2fad1f5f 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py @@ -163,14 +163,23 @@ class OVNMechanismDriver(api.MechanismDriver): portbindings.VNIC_MACVTAP] self.vif_details = { portbindings.VIF_TYPE_OVS: { - portbindings.CAP_PORT_FILTER: self.sg_enabled + portbindings.CAP_PORT_FILTER: self.sg_enabled, + portbindings.VIF_DETAILS_CONNECTIVITY: + portbindings.CONNECTIVITY_L2, }, portbindings.VIF_TYPE_VHOST_USER: { portbindings.CAP_PORT_FILTER: False, portbindings.VHOST_USER_MODE: portbindings.VHOST_USER_MODE_SERVER, - portbindings.VHOST_USER_OVS_PLUG: True + portbindings.VHOST_USER_OVS_PLUG: True, + portbindings.VIF_DETAILS_CONNECTIVITY: + portbindings.CONNECTIVITY_L2, }, + # NOTE(ralonsoh): for stable releases, this parameter is left here + # to allow "_check_drivers_connectivity" to check the OVN mech + # driver connectivity correctly. This addresses LP#1959125, that + # in master branch ("Y") was solved by adding a "connectivity" + # property to the "MechanismDriver" class. portbindings.VIF_DETAILS_CONNECTIVITY: portbindings.CONNECTIVITY_L2, } diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index b5d56a53089..a66cfb2034c 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import copy import functools import re from unittest import mock @@ -37,6 +38,16 @@ from neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb import ovn_client from neutron.tests import base as tests_base from neutron.tests.functional import base +VHU_MODE = 'server' +OVS_VIF_DETAILS = { + portbindings.CAP_PORT_FILTER: True, + portbindings.VIF_DETAILS_CONNECTIVITY: portbindings.CONNECTIVITY_L2} +VHOSTUSER_VIF_DETAILS = { + portbindings.CAP_PORT_FILTER: False, + 'vhostuser_mode': VHU_MODE, + 'vhostuser_ovs_plug': True, + portbindings.VIF_DETAILS_CONNECTIVITY: portbindings.CONNECTIVITY_L2} + class TestPortBinding(base.TestOVNFunctionalBase): @@ -45,7 +56,6 @@ class TestPortBinding(base.TestOVNFunctionalBase): self.ovs_host = 'ovs-host' self.dpdk_host = 'dpdk-host' self.invalid_dpdk_host = 'invalid-host' - self.vhu_mode = 'server' self.add_fake_chassis(self.ovs_host) self.add_fake_chassis( self.dpdk_host, @@ -102,12 +112,10 @@ class TestPortBinding(base.TestOVNFunctionalBase): def test_port_binding_create_port(self): port_id = self._create_or_update_port(hostname=self.ovs_host) self._verify_vif_details(port_id, self.ovs_host, 'ovs', - {'port_filter': True}) + OVS_VIF_DETAILS) port_id = self._create_or_update_port(hostname=self.dpdk_host) - expected_vif_details = {'port_filter': False, - 'vhostuser_mode': self.vhu_mode, - 'vhostuser_ovs_plug': True} + expected_vif_details = copy.deepcopy(VHOSTUSER_VIF_DETAILS) expected_vif_details['vhostuser_socket'] = ( utils.ovn_vhu_sockpath(cfg.CONF.ovn.vhost_sock_dir, port_id)) self._verify_vif_details(port_id, self.dpdk_host, 'vhostuser', @@ -115,7 +123,7 @@ class TestPortBinding(base.TestOVNFunctionalBase): port_id = self._create_or_update_port(hostname=self.invalid_dpdk_host) self._verify_vif_details(port_id, self.invalid_dpdk_host, 'ovs', - {'port_filter': True}) + OVS_VIF_DETAILS) def test_port_binding_update_port(self): port_id = self._create_or_update_port() @@ -123,13 +131,11 @@ class TestPortBinding(base.TestOVNFunctionalBase): port_id = self._create_or_update_port(port_id=port_id, hostname=self.ovs_host) self._verify_vif_details(port_id, self.ovs_host, 'ovs', - {'port_filter': True}) + OVS_VIF_DETAILS) port_id = self._create_or_update_port(port_id=port_id, hostname=self.dpdk_host) - expected_vif_details = {'port_filter': False, - 'vhostuser_mode': self.vhu_mode, - 'vhostuser_ovs_plug': True} + expected_vif_details = copy.deepcopy(VHOSTUSER_VIF_DETAILS) expected_vif_details['vhostuser_socket'] = ( utils.ovn_vhu_sockpath(cfg.CONF.ovn.vhost_sock_dir, port_id)) self._verify_vif_details(port_id, self.dpdk_host, 'vhostuser', @@ -138,7 +144,7 @@ class TestPortBinding(base.TestOVNFunctionalBase): port_id = self._create_or_update_port(port_id=port_id, hostname=self.invalid_dpdk_host) self._verify_vif_details(port_id, self.invalid_dpdk_host, 'ovs', - {'port_filter': True}) + OVS_VIF_DETAILS) class TestPortBindingOverTcp(TestPortBinding):