nxos_igmp_snooping fix cherry-pick (#38596)

* fix nxos_igmp_snooping issues (#38566)

* fix nxos_igmp_snooping issue

* shippable error fix

(cherry picked from commit ed42331105)

* update nxos changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/38053/head
Trishna Guha 8 years ago committed by GitHub
parent 8b8455523d
commit 91c8a8dccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,3 +17,4 @@ bugfixes:
- nxos_acl_interface test - Fix nxos_acl_interface test (https://github.com/ansible/ansible/pull/38230)
- nxos_igmp - Fix nxos_igmp (https://github.com/ansible/ansible/pull/38496)
- nxos_hsrp - Fix nxos_hsrp (https://github.com/ansible/ansible/pull/38410)
- nxos_igmp_snooping - Fix nxos_igmp_snooping (https://github.com/ansible/ansible/pull/38566)

@ -40,37 +40,27 @@ options:
snooping:
description:
- Enables/disables IGMP snooping on the switch.
required: false
default: null
choices: ['true', 'false']
type: bool
group_timeout:
description:
- Group membership timeout value for all VLANs on the device.
Accepted values are integer in range 1-10080, I(never) and
I(default).
required: false
default: null
link_local_grp_supp:
description:
- Global link-local groups suppression.
required: false
default: null
choices: ['true', 'false']
type: bool
report_supp:
description:
- Global IGMPv1/IGMPv2 Report Suppression.
required: false
default: null
type: bool
v3_report_supp:
description:
- Global IGMPv3 Report Suppression and Proxy Reporting.
required: false
default: null
choices: ['true', 'false']
type: bool
state:
description:
- Manage the state of the resource.
required: false
default: present
choices: ['present','default']
'''
@ -138,17 +128,6 @@ def get_group_timeout(config):
return value
def get_snooping(config):
REGEX = re.compile(r'{0}$'.format('no ip igmp snooping'), re.M)
value = False
try:
if REGEX.search(config):
value = False
except TypeError:
value = True
return value
def get_igmp_snooping(module):
command = 'show ip igmp snooping'
existing = {}
@ -207,6 +186,9 @@ def config_igmp_snooping(delta, existing, default=False):
if default and key == 'group_timeout':
if existing.get(key):
command = 'no ' + CMDS.get(key).format(existing.get(key))
elif value == 'default' and key == 'group_timeout':
if existing.get(key):
command = 'no ' + CMDS.get(key).format(existing.get(key))
else:
command = CMDS.get(key).format(value)
else:

@ -3,14 +3,24 @@
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: gt_run="false"
- set_fact: gt_run="true"
when: not (platform is match("N5K")) and not (platform is match("N35"))
- set_fact: group_timeout="never"
when: not (platform is match("N5K")) and not (platform is match("N35"))
- set_fact: def_group_timeout="default"
when: not (platform is match("N5K")) and not (platform is match("N35"))
- block:
- name: Configure igmp snooping with non-default values
nxos_igmp_snooping: &non-default
snooping: true
group_timeout: never
link_local_grp_supp: true
report_supp: true
snooping: false
group_timeout: "{{group_timeout|default(omit)}}"
link_local_grp_supp: false
report_supp: false
v3_report_supp: true
state: present
provider: "{{ connection }}"
@ -19,14 +29,33 @@
- assert: &true
that:
- "result.changed == true"
- block:
- name: "Check Idempotence - Configure igmp snooping with non-default values"
nxos_igmp_snooping: *non-default
register: result
- name: "Check Idempotence - Configure igmp snooping with non-default values"
nxos_igmp_snooping: *non-default
- assert: &false
that:
- "result.changed == false"
when: (imagetag and (imagetag is version_compare('D1', 'ne')))
- name: Configure igmp snooping with default group timeout
nxos_igmp_snooping: &defgt
group_timeout: "{{def_group_timeout|default(omit)}}"
state: present
provider: "{{ connection }}"
register: result
- assert: &false
that:
- "result.changed == false"
- assert: *true
when: gt_run
- block:
- name: "Check Idempotence"
nxos_igmp_snooping: *defgt
register: result
- assert: *false
when: gt_run or (imagetag and (imagetag is version_compare('D1', 'ne')))
- name: Configure igmp snooping with default values
nxos_igmp_snooping: &default
@ -36,11 +65,13 @@
- assert: *true
- name: "Check Idempotence - Configure igmp snooping with default values"
nxos_igmp_snooping: *default
register: result
- block:
- name: "Check Idempotence - Configure igmp snooping with default values"
nxos_igmp_snooping: *default
register: result
- assert: *false
- assert: *false
when: (imagetag and (imagetag is version_compare('D1', 'ne')))
always:
- name: Configure igmp snooping with default values

Loading…
Cancel
Save