mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
fix nxos_vlan and nxos_switchport issues (#27505)
This commit is contained in:
parent
a52a4332fd
commit
37392318a6
19 changed files with 378 additions and 5 deletions
|
@ -307,7 +307,7 @@ def get_switchport_config_commands(interface, existing, proposed, module):
|
|||
commands.append(command)
|
||||
|
||||
if proposed_mode == 'access':
|
||||
av_check = existing.get('access_vlan') == proposed.get('access_vlan')
|
||||
av_check = str(existing.get('access_vlan')) == str(proposed.get('access_vlan'))
|
||||
if not av_check:
|
||||
command = 'switchport access vlan {0}'.format(proposed.get('access_vlan'))
|
||||
commands.append(command)
|
||||
|
@ -328,7 +328,7 @@ def get_switchport_config_commands(interface, existing, proposed, module):
|
|||
command = 'switchport trunk allowed vlan add {0}'.format(proposed.get('trunk_vlans'))
|
||||
commands.append(command)
|
||||
|
||||
native_check = existing.get('native_vlan') == proposed.get('native_vlan')
|
||||
native_check = str(existing.get('native_vlan')) == str(proposed.get('native_vlan'))
|
||||
if not native_check and proposed.get('native_vlan'):
|
||||
command = 'switchport trunk native vlan {0}'.format(proposed.get('native_vlan'))
|
||||
commands.append(command)
|
||||
|
@ -347,8 +347,8 @@ def is_switchport_default(existing):
|
|||
vlan 1 and trunk all and mode is access
|
||||
"""
|
||||
|
||||
c1 = existing['access_vlan'] == '1'
|
||||
c2 = existing['native_vlan'] == '1'
|
||||
c1 = str(existing['access_vlan']) == '1'
|
||||
c2 = str(existing['native_vlan']) == '1'
|
||||
c3 = existing['trunk_vlans'] == '1-4094'
|
||||
c4 = existing['mode'] == 'access'
|
||||
|
||||
|
@ -578,5 +578,6 @@ def main():
|
|||
|
||||
module.exit_json(**results)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -370,7 +370,10 @@ def main():
|
|||
if existing.get('mapped_vni'):
|
||||
if (existing.get('mapped_vni') != proposed.get('mapped_vni') and
|
||||
existing.get('mapped_vni') != '0' and proposed.get('mapped_vni') != 'default'):
|
||||
commands.insert(1, 'no vn-segment')
|
||||
if state == 'absent':
|
||||
commands = ['vlan ' + vlan_id, 'no vn-segment', 'no vlan ' + vlan_id]
|
||||
else:
|
||||
commands.insert(1, 'no vn-segment')
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True, commands=commands)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue