| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
- name: Test that we have an ACI APIC host, ACI username and ACI password |
| 7 |
ansible.builtin.fail: |
| 8 |
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.' |
| 9 |
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined |
| 10 |
|
| 11 |
- name: Set vars |
| 12 |
ansible.builtin.set_fact: |
| 13 |
aci_info: &aci_info |
| 14 |
host: "{{ aci_hostname }}" |
| 15 |
username: "{{ aci_username }}" |
| 16 |
password: "{{ aci_password }}" |
| 17 |
validate_certs: '{{ aci_validate_certs | default(false) }}' |
| 18 |
use_ssl: '{{ aci_use_ssl | default(true) }}' |
| 19 |
use_proxy: '{{ aci_use_proxy | default(true) }}' |
| 20 |
output_level: debug |
| 21 |
|
| 22 |
- name: Query system information |
| 23 |
cisco.aci.aci_system: |
| 24 |
<<: *aci_info |
| 25 |
id: 1 |
| 26 |
state: query |
| 27 |
register: version |
| 28 |
|
| 29 |
- name: Verify Cloud and Non-Cloud Sites in use. |
| 30 |
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
| 31 |
|
| 32 |
- name: Execute tasks only for non-cloud sites |
| 33 |
when: query_cloud.current == [] |
| 34 |
block: |
| 35 |
- name: ensure tenant exists for tests to kick off |
| 36 |
cisco.aci.aci_tenant: &aci_tenant_present |
| 37 |
<<: *aci_info |
| 38 |
tenant: ansible_test |
| 39 |
register: tenant_present |
| 40 |
|
| 41 |
- name: Query system information |
| 42 |
cisco.aci.aci_system: |
| 43 |
<<: *aci_info |
| 44 |
id: 1 |
| 45 |
state: query |
| 46 |
register: version |
| 47 |
|
| 48 |
- name: ensure bd exists for tests to kick off |
| 49 |
cisco.aci.aci_bd: &aci_bd_present |
| 50 |
<<: *aci_tenant_present |
| 51 |
bd: anstest |
| 52 |
register: bd_present |
| 53 |
|
| 54 |
- name: ensure subnet does not exist for tests to kick off |
| 55 |
cisco.aci.aci_bd_subnet: &aci_subnet_absent |
| 56 |
<<: *aci_bd_present |
| 57 |
state: absent |
| 58 |
gateway: 10.100.100.1 |
| 59 |
mask: 24 |
| 60 |
|
| 61 |
- name: ensure subnet does not exist for tests to kick off |
| 62 |
cisco.aci.aci_bd_subnet: &aci_subnet2_absent |
| 63 |
<<: *aci_subnet_absent |
| 64 |
gateway: 10.100.101.1 |
| 65 |
mask: 25 |
| 66 |
|
| 67 |
- name: create subnet - check mode works |
| 68 |
cisco.aci.aci_bd_subnet: &aci_subnet_present |
| 69 |
<<: *aci_subnet_absent |
| 70 |
state: present |
| 71 |
subnet_name: anstest |
| 72 |
descr: Ansible Test |
| 73 |
check_mode: true |
| 74 |
register: create_check_mode |
| 75 |
|
| 76 |
- name: create subnet - creation works |
| 77 |
cisco.aci.aci_bd_subnet: |
| 78 |
<<: *aci_subnet_present |
| 79 |
register: create_subnet |
| 80 |
|
| 81 |
- name: create new subnet - creation works (with no ip_data_plane_learning - APIC version < 5.0) |
| 82 |
cisco.aci.aci_bd_subnet: &aci_subnet2_present |
| 83 |
<<: *aci_subnet2_absent |
| 84 |
state: present |
| 85 |
descr: Ansible Test |
| 86 |
scope: [private, shared] |
| 87 |
route_profile: default |
| 88 |
route_profile_l3_out: default |
| 89 |
register: create_subnet2 |
| 90 |
when: version.current.0.topSystem.attributes.version is version('5', '<') |
| 91 |
|
| 92 |
- name: create new subnet - creation works (with ip_data_plane_learning - APIC version >= 5.0) |
| 93 |
cisco.aci.aci_bd_subnet: |
| 94 |
<<: *aci_subnet2_present |
| 95 |
state: present |
| 96 |
descr: Ansible Test |
| 97 |
scope: [private, shared] |
| 98 |
route_profile: default |
| 99 |
route_profile_l3_out: default |
| 100 |
ip_data_plane_learning: disabled |
| 101 |
register: create_subnet2_5 |
| 102 |
when: version.current.0.topSystem.attributes.version is version('5', '>=') |
| 103 |
|
| 104 |
- name: create subnet again - idempotency works |
| 105 |
cisco.aci.aci_bd_subnet: |
| 106 |
<<: *aci_subnet2_present |
| 107 |
register: create_idempotency |
| 108 |
|
| 109 |
- name: modify subnet - update works |
| 110 |
cisco.aci.aci_bd_subnet: |
| 111 |
<<: *aci_subnet_present |
| 112 |
scope: [shared, public] |
| 113 |
subnet_control: querier_ip |
| 114 |
register: modify_subnet |
| 115 |
|
| 116 |
- name: create subnet with bad scope - failure message works |
| 117 |
cisco.aci.aci_bd_subnet: |
| 118 |
<<: *aci_subnet_present |
| 119 |
scope: [private, public] |
| 120 |
register: create_bad_scope |
| 121 |
ignore_errors: true |
| 122 |
|
| 123 |
- name: create subnet without all necessary params - failure message works |
| 124 |
cisco.aci.aci_bd_subnet: |
| 125 |
<<: *aci_subnet_present |
| 126 |
bd: "{{ fake_var | default(omit) }}" |
| 127 |
register: create_incomplete_data |
| 128 |
ignore_errors: true |
| 129 |
|
| 130 |
- name: assert for subnet creation tasks |
| 131 |
ansible.builtin.assert: |
| 132 |
that: |
| 133 |
- create_check_mode is changed |
| 134 |
- create_check_mode.sent.fvSubnet.attributes.descr == create_subnet.sent.fvSubnet.attributes.descr == 'Ansible Test' |
| 135 |
- create_check_mode.sent.fvSubnet.attributes.ip == create_subnet.sent.fvSubnet.attributes.ip == '10.100.100.1/24' |
| 136 |
- create_check_mode.sent.fvSubnet.attributes.name == create_subnet.sent.fvSubnet.attributes.name == 'anstest' |
| 137 |
- create_subnet is changed |
| 138 |
- create_subnet.current.0.fvSubnet.attributes.annotation == 'orchestrator:ansible' |
| 139 |
- create_subnet.previous == [] |
| 140 |
- create_idempotency is not changed |
| 141 |
- create_idempotency.previous != [] |
| 142 |
- modify_subnet is changed |
| 143 |
- modify_subnet.previous != [] |
| 144 |
- modify_subnet.sent != modify_subnet.proposed |
| 145 |
- modify_subnet.sent.fvSubnet.attributes.ctrl == 'querier' |
| 146 |
- modify_subnet.sent.fvSubnet.attributes.scope == 'public,shared' |
| 147 |
- create_bad_scope is failed |
| 148 |
- create_bad_scope.msg.startswith("Parameter 'scope' cannot be both 'private' and 'public'") |
| 149 |
- create_incomplete_data is failed |
| 150 |
- 'create_incomplete_data.msg == "state is present but all of the following are missing: bd"' |
| 151 |
|
| 152 |
- name: assert for subnet for task with version < 5 |
| 153 |
ansible.builtin.assert: |
| 154 |
that: |
| 155 |
- create_subnet2 is changed |
| 156 |
- create_subnet2.sent == create_subnet2.proposed |
| 157 |
- create_subnet2.sent.fvSubnet.attributes.scope == "private,shared" |
| 158 |
- create_subnet2.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes.tnL3extOutName == 'default' |
| 159 |
- create_subnet2.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes.tnRtctrlProfileName == 'default' |
| 160 |
when: version.current.0.topSystem.attributes.version is version('5', '<') |
| 161 |
|
| 162 |
- name: assert for subnet ip_data_learning for task with version >=5 |
| 163 |
ansible.builtin.assert: |
| 164 |
that: |
| 165 |
- create_subnet.current.0.fvSubnet.attributes.ipDPLearning == 'enabled' |
| 166 |
- create_subnet2_5 is changed |
| 167 |
- create_subnet2_5.current.0.fvSubnet.attributes.ipDPLearning == 'disabled' |
| 168 |
- create_subnet2_5.sent == create_subnet2_5.proposed |
| 169 |
- create_subnet2_5.sent.fvSubnet.attributes.scope == "private,shared" |
| 170 |
- create_subnet2_5.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes.tnL3extOutName == 'default' |
| 171 |
- create_subnet2_5.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes.tnRtctrlProfileName == 'default' |
| 172 |
when: version.current.0.topSystem.attributes.version is version('5', '>=') |
| 173 |
|
| 174 |
|
| 175 |
- name: create bd subnet with no previous (check mode) |
| 176 |
cisco.aci.aci_bd_subnet: &aci_bd_subnet_no_previous |
| 177 |
<<: *aci_subnet_present |
| 178 |
subnet_name: anstest_no_previous |
| 179 |
gateway: 10.101.101.10 |
| 180 |
mask: 25 |
| 181 |
no_previous: true |
| 182 |
check_mode: true |
| 183 |
register: bd_subnet_present_no_previous_cm |
| 184 |
|
| 185 |
- name: create bd subnet with no previous |
| 186 |
cisco.aci.aci_bd_subnet: |
| 187 |
<<: *aci_bd_subnet_no_previous |
| 188 |
register: bd_subnet_present_no_previous |
| 189 |
|
| 190 |
- name: create bd subnet with no previous again |
| 191 |
cisco.aci.aci_bd_subnet: |
| 192 |
<<: *aci_bd_subnet_no_previous |
| 193 |
register: bd_subnet_present_no_previous_again |
| 194 |
|
| 195 |
- name: update bd subnet with no previous |
| 196 |
cisco.aci.aci_bd_subnet: |
| 197 |
<<: *aci_bd_subnet_no_previous |
| 198 |
descr: Ansible Test no previous |
| 199 |
register: update_bd_subnet_present_no_previous |
| 200 |
|
| 201 |
- name: delete bd subnet with no previous |
| 202 |
cisco.aci.aci_bd_subnet: |
| 203 |
<<: *aci_bd_subnet_no_previous |
| 204 |
state: absent |
| 205 |
register: delete_bd_subnet_present_no_previous |
| 206 |
|
| 207 |
- name: delete bd subnet with no previous again |
| 208 |
cisco.aci.aci_bd_subnet: |
| 209 |
<<: *aci_bd_subnet_no_previous |
| 210 |
state: absent |
| 211 |
register: delete_bd_subnet_present_no_previous_again |
| 212 |
|
| 213 |
- name: no previous asserts |
| 214 |
ansible.builtin.assert: |
| 215 |
that: |
| 216 |
- bd_subnet_present_no_previous_cm is changed |
| 217 |
- bd_subnet_present_no_previous_cm.current == [] |
| 218 |
- bd_subnet_present_no_previous_cm.previous == [] |
| 219 |
- bd_subnet_present_no_previous_cm.proposed.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.101.101.10/25]" |
| 220 |
- bd_subnet_present_no_previous_cm.proposed.fvSubnet.attributes.descr == "Ansible Test" |
| 221 |
- bd_subnet_present_no_previous_cm.proposed.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 222 |
- bd_subnet_present_no_previous is changed |
| 223 |
- bd_subnet_present_no_previous.current.0.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.101.101.10/25]" |
| 224 |
- bd_subnet_present_no_previous.current.0.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 225 |
- bd_subnet_present_no_previous.current.0.fvSubnet.attributes.descr == "Ansible Test" |
| 226 |
- bd_subnet_present_no_previous.proposed.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.101.101.10/25]" |
| 227 |
- bd_subnet_present_no_previous.proposed.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 228 |
- bd_subnet_present_no_previous.proposed.fvSubnet.attributes.descr == "Ansible Test" |
| 229 |
- bd_subnet_present_no_previous.previous == [] |
| 230 |
- bd_subnet_present_no_previous_again is changed |
| 231 |
- bd_subnet_present_no_previous_again.current == bd_subnet_present_no_previous.current |
| 232 |
- bd_subnet_present_no_previous_again.proposed == bd_subnet_present_no_previous.proposed |
| 233 |
- bd_subnet_present_no_previous_again.previous == [] |
| 234 |
- update_bd_subnet_present_no_previous is changed |
| 235 |
- update_bd_subnet_present_no_previous.current.0.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.101.101.10/25]" |
| 236 |
- update_bd_subnet_present_no_previous.current.0.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 237 |
- update_bd_subnet_present_no_previous.current.0.fvSubnet.attributes.descr == "Ansible Test no previous" |
| 238 |
- delete_bd_subnet_present_no_previous is changed |
| 239 |
- delete_bd_subnet_present_no_previous.current == [] |
| 240 |
- delete_bd_subnet_present_no_previous.previous == [] |
| 241 |
- delete_bd_subnet_present_no_previous.proposed == {} |
| 242 |
- delete_bd_subnet_present_no_previous_again is changed |
| 243 |
- delete_bd_subnet_present_no_previous_again.current == [] |
| 244 |
- delete_bd_subnet_present_no_previous_again.previous == [] |
| 245 |
- delete_bd_subnet_present_no_previous_again.proposed == {} |
| 246 |
|
| 247 |
|
| 248 |
- name: create bd subnet with no previous & no verify (check mode) |
| 249 |
cisco.aci.aci_bd_subnet: &aci_bd_subnet_no_lb_no_v |
| 250 |
<<: *aci_subnet_present |
| 251 |
subnet_name: anstest_no_lb_no_v |
| 252 |
gateway: 10.102.101.12 |
| 253 |
mask: 25 |
| 254 |
no_previous: true |
| 255 |
no_verify: true |
| 256 |
check_mode: true |
| 257 |
register: bd_subnet_present_no_lb_no_v_cm |
| 258 |
|
| 259 |
- name: create bd subnet with no previous & no verify |
| 260 |
cisco.aci.aci_bd_subnet: |
| 261 |
<<: *aci_bd_subnet_no_lb_no_v |
| 262 |
register: bd_subnet_present_no_lb_no_v |
| 263 |
|
| 264 |
- name: create bd subnet with no previous again & no verify |
| 265 |
cisco.aci.aci_bd_subnet: |
| 266 |
<<: *aci_bd_subnet_no_lb_no_v |
| 267 |
register: bd_subnet_present_no_lb_no_v_again |
| 268 |
|
| 269 |
- name: update bd subnet with no previous & no verify |
| 270 |
cisco.aci.aci_bd_subnet: |
| 271 |
<<: *aci_bd_subnet_no_lb_no_v |
| 272 |
descr: Ansible Test no previous & no verify |
| 273 |
register: update_bd_subnet_present_no_lb_no_v |
| 274 |
|
| 275 |
- name: delete bd subnet with no previous & no verify |
| 276 |
cisco.aci.aci_bd_subnet: |
| 277 |
<<: *aci_bd_subnet_no_lb_no_v |
| 278 |
state: absent |
| 279 |
register: delete_bd_subnet_present_no_lb_no_v |
| 280 |
|
| 281 |
- name: delete bd subnet with no previous again & no verify |
| 282 |
cisco.aci.aci_bd_subnet: |
| 283 |
<<: *aci_bd_subnet_no_lb_no_v |
| 284 |
state: absent |
| 285 |
register: delete_bd_subnet_present_no_lb_no_v_again |
| 286 |
|
| 287 |
- name: no previous & no verify asserts |
| 288 |
ansible.builtin.assert: |
| 289 |
that: |
| 290 |
- bd_subnet_present_no_lb_no_v_cm is changed |
| 291 |
- bd_subnet_present_no_lb_no_v_cm.current.0 == bd_subnet_present_no_lb_no_v_cm.proposed |
| 292 |
- bd_subnet_present_no_lb_no_v_cm.previous == [] |
| 293 |
- bd_subnet_present_no_lb_no_v_cm.proposed.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.102.101.12/25]" |
| 294 |
- bd_subnet_present_no_lb_no_v_cm.proposed.fvSubnet.attributes.descr == "Ansible Test" |
| 295 |
- bd_subnet_present_no_lb_no_v_cm.proposed.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 296 |
- bd_subnet_present_no_lb_no_v is changed |
| 297 |
- bd_subnet_present_no_lb_no_v.current.0 == bd_subnet_present_no_lb_no_v.proposed |
| 298 |
- bd_subnet_present_no_lb_no_v.previous == [] |
| 299 |
- bd_subnet_present_no_lb_no_v_again is changed |
| 300 |
- bd_subnet_present_no_lb_no_v_again.current == bd_subnet_present_no_lb_no_v.current |
| 301 |
- bd_subnet_present_no_lb_no_v_again.proposed == bd_subnet_present_no_lb_no_v.proposed |
| 302 |
- bd_subnet_present_no_lb_no_v_again.previous == [] |
| 303 |
- update_bd_subnet_present_no_lb_no_v is changed |
| 304 |
- update_bd_subnet_present_no_lb_no_v.current.0 == update_bd_subnet_present_no_lb_no_v.proposed |
| 305 |
- update_bd_subnet_present_no_lb_no_v.current.0.fvSubnet.attributes.dn == "uni/tn-ansible_test/BD-anstest/subnet-[10.102.101.12/25]" |
| 306 |
- update_bd_subnet_present_no_lb_no_v.current.0.fvSubnet.attributes.annotation == "orchestrator:ansible" |
| 307 |
- update_bd_subnet_present_no_lb_no_v.current.0.fvSubnet.attributes.descr == "Ansible Test no previous & no verify" |
| 308 |
- delete_bd_subnet_present_no_lb_no_v is changed |
| 309 |
- delete_bd_subnet_present_no_lb_no_v.current == [] |
| 310 |
- delete_bd_subnet_present_no_lb_no_v.previous == [] |
| 311 |
- delete_bd_subnet_present_no_lb_no_v.proposed == {} |
| 312 |
- delete_bd_subnet_present_no_lb_no_v_again is changed |
| 313 |
- delete_bd_subnet_present_no_lb_no_v_again.current == [] |
| 314 |
- delete_bd_subnet_present_no_lb_no_v_again.previous == [] |
| 315 |
- delete_bd_subnet_present_no_lb_no_v_again.proposed == {} |
| 316 |
|
| 317 |
- name: get all subnets |
| 318 |
cisco.aci.aci_bd_subnet: &aci_query |
| 319 |
<<: *aci_tenant_present |
| 320 |
state: query |
| 321 |
tenant: "{{ fake_var | default(omit) }}" |
| 322 |
register: get_all |
| 323 |
|
| 324 |
- name: get all in tenant |
| 325 |
cisco.aci.aci_bd_subnet: |
| 326 |
<<: *aci_query |
| 327 |
tenant: ansible_test |
| 328 |
register: get_all_tenant |
| 329 |
|
| 330 |
- name: get all in bd |
| 331 |
cisco.aci.aci_bd_subnet: |
| 332 |
<<: *aci_query |
| 333 |
bd: anstest |
| 334 |
register: get_all_bd |
| 335 |
|
| 336 |
- name: get all tenant and bd |
| 337 |
cisco.aci.aci_bd_subnet: |
| 338 |
<<: *aci_bd_present |
| 339 |
state: query |
| 340 |
register: get_all_tenant_bd |
| 341 |
|
| 342 |
- name: get subnet in tenant |
| 343 |
cisco.aci.aci_bd_subnet: |
| 344 |
<<: *aci_subnet_present |
| 345 |
state: query |
| 346 |
bd: "{{ fake_var | default(omit) }}" |
| 347 |
register: get_subnet_tenant |
| 348 |
|
| 349 |
- name: get subnet in bd |
| 350 |
cisco.aci.aci_bd_subnet: |
| 351 |
<<: *aci_subnet_present |
| 352 |
state: query |
| 353 |
tenant: "{{ fake_var | default(omit) }}" |
| 354 |
register: get_subnet_bd |
| 355 |
|
| 356 |
- name: get specific subnet |
| 357 |
cisco.aci.aci_bd_subnet: |
| 358 |
<<: *aci_subnet_present |
| 359 |
state: query |
| 360 |
register: get_subnet |
| 361 |
|
| 362 |
- name: get all subnets matching gateway |
| 363 |
cisco.aci.aci_bd_subnet: |
| 364 |
<<: *aci_subnet_present |
| 365 |
state: query |
| 366 |
tenant: "{{ fake_var | default(omit) }}" |
| 367 |
bd: "{{ fake_var | default(omit) }}" |
| 368 |
register: get_subnets_gateway |
| 369 |
|
| 370 |
- name: asserts for query tasks |
| 371 |
ansible.builtin.assert: |
| 372 |
that: |
| 373 |
- get_all is not changed |
| 374 |
- get_all.current | length > 1 |
| 375 |
- get_all_tenant is not changed |
| 376 |
- '"tn-ansible_test.json" in get_all_tenant.url' |
| 377 |
- get_all_bd is not changed |
| 378 |
- '"query-target-filter=eq(fvBD.name,\"anstest\")" in get_all_bd.filter_string' |
| 379 |
- '"class/fvBD.json" in get_all_bd.url' |
| 380 |
- get_all_tenant_bd is not changed |
| 381 |
- '"tn-ansible_test/BD-anstest.json" in get_all_tenant_bd.url' |
| 382 |
- get_all_tenant_bd.current.0.fvBD.children | length > 1 |
| 383 |
- get_subnet_tenant is not changed |
| 384 |
- '"rsp-subtree-filter=eq(fvSubnet.ip,\"10.100.100.1/24\")" in get_subnet_tenant.filter_string' |
| 385 |
- '"tn-ansible_test.json" in get_subnet_tenant.url' |
| 386 |
- get_subnet_bd is not changed |
| 387 |
- '"query-target-filter=eq(fvBD.name,\"anstest\")"' |
| 388 |
- '"rsp-subtree-filter=eq(fvSubnet.ip,\"10.100.100.1/24\")" in get_subnet_bd.filter_string' |
| 389 |
- '"class/fvBD.json" in get_subnet_bd.url' |
| 390 |
- get_subnet is not changed |
| 391 |
- get_subnet.current | length == 1 |
| 392 |
- '"tn-ansible_test/BD-anstest/subnet-[10.100.100.1/24].json" in get_subnet.url' |
| 393 |
- get_subnets_gateway is not changed |
| 394 |
- '"query-target-filter=eq(fvSubnet.ip,\"10.100.100.1/24\")" in get_subnets_gateway.filter_string' |
| 395 |
- '"class/fvSubnet.json" in get_subnets_gateway.url' |
| 396 |
|
| 397 |
- name: error handling for ipv4 subnet with wrong mask |
| 398 |
cisco.aci.aci_bd_subnet: |
| 399 |
<<: *aci_bd_present |
| 400 |
gateway: 10.100.100.1 |
| 401 |
mask: 33 |
| 402 |
ignore_errors: true |
| 403 |
register: error_mask_ipv4 |
| 404 |
|
| 405 |
- name: error handling for ipv6 subnet with wrong mask |
| 406 |
cisco.aci.aci_bd_subnet: |
| 407 |
<<: *aci_bd_present |
| 408 |
gateway: "2001:0db8:85a3:0000:0000:8a2e:0370:7334" |
| 409 |
mask: 129 |
| 410 |
ignore_errors: true |
| 411 |
register: error_mask_ipv6 |
| 412 |
|
| 413 |
- name: asserts for mask error handling |
| 414 |
ansible.builtin.assert: |
| 415 |
that: |
| 416 |
- error_mask_ipv4.msg == "Valid Subnet Masks are 0 to 32 for IPv4 Addresses" |
| 417 |
- error_mask_ipv6.msg == "Valid Subnet Masks are 0 to 128 for IPv6 Addresses" |
| 418 |
|
| 419 |
- name: delete subnet - check mode works |
| 420 |
cisco.aci.aci_bd_subnet: |
| 421 |
<<: *aci_subnet_absent |
| 422 |
check_mode: true |
| 423 |
register: delete_check_mode |
| 424 |
|
| 425 |
- name: delete subnet - delete works |
| 426 |
cisco.aci.aci_bd_subnet: |
| 427 |
<<: *aci_subnet_absent |
| 428 |
register: delete_subnet |
| 429 |
|
| 430 |
- name: delete subnet - cleanup |
| 431 |
cisco.aci.aci_bd_subnet: |
| 432 |
<<: *aci_subnet2_absent |
| 433 |
|
| 434 |
- name: delete subnet again - idempotency works |
| 435 |
cisco.aci.aci_bd_subnet: |
| 436 |
<<: *aci_subnet2_absent |
| 437 |
register: delete_idempotency |
| 438 |
|
| 439 |
- name: asserts for deletion task |
| 440 |
ansible.builtin.assert: |
| 441 |
that: |
| 442 |
- delete_check_mode is changed |
| 443 |
- delete_check_mode.proposed == {} |
| 444 |
- delete_subnet is changed |
| 445 |
- delete_subnet.previous != [] |
| 446 |
- delete_subnet.method == "DELETE" |
| 447 |
- delete_idempotency is not changed |
| 448 |
- delete_idempotency.previous == [] |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
- name: Create subnet with all subnet_control |
| 453 |
cisco.aci.aci_bd_subnet: &subnet_control |
| 454 |
<<: *aci_subnet_present |
| 455 |
subnet_control: |
| 456 |
- querier_ip |
| 457 |
- no_gw |
| 458 |
- nd_ra |
| 459 |
register: create_with_all_subnet_control |
| 460 |
|
| 461 |
- name: Create subnet with all subnet_control again - idempotency works |
| 462 |
cisco.aci.aci_bd_subnet: |
| 463 |
<<: *subnet_control |
| 464 |
register: create_with_all_subnet_control_again |
| 465 |
|
| 466 |
- name: Update subnet with unspecified subnet_control |
| 467 |
cisco.aci.aci_bd_subnet: &create_with_removed_subnet_control |
| 468 |
<<: *subnet_control |
| 469 |
subnet_control: |
| 470 |
- unspecified |
| 471 |
register: update_subnet_control_unspecified |
| 472 |
|
| 473 |
- name: Update subnet with unspecified subnet_control again - idempotency works |
| 474 |
cisco.aci.aci_bd_subnet: |
| 475 |
<<: *create_with_removed_subnet_control |
| 476 |
register: update_subnet_control_unspecified_again |
| 477 |
|
| 478 |
- name: Update subnet with unspecified subnet_control and other subnet_controls |
| 479 |
cisco.aci.aci_bd_subnet: |
| 480 |
<<: *subnet_control |
| 481 |
subnet_control: |
| 482 |
- unspecified |
| 483 |
- querier_ip |
| 484 |
- no_gw |
| 485 |
ignore_errors: true |
| 486 |
register: err_update_subnet_control_unspecified_other |
| 487 |
|
| 488 |
- name: Update subnet with subnet_controls |
| 489 |
cisco.aci.aci_bd_subnet: |
| 490 |
<<: *subnet_control |
| 491 |
subnet_control: |
| 492 |
- querier_ip |
| 493 |
- no_gw |
| 494 |
register: update_subnet_controls |
| 495 |
|
| 496 |
- name: Update subnet with subnet_controls in reversed order - idempotency works |
| 497 |
cisco.aci.aci_bd_subnet: |
| 498 |
<<: *subnet_control |
| 499 |
subnet_control: |
| 500 |
- no_gw |
| 501 |
- querier_ip |
| 502 |
register: update_subnet_controls_reversed_order |
| 503 |
|
| 504 |
- name: Asserts for subnet control as list tasks |
| 505 |
ansible.builtin.assert: |
| 506 |
that: |
| 507 |
- create_with_all_subnet_control is changed |
| 508 |
- create_with_all_subnet_control.previous == [] |
| 509 |
- create_with_all_subnet_control.current.0.fvSubnet.attributes.name == "anstest" |
| 510 |
- create_with_all_subnet_control.current.0.fvSubnet.attributes.ctrl == "nd,no-default-gateway,querier" |
| 511 |
- create_with_all_subnet_control_again is not changed |
| 512 |
- create_with_all_subnet_control_again.previous == create_with_all_subnet_control_again.current |
| 513 |
- create_with_all_subnet_control_again.current.0.fvSubnet.attributes.name == "anstest" |
| 514 |
- create_with_all_subnet_control_again.current.0.fvSubnet.attributes.ctrl == "nd,no-default-gateway,querier" |
| 515 |
- update_subnet_control_unspecified is changed |
| 516 |
- update_subnet_control_unspecified.previous == create_with_all_subnet_control_again.current |
| 517 |
- update_subnet_control_unspecified.current.0.fvSubnet.attributes.name == "anstest" |
| 518 |
- update_subnet_control_unspecified.current.0.fvSubnet.attributes.ctrl == "" |
| 519 |
- update_subnet_control_unspecified_again is not changed |
| 520 |
- update_subnet_control_unspecified_again.previous == update_subnet_control_unspecified_again.current |
| 521 |
- update_subnet_control_unspecified_again.current.0.fvSubnet.attributes.name == "anstest" |
| 522 |
- update_subnet_control_unspecified_again.current.0.fvSubnet.attributes.ctrl == "" |
| 523 |
- err_update_subnet_control_unspecified_other is failed |
| 524 |
- err_update_subnet_control_unspecified_other.msg == "Parameter 'subnet_control' cannot contain 'unspecified' in combination with other values, got{{":"}} ['unspecified', 'querier_ip', 'no_gw']" |
| 525 |
- update_subnet_controls is changed |
| 526 |
- update_subnet_controls.previous == update_subnet_control_unspecified_again.current |
| 527 |
- update_subnet_controls.current.0.fvSubnet.attributes.name == "anstest" |
| 528 |
- update_subnet_controls.current.0.fvSubnet.attributes.ctrl == "no-default-gateway,querier" |
| 529 |
- update_subnet_controls_reversed_order is not changed |
| 530 |
- update_subnet_controls_reversed_order.previous == update_subnet_controls_reversed_order.current |
| 531 |
- update_subnet_controls_reversed_order.current.0.fvSubnet.attributes.name == "anstest" |
| 532 |
- update_subnet_controls_reversed_order.current.0.fvSubnet.attributes.ctrl == "no-default-gateway,querier" |
| 533 |
|
| 534 |
- name: delete bd - cleanup before ending tests |
| 535 |
cisco.aci.aci_bd: |
| 536 |
<<: *aci_bd_present |
| 537 |
state: absent |
| 538 |
when: bd_present is changed |
| 539 |
|
| 540 |
- name: delete tenant - cleanup before ending tests |
| 541 |
cisco.aci.aci_tenant: |
| 542 |
<<: *aci_tenant_present |
| 543 |
state: absent |
| 544 |
when: tenant_present is changed |