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

nxos fixes #36514

Merged
merged 2 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
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
22 changes: 17 additions & 5 deletions lib/ansible/modules/network/nxos/nxos_pim.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,33 @@
ssm_range:
description:
- Configure group ranges for Source Specific Multicast (SSM).
Valid values are multicast addresses or the keyword 'none'
or keyword 'default'
Valid values are multicast addresses or the keyword C(none)
or keyword C(default). C(none) removes all SSM group ranges.
C(default) will set ssm_range to the default multicast address.
If you set multicast address, please ensure that it is not the
same as the C(default), otherwise use the C(default) option.
required: true
'''
EXAMPLES = '''
- nxos_pim:
ssm_range: "232.0.0.0/8"
- name: Configure ssm_range
nxos_pim:
ssm_range: "224.0.0.0/8"

- name: Set to default
nxos_pim:
ssm_range: default

- name: Remove all ssm group ranges
nxos_pim:
ssm_range: none
'''

RETURN = '''
commands:
description: commands sent to the device
returned: always
type: list
sample: ["ip pim ssm range 232.0.0.0/8"]
sample: ["ip pim ssm range 224.0.0.0/8"]
'''


Expand Down
43 changes: 29 additions & 14 deletions lib/ansible/modules/network/nxos/nxos_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def map_obj_to_commands(updates, module):
state = module.params['state']
purge = module.params['purge']

args = ('rd', 'description', 'vni')

for w in want:
name = w['name']
description = w['description']
vni = w['vni']
rd = w['rd']
admin_state = w['admin_state']
vni = w['vni']
interfaces = w.get('interfaces') or []
state = w['state']
del w['state']
Expand All @@ -242,29 +242,44 @@ def map_obj_to_commands(updates, module):
elif state == 'present':
if not obj_in_have:
commands.append('vrf context {0}'.format(name))
if rd and rd != '':
commands.append('rd {0}'.format(rd))
if description:
commands.append('description {0}'.format(description))
if vni and vni != '':
commands.append('vni {0}'.format(vni))
for item in args:
candidate = w.get(item)
if candidate:
cmd = item + ' ' + str(candidate)
commands.append(cmd)
if admin_state == 'up':
commands.append('no shutdown')
elif admin_state == 'down':
commands.append('shutdown')

if commands:
if vni:
if have.get('vni') and have.get('vni') != '':
commands.insert(1, 'no vni {0}'.format(have['vni']))
commands.append('exit')

if interfaces:
for i in interfaces:
commands.append('interface {0}'.format(i))
commands.append('no switchport')
commands.append('vrf member {0}'.format(name))

else:
# If vni is already configured on vrf, unconfigure it first.
if vni:
if obj_in_have.get('vni') and vni != obj_in_have.get('vni'):
commands.append('no vni {0}'.format(obj_in_have.get('vni')))

for item in args:
candidate = w.get(item)
if candidate and candidate != obj_in_have.get(item):
cmd = item + ' ' + str(candidate)
commands.append(cmd)
if admin_state and admin_state != obj_in_have.get('admin_state'):
if admin_state == 'up':
commands.append('no shutdown')
elif admin_state == 'down':
commands.append('shutdown')

if commands:
commands.insert(0, 'vrf context {0}'.format(name))
commands.append('exit')

if interfaces:
if not obj_in_have['interfaces']:
for i in interfaces:
Expand Down