Browse Source

Prevent recursive check for vrf supported commands

On switches that do not support vrf instance command, if the command
fails it will try again to check which commands are supported and will
generate a loop. This will prevent the L3 plugin to check for vrf
supported commands while it is checking what command are supported

Change-Id: If441bbf2c5d3863282aaede55f7f6f130c67844e
changes/19/706419/1
Alin Iorga 2 weeks ago
parent
commit
b6d6c44428
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      networking_arista/l3Plugin/arista_l3_driver.py

+ 7
- 5
networking_arista/l3Plugin/arista_l3_driver.py View File

@@ -256,7 +256,8 @@ class AristaL3Driver(object):
'no vrf instance _tmp_openstack_vrf']
try:
self._run_config_cmds(cmds, host, log_exception=False,
keep_alive=keep_alive)
keep_alive=keep_alive,
update_vrf_commands=False)
except arista_exc.AristaServicePluginInvalidCommand:
msg = _('Switch does not support vrf instance command')
LOG.info(msg)
@@ -619,7 +620,7 @@ class AristaL3Driver(object):
raise arista_exc.AristaServicePluginRpcError(msg=msg)

def _run_config_cmds(self, commands, server, log_exception=True,
keep_alive=True):
keep_alive=True, update_vrf_commands=True):
"""Execute/sends a CAPI (Command API) command to EOS.

In this method, list of commands is appended with prefix and
@@ -631,10 +632,11 @@ class AristaL3Driver(object):
command_start = ['enable', 'configure']
command_end = ['exit']
full_command = command_start + commands + command_end
self._run_eos_cmds(full_command, server, log_exception, keep_alive)
self._run_eos_cmds(full_command, server, log_exception, keep_alive,
update_vrf_commands)

def _run_eos_cmds(self, commands, server, log_exception=True,
keep_alive=True):
keep_alive=True, update_vrf_commands=True):
LOG.info(_LI('Executing command on Arista EOS: %s'), commands)

try:
@@ -648,7 +650,7 @@ class AristaL3Driver(object):
'work on next retry.'))
if log_exception:
LOG.exception(msg)
if self._use_vrf:
if self._use_vrf and update_vrf_commands:
# For now we assume that the only command that raises this
# exception is vrf instance/definition and we need to update
# the current support


Loading…
Cancel
Save