diff options
author | Dennis Israelsson <dennis.israelsson@gmail.com> | 2017-08-01 19:27:47 +0200 |
---|---|---|
committer | Chris Alfonso <christopher.alfonso@gmail.com> | 2017-08-01 11:27:47 -0600 |
commit | d7202e61554bac18107867eacd46d49d31a0b879 (patch) | |
tree | 388e56121fb7ce157b8a99d2f8fc14b09a3dcd27 /lib | |
parent | 448c46194058df46f1030ea52e517dbdb2fcfe97 (diff) | |
download | ansible-d7202e61554bac18107867eacd46d49d31a0b879.tar.gz |
Add fabricpath support for nxos_vlan (#26013)
* Add files via upload
Fix for issue #25720
* nxos_vlan fabricpath (#25720)
Fix for issue #25720
* Add files via upload
* Add files via upload
* Delete nxos_vlan.py
* Add files via upload
* Add files via upload
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/modules/network/nxos/nxos_vlan.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/ansible/modules/network/nxos/nxos_vlan.py b/lib/ansible/modules/network/nxos/nxos_vlan.py index 6aba11f100..a196271e78 100644 --- a/lib/ansible/modules/network/nxos/nxos_vlan.py +++ b/lib/ansible/modules/network/nxos/nxos_vlan.py @@ -74,6 +74,13 @@ options: required: false default: present choices: ['present','absent'] + mode: + description: + - Set VLAN mode to classical ethernet or fabricpath. + required: false + default: null + choices: ['ce','fabricpath'] + version_added: "2.4" ''' EXAMPLES = ''' @@ -228,6 +235,7 @@ def get_vlan(vlanid, module): try: body = run_commands(module, [command])[0] vlan_table = body['TABLE_vlanbriefid']['ROW_vlanbriefid'] + mtu_table = body['TABLE_mtuinfoid']['ROW_mtuinfoid'] except (TypeError, IndexError, KeyError): return {} @@ -240,11 +248,18 @@ def get_vlan(vlanid, module): vlan = apply_key_map(key_map, vlan_table) + vlan['mode'] = mtu_table['vlanshowinfo-vlanmode'] + value_map = { "admin_state": { "shutdown": "down", "noshutdown": "up" + }, + "mode": { + "fabricpath-vlan": "fabricpath", + "ce-vlan": "ce" } + } vlan = apply_value_map(value_map, vlan) @@ -284,6 +299,7 @@ def main(): mapped_vni=dict(required=False, type='str'), state=dict(choices=['present', 'absent'], default='present', required=False), admin_state=dict(choices=['up', 'down'], required=False), + mode=dict(choices=['ce', 'fabricpath'], required=False), # Deprecated in Ansible 2.4 include_defaults=dict(default=False), @@ -309,13 +325,14 @@ def main(): admin_state = module.params['admin_state'] mapped_vni = module.params['mapped_vni'] state = module.params['state'] + mode = module.params['mode'] if vlan_id: if not vlan_id.isdigit(): module.fail_json(msg='vlan_id must be a valid VLAN ID') args = dict(name=name, vlan_state=vlan_state, - admin_state=admin_state, mapped_vni=mapped_vni) + admin_state=admin_state, mapped_vni=mapped_vni, mode=mode) proposed = dict((k, v) for k, v in args.items() if v is not None) |