Browse Source

Add "connectivity" parameter in vif_details

Added "connectivity" parameter to mech driver vif_details. The default
value is "legacy". The in-tree drivers (Linux Bridge, Open vSwitch, SR-IOV
and MacVTap) have "l2" connectivity.

Change-Id: I45480986fc89e0b2f475ee0ceb13d8742fb8c530
Related-Bug: #1821058
tags/15.0.0.0b1
Rodolfo Alonso Hernandez 1 year ago
parent
commit
a70f07deb1
6 changed files with 23 additions and 12 deletions
  1. +4
    -1
      neutron/plugins/ml2/drivers/linuxbridge/mech_driver/mech_linuxbridge.py
  2. +4
    -1
      neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py
  3. +3
    -1
      neutron/plugins/ml2/drivers/mech_agent.py
  4. +3
    -1
      neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py
  5. +3
    -1
      neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py
  6. +6
    -7
      neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py

+ 4
- 1
neutron/plugins/ml2/drivers/linuxbridge/mech_driver/mech_linuxbridge.py View File

@@ -33,10 +33,13 @@ class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):

def __init__(self):
sg_enabled = securitygroups_rpc.is_firewall_enabled()
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2}
super(LinuxbridgeMechanismDriver, self).__init__(
constants.AGENT_TYPE_LINUXBRIDGE,
portbindings.VIF_TYPE_BRIDGE,
{portbindings.CAP_PORT_FILTER: sg_enabled})
vif_details)
lb_qos_driver.register()

def get_allowed_network_types(self, agent):


+ 4
- 1
neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py View File

@@ -38,10 +38,13 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
"""

def __init__(self):
vif_details = {portbindings.CAP_PORT_FILTER: False,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2}
super(MacvtapMechanismDriver, self).__init__(
constants.AGENT_TYPE_MACVTAP,
portbindings.VIF_TYPE_MACVTAP,
{portbindings.CAP_PORT_FILTER: False})
vif_details)

def get_allowed_network_types(self, agent):
return [constants.TYPE_FLAT, constants.TYPE_VLAN]


+ 3
- 1
neutron/plugins/ml2/drivers/mech_agent.py View File

@@ -265,7 +265,9 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase):
super(SimpleAgentMechanismDriverBase, self).__init__(
agent_type, supported_vnic_types)
self.vif_type = vif_type
self.vif_details = vif_details
self.vif_details = {portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_LEGACY}
self.vif_details.update(vif_details)

def try_to_bind_segment_for_agent(self, context, segment, agent):
if self.check_segment_for_agent(segment, agent):


+ 3
- 1
neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py View File

@@ -55,7 +55,9 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):

def __init__(self,
agent_type=constants.AGENT_TYPE_NIC_SWITCH,
vif_details={portbindings.CAP_PORT_FILTER: False},
vif_details={portbindings.CAP_PORT_FILTER: False,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2},
supported_vnic_types=[portbindings.VNIC_DIRECT,
portbindings.VNIC_MACVTAP,
portbindings.VNIC_DIRECT_PHYSICAL]):


+ 3
- 1
neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py View File

@@ -62,7 +62,9 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
IPTABLES_FW_DRIVER_FULL, 'iptables_hybrid')
) and sg_enabled
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
portbindings.OVS_HYBRID_PLUG: hybrid_plug_required}
portbindings.OVS_HYBRID_PLUG: hybrid_plug_required,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2}
# NOTE(moshele): Bind DIRECT (SR-IOV) port allows
# to offload the OVS flows using tc to the SR-IOV NIC.
# We are using OVS mechanism driver because the openvswitch (>=2.8.0)


+ 6
- 7
neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py View File

@@ -34,7 +34,9 @@ class OpenvswitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
VIF_DETAILS = {'bridge_name': 'br-int',
portbindings.OVS_DATAPATH_TYPE: 'system',
portbindings.CAP_PORT_FILTER: True,
portbindings.OVS_HYBRID_PLUG: True}
portbindings.OVS_HYBRID_PLUG: True,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2}
AGENT_TYPE = constants.AGENT_TYPE_OVS

GOOD_MAPPINGS = {'fake_physical_network': 'fake_bridge'}
@@ -112,7 +114,9 @@ class OpenvswitchMechanismSGDisabledBaseTestCase(
VIF_DETAILS = {'bridge_name': 'br-int',
portbindings.OVS_DATAPATH_TYPE: 'system',
portbindings.CAP_PORT_FILTER: False,
portbindings.OVS_HYBRID_PLUG: False}
portbindings.OVS_HYBRID_PLUG: False,
portbindings.VIF_DETAILS_CONNECTIVITY:
portbindings.CONNECTIVITY_L2}

def setUp(self):
cfg.CONF.set_override('enable_security_group',
@@ -218,11 +222,6 @@ class OpenvswitchMechanismSGDisabledLocalTestCase(
class OpenvswitchMechanismFirewallUndefinedTestCase(
OpenvswitchMechanismBaseTestCase, base.AgentMechanismLocalTestCase):

VIF_DETAILS = {'bridge_name': 'br-int',
portbindings.OVS_DATAPATH_TYPE: 'system',
portbindings.CAP_PORT_FILTER: True,
portbindings.OVS_HYBRID_PLUG: True}

def setUp(self):
# this simple test case just ensures backward compatibility where
# the server has no firewall driver configured, which should result


Loading…
Cancel
Save