nxos_vrf_interface fix (#33249)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
25a465ffcb
commit
7b19c28438
1 changed files with 13 additions and 5 deletions
|
@ -121,10 +121,18 @@ def get_interface_mode(interface, intf_type, module):
|
|||
|
||||
if intf_type in ['ethernet', 'portchannel']:
|
||||
body = execute_show_command(command, module)
|
||||
interface_table = body['TABLE_interface']['ROW_interface']
|
||||
mode = str(interface_table.get('eth_mode', 'layer3'))
|
||||
if mode == 'access' or mode == 'trunk':
|
||||
mode = 'layer2'
|
||||
try:
|
||||
interface_table = body['TABLE_interface']['ROW_interface']
|
||||
except KeyError:
|
||||
return mode
|
||||
|
||||
if interface_table and isinstance(interface_table, dict):
|
||||
mode = str(interface_table.get('eth_mode', 'layer3'))
|
||||
if mode == 'access' or mode == 'trunk':
|
||||
mode = 'layer2'
|
||||
else:
|
||||
return mode
|
||||
|
||||
elif intf_type == 'loopback' or intf_type == 'svi':
|
||||
mode = 'layer3'
|
||||
return mode
|
||||
|
@ -150,7 +158,7 @@ def get_interface_info(interface, module):
|
|||
if not interface.startswith('loopback'):
|
||||
interface = interface.capitalize()
|
||||
|
||||
command = 'show run | section interface.{0}'.format(interface)
|
||||
command = 'show run interface {0}'.format(interface)
|
||||
vrf_regex = r".*vrf\s+member\s+(?P<vrf>\S+).*"
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue