Debian Codegraph @

ansible_collections/cisco/aci/tests/integration/targets/aci_domain/tasks/l3dom.yml

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2018, Dag Wieers (@dagwieers) <[email protected]>
3
4 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6
7 # CLEAN ENVIRONMENT
8 - name: Remove L3 domain
9 cisco.aci.aci_domain: &domain_absent
10 host: "{{ aci_hostname }}"
11 username: "{{ aci_username }}"
12 password: "{{ aci_password }}"
13 validate_certs: '{{ aci_validate_certs | default(false) }}'
14 use_ssl: '{{ aci_use_ssl | default(true) }}'
15 use_proxy: '{{ aci_use_proxy | default(true) }}'
16 output_level: '{{ aci_output_level | default("info") }}'
17 domain: l3_dom
18 domain_type: l3dom
19 state: absent
20
21
22 # ADD DOMAIN
23 - name: Add L3 domain (check_mode)
24 cisco.aci.aci_domain: &domain_present
25 host: '{{ aci_hostname }}'
26 username: '{{ aci_username }}'
27 password: '{{ aci_password }}'
28 validate_certs: '{{ aci_validate_certs | default(false) }}'
29 use_ssl: '{{ aci_use_ssl | default(true) }}'
30 use_proxy: '{{ aci_use_proxy | default(true) }}'
31 output_level: '{{ aci_output_level | default("info") }}'
32 domain: l3_dom
33 domain_type: l3dom
34 state: present
35 check_mode: true
36 register: cm_add_domain
37
38 - name: Add L3 domain (normal mode)
39 cisco.aci.aci_domain: *domain_present
40 register: nm_add_domain
41
42 - name: Verify L3 add_domain
43 ansible.builtin.assert:
44 that:
45 - cm_add_domain is changed
46 - nm_add_domain is changed
47 - cm_add_domain.sent.l3extDomP.attributes.name == nm_add_domain.sent.l3extDomP.attributes.name == 'l3_dom'
48 - cm_add_domain.proposed.l3extDomP.attributes.name == nm_add_domain.proposed.l3extDomP.attributes.name == 'l3_dom'
49 - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == []
50 - nm_add_domain.current.0.l3extDomP.attributes.annotation == 'orchestrator:ansible'
51 - nm_add_domain.current.0.l3extDomP.attributes.name == 'l3_dom'
52 - nm_add_domain.current.0.l3extDomP.attributes.dn == 'uni/l3dom-l3_dom'
53
54 - name: Add L3 domain again (check_mode)
55 cisco.aci.aci_domain: *domain_present
56 check_mode: true
57 register: cm_add_domain_again
58
59 - name: Add L3 domain again (normal mode)
60 cisco.aci.aci_domain: *domain_present
61 register: nm_add_domain_again
62
63 - name: Verify L3 add_domain_again
64 ansible.builtin.assert:
65 that:
66 - cm_add_domain_again is not changed
67 - nm_add_domain_again is not changed
68
69 - name: Update L3 domain with incorrect parameter vm_provider (check_mode)
70 cisco.aci.aci_domain:
71 <<: *domain_present
72 vm_provider: vmware
73 check_mode: true
74 ignore_errors: true
75 register: cm_incorrect_vm_provider
76
77 - name: Update L3 domain with incorrect parameter vm_provider (normal mode)
78 cisco.aci.aci_domain:
79 <<: *domain_present
80 vm_provider: vmware
81 ignore_errors: true
82 register: nm_incorrect_vm_provider
83
84 - name: Update L3 domain with incorrect parameter encap_mode (check_mode)
85 cisco.aci.aci_domain:
86 <<: *domain_present
87 encap_mode: vlan
88 check_mode: true
89 ignore_errors: true
90 register: cm_incorrect_encap_mode
91
92 - name: Update L3 domain with incorrect parameter encap_mode (normal mode)
93 cisco.aci.aci_domain:
94 <<: *domain_present
95 encap_mode: vlan
96 ignore_errors: true
97 register: nm_incorrect_encap_mode
98
99 - name: Update L3 domain with incorrect parameter multicast_address (check_mode)
100 cisco.aci.aci_domain:
101 <<: *domain_present
102 multicast_address: 10.10.10.0
103 check_mode: true
104 ignore_errors: true
105 register: cm_incorrect_multicast_address
106
107 - name: Update L3 domain with incorrect parameter multicast_address (normal mode)
108 cisco.aci.aci_domain:
109 <<: *domain_present
110 multicast_address: 10.10.10.0
111 ignore_errors: true
112 register: nm_incorrect_multicast_address
113
114 - name: Update L3m domain with incorrect parameter vswitch (check_mode)
115 cisco.aci.aci_domain:
116 <<: *domain_present
117 vswitch: avs
118 check_mode: true
119 ignore_errors: true
120 register: cm_incorrect_vswitch
121
122 - name: Update L3 domain with incorrect parameter vswitch (normal mode)
123 cisco.aci.aci_domain:
124 <<: *domain_present
125 vswitch: avs
126 ignore_errors: true
127 register: nm_incorrect_vswitch
128
129 - name: Verify incorrect parameter
130 ansible.builtin.assert:
131 that:
132 - cm_incorrect_vm_provider.msg == "Domain type 'l3dom' cannot have parameter 'vm_provider'"
133 - nm_incorrect_vm_provider.msg == "Domain type 'l3dom' cannot have parameter 'vm_provider'"
134 - cm_incorrect_encap_mode.msg == "Domain type 'l3dom' cannot have parameter 'encap_mode'"
135 - nm_incorrect_encap_mode.msg == "Domain type 'l3dom' cannot have parameter 'encap_mode'"
136 - cm_incorrect_multicast_address.msg == "Domain type 'l3dom' cannot have parameter 'multicast_address'"
137 - nm_incorrect_multicast_address.msg == "Domain type 'l3dom' cannot have parameter 'multicast_address'"
138 - cm_incorrect_vswitch.msg == "Domain type 'l3dom' cannot have parameter 'vswitch'"
139 - nm_incorrect_vswitch.msg == "Domain type 'l3dom' cannot have parameter 'vswitch'"
140
141
142 # QUERY ALL DOMAINS
143 - name: Query all L3 domains (check_mode)
144 cisco.aci.aci_domain: &domain_query
145 host: '{{ aci_hostname }}'
146 username: '{{ aci_username }}'
147 password: '{{ aci_password }}'
148 validate_certs: '{{ aci_validate_certs | default(false) }}'
149 use_ssl: '{{ aci_use_ssl | default(true) }}'
150 use_proxy: '{{ aci_use_proxy | default(true) }}'
151 output_level: '{{ aci_output_level | default("info") }}'
152 domain_type: l3dom
153 state: query
154 check_mode: true
155 register: cm_query_all_domains
156
157 - name: Query all L3 domains (normal mode)
158 cisco.aci.aci_domain: *domain_query
159 register: nm_query_all_domains
160
161 - name: Verify query_all_domains
162 ansible.builtin.assert:
163 that:
164 - cm_query_all_domains is not changed
165 - nm_query_all_domains is not changed
166 - cm_query_all_domains == nm_query_all_domains
167 - nm_query_all_domains.current|length >= 1
168
169
170 # QUERY A DOMAIN
171 - name: Query our L3 domain (check_mode)
172 cisco.aci.aci_domain:
173 <<: *domain_query
174 domain: l3_dom
175 check_mode: true
176 register: cm_query_domain
177
178 - name: Query our L3 domain (normal mode)
179 cisco.aci.aci_domain:
180 <<: *domain_query
181 domain: l3_dom
182 register: nm_query_domain
183
184 - name: Verify L3 query_domain
185 ansible.builtin.assert:
186 that:
187 - cm_query_domain is not changed
188 - nm_query_domain is not changed
189 - cm_query_domain == nm_query_domain
190 - nm_query_domain.current.0.l3extDomP.attributes.dn == 'uni/l3dom-l3_dom'
191 - nm_query_domain.current.0.l3extDomP.attributes.name == 'l3_dom'
192
193
194 # REMOVE DOMAIN
195 - name: Remove L3 domain (check_mode)
196 cisco.aci.aci_domain: *domain_absent
197 check_mode: true
198 register: cm_remove_domain
199
200 - name: Remove L3 domain (normal mode)
201 cisco.aci.aci_domain: *domain_absent
202 register: nm_remove_domain
203
204 - name: Verify L3 remove_domain
205 ansible.builtin.assert:
206 that:
207 - cm_remove_domain is changed
208 - nm_remove_domain is changed
209 - cm_remove_domain.current.0.l3extDomP.attributes.name == cm_remove_domain.previous.0.l3extDomP.attributes.name == nm_remove_domain.previous.0.l3extDomP.attributes.name == 'l3_dom'
210 - cm_remove_domain.current.0.l3extDomP.attributes.dn == cm_remove_domain.previous.0.l3extDomP.attributes.dn == nm_remove_domain.previous.0.l3extDomP.attributes.dn == 'uni/l3dom-l3_dom'
211 - nm_remove_domain.current == []
212
213 - name: Remove L3 domain again (check_mode)
214 cisco.aci.aci_domain: *domain_absent
215 check_mode: true
216 register: cm_remove_domain_again
217
218 - name: Remove L3 domain again (normal mode)
219 cisco.aci.aci_domain: *domain_absent
220 register: nm_remove_domain_again
221
222 - name: Verify L3 remove_domain_again
223 ansible.builtin.assert:
224 that:
225 - cm_remove_domain_again is not changed
226 - nm_remove_domain_again is not changed
227
228
229 # QUERY NON-EXISTING DOMAIN
230 - name: Query non-existing L3 domain (check_mode)
231 cisco.aci.aci_domain:
232 <<: *domain_query
233 domain: l3_dom
234 check_mode: true
235 register: cm_query_non_domain
236
237 - name: Query non-existing L3 domain (normal mode)
238 cisco.aci.aci_domain:
239 <<: *domain_query
240 domain: l3_dom
241 register: nm_query_non_domain
242
243 - name: Verify L3 query_non_domain
244 ansible.builtin.assert:
245 that:
246 - cm_query_non_domain is not changed
247 - nm_query_non_domain is not changed
248 - cm_query_non_domain == nm_query_non_domain
249 - nm_query_non_domain.current == []