| 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: '{{ aci_output_level | default("info") }}' |
| 21 |
aci_tenant: ansible_test |
| 22 |
|
| 23 |
- name: Verify Cloud and Non-Cloud Sites in use. |
| 24 |
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
| 25 |
|
| 26 |
- name: Execute tasks only for non-cloud sites |
| 27 |
when: |
| 28 |
- query_cloud.current == [] |
| 29 |
block: |
| 30 |
|
| 31 |
- name: Query system information |
| 32 |
cisco.aci.aci_system: |
| 33 |
<<: *aci_info |
| 34 |
id: 1 |
| 35 |
state: query |
| 36 |
register: version |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
- name: Ensure clean tenant configuration |
| 41 |
cisco.aci.aci_tenant: |
| 42 |
<<: *aci_info |
| 43 |
tenant: "{{ aci_tenant }}" |
| 44 |
state: "{{ item }}" |
| 45 |
loop: |
| 46 |
- absent |
| 47 |
- present |
| 48 |
|
| 49 |
- name: Ensure clean vrf configuration |
| 50 |
cisco.aci.aci_vrf: |
| 51 |
<<: *aci_info |
| 52 |
tenant: "{{ aci_tenant }}" |
| 53 |
vrf: vrf_1 |
| 54 |
|
| 55 |
- name: Ensure clean l3out configuration |
| 56 |
cisco.aci.aci_l3out: |
| 57 |
<<: *aci_info |
| 58 |
tenant: "{{ aci_tenant }}" |
| 59 |
l3out: "{{ item }}" |
| 60 |
vrf: vrf_1 |
| 61 |
domain: dom_1 |
| 62 |
loop: |
| 63 |
- l3out_1 |
| 64 |
- l3out_2 |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
- name: Add l3out external epg 1 ( check mode ) |
| 69 |
cisco.aci.aci_l3out_extepg: &add_l3out_extepg_1 |
| 70 |
<<: *aci_info |
| 71 |
tenant: "{{ aci_tenant }}" |
| 72 |
l3out: l3out_1 |
| 73 |
extepg: extepg_1 |
| 74 |
state: present |
| 75 |
check_mode: true |
| 76 |
register: cm_add_l3out_extepg_1 |
| 77 |
|
| 78 |
- name: Add l3out external epg 1 |
| 79 |
cisco.aci.aci_l3out_extepg: |
| 80 |
<<: *add_l3out_extepg_1 |
| 81 |
route_control_profiles: |
| 82 |
import_profile: "" |
| 83 |
register: nm_add_l3out_extepg_1 |
| 84 |
|
| 85 |
- name: Add l3out external epg 1 again |
| 86 |
cisco.aci.aci_l3out_extepg: |
| 87 |
<<: *add_l3out_extepg_1 |
| 88 |
register: nm_add_l3out_extepg_1_again |
| 89 |
|
| 90 |
- name: Verify add l3out external epg 1 |
| 91 |
ansible.builtin.assert: |
| 92 |
that: |
| 93 |
- cm_add_l3out_extepg_1 is changed |
| 94 |
- cm_add_l3out_extepg_1.current == [] |
| 95 |
- cm_add_l3out_extepg_1.previous == [] |
| 96 |
- cm_add_l3out_extepg_1.proposed.l3extInstP.attributes.name == "extepg_1" |
| 97 |
- nm_add_l3out_extepg_1 is changed |
| 98 |
- nm_add_l3out_extepg_1.previous == [] |
| 99 |
- nm_add_l3out_extepg_1.current.0.l3extInstP.attributes.name == "extepg_1" |
| 100 |
- nm_add_l3out_extepg_1.current.0.l3extInstP.attributes.descr == "" |
| 101 |
- nm_add_l3out_extepg_1.current.0.l3extInstP.attributes.prefGrMemb == "exclude" |
| 102 |
- nm_add_l3out_extepg_1.current.0.l3extInstP.attributes.targetDscp == "unspecified" |
| 103 |
- nm_add_l3out_extepg_1_again is not changed |
| 104 |
- nm_add_l3out_extepg_1_again.previous.0.l3extInstP.attributes.name == "extepg_1" |
| 105 |
- nm_add_l3out_extepg_1_again.previous.0.l3extInstP.attributes.descr == "" |
| 106 |
- nm_add_l3out_extepg_1_again.previous.0.l3extInstP.attributes.prefGrMemb == "exclude" |
| 107 |
- nm_add_l3out_extepg_1_again.previous.0.l3extInstP.attributes.targetDscp == "unspecified" |
| 108 |
- nm_add_l3out_extepg_1_again.current.0.l3extInstP.attributes.name == "extepg_1" |
| 109 |
- nm_add_l3out_extepg_1_again.current.0.l3extInstP.attributes.descr == "" |
| 110 |
- nm_add_l3out_extepg_1_again.current.0.l3extInstP.attributes.prefGrMemb == "exclude" |
| 111 |
- nm_add_l3out_extepg_1_again.current.0.l3extInstP.attributes.targetDscp == "unspecified" |
| 112 |
|
| 113 |
- name: Change l3out external epg 1 |
| 114 |
cisco.aci.aci_l3out_extepg: |
| 115 |
<<: *add_l3out_extepg_1 |
| 116 |
description: "changed description" |
| 117 |
preferred_group: true |
| 118 |
dscp: AF12 |
| 119 |
register: nm_change_l3out_extepg_1 |
| 120 |
|
| 121 |
- name: Verify change l3out external epg 1 |
| 122 |
ansible.builtin.assert: |
| 123 |
that: |
| 124 |
- nm_change_l3out_extepg_1 is changed |
| 125 |
- nm_change_l3out_extepg_1.previous.0.l3extInstP.attributes.name == "extepg_1" |
| 126 |
- nm_change_l3out_extepg_1.previous.0.l3extInstP.attributes.descr == "" |
| 127 |
- nm_change_l3out_extepg_1.previous.0.l3extInstP.attributes.prefGrMemb == "exclude" |
| 128 |
- nm_change_l3out_extepg_1.previous.0.l3extInstP.attributes.targetDscp == "unspecified" |
| 129 |
- nm_change_l3out_extepg_1.current.0.l3extInstP.attributes.name == "extepg_1" |
| 130 |
- nm_change_l3out_extepg_1.current.0.l3extInstP.attributes.descr == "changed description" |
| 131 |
- nm_change_l3out_extepg_1.current.0.l3extInstP.attributes.prefGrMemb == "include" |
| 132 |
- nm_change_l3out_extepg_1.current.0.l3extInstP.attributes.targetDscp == "AF12" |
| 133 |
|
| 134 |
- name: Add two more l3out external epgs |
| 135 |
cisco.aci.aci_l3out_extepg: |
| 136 |
<<: *aci_info |
| 137 |
tenant: "{{ aci_tenant }}" |
| 138 |
l3out: "{{ item.l3out }}" |
| 139 |
extepg: "{{ item.extepg }}" |
| 140 |
state: present |
| 141 |
loop: |
| 142 |
- {l3out: l3out_1, extepg: extepg_2} |
| 143 |
- {l3out: l3out_2, extepg: extepg_3} |
| 144 |
|
| 145 |
- name: Add l3out external epg with the new optional params |
| 146 |
cisco.aci.aci_l3out_extepg: |
| 147 |
<<: *aci_info |
| 148 |
tenant: ansible_test |
| 149 |
l3out: l3out_1 |
| 150 |
extepg: extepg_params |
| 151 |
contract_exception_tag: contract_excepted |
| 152 |
qos_class: level6 |
| 153 |
route_control_profiles: |
| 154 |
import_profile: profile1 |
| 155 |
export_profile: profile2 |
| 156 |
state: present |
| 157 |
register: nm_l3out_extepg_optional_params |
| 158 |
|
| 159 |
- name: Add l3out external epg with the new optional params again |
| 160 |
cisco.aci.aci_l3out_extepg: |
| 161 |
<<: *aci_info |
| 162 |
tenant: ansible_test |
| 163 |
l3out: l3out_1 |
| 164 |
extepg: extepg_params |
| 165 |
contract_exception_tag: contract_excepted |
| 166 |
qos_class: level6 |
| 167 |
route_control_profiles: |
| 168 |
import_profile: profile1 |
| 169 |
export_profile: profile2 |
| 170 |
state: present |
| 171 |
register: nm_l3out_extepg_optional_params_again |
| 172 |
|
| 173 |
- name: Add l3out external epg with no export route control profile in the task |
| 174 |
cisco.aci.aci_l3out_extepg: |
| 175 |
<<: *aci_info |
| 176 |
tenant: ansible_test |
| 177 |
l3out: l3out_1 |
| 178 |
extepg: extepg_params |
| 179 |
contract_exception_tag: contract_excepted |
| 180 |
qos_class: level6 |
| 181 |
route_control_profiles: |
| 182 |
import_profile: profile1 |
| 183 |
state: present |
| 184 |
register: nm_l3out_extepg_non_existent_export_profile |
| 185 |
|
| 186 |
- name: Add l3out external epg with export route control profile having "" |
| 187 |
cisco.aci.aci_l3out_extepg: |
| 188 |
<<: *aci_info |
| 189 |
tenant: ansible_test |
| 190 |
l3out: l3out_1 |
| 191 |
extepg: extepg_params |
| 192 |
contract_exception_tag: contract_excepted |
| 193 |
qos_class: level6 |
| 194 |
route_control_profiles: |
| 195 |
import_profile: profile1 |
| 196 |
export_profile: "" |
| 197 |
state: present |
| 198 |
register: nm_l3out_extepg_remove_export_profile |
| 199 |
|
| 200 |
- name: Add l3out external epg with export route control profile again |
| 201 |
cisco.aci.aci_l3out_extepg: |
| 202 |
<<: *aci_info |
| 203 |
tenant: ansible_test |
| 204 |
l3out: l3out_1 |
| 205 |
extepg: extepg_params |
| 206 |
contract_exception_tag: contract_excepted |
| 207 |
qos_class: level6 |
| 208 |
route_control_profiles: |
| 209 |
import_profile: profile1 |
| 210 |
export: profile2 |
| 211 |
state: present |
| 212 |
register: nm_l3out_extepg_add_export_profile |
| 213 |
|
| 214 |
- name: Add l3out external epg with intra_ext_epg_isolation |
| 215 |
cisco.aci.aci_l3out_extepg: |
| 216 |
<<: *aci_info |
| 217 |
tenant: ansible_test |
| 218 |
l3out: l3out_1 |
| 219 |
extepg: extepg_isolation |
| 220 |
intra_ext_epg_isolation: enforced |
| 221 |
state: present |
| 222 |
register: nm_l3out_extepg_isolation |
| 223 |
when: |
| 224 |
- version.current.0.topSystem.attributes.version is version('5.0', '>=') |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
- name: Query l3out external epg 1 |
| 229 |
cisco.aci.aci_l3out_extepg: |
| 230 |
<<: *add_l3out_extepg_1 |
| 231 |
state: query |
| 232 |
register: query_one |
| 233 |
|
| 234 |
- name: Query all l3out external epgs ( class query ) |
| 235 |
cisco.aci.aci_l3out_extepg: |
| 236 |
<<: *aci_info |
| 237 |
state: query |
| 238 |
register: query_all |
| 239 |
|
| 240 |
- name: Verify query l3out external epgs |
| 241 |
ansible.builtin.assert: |
| 242 |
that: |
| 243 |
- query_one is not changed |
| 244 |
- query_one.current | length == 1 |
| 245 |
- query_one.current.0.l3extInstP.attributes.name == "extepg_1" |
| 246 |
- query_all is not changed |
| 247 |
- query_all.current | length >= 3 |
| 248 |
|
| 249 |
- name: Query l3out external epg with the new optional params |
| 250 |
cisco.aci.aci_l3out_extepg: |
| 251 |
<<: *aci_info |
| 252 |
tenant: ansible_test |
| 253 |
l3out: l3out_1 |
| 254 |
extepg: extepg_params |
| 255 |
state: query |
| 256 |
register: query_l3out_extepg_optional_params |
| 257 |
|
| 258 |
- name: Query l3out external epg with intra_ext_epg_isolation |
| 259 |
cisco.aci.aci_l3out_extepg: |
| 260 |
<<: *aci_info |
| 261 |
tenant: ansible_test |
| 262 |
l3out: l3out_1 |
| 263 |
extepg: extepg_isolation |
| 264 |
state: query |
| 265 |
register: query_l3out_extepg_isolation |
| 266 |
when: |
| 267 |
- version.current.0.topSystem.attributes.version is version('5.0', '>=') |
| 268 |
|
| 269 |
- name: Gather attribute search results using regex |
| 270 |
ansible.builtin.set_fact: |
| 271 |
profile1_name: "{{ nm_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('profile1') }}" |
| 272 |
profile1_direction: "{{ nm_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('import') }}" |
| 273 |
profile2_name: "{{ nm_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('profile2') }}" |
| 274 |
profile2_direction: "{{ nm_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('export') }}" |
| 275 |
profile2_exists: "{{ nm_l3out_extepg_non_existent_export_profile.current.0.l3extInstP.children | regex_search('profile2') }}" |
| 276 |
profile2_removed: "{{ nm_l3out_extepg_remove_export_profile.current.0.l3extInstP.children | regex_search('profile2') }}" |
| 277 |
profile2_direction_removed: "{{ nm_l3out_extepg_remove_export_profile.current.0.l3extInstP.children | regex_search('export') }}" |
| 278 |
query_profile1_name: "{{ query_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('profile1') }}" |
| 279 |
query_profile1_direction: "{{ query_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('import') }}" |
| 280 |
query_profile2_name: "{{ query_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('profile2') }}" |
| 281 |
query_profile2_direction: "{{ query_l3out_extepg_optional_params.current.0.l3extInstP.children | regex_search('export') }}" |
| 282 |
|
| 283 |
- name: Verify l3out external epg with the new optional params |
| 284 |
ansible.builtin.assert: |
| 285 |
that: |
| 286 |
- nm_l3out_extepg_optional_params is changed |
| 287 |
- nm_l3out_extepg_optional_params_again is not changed |
| 288 |
- nm_l3out_extepg_non_existent_export_profile is not changed |
| 289 |
- nm_l3out_extepg_remove_export_profile is changed |
| 290 |
- nm_l3out_extepg_add_export_profile is changed |
| 291 |
- query_l3out_extepg_optional_params is not changed |
| 292 |
- nm_l3out_extepg_optional_params.current.0.l3extInstP.attributes.name == "extepg_params" |
| 293 |
- nm_l3out_extepg_optional_params.current.0.l3extInstP.attributes.prio == "level6" |
| 294 |
- profile1_name == "profile1" |
| 295 |
- profile1_direction == "import" |
| 296 |
- profile2_name == "profile2" |
| 297 |
- profile2_direction == "export" |
| 298 |
- query_profile1_name == "profile1" |
| 299 |
- query_profile1_direction == "import" |
| 300 |
- query_profile2_name == "profile2" |
| 301 |
- query_profile2_direction == "export" |
| 302 |
- profile2_exists == "profile2" |
| 303 |
- profile2_removed == "" |
| 304 |
- profile2_direction_removed == "" |
| 305 |
|
| 306 |
- name: Verify l3out external epg with intra_ext_epg_isolation |
| 307 |
ansible.builtin.assert: |
| 308 |
that: |
| 309 |
- nm_l3out_extepg_isolation.current.0.l3extInstP.attributes.pcEnfPref == "enforced" |
| 310 |
- query_l3out_extepg_isolation.current.0.l3extInstP.attributes.pcEnfPref == "enforced" |
| 311 |
when: |
| 312 |
- version.current.0.topSystem.attributes.version is version('5.0', '>=') |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
- name: Remove l3out external epg 1 ( check mode ) |
| 317 |
cisco.aci.aci_l3out_extepg: &remove_l3out_extepg_1 |
| 318 |
<<: *add_l3out_extepg_1 |
| 319 |
state: absent |
| 320 |
check_mode: true |
| 321 |
register: cm_remove_l3out_extepg_1 |
| 322 |
|
| 323 |
- name: Remove l3out external epg 1 |
| 324 |
cisco.aci.aci_l3out_extepg: |
| 325 |
<<: *remove_l3out_extepg_1 |
| 326 |
register: nm_remove_l3out_extepg_1 |
| 327 |
|
| 328 |
- name: Remove l3out external epg 1 again |
| 329 |
cisco.aci.aci_l3out_extepg: |
| 330 |
<<: *remove_l3out_extepg_1 |
| 331 |
register: nm_remove_l3out_extepg_1_again |
| 332 |
|
| 333 |
- name: Remove l3out external epg params |
| 334 |
cisco.aci.aci_l3out_extepg: |
| 335 |
<<: *aci_info |
| 336 |
tenant: ansible_test |
| 337 |
l3out: l3out_1 |
| 338 |
extepg: extepg_params |
| 339 |
state: absent |
| 340 |
register: remove_l3out_extepg_params |
| 341 |
|
| 342 |
- name: Remove l3out external epg with intra_ext_epg_isolation |
| 343 |
cisco.aci.aci_l3out_extepg: |
| 344 |
<<: *aci_info |
| 345 |
tenant: ansible_test |
| 346 |
l3out: l3out_1 |
| 347 |
extepg: extepg_isolation |
| 348 |
state: absent |
| 349 |
register: remove_l3out_extepg_isolation |
| 350 |
|
| 351 |
- name: Verify removal epg monitoring policies |
| 352 |
ansible.builtin.assert: |
| 353 |
that: |
| 354 |
- cm_remove_l3out_extepg_1 is changed |
| 355 |
- cm_remove_l3out_extepg_1.proposed == {} |
| 356 |
- nm_remove_l3out_extepg_1 is changed |
| 357 |
- nm_remove_l3out_extepg_1.previous.0.l3extInstP.attributes.name == "extepg_1" |
| 358 |
- nm_remove_l3out_extepg_1.current == [] |
| 359 |
- nm_remove_l3out_extepg_1_again is not changed |
| 360 |
- nm_remove_l3out_extepg_1_again.previous == [] |
| 361 |
- nm_remove_l3out_extepg_1_again.current == [] |
| 362 |
- remove_l3out_extepg_params is changed |
| 363 |
- remove_l3out_extepg_params.current == [] |
| 364 |
- remove_l3out_extepg_isolation.current == [] |