|
|
@ -75,6 +75,7 @@ options:
|
|
|
|
- Set VLAN mode to classical ethernet or fabricpath.
|
|
|
|
- Set VLAN mode to classical ethernet or fabricpath.
|
|
|
|
This is a valid option for Nexus 5000 and 7000 series.
|
|
|
|
This is a valid option for Nexus 5000 and 7000 series.
|
|
|
|
choices: ['ce','fabricpath']
|
|
|
|
choices: ['ce','fabricpath']
|
|
|
|
|
|
|
|
default: 'ce'
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
aggregate:
|
|
|
|
aggregate:
|
|
|
|
description: List of VLANs definitions.
|
|
|
|
description: List of VLANs definitions.
|
|
|
@ -154,6 +155,7 @@ import time
|
|
|
|
|
|
|
|
|
|
|
|
from copy import deepcopy
|
|
|
|
from copy import deepcopy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_capabilities
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
|
|
|
|
from ansible.module_utils.network.nxos.nxos import normalize_interface, nxos_argument_spec
|
|
|
|
from ansible.module_utils.network.nxos.nxos import normalize_interface, nxos_argument_spec
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
@ -196,6 +198,8 @@ def map_obj_to_commands(updates, module):
|
|
|
|
commands = list()
|
|
|
|
commands = list()
|
|
|
|
purge = module.params['purge']
|
|
|
|
purge = module.params['purge']
|
|
|
|
want, have = updates
|
|
|
|
want, have = updates
|
|
|
|
|
|
|
|
info = get_capabilities(module).get('device_info')
|
|
|
|
|
|
|
|
os_platform = info.get('network_os_platform')
|
|
|
|
|
|
|
|
|
|
|
|
for w in want:
|
|
|
|
for w in want:
|
|
|
|
vlan_id = w['vlan_id']
|
|
|
|
vlan_id = w['vlan_id']
|
|
|
@ -208,13 +212,15 @@ def map_obj_to_commands(updates, module):
|
|
|
|
state = w['state']
|
|
|
|
state = w['state']
|
|
|
|
del w['state']
|
|
|
|
del w['state']
|
|
|
|
|
|
|
|
|
|
|
|
obj_in_have = search_obj_in_list(vlan_id, have)
|
|
|
|
obj_in_have = search_obj_in_list(vlan_id, have) or {}
|
|
|
|
|
|
|
|
if not re.match('N[567]', os_platform) or (not obj_in_have.get('mode') and mode == 'ce'):
|
|
|
|
|
|
|
|
mode = w['mode'] = None
|
|
|
|
|
|
|
|
|
|
|
|
if state == 'absent':
|
|
|
|
if state == 'absent':
|
|
|
|
if obj_in_have:
|
|
|
|
if obj_in_have:
|
|
|
|
commands.append('no vlan {0}'.format(vlan_id))
|
|
|
|
commands.append('no vlan {0}'.format(vlan_id))
|
|
|
|
|
|
|
|
|
|
|
|
elif state == 'present':
|
|
|
|
elif state == 'present' and not purge:
|
|
|
|
if not obj_in_have:
|
|
|
|
if not obj_in_have:
|
|
|
|
commands.append('vlan {0}'.format(vlan_id))
|
|
|
|
commands.append('vlan {0}'.format(vlan_id))
|
|
|
|
|
|
|
|
|
|
|
@ -627,7 +633,7 @@ def main():
|
|
|
|
delay=dict(default=10, type='int'),
|
|
|
|
delay=dict(default=10, type='int'),
|
|
|
|
state=dict(choices=['present', 'absent'], default='present', required=False),
|
|
|
|
state=dict(choices=['present', 'absent'], default='present', required=False),
|
|
|
|
admin_state=dict(choices=['up', 'down'], required=False, default='up'),
|
|
|
|
admin_state=dict(choices=['up', 'down'], required=False, default='up'),
|
|
|
|
mode=dict(choices=['ce', 'fabricpath'], required=False),
|
|
|
|
mode=dict(default='ce', choices=['ce', 'fabricpath']),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
aggregate_spec = deepcopy(element_spec)
|
|
|
|
aggregate_spec = deepcopy(element_spec)
|
|
|
|