[OVN] Add the VIF details "connectivity" parameter

In [1], the parameter was included in the mech driver "vif_details"
member, instead of adding it in each defined VIF type, "ovs" and
"vhostuser".

[1]https://review.opendev.org/c/openstack/networking-ovn/+/678599

NOTE: this patch differs from the master one (in "Y" release) due
to LP#1959125. Because the fix for this bug implies a change in
neutron-lib, this patch addresses the issue by leaving the
connectivity parameter in the OVN mech driver "vif_details"
dictionary, thus "_check_drivers_connectivity" can properly
check it.

Conflicts:
  neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py

Closes-Bug: #1947378

Change-Id: Ie9676fb2869cbf5b5cba9a7b27f2bfbbe0eab458
(cherry picked from commit b871dabdf4)
This commit is contained in:
Rodolfo Alonso Hernandez 2021-10-15 13:18:00 +00:00
parent b21c8965dd
commit 6be2df7eb5
2 changed files with 28 additions and 13 deletions

View File

@ -199,14 +199,23 @@ class OVNMechanismDriver(api.MechanismDriver):
]
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,
}

View File

@ -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
@ -38,6 +39,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):
@ -46,7 +57,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,
@ -103,12 +113,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',
@ -116,7 +124,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()
@ -124,13 +132,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',
@ -139,7 +145,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):