| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
- name: Remove physical 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: phys_dom |
| 18 |
domain_type: phys |
| 19 |
state: absent |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
- name: Add physical 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: phys_dom |
| 33 |
domain_type: phys |
| 34 |
state: present |
| 35 |
check_mode: true |
| 36 |
register: cm_add_domain |
| 37 |
|
| 38 |
- name: Add physical domain (normal mode) |
| 39 |
cisco.aci.aci_domain: *domain_present |
| 40 |
register: nm_add_domain |
| 41 |
|
| 42 |
- name: Verify physical 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.physDomP.attributes.name == nm_add_domain.sent.physDomP.attributes.name == 'phys_dom' |
| 48 |
- cm_add_domain.proposed.physDomP.attributes.name == nm_add_domain.proposed.physDomP.attributes.name == 'phys_dom' |
| 49 |
- cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] |
| 50 |
- nm_add_domain.current.0.physDomP.attributes.annotation == 'orchestrator:ansible' |
| 51 |
- nm_add_domain.current.0.physDomP.attributes.name == 'phys_dom' |
| 52 |
- nm_add_domain.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom' |
| 53 |
|
| 54 |
- name: Add physical 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 physical domain again (normal mode) |
| 60 |
cisco.aci.aci_domain: *domain_present |
| 61 |
register: nm_add_domain_again |
| 62 |
|
| 63 |
- name: Verify physical 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 physical 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 physical 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 physical 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 physical 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 physical 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 physical 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 physical 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 physical 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 'phys' cannot have parameter 'vm_provider'" |
| 133 |
- nm_incorrect_vm_provider.msg == "Domain type 'phys' cannot have parameter 'vm_provider'" |
| 134 |
- cm_incorrect_encap_mode.msg == "Domain type 'phys' cannot have parameter 'encap_mode'" |
| 135 |
- nm_incorrect_encap_mode.msg == "Domain type 'phys' cannot have parameter 'encap_mode'" |
| 136 |
- cm_incorrect_multicast_address.msg == "Domain type 'phys' cannot have parameter 'multicast_address'" |
| 137 |
- nm_incorrect_multicast_address.msg == "Domain type 'phys' cannot have parameter 'multicast_address'" |
| 138 |
- cm_incorrect_vswitch.msg == "Domain type 'phys' cannot have parameter 'vswitch'" |
| 139 |
- nm_incorrect_vswitch.msg == "Domain type 'phys' cannot have parameter 'vswitch'" |
| 140 |
|
| 141 |
|
| 142 |
- name: Query all physical domains (check_mode) |
| 143 |
cisco.aci.aci_domain: &domain_query |
| 144 |
host: '{{ aci_hostname }}' |
| 145 |
username: '{{ aci_username }}' |
| 146 |
password: '{{ aci_password }}' |
| 147 |
validate_certs: '{{ aci_validate_certs | default(false) }}' |
| 148 |
use_ssl: '{{ aci_use_ssl | default(true) }}' |
| 149 |
use_proxy: '{{ aci_use_proxy | default(true) }}' |
| 150 |
output_level: '{{ aci_output_level | default("info") }}' |
| 151 |
domain_type: phys |
| 152 |
state: query |
| 153 |
check_mode: true |
| 154 |
register: cm_query_all_domains |
| 155 |
|
| 156 |
- name: Query all physical domains (normal mode) |
| 157 |
cisco.aci.aci_domain: *domain_query |
| 158 |
register: nm_query_all_domains |
| 159 |
|
| 160 |
- name: Verify physical query_all_domains |
| 161 |
ansible.builtin.assert: |
| 162 |
that: |
| 163 |
- cm_query_all_domains is not changed |
| 164 |
- nm_query_all_domains is not changed |
| 165 |
- cm_query_all_domains == nm_query_all_domains |
| 166 |
- nm_query_all_domains.current|length >= 1 |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
- name: Query our physical domain (check_mode) |
| 171 |
cisco.aci.aci_domain: |
| 172 |
<<: *domain_query |
| 173 |
domain: phys_dom |
| 174 |
check_mode: true |
| 175 |
register: cm_query_domain |
| 176 |
|
| 177 |
- name: Query our physical domain (normal mode) |
| 178 |
cisco.aci.aci_domain: |
| 179 |
<<: *domain_query |
| 180 |
domain: phys_dom |
| 181 |
register: nm_query_domain |
| 182 |
|
| 183 |
- name: Verify physical query_domain |
| 184 |
ansible.builtin.assert: |
| 185 |
that: |
| 186 |
- cm_query_domain is not changed |
| 187 |
- nm_query_domain is not changed |
| 188 |
- cm_query_domain == nm_query_domain |
| 189 |
- nm_query_domain.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom' |
| 190 |
- nm_query_domain.current.0.physDomP.attributes.name == 'phys_dom' |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
- name: Remove physical domain (check_mode) |
| 195 |
cisco.aci.aci_domain: *domain_absent |
| 196 |
check_mode: true |
| 197 |
register: cm_remove_domain |
| 198 |
|
| 199 |
- name: Remove physical domain (normal mode) |
| 200 |
cisco.aci.aci_domain: *domain_absent |
| 201 |
register: nm_remove_domain |
| 202 |
|
| 203 |
- name: Verify physical remove_domain |
| 204 |
ansible.builtin.assert: |
| 205 |
that: |
| 206 |
- cm_remove_domain is changed |
| 207 |
- nm_remove_domain is changed |
| 208 |
- cm_remove_domain.current.0.physDomP.attributes.name == cm_remove_domain.previous.0.physDomP.attributes.name == nm_remove_domain.previous.0.physDomP.attributes.name == 'phys_dom' |
| 209 |
- cm_remove_domain.current.0.physDomP.attributes.dn == cm_remove_domain.previous.0.physDomP.attributes.dn == nm_remove_domain.previous.0.physDomP.attributes.dn == 'uni/phys-phys_dom' |
| 210 |
- nm_remove_domain.current == [] |
| 211 |
|
| 212 |
- name: Remove physical domain again (check_mode) |
| 213 |
cisco.aci.aci_domain: *domain_absent |
| 214 |
check_mode: true |
| 215 |
register: cm_remove_domain_again |
| 216 |
|
| 217 |
- name: Remove physical domain again (normal mode) |
| 218 |
cisco.aci.aci_domain: *domain_absent |
| 219 |
register: nm_remove_domain_again |
| 220 |
|
| 221 |
- name: Verify physical remove_domain_again |
| 222 |
ansible.builtin.assert: |
| 223 |
that: |
| 224 |
- cm_remove_domain_again is not changed |
| 225 |
- nm_remove_domain_again is not changed |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
- name: Query non-existing physical domain (check_mode) |
| 230 |
cisco.aci.aci_domain: |
| 231 |
<<: *domain_query |
| 232 |
domain: phys_dom |
| 233 |
check_mode: true |
| 234 |
register: cm_query_non_domain |
| 235 |
|
| 236 |
- name: Query non-existing physical domain (normal mode) |
| 237 |
cisco.aci.aci_domain: |
| 238 |
<<: *domain_query |
| 239 |
domain: phys_dom |
| 240 |
register: nm_query_non_domain |
| 241 |
|
| 242 |
- name: Verify physical query_non_domain |
| 243 |
ansible.builtin.assert: |
| 244 |
that: |
| 245 |
- cm_query_non_domain is not changed |
| 246 |
- nm_query_non_domain is not changed |
| 247 |
- cm_query_non_domain == nm_query_non_domain |
| 248 |
- nm_query_non_domain.current == [] |