Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing nxos_vlan to match platform agnostic net_vlan part2 #32410

Merged
merged 3 commits into from
Nov 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/ansible/modules/network/nxos/nxos_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
vlan_state:
description:
- Manage the vlan operational state of the VLAN
(equivalent to state {active | suspend} command.
This is being deprecated in favor of state.
required: false
default: active
choices: ['active','suspend']
Expand All @@ -69,9 +69,10 @@
state:
description:
- Manage the state of the resource.
Active and Suspend will assume the vlan is present.
required: false
default: present
choices: ['present','absent']
choices: ['present','absent', 'active', 'suspend']
mode:
description:
- Set VLAN mode to classical ethernet or fabricpath.
Expand Down Expand Up @@ -286,9 +287,10 @@ def main():
name=dict(required=False),
vlan_state=dict(choices=['active', 'suspend'], required=False),
mapped_vni=dict(required=False, type='str'),
state=dict(choices=['present', 'absent'], default='present', required=False),
state=dict(choices=['present', 'absent', 'active', 'suspend'], default='present', required=False),
admin_state=dict(choices=['up', 'down'], required=False),
mode=dict(choices=['ce', 'fabricpath'], required=False),

)

argument_spec.update(nxos_argument_spec)
Expand All @@ -309,6 +311,13 @@ def main():
admin_state = module.params['admin_state']
mapped_vni = module.params['mapped_vni']
state = module.params['state']

# this allows vlan_state to remain backwards compatible as we move towards
# pushing all 4 options into state to match net_vlan
if state == 'active' or state == 'suspend':
vlan_state = module.params['state']
state = 'present'

mode = module.params['mode']

if vlan_id:
Expand Down