| 1 |
# Test code for the ACI modules |
| 2 |
# Copyright: (c) 2023, Sabari Jaganathan <[email protected]> |
| 3 |
|
| 4 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 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: '{{ aci_output_level | default("debug") }}' |
| 21 |
|
| 22 |
|
| 23 |
- name: Query system information |
| 24 |
cisco.aci.aci_system: |
| 25 |
<<: *aci_info |
| 26 |
id: 1 |
| 27 |
state: query |
| 28 |
register: version |
| 29 |
|
| 30 |
- name: Verify Cloud and Non-Cloud Sites in use. |
| 31 |
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
| 32 |
|
| 33 |
- name: Execute tasks only for ACI v6+ and non-cloud sites |
| 34 |
when: |
| 35 |
- version.current.0.topSystem.attributes.version is version('6', '>=') |
| 36 |
- query_cloud.current == [] # This condition will execute only non-cloud sites |
| 37 |
block: |
| 38 |
# Negative test cases |
| 39 |
- name: Ensure Interface does not exists, invalid test without node id |
| 40 |
cisco.aci.aci_interface_config: |
| 41 |
<<: *aci_info |
| 42 |
role: leaf |
| 43 |
port_type: access |
| 44 |
interface_type: switch_port |
| 45 |
interface: "1/1" |
| 46 |
state: absent |
| 47 |
register: invalid_interface_absent |
| 48 |
ignore_errors: true |
| 49 |
|
| 50 |
- name: Ensure Interface 501 does not exists, invalid test with invalid interface details |
| 51 |
cisco.aci.aci_interface_config: |
| 52 |
<<: *aci_info |
| 53 |
role: leaf |
| 54 |
port_type: access |
| 55 |
interface_type: switch_port |
| 56 |
node: 501 |
| 57 |
interface: "a/b/c" |
| 58 |
state: absent |
| 59 |
register: invalid_interface_details |
| 60 |
ignore_errors: true |
| 61 |
|
| 62 |
- name: Add Interface 501, invalid test with policy_group and breakout |
| 63 |
cisco.aci.aci_interface_config: |
| 64 |
<<: *aci_info |
| 65 |
role: leaf |
| 66 |
port_type: access |
| 67 |
interface_type: switch_port |
| 68 |
policy_group: ans_test_switch_port |
| 69 |
node: 501 |
| 70 |
breakout: "100g-4x" |
| 71 |
interface: "1/1" |
| 72 |
state: present |
| 73 |
register: invalid_policy_group_with_breakout |
| 74 |
ignore_errors: true |
| 75 |
|
| 76 |
- name: Assertions check for the invalid tasks |
| 77 |
ansible.builtin.assert: |
| 78 |
that: |
| 79 |
- invalid_interface_absent.msg is match("state is absent but all of the following are missing{{':'}} node") |
| 80 |
- invalid_interface_details is not changed |
| 81 |
- invalid_interface_details.msg is match("Interface configuration failed due to") |
| 82 |
- invalid_policy_group_with_breakout is not changed |
| 83 |
- invalid_policy_group_with_breakout.msg == "parameters are mutually exclusive{{':'}} policy_group|breakout" |
| 84 |
|
| 85 |
- name: Invalid Node ID check |
| 86 |
cisco.aci.aci_interface_config: |
| 87 |
<<: *aci_info |
| 88 |
node: 5000 |
| 89 |
interface: "1/1" |
| 90 |
state: present |
| 91 |
register: invalid_node |
| 92 |
ignore_errors: true |
| 93 |
|
| 94 |
- name: Invalid Interface ID check |
| 95 |
cisco.aci.aci_interface_config: |
| 96 |
<<: *aci_info |
| 97 |
node: 101 |
| 98 |
interface: "1" |
| 99 |
state: present |
| 100 |
register: invalid_interface |
| 101 |
ignore_errors: true |
| 102 |
|
| 103 |
- name: Invalid Card ID check |
| 104 |
cisco.aci.aci_interface_config: |
| 105 |
<<: *aci_info |
| 106 |
node: 101 |
| 107 |
interface: "1000/1/1" |
| 108 |
state: present |
| 109 |
register: invalid_card |
| 110 |
ignore_errors: true |
| 111 |
|
| 112 |
- name: Invalid Port ID check |
| 113 |
cisco.aci.aci_interface_config: |
| 114 |
<<: *aci_info |
| 115 |
node: 101 |
| 116 |
interface: "1/500/1" |
| 117 |
state: present |
| 118 |
register: invalid_port |
| 119 |
ignore_errors: true |
| 120 |
|
| 121 |
- name: Invalid Sub Port ID check |
| 122 |
cisco.aci.aci_interface_config: |
| 123 |
<<: *aci_info |
| 124 |
node: 101 |
| 125 |
interface: "1/1/100" |
| 126 |
state: present |
| 127 |
register: invalid_sub_port |
| 128 |
ignore_errors: true |
| 129 |
|
| 130 |
- name: Assertions check for invalid interface configuration tasks |
| 131 |
ansible.builtin.assert: |
| 132 |
that: |
| 133 |
- invalid_node is not changed |
| 134 |
- invalid_node.msg is match("^Node ID{{':'}} .+? is invalid; it must be in the range of 101 to 4000.") |
| 135 |
- invalid_interface is not changed |
| 136 |
- invalid_interface.msg is match("^Interface{{':'}} .+? is invalid; The format must be either card\/port\/sub_port\(1\/1\/1\) or card\/port\(1\/1\)") |
| 137 |
- invalid_card is not changed |
| 138 |
- invalid_card.msg is match("^Card ID{{':'}} .+? is invalid; it must be in the range of 1 to 255.") |
| 139 |
- invalid_port is not changed |
| 140 |
- invalid_port.msg is match("^Port ID{{':'}} .+? is invalid; it must be in the range of 1 to 128.") |
| 141 |
- invalid_sub_port is not changed |
| 142 |
- invalid_sub_port.msg is match("^Sub Port ID{{':'}} .+? is invalid; it must be in the range of 0 to 64.") |
| 143 |
|
| 144 |
- name: Ensure Interface 501 with leaf access with policy_group and without sub port - switch_port absent |
| 145 |
cisco.aci.aci_interface_config: &interface_501_absent |
| 146 |
<<: *aci_info |
| 147 |
role: leaf |
| 148 |
port_type: access |
| 149 |
interface_type: switch_port |
| 150 |
policy_group: ans_test_switch_port |
| 151 |
node: 501 |
| 152 |
interface: "1/1" |
| 153 |
description: "Interface - 501 added by Ansible" |
| 154 |
admin_state: "down" |
| 155 |
state: absent |
| 156 |
register: interface_501_absent |
| 157 |
|
| 158 |
- name: Ensure Interface 501 with leaf access with policy_group and without sub port - switch_port present - check mode |
| 159 |
cisco.aci.aci_interface_config: &cm_interface_501_present |
| 160 |
<<: *interface_501_absent |
| 161 |
state: present |
| 162 |
check_mode: true |
| 163 |
register: cm_interface_501_present |
| 164 |
|
| 165 |
- name: Ensure Interface 501 with leaf access with policy_group and without sub port - switch_port present - normal mode |
| 166 |
cisco.aci.aci_interface_config: &nm_interface_501_present |
| 167 |
<<: *interface_501_absent |
| 168 |
state: present |
| 169 |
register: nm_interface_501_present |
| 170 |
|
| 171 |
- name: Assertions check for an interface 501 |
| 172 |
ansible.builtin.assert: |
| 173 |
that: |
| 174 |
- interface_501_absent.current == [] |
| 175 |
- cm_interface_501_present is changed |
| 176 |
- cm_interface_501_present.current == [] |
| 177 |
- nm_interface_501_present is changed |
| 178 |
- nm_interface_501_present.current != [] |
| 179 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.assocGrp == "uni/infra/funcprof/accportgrp-ans_test_switch_port" |
| 180 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 181 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-501-card-1-port-1-sub-0" |
| 182 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.node == "501" |
| 183 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 184 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.shutdown == "yes" |
| 185 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.card == "1" |
| 186 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.port == "1" |
| 187 |
- nm_interface_501_present.current.0.infraPortConfig.attributes.subPort == "0" |
| 188 |
|
| 189 |
- name: Ensure Interface 502 with leaf access with policy_group - pc_or_vpc absent |
| 190 |
cisco.aci.aci_interface_config: &interface_502_absent |
| 191 |
<<: *aci_info |
| 192 |
role: leaf |
| 193 |
port_type: access |
| 194 |
interface_type: pc_or_vpc |
| 195 |
policy_group: ans_test_pc_or_vpc |
| 196 |
node: 502 |
| 197 |
interface: "2/2" |
| 198 |
pc_member: ans_test_pc_member_policy |
| 199 |
description: "Interface - 502 added by Ansible" |
| 200 |
state: absent |
| 201 |
register: interface_502_absent |
| 202 |
|
| 203 |
- name: Ensure Interface 502 with leaf access with policy_group - pc_or_vpc present - check mode |
| 204 |
cisco.aci.aci_interface_config: &cm_interface_502_present |
| 205 |
<<: *interface_502_absent |
| 206 |
state: present |
| 207 |
check_mode: true |
| 208 |
register: cm_interface_502_present |
| 209 |
|
| 210 |
- name: Ensure Interface 502 with leaf access with policy_group - pc_or_vpc present - normal mode |
| 211 |
cisco.aci.aci_interface_config: &nm_interface_502_present |
| 212 |
<<: *interface_502_absent |
| 213 |
state: present |
| 214 |
register: nm_interface_502_present |
| 215 |
|
| 216 |
- name: Assertions check for an interface 502 |
| 217 |
ansible.builtin.assert: |
| 218 |
that: |
| 219 |
- interface_502_absent.current == [] |
| 220 |
- cm_interface_502_present is changed |
| 221 |
- cm_interface_502_present.current == [] |
| 222 |
- nm_interface_502_present is changed |
| 223 |
- nm_interface_502_present.current != [] |
| 224 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.assocGrp == "uni/infra/funcprof/accbundle-ans_test_pc_or_vpc" |
| 225 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 226 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.card == "2" |
| 227 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.description == "Interface - 502 added by Ansible" |
| 228 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-502-card-2-port-2-sub-0" |
| 229 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.node == "502" |
| 230 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.port == "2" |
| 231 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 232 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.shutdown == "no" |
| 233 |
- nm_interface_502_present.current.0.infraPortConfig.attributes.pcMember == "ans_test_pc_member_policy" |
| 234 |
|
| 235 |
- name: Ensure Interface 505 with leaf access with policy_group - fc absent |
| 236 |
cisco.aci.aci_interface_config: &interface_505_absent |
| 237 |
<<: *aci_info |
| 238 |
role: leaf |
| 239 |
port_type: access |
| 240 |
interface_type: fc |
| 241 |
policy_group: ans_test_fc |
| 242 |
node: 505 |
| 243 |
interface: "5/5/5" |
| 244 |
description: "Interface - 505 added by Ansible" |
| 245 |
state: absent |
| 246 |
register: interface_505_absent |
| 247 |
|
| 248 |
- name: Ensure Interface 505 with leaf access with policy_group - fc present - check mode |
| 249 |
cisco.aci.aci_interface_config: &cm_interface_505_present |
| 250 |
<<: *interface_505_absent |
| 251 |
state: present |
| 252 |
check_mode: true |
| 253 |
register: cm_interface_505_present |
| 254 |
|
| 255 |
- name: Ensure Interface 505 with leaf access with policy_group - fc present - normal mode |
| 256 |
cisco.aci.aci_interface_config: &nm_interface_505_present |
| 257 |
<<: *interface_505_absent |
| 258 |
state: present |
| 259 |
register: nm_interface_505_present |
| 260 |
|
| 261 |
- name: Assertions check for an interface 505 |
| 262 |
ansible.builtin.assert: |
| 263 |
that: |
| 264 |
- interface_505_absent.current == [] |
| 265 |
- cm_interface_505_present is changed |
| 266 |
- cm_interface_505_present.current == [] |
| 267 |
- nm_interface_505_present is changed |
| 268 |
- nm_interface_505_present.current != [] |
| 269 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.assocGrp == "uni/infra/funcprof/fcaccportgrp-ans_test_fc" |
| 270 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 271 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.card == "5" |
| 272 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.description == "Interface - 505 added by Ansible" |
| 273 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-505-card-5-port-5-sub-5" |
| 274 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.node == "505" |
| 275 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.port == "5" |
| 276 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 277 |
- nm_interface_505_present.current.0.infraPortConfig.attributes.shutdown == "no" |
| 278 |
|
| 279 |
- name: Ensure Interface 506 with leaf access with policy_group - fc_port_channel absent |
| 280 |
cisco.aci.aci_interface_config: &interface_506_absent |
| 281 |
<<: *aci_info |
| 282 |
role: leaf |
| 283 |
port_type: access |
| 284 |
interface_type: fc_port_channel |
| 285 |
policy_group: ans_test_fc_port_channel |
| 286 |
node: 506 |
| 287 |
interface: "6/6/6" |
| 288 |
description: "Interface - 506 added by Ansible" |
| 289 |
state: absent |
| 290 |
register: interface_506_absent |
| 291 |
|
| 292 |
- name: Ensure Interface 506 with leaf access with policy_group - fc_port_channel present - check mode |
| 293 |
cisco.aci.aci_interface_config: &cm_interface_506_present |
| 294 |
<<: *interface_506_absent |
| 295 |
state: present |
| 296 |
check_mode: true |
| 297 |
register: cm_interface_506_present |
| 298 |
|
| 299 |
- name: Ensure Interface 506 with leaf access with policy_group - fc_port_channel present - normal mode |
| 300 |
cisco.aci.aci_interface_config: &nm_interface_506_present |
| 301 |
<<: *interface_506_absent |
| 302 |
state: present |
| 303 |
register: nm_interface_506_present |
| 304 |
|
| 305 |
- name: Assertions check for an interface 506 |
| 306 |
ansible.builtin.assert: |
| 307 |
that: |
| 308 |
- interface_506_absent.current == [] |
| 309 |
- cm_interface_506_present is changed |
| 310 |
- cm_interface_506_present.current == [] |
| 311 |
- nm_interface_506_present is changed |
| 312 |
- nm_interface_506_present.current != [] |
| 313 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.assocGrp == "uni/infra/funcprof/fcaccbundle-ans_test_fc_port_channel" |
| 314 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 315 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.card == "6" |
| 316 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.description == "Interface - 506 added by Ansible" |
| 317 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-506-card-6-port-6-sub-6" |
| 318 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.node == "506" |
| 319 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.port == "6" |
| 320 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 321 |
- nm_interface_506_present.current.0.infraPortConfig.attributes.shutdown == "no" |
| 322 |
|
| 323 |
- name: Ensure Interface 507 with leaf fabric with policy_group - leaf_fabric absent |
| 324 |
cisco.aci.aci_interface_config: &interface_507_absent |
| 325 |
<<: *aci_info |
| 326 |
role: leaf |
| 327 |
port_type: fabric |
| 328 |
interface_type: leaf_fabric |
| 329 |
policy_group: ans_test_leaf_fabric |
| 330 |
node: 507 |
| 331 |
interface: "7/7/7" |
| 332 |
description: "Interface - 507 added by Ansible" |
| 333 |
state: absent |
| 334 |
register: interface_507_absent |
| 335 |
|
| 336 |
- name: Ensure Interface 507 with leaf fabric with policy_group - leaf_fabric present - check mode |
| 337 |
cisco.aci.aci_interface_config: &cm_interface_507_present |
| 338 |
<<: *interface_507_absent |
| 339 |
state: present |
| 340 |
check_mode: true |
| 341 |
register: cm_interface_507_present |
| 342 |
|
| 343 |
- name: Ensure Interface 507 with leaf fabric with policy_group - leaf_fabric present - normal mode |
| 344 |
cisco.aci.aci_interface_config: &nm_interface_507_present |
| 345 |
<<: *interface_507_absent |
| 346 |
state: present |
| 347 |
register: nm_interface_507_present |
| 348 |
|
| 349 |
- name: Assertions check for an interface 507 |
| 350 |
ansible.builtin.assert: |
| 351 |
that: |
| 352 |
- interface_507_absent.current == [] |
| 353 |
- cm_interface_507_present is changed |
| 354 |
- cm_interface_507_present.current == [] |
| 355 |
- nm_interface_507_present is changed |
| 356 |
- nm_interface_507_present.current != [] |
| 357 |
- nm_interface_507_present.current.0.fabricPortConfig.attributes.assocGrp == "uni/fabric/funcprof/leportgrp-ans_test_leaf_fabric" |
| 358 |
- nm_interface_507_present.current.0.fabricPortConfig.attributes.description == "Interface - 507 added by Ansible" |
| 359 |
- nm_interface_507_present.current.0.fabricPortConfig.attributes.dn == "uni/fabric/portconfnode-507-card-7-port-7-sub-7" |
| 360 |
- nm_interface_507_present.current.0.fabricPortConfig.attributes.role == "leaf" |
| 361 |
- nm_interface_507_present.current.0.fabricPortConfig.attributes.shutdown == "no" |
| 362 |
|
| 363 |
- name: Ensure Interface 508 with spine access with policy_group - spine_access absent |
| 364 |
cisco.aci.aci_interface_config: &interface_508_absent |
| 365 |
<<: *aci_info |
| 366 |
role: spine |
| 367 |
port_type: access |
| 368 |
interface_type: spine_access |
| 369 |
policy_group: ans_test_spine_access |
| 370 |
node: 508 |
| 371 |
interface: "8/8/8" |
| 372 |
description: "Interface - 508 added by Ansible" |
| 373 |
state: absent |
| 374 |
register: interface_508_absent |
| 375 |
|
| 376 |
- name: Ensure Interface 508 with spine access with policy_group - spine_access present - check mode |
| 377 |
cisco.aci.aci_interface_config: &cm_interface_508_present |
| 378 |
<<: *interface_508_absent |
| 379 |
state: present |
| 380 |
check_mode: true |
| 381 |
register: cm_interface_508_present |
| 382 |
|
| 383 |
- name: Ensure Interface 508 with spine access with policy_group - spine_access present - normal mode |
| 384 |
cisco.aci.aci_interface_config: &nm_interface_508_present |
| 385 |
<<: *interface_508_absent |
| 386 |
state: present |
| 387 |
register: nm_interface_508_present |
| 388 |
|
| 389 |
- name: Assertions check for an interface 508 |
| 390 |
ansible.builtin.assert: |
| 391 |
that: |
| 392 |
- interface_508_absent.current == [] |
| 393 |
- cm_interface_508_present is changed |
| 394 |
- cm_interface_508_present.current == [] |
| 395 |
- nm_interface_508_present is changed |
| 396 |
- nm_interface_508_present.current != [] |
| 397 |
- nm_interface_508_present.current.0.infraPortConfig.attributes.assocGrp == "uni/infra/funcprof/spaccportgrp-ans_test_spine_access" |
| 398 |
- nm_interface_508_present.current.0.infraPortConfig.attributes.description == "Interface - 508 added by Ansible" |
| 399 |
- nm_interface_508_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-508-card-8-port-8-sub-8" |
| 400 |
- nm_interface_508_present.current.0.infraPortConfig.attributes.role == "spine" |
| 401 |
- nm_interface_508_present.current.0.infraPortConfig.attributes.shutdown == "no" |
| 402 |
|
| 403 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric absent |
| 404 |
cisco.aci.aci_interface_config: &interface_509_absent |
| 405 |
<<: *aci_info |
| 406 |
role: spine |
| 407 |
port_type: fabric |
| 408 |
interface_type: spine_fabric |
| 409 |
policy_group: ans_test_spine_fabric |
| 410 |
node: 509 |
| 411 |
interface: "9/9/9" |
| 412 |
description: "Interface - 509 added by Ansible" |
| 413 |
state: absent |
| 414 |
register: interface_509_absent |
| 415 |
|
| 416 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric present - check mode |
| 417 |
cisco.aci.aci_interface_config: &cm_interface_509_present |
| 418 |
<<: *interface_509_absent |
| 419 |
state: present |
| 420 |
check_mode: true |
| 421 |
register: cm_interface_509_present |
| 422 |
|
| 423 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric present - normal mode |
| 424 |
cisco.aci.aci_interface_config: &nm_interface_509_present |
| 425 |
<<: *interface_509_absent |
| 426 |
state: present |
| 427 |
register: nm_interface_509_present |
| 428 |
|
| 429 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric present - normal mode with idempotency check |
| 430 |
cisco.aci.aci_interface_config: |
| 431 |
<<: *interface_509_absent |
| 432 |
state: present |
| 433 |
register: idm_interface_509_present |
| 434 |
|
| 435 |
- name: Assertions check for an interface 509 |
| 436 |
ansible.builtin.assert: |
| 437 |
that: |
| 438 |
- interface_509_absent.current == [] |
| 439 |
- cm_interface_509_present is changed |
| 440 |
- cm_interface_509_present.current == [] |
| 441 |
- nm_interface_509_present is changed |
| 442 |
- nm_interface_509_present.current != [] |
| 443 |
- nm_interface_509_present.current.0.fabricPortConfig.attributes.assocGrp == "uni/fabric/funcprof/spportgrp-ans_test_spine_fabric" |
| 444 |
- nm_interface_509_present.current.0.fabricPortConfig.attributes.description == "Interface - 509 added by Ansible" |
| 445 |
- nm_interface_509_present.current.0.fabricPortConfig.attributes.dn == "uni/fabric/portconfnode-509-card-9-port-9-sub-9" |
| 446 |
- nm_interface_509_present.current.0.fabricPortConfig.attributes.role == "spine" |
| 447 |
- nm_interface_509_present.current.0.fabricPortConfig.attributes.shutdown == "no" |
| 448 |
- idm_interface_509_present is not changed |
| 449 |
- idm_interface_509_present.current != [] |
| 450 |
- idm_interface_509_present.current.0.fabricPortConfig.attributes.assocGrp == "uni/fabric/funcprof/spportgrp-ans_test_spine_fabric" |
| 451 |
- idm_interface_509_present.current.0.fabricPortConfig.attributes.description == "Interface - 509 added by Ansible" |
| 452 |
- idm_interface_509_present.current.0.fabricPortConfig.attributes.dn == "uni/fabric/portconfnode-509-card-9-port-9-sub-9" |
| 453 |
- idm_interface_509_present.current.0.fabricPortConfig.attributes.role == "spine" |
| 454 |
- idm_interface_509_present.current.0.fabricPortConfig.attributes.shutdown == "no" |
| 455 |
|
| 456 |
# Breakout part begins |
| 457 |
- name: Convert the interface 501 to breakout(100g-4x) with policy group - invalid test |
| 458 |
cisco.aci.aci_interface_config: |
| 459 |
<<: *aci_info |
| 460 |
role: leaf |
| 461 |
port_type: access |
| 462 |
interface_type: switch_port |
| 463 |
policy_group: ans_test_switch_port |
| 464 |
breakout: "100g-4x" |
| 465 |
node: 501 |
| 466 |
interface: "1/1" |
| 467 |
description: "Interface - 501 added by Ansible" |
| 468 |
state: present |
| 469 |
register: invalid_breakout_501_present |
| 470 |
ignore_errors: true |
| 471 |
|
| 472 |
- name: Convert the interface 501 to breakout(100g-4x) - check mode |
| 473 |
cisco.aci.aci_interface_config: &valid_breakout_501_present |
| 474 |
<<: *aci_info |
| 475 |
role: leaf |
| 476 |
port_type: access |
| 477 |
interface_type: switch_port |
| 478 |
breakout: "100g-4x" |
| 479 |
node: 501 |
| 480 |
interface: "1/1" |
| 481 |
description: "Interface - 501 added by Ansible" |
| 482 |
admin_state: "down" |
| 483 |
state: present |
| 484 |
check_mode: true |
| 485 |
register: cm_valid_breakout_501_present |
| 486 |
|
| 487 |
- name: Convert the interface 501 to breakout(100g-4x) - normal mode |
| 488 |
cisco.aci.aci_interface_config: |
| 489 |
<<: *valid_breakout_501_present |
| 490 |
register: nm_valid_breakout_501_present |
| 491 |
|
| 492 |
- name: Convert the interface 501 to breakout(100g-4x) - normal mode with idempotency check |
| 493 |
cisco.aci.aci_interface_config: |
| 494 |
<<: *valid_breakout_501_present |
| 495 |
register: idm_breakout_501_present |
| 496 |
|
| 497 |
- name: Assertions check for convert the interface 501 to breakout(100g-4x) |
| 498 |
ansible.builtin.assert: |
| 499 |
that: |
| 500 |
- invalid_breakout_501_present is not changed |
| 501 |
- invalid_breakout_501_present.msg == "parameters are mutually exclusive{{':'}} policy_group|breakout" |
| 502 |
- cm_valid_breakout_501_present is changed |
| 503 |
- cm_valid_breakout_501_present.current != [] |
| 504 |
- cm_valid_breakout_501_present.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 505 |
- nm_valid_breakout_501_present is changed |
| 506 |
- nm_valid_breakout_501_present.current != [] |
| 507 |
- nm_valid_breakout_501_present.current.0.infraPortConfig.attributes.brkoutMap == "100g-4x" |
| 508 |
- nm_valid_breakout_501_present.current.0.infraPortConfig.attributes.description == "Interface - 501 added by Ansible" |
| 509 |
- nm_valid_breakout_501_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-501-card-1-port-1-sub-0" |
| 510 |
- nm_valid_breakout_501_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 511 |
- nm_valid_breakout_501_present.current.0.infraPortConfig.attributes.shutdown == "yes" |
| 512 |
- idm_breakout_501_present is not changed |
| 513 |
- idm_breakout_501_present.current != [] |
| 514 |
- idm_breakout_501_present.current.0.infraPortConfig.attributes.brkoutMap == "100g-4x" |
| 515 |
- idm_breakout_501_present.current.0.infraPortConfig.attributes.description == "Interface - 501 added by Ansible" |
| 516 |
- idm_breakout_501_present.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-501-card-1-port-1-sub-0" |
| 517 |
- idm_breakout_501_present.current.0.infraPortConfig.attributes.role == "leaf" |
| 518 |
- idm_breakout_501_present.current.0.infraPortConfig.attributes.shutdown == "yes" |
| 519 |
# Breakup part ends |
| 520 |
|
| 521 |
- name: Query all access interfaces |
| 522 |
cisco.aci.aci_interface_config: |
| 523 |
<<: *aci_info |
| 524 |
port_type: access |
| 525 |
state: query |
| 526 |
register: query_all_access_interfaces |
| 527 |
|
| 528 |
- name: Assertions check for query all access interfaces |
| 529 |
ansible.builtin.assert: |
| 530 |
that: |
| 531 |
- query_all_access_interfaces is not changed |
| 532 |
- query_all_access_interfaces.current|length >= 5 |
| 533 |
|
| 534 |
- name: Query all fabric interfaces |
| 535 |
cisco.aci.aci_interface_config: |
| 536 |
<<: *aci_info |
| 537 |
port_type: fabric |
| 538 |
state: query |
| 539 |
register: query_all_fabric_interfaces |
| 540 |
|
| 541 |
- name: Assertions check for query all fabric interfaces |
| 542 |
ansible.builtin.assert: |
| 543 |
that: |
| 544 |
- query_all_fabric_interfaces is not changed |
| 545 |
- query_all_fabric_interfaces.current|length >= 2 |
| 546 |
|
| 547 |
- name: Query a access interface with node id 502 |
| 548 |
cisco.aci.aci_interface_config: |
| 549 |
<<: *aci_info |
| 550 |
port_type: access |
| 551 |
node: 502 |
| 552 |
state: query |
| 553 |
register: query_access_interface_502 |
| 554 |
|
| 555 |
- name: Assertions check for query a access interface with node id 502 |
| 556 |
ansible.builtin.assert: |
| 557 |
that: |
| 558 |
- query_access_interface_502 is not changed |
| 559 |
- query_access_interface_502.current|length == 1 |
| 560 |
- query_access_interface_502.current.0.infraPortConfig.attributes.brkoutMap == "none" |
| 561 |
- query_access_interface_502.current.0.infraPortConfig.attributes.description == "Interface - 502 added by Ansible" |
| 562 |
- query_access_interface_502.current.0.infraPortConfig.attributes.dn == "uni/infra/portconfnode-502-card-2-port-2-sub-0" |
| 563 |
- query_access_interface_502.current.0.infraPortConfig.attributes.role == "leaf" |
| 564 |
- query_access_interface_502.current.0.infraPortConfig.attributes.shutdown == "no" |
| 565 |
|
| 566 |
- name: Query a fabric interface with node id 509 |
| 567 |
cisco.aci.aci_interface_config: |
| 568 |
<<: *aci_info |
| 569 |
port_type: fabric |
| 570 |
node: 509 |
| 571 |
state: query |
| 572 |
register: query_access_fabric_509 |
| 573 |
|
| 574 |
- name: Assertions check for query a fabric interface with node id 509 |
| 575 |
ansible.builtin.assert: |
| 576 |
that: |
| 577 |
- query_access_fabric_509 is not changed |
| 578 |
- query_access_fabric_509.current|length == 1 |
| 579 |
- query_access_fabric_509.current.0.fabricPortConfig.attributes.assocGrp == "uni/fabric/funcprof/spportgrp-ans_test_spine_fabric" |
| 580 |
- query_access_fabric_509.current.0.fabricPortConfig.attributes.description == "Interface - 509 added by Ansible" |
| 581 |
- query_access_fabric_509.current.0.fabricPortConfig.attributes.dn == "uni/fabric/portconfnode-509-card-9-port-9-sub-9" |
| 582 |
- query_access_fabric_509.current.0.fabricPortConfig.attributes.role == "spine" |
| 583 |
- query_access_fabric_509.current.0.fabricPortConfig.attributes.shutdown == "no" |
| 584 |
|
| 585 |
- name: Ensure Breakout Interface 501 absent |
| 586 |
cisco.aci.aci_interface_config: |
| 587 |
<<: *valid_breakout_501_present |
| 588 |
state: absent |
| 589 |
register: rm_interface_501_present |
| 590 |
|
| 591 |
- name: Ensure Interface 502 with leaf access with policy_group - pc_or_vpc absent |
| 592 |
cisco.aci.aci_interface_config: |
| 593 |
<<: *interface_502_absent |
| 594 |
state: absent |
| 595 |
register: rm_interface_502_present |
| 596 |
|
| 597 |
- name: Ensure Interface 505 with leaf access with policy_group - fc absent |
| 598 |
cisco.aci.aci_interface_config: |
| 599 |
<<: *interface_505_absent |
| 600 |
state: absent |
| 601 |
register: rm_interface_505_present |
| 602 |
|
| 603 |
- name: Ensure Interface 506 with leaf access with policy_group - fc_port_channel absent |
| 604 |
cisco.aci.aci_interface_config: |
| 605 |
<<: *interface_506_absent |
| 606 |
state: absent |
| 607 |
register: rm_interface_506_present |
| 608 |
|
| 609 |
- name: Ensure Interface 507 with leaf fabric with policy_group - leaf_fabric absent |
| 610 |
cisco.aci.aci_interface_config: |
| 611 |
<<: *interface_507_absent |
| 612 |
state: absent |
| 613 |
register: rm_interface_507_present |
| 614 |
|
| 615 |
- name: Ensure Interface 508 with spine access with policy_group - spine_access absent |
| 616 |
cisco.aci.aci_interface_config: |
| 617 |
<<: *interface_508_absent |
| 618 |
state: absent |
| 619 |
register: rm_interface_508_present |
| 620 |
|
| 621 |
- name: Assertions check for remove Interfaces 501 to 508 |
| 622 |
ansible.builtin.assert: |
| 623 |
that: |
| 624 |
- rm_interface_501_present is changed |
| 625 |
- rm_interface_501_present.current == [] |
| 626 |
- rm_interface_502_present is changed |
| 627 |
- rm_interface_502_present.current == [] |
| 628 |
- rm_interface_505_present is changed |
| 629 |
- rm_interface_505_present.current == [] |
| 630 |
- rm_interface_506_present is changed |
| 631 |
- rm_interface_506_present.current == [] |
| 632 |
- rm_interface_507_present is changed |
| 633 |
- rm_interface_507_present.current == [] |
| 634 |
- rm_interface_508_present is changed |
| 635 |
- rm_interface_508_present.current == [] |
| 636 |
|
| 637 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric absent - check mode |
| 638 |
cisco.aci.aci_interface_config: |
| 639 |
<<: *interface_509_absent |
| 640 |
state: absent |
| 641 |
check_mode: true |
| 642 |
register: cm_rm_interface_509_present |
| 643 |
|
| 644 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric absent - normal mode |
| 645 |
cisco.aci.aci_interface_config: |
| 646 |
<<: *interface_509_absent |
| 647 |
state: absent |
| 648 |
register: nm_rm_interface_509_present |
| 649 |
|
| 650 |
- name: Assertions check for remove Interface 509 |
| 651 |
ansible.builtin.assert: |
| 652 |
that: |
| 653 |
- cm_rm_interface_509_present is changed |
| 654 |
- cm_rm_interface_509_present.current != [] |
| 655 |
- nm_rm_interface_509_present is changed |
| 656 |
- nm_rm_interface_509_present.current == [] |
| 657 |
|
| 658 |
- name: Ensure Interface 509 with spine fabric with policy_group - spine_fabric absent - normal mode with idempotency check |
| 659 |
cisco.aci.aci_interface_config: |
| 660 |
<<: *interface_509_absent |
| 661 |
state: absent |
| 662 |
register: idm_rm_interface_509_present |
| 663 |
|
| 664 |
- name: Assertions check for remove Interface 509 with idempotency check |
| 665 |
ansible.builtin.assert: |
| 666 |
that: |
| 667 |
- idm_rm_interface_509_present is not changed |
| 668 |
- idm_rm_interface_509_present.current == [] |
| 669 |
|
| 670 |
- name: Query an interface 509 after removed from the APIC |
| 671 |
cisco.aci.aci_interface_config: |
| 672 |
<<: *aci_info |
| 673 |
node: 509 |
| 674 |
port_type: "fabric" |
| 675 |
state: query |
| 676 |
register: query_interface_509 |
| 677 |
|
| 678 |
- name: Assertions check for query an interface 509 after removed from the APIC |
| 679 |
ansible.builtin.assert: |
| 680 |
that: |
| 681 |
- query_interface_509 is not changed |
| 682 |
- query_interface_509.current == [] |
| 683 |
|
| 684 |
- name: Ensure Interfaces 50* are absent - Clean up test environment |
| 685 |
cisco.aci.aci_interface_config: |
| 686 |
<<: *aci_info |
| 687 |
node: "{{ item.node }}" |
| 688 |
interface: "{{ item.interface }}" |
| 689 |
state: absent |
| 690 |
with_items: |
| 691 |
- { node: "501", interface: "1/1/1" } |
| 692 |
- { node: "502", interface: "2/2/2" } |
| 693 |
- { node: "503", interface: "1/1/1" } |
| 694 |
- { node: "505", interface: "5/5/5" } |
| 695 |
- { node: "506", interface: "6/6/6" } |
| 696 |
- { node: "507", interface: "7/7/7" } |
| 697 |
- { node: "508", interface: "8/8/8" } |
| 698 |
- { node: "509", interface: "9/9/9" } |