nxos_vrf_interface fix (#33249)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 7b19c28438
)
This commit is contained in:
parent
f78a60aaa6
commit
4550dbc9dc
1 changed files with 14 additions and 6 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,8 +158,8 @@ def get_interface_info(interface, module):
|
|||
if not interface.startswith('loopback'):
|
||||
interface = interface.capitalize()
|
||||
|
||||
command = 'show run | section interface.{0}'.format(interface)
|
||||
vrf_regex = ".*vrf\s+member\s+(?P<vrf>\S+).*"
|
||||
command = 'show run interface {0}'.format(interface)
|
||||
vrf_regex = r".*vrf\s+member\s+(?P<vrf>\S+).*"
|
||||
|
||||
try:
|
||||
body = execute_show_command(command, module)
|
||||
|
|
Loading…
Reference in a new issue