Fix nxos_interface error for nxapi and idempotence problem (#29136)

* Fix nxos_interface nxapi error and idempotence

* Make shippable happy
This commit is contained in:
Mike Wiebe 2017-09-14 13:25:35 -04:00 committed by Nathaniel Case
parent 58088e836e
commit 3faba93a2b
2 changed files with 139 additions and 9 deletions

View file

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