OVS DPDK port representors support

Adds support for OVS DPDK port representors[1], a direct port on
a netdev datapath is considered a DPDK representor port.

get_vif_type returns OVS VIF type in case of a direct port.

[1] http://docs.openvswitch.org/en/latest/topics/dpdk/phy/#representors

Closes-Bug: #1829734
Change-Id: I3956eeda19ebc93fdb0b13c1cfb3dc64abffee9f
This commit is contained in:
Hamdy Khader 2019-05-13 13:39:57 +03:00
parent 3e1cd9abef
commit 47390226f5
3 changed files with 21 additions and 3 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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.