fix nxos_vpc_interface peer_link idempotence (#35737)

* fix peer_link idempotence

* review comment
This commit is contained in:
saichint 2018-02-06 19:05:43 -08:00 committed by Trishna Guha
commit c9e0ce1d7d
2 changed files with 49 additions and 7 deletions

View file

@ -193,12 +193,15 @@ def get_portchannel_vpc_config(module, portchannel):
def get_commands_to_config_vpc_interface(portchannel, delta, config_value, existing):
commands = []
if delta.get('peer-link') is False and existing.get('peer-link') is True:
command = 'no vpc peer-link'
if not delta.get('peer-link') and existing.get('peer-link'):
commands.append('no vpc peer-link')
commands.insert(0, 'interface port-channel{0}'.format(portchannel))
elif delta.get('peer-link') or not existing.get('vpc'):
elif delta.get('peer-link') and not existing.get('peer-link'):
commands.append('vpc peer-link')
commands.insert(0, 'interface port-channel{0}'.format(portchannel))
elif delta.get('vpc') and not existing.get('vpc'):
command = 'vpc {0}'.format(config_value)
commands.append(command)
commands.insert(0, 'interface port-channel{0}'.format(portchannel))