Add a manage_fabric configuration option

For fabric segments, the physnet is None. We should offer the
ability for a deployer to toggle whether arista driver acts as the
fabric driver while also offering the ability to have the arista
driver manage only a subset of VLAN segments. (I also cleaned up
some of our config descriptions.)

Change-Id: I4b2e6bd44e948dbeefefe0d344d551ee9e83e5dd
changes/57/447157/2
Mitchell Jameson 6 years ago
parent d7758a3f28
commit fd6cdf8e1d

@ -31,11 +31,11 @@
#
# (IntOpt) Sync interval in seconds between Neutron plugin and EOS.
# This field defines how often the synchronization is performed.
# This is an optional field. If not set, a value of 180 seconds
# This is an optional field. If not set, a value of 30 seconds
# is assumed.
#
# sync_interval =
# Example: sync_interval = 60
# Example: sync_interval = 30
#
# (StrOpt) Defines Region Name that is assigned to this OpenStack Controller.
# This is useful when multiple OpenStack/Neutron controllers are
@ -48,21 +48,43 @@
# Example: region_name = RegionOne
#
# (BoolOpt) Specifies if the Security Groups need to be deployed for baremetal
# deployments. If this flag is set to "True", this means switch_info
# (see below) must be defined. If this flag is not defined, it is
# assumed to be False.
# deployments. If this flag is set to "True", this means switch_info
# (see below) must be defined. If this flag is not defined, it is
# assumed to be False.
#
# sec_group_support =
# Example: sec_group_support = True
#
# (ListOpt) This is a comma separated list of Arista Switches where the
# Security groups (i.e. ACLs) need to be applied. Each string has
# three values separated by ":" in the following format.
# <switch IP>:<username>:<password>,<switch IP>:<username>:<password>
# This is required if sec_group_support is set to "True"
# (ListOpt) This is a comma separated list of Arista switches where
# security groups (i.e. ACLs) need to be applied. Each string has
# three values separated by ":" in the following format.
# <switch IP>:<username>:<password>,<switch IP>:<username>:<password>
# This is required if sec_group_support is set to "True"
#
# switch_info =
# Example: switch_info = 172.13.23.55:admin:admin,172.13.23.56:admin:admin
#
# (StrOpt) Tells the plugin to use a sepcific API interfaces to communicate
# with CVX. Valid options are:
# EAPI - Use EOS' extensible API.
# JSON - Use EOS' JSON/REST API.
# api_type =
# Example: api_type = EAPI
#
# (ListOpt) This is a comma separated list of physical networks which are
# managed by Arista switches. This list will be used in
# by the Arista ML2 plugin to make the decision if it can
# participate on binding or updating a port.
#
# managed_physnets =
# Example: managed_physnets = arista_network
#
# (BoolOpt) Specifies whether the Arista ML2 plugin should bind ports to vxlan
# fabric segments and dynamically allocate vlan segments based on
# the host to connect the port to the vxlan fabric.
#
# manage_fabric =
# Example: manage_fabric = False
[l3_arista]

@ -82,8 +82,8 @@ ARISTA_DRIVER_OPTS = [
'to be False')),
cfg.ListOpt('switch_info',
default=[],
help=_('This is a comma separated list of Arista Switches '
'where the Security groups (i.e. ACLs) need to be '
help=_('This is a comma separated list of Arista switches '
'where security groups (i.e. ACLs) need to be '
'applied. Each string has three values separated '
'by : in the follow format '
'<IP of switch>:<username>:<password>, ...... '
@ -95,17 +95,23 @@ ARISTA_DRIVER_OPTS = [
default='EAPI',
help=_('Tells the plugin to use a sepcific API interfaces '
'to communicate with CVX. Valid options are:'
'EAPI - Use EOS\' external API.'
'EAPI - Use EOS\' extensible API.'
'JSON - Use EOS\' JSON/REST API.')),
cfg.ListOpt('managed_physnets',
default=[],
help=_('This is a comma separated list of physical networks '
'which are managed by Arista Switches.'
'This list will be used in bind_port/update_port by '
'Arista mechanism driver to make decision if it can '
'participate on binding or updating a port.'
'which are managed by Arista switches.'
'This list will be used by the Arista ML2 plugin'
'to make the decision if it can participate in binding'
'or updating a port.'
'For Example: '
'managed_physnets = arista_network')),
cfg.BoolOpt('manage_fabric',
default=False,
help=_('Specifies whether the Arista ML2 plugin should bind '
'ports to vxlan fabric segments and dynamically '
'allocate vlan segments based on the host to connect '
'the port to the vxlan fabric')),
]

@ -71,6 +71,7 @@ class AristaDriver(driver_api.MechanismDriver):
self.timer = None
self.sync_timeout = confg['sync_interval']
self.managed_physnets = confg['managed_physnets']
self.manage_fabric = confg['manage_fabric']
self.eos_sync_lock = threading.Lock()
self.eapi = None
@ -408,8 +409,11 @@ class AristaDriver(driver_api.MechanismDriver):
return tid
def _is_in_managed_physnets(self, physnet):
# Check if this is a fabric segment
if not physnet:
return self.manage_fabric
# If managed physnet is empty, accept all.
if not self.managed_physnets:
# If managed physnet is empty, accept all.
return True
# managed physnet is not empty, find for matching physnet
return any(pn == physnet for pn in self.managed_physnets)

Loading…
Cancel
Save