diff --git a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py index 214259d5198..5cd541fe3f3 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py +++ b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py @@ -130,6 +130,10 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): super(OpenvswitchMechanismDriver, self).bind_port(context) def get_vif_type(self, context, agent, segment): + if (context.current.get(portbindings.VNIC_TYPE) == + portbindings.VNIC_DIRECT): + return portbindings.VIF_TYPE_OVS + caps = agent['configurations'].get('ovs_capabilities', {}) if (any(x in caps.get('iface_types', []) for x in [a_const.OVS_DPDK_VHOST_USER, diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py index cf073b5471a..0bbd49e0c05 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py @@ -285,13 +285,22 @@ class OpenvswitchMechanismDPDKTestCase(OpenvswitchMechanismBaseTestCase): self.assertEqual(portbindings.VHOST_USER_MODE_SERVER, result) def test_get_vif_type(self): - result = self.driver.get_vif_type(None, self.AGENT, None) + normal_port_cxt = base.FakePortContext(None, None, None) + result = self.driver.get_vif_type(normal_port_cxt, self.AGENT, None) self.assertEqual(portbindings.VIF_TYPE_VHOST_USER, result) - result = self.driver.get_vif_type(None, self.AGENT_SERVER, None) + result = self.driver.get_vif_type(normal_port_cxt, + self.AGENT_SERVER, None) self.assertEqual(portbindings.VIF_TYPE_VHOST_USER, result) - result = self.driver.get_vif_type(None, self.AGENT_SYSTEM, None) + result = self.driver.get_vif_type(normal_port_cxt, + self.AGENT_SYSTEM, None) + self.assertEqual(portbindings.VIF_TYPE_OVS, result) + + direct_port_cxt = base.FakePortContext( + None, None, None, vnic_type=portbindings.VNIC_DIRECT) + result = self.driver.get_vif_type(direct_port_cxt, + self.AGENT, None) self.assertEqual(portbindings.VIF_TYPE_OVS, result) diff --git a/releasenotes/notes/ovs-dpdk-rep-port-40fe628974040786.yaml b/releasenotes/notes/ovs-dpdk-rep-port-40fe628974040786.yaml new file mode 100644 index 00000000000..677a8df9184 --- /dev/null +++ b/releasenotes/notes/ovs-dpdk-rep-port-40fe628974040786.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds support for OVS DPDK port representors, a direct port on + a netdev datapath is considered a DPDK representor port.