forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.yaml
116 lines (94 loc) · 3.13 KB
/
sanity.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
- debug: msg="START connection={{ ansible_connection }} nxos_igmp_snooping sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- meta: end_host
# show ip igmp snooping | json does not work on some platforms
when: platform is search('N6K')
- set_fact: gt_run="false"
- block:
- set_fact: gt_run="true"
- set_fact: group_timeout="never"
- set_fact: def_group_timeout="default"
when: platform is not search('N35|N5K|N6K')
- name: Setup
nxos_igmp_snooping: &default
provider: "{{ connection }}"
state: default
- block:
- name: Configure igmp snooping with non-default values
nxos_igmp_snooping: &non-default
snooping: false
# group_timeout: n/a when snooping:false
link_local_grp_supp: false
report_supp: false
v3_report_supp: true
provider: "{{ connection }}"
state: present
register: result
- assert: &true
that:
- "result.changed == true"
- block:
- name: "Check Idempotence - Configure igmp snooping with non-default values"
nxos_igmp_snooping: *non-default
register: result
- assert: &false
that:
- "result.changed == false"
when: (imagetag and (imagetag is version_compare('D1', 'ne')))
- block:
- name: Negative Test config group-timeout when igmp snooping disabled
nxos_igmp_snooping:
snooping: false
group_timeout: "{{group_timeout|default(omit)}}"
provider: "{{ connection }}"
state: present
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "result.msg == 'group-timeout cannot be enabled or changed when ip igmp snooping is disabled'"
- name: Configure group-timeout non-default
nxos_igmp_snooping: &non-defgt
snooping: true
group_timeout: "{{group_timeout|default(omit)}}"
provider: "{{ connection }}"
state: present
register: result
- assert: *true
- name: "Check Idempotence"
nxos_igmp_snooping: *non-defgt
register: result
- assert: *false
when: gt_run
- name: Configure igmp snooping with default group timeout
nxos_igmp_snooping: &defgt
group_timeout: "{{def_group_timeout|default(omit)}}"
provider: "{{ connection }}"
state: present
register: result
- 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
register: result
- assert: *true
- block:
- name: "Check Idempotence - Configure igmp snooping with default values"
nxos_igmp_snooping: *default
register: result
- assert: *false
when: (imagetag and (imagetag is version_compare('D1', 'ne')))
always:
- name: Configure igmp snooping with default values
nxos_igmp_snooping: *default
register: result
- debug: msg="END connection={{ ansible_connection }} nxos_igmp_snooping sanity test"