fixes nxos_interface (#24199)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/24280/head
Trishna Guha 8 years ago committed by GitHub
parent cec2b960f8
commit 67bd8f9204

@ -221,21 +221,22 @@ def get_manual_interface_attributes(interface, module):
if get_interface_type(interface) == 'svi': if get_interface_type(interface) == 'svi':
command = 'show interface {0}'.format(interface) command = 'show interface {0}'.format(interface)
try: try:
body = execute_show_command(command, module)[0] body = run_commands(module, [command])[0]
except IndexError: except IndexError:
return None return None
command_list = body.split('\n') if body:
desc = None command_list = body.split('\n')
admin_state = 'up' desc = None
for each in command_list: admin_state = 'up'
if 'Description:' in each: for each in command_list:
line = each.split('Description:') if 'Description:' in each:
desc = line[1].strip().split('MTU')[0].strip() line = each.split('Description:')
elif 'Administratively down' in each: desc = line[1].strip().split('MTU')[0].strip()
admin_state = 'down' elif 'Administratively down' in each:
admin_state = 'down'
return dict(description=desc, admin_state=admin_state)
return dict(description=desc, admin_state=admin_state)
else: else:
return None return None

Loading…
Cancel
Save