| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
- name: Remove FC 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: fc_dom |
| 18 |
domain_type: fc |
| 19 |
state: absent |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
- name: Add FC 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: fc_dom |
| 33 |
domain_type: fc |
| 34 |
state: present |
| 35 |
check_mode: true |
| 36 |
register: cm_add_domain |
| 37 |
|
| 38 |
- name: Add FC domain (normal mode) |
| 39 |
cisco.aci.aci_domain: *domain_present |
| 40 |
register: nm_add_domain |
| 41 |
|
| 42 |
- name: Verify FC 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.fcDomP.attributes.name == nm_add_domain.sent.fcDomP.attributes.name == 'fc_dom' |
| 48 |
- cm_add_domain.proposed.fcDomP.attributes.name == nm_add_domain.proposed.fcDomP.attributes.name == 'fc_dom' |
| 49 |
- cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] |
| 50 |
- nm_add_domain.current.0.fcDomP.attributes.annotation == 'orchestrator:ansible' |
| 51 |
- nm_add_domain.current.0.fcDomP.attributes.name == 'fc_dom' |
| 52 |
- nm_add_domain.current.0.fcDomP.attributes.dn == 'uni/fc-fc_dom' |
| 53 |
|
| 54 |
- name: Add FC 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 FC domain again (normal mode) |
| 60 |
cisco.aci.aci_domain: *domain_present |
| 61 |
register: nm_add_domain_again |
| 62 |
|
| 63 |
- name: Verify FC 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 FC 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 FC 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 FC 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 FC 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 FC 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 FC 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 FC 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 FC 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: Update FC domain with incorrect parameter dscp (check mode) |
| 130 |
cisco.aci.aci_domain: |
| 131 |
<<: *domain_present |
| 132 |
dscp: unspecified |
| 133 |
check_mode: true |
| 134 |
ignore_errors: true |
| 135 |
register: cm_incorrect_dscp |
| 136 |
|
| 137 |
- name: Update FC domain with incorrect parameter dscp (normal mode) |
| 138 |
cisco.aci.aci_domain: |
| 139 |
<<: *domain_present |
| 140 |
dscp: unspecified |
| 141 |
ignore_errors: true |
| 142 |
register: nm_incorrect_dscp |
| 143 |
|
| 144 |
- name: Update FC domain with incorrect parameter access_mode (check mode) |
| 145 |
cisco.aci.aci_domain: |
| 146 |
<<: *domain_present |
| 147 |
access_mode: read-write |
| 148 |
check_mode: true |
| 149 |
ignore_errors: true |
| 150 |
register: cm_incorrect_access_mode |
| 151 |
|
| 152 |
- name: Update FC domain with incorrect parameter access_mode (normal mode) |
| 153 |
cisco.aci.aci_domain: |
| 154 |
<<: *domain_present |
| 155 |
access_mode: read-write |
| 156 |
ignore_errors: true |
| 157 |
register: nm_incorrect_access_mode |
| 158 |
|
| 159 |
- name: Update FC domain with incorrect parameter enable_vm_folder (check mode) |
| 160 |
cisco.aci.aci_domain: |
| 161 |
<<: *domain_present |
| 162 |
enable_vm_folder: true |
| 163 |
check_mode: true |
| 164 |
ignore_errors: true |
| 165 |
register: cm_incorrect_enable_vm_folder |
| 166 |
|
| 167 |
- name: Update FC domain with incorrect parameter enable_vm_folder (normal mode) |
| 168 |
cisco.aci.aci_domain: |
| 169 |
<<: *domain_present |
| 170 |
enable_vm_folder: true |
| 171 |
ignore_errors: true |
| 172 |
register: nm_incorrect_enable_vm_folder |
| 173 |
|
| 174 |
- name: Verify incorrect parameter |
| 175 |
ansible.builtin.assert: |
| 176 |
that: |
| 177 |
- cm_incorrect_vm_provider.msg == "Domain type 'fc' cannot have parameter 'vm_provider'" |
| 178 |
- nm_incorrect_vm_provider.msg == "Domain type 'fc' cannot have parameter 'vm_provider'" |
| 179 |
- cm_incorrect_encap_mode.msg == "Domain type 'fc' cannot have parameter 'encap_mode'" |
| 180 |
- nm_incorrect_encap_mode.msg == "Domain type 'fc' cannot have parameter 'encap_mode'" |
| 181 |
- cm_incorrect_multicast_address.msg == "Domain type 'fc' cannot have parameter 'multicast_address'" |
| 182 |
- nm_incorrect_multicast_address.msg == "Domain type 'fc' cannot have parameter 'multicast_address'" |
| 183 |
- cm_incorrect_vswitch.msg == "Domain type 'fc' cannot have parameter 'vswitch'" |
| 184 |
- nm_incorrect_vswitch.msg == "Domain type 'fc' cannot have parameter 'vswitch'" |
| 185 |
- cm_incorrect_dscp.msg == "DSCP values can only be assigned to 'l2ext and 'l3ext' domains" |
| 186 |
- nm_incorrect_dscp.msg == "DSCP values can only be assigned to 'l2ext and 'l3ext' domains" |
| 187 |
- cm_incorrect_access_mode.msg == "Domain type 'fc' cannot have parameter 'access_mode'" |
| 188 |
- nm_incorrect_access_mode.msg == "Domain type 'fc' cannot have parameter 'access_mode'" |
| 189 |
- cm_incorrect_enable_vm_folder.msg == "Domain type 'fc' cannot have parameter 'enable_vm_folder'" |
| 190 |
- nm_incorrect_enable_vm_folder.msg == "Domain type 'fc' cannot have parameter 'enable_vm_folder'" |
| 191 |
|
| 192 |
|
| 193 |
- name: Query all FC domains (check_mode) |
| 194 |
cisco.aci.aci_domain: &domain_query |
| 195 |
host: '{{ aci_hostname }}' |
| 196 |
username: '{{ aci_username }}' |
| 197 |
password: '{{ aci_password }}' |
| 198 |
validate_certs: '{{ aci_validate_certs | default(false) }}' |
| 199 |
use_ssl: '{{ aci_use_ssl | default(true) }}' |
| 200 |
use_proxy: '{{ aci_use_proxy | default(true) }}' |
| 201 |
output_level: '{{ aci_output_level | default("info") }}' |
| 202 |
domain_type: fc |
| 203 |
state: query |
| 204 |
check_mode: true |
| 205 |
register: cm_query_all_domains |
| 206 |
|
| 207 |
- name: Query all FC domains (normal mode) |
| 208 |
cisco.aci.aci_domain: *domain_query |
| 209 |
register: nm_query_all_domains |
| 210 |
|
| 211 |
- name: Verify FC query_all_domains |
| 212 |
ansible.builtin.assert: |
| 213 |
that: |
| 214 |
- cm_query_all_domains is not changed |
| 215 |
- nm_query_all_domains is not changed |
| 216 |
- cm_query_all_domains == nm_query_all_domains |
| 217 |
- nm_query_all_domains.current|length >= 1 |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
- name: Query our FC domain (check_mode) |
| 222 |
cisco.aci.aci_domain: |
| 223 |
<<: *domain_query |
| 224 |
domain: fc_dom |
| 225 |
check_mode: true |
| 226 |
register: cm_query_domain |
| 227 |
|
| 228 |
- name: Query our FC domain (normal mode) |
| 229 |
cisco.aci.aci_domain: |
| 230 |
<<: *domain_query |
| 231 |
domain: fc_dom |
| 232 |
register: nm_query_domain |
| 233 |
|
| 234 |
- name: Verify FC query_domain |
| 235 |
ansible.builtin.assert: |
| 236 |
that: |
| 237 |
- cm_query_domain is not changed |
| 238 |
- nm_query_domain is not changed |
| 239 |
- cm_query_domain == nm_query_domain |
| 240 |
- nm_query_domain.current.0.fcDomP.attributes.dn == 'uni/fc-fc_dom' |
| 241 |
- nm_query_domain.current.0.fcDomP.attributes.name == 'fc_dom' |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
- name: Remove FC domain (check_mode) |
| 246 |
cisco.aci.aci_domain: *domain_absent |
| 247 |
check_mode: true |
| 248 |
register: cm_remove_domain |
| 249 |
|
| 250 |
- name: Remove FC domain (normal mode) |
| 251 |
cisco.aci.aci_domain: *domain_absent |
| 252 |
register: nm_remove_domain |
| 253 |
|
| 254 |
- name: Verify FC remove_domain |
| 255 |
ansible.builtin.assert: |
| 256 |
that: |
| 257 |
- cm_remove_domain is changed |
| 258 |
- nm_remove_domain is changed |
| 259 |
- cm_remove_domain.current.0.fcDomP.attributes.name == cm_remove_domain.previous.0.fcDomP.attributes.name == nm_remove_domain.previous.0.fcDomP.attributes.name == 'fc_dom' |
| 260 |
- cm_remove_domain.current.0.fcDomP.attributes.dn == cm_remove_domain.previous.0.fcDomP.attributes.dn == nm_remove_domain.previous.0.fcDomP.attributes.dn == 'uni/fc-fc_dom' |
| 261 |
- nm_remove_domain.current == [] |
| 262 |
|
| 263 |
- name: Remove FC domain again (check_mode) |
| 264 |
cisco.aci.aci_domain: *domain_absent |
| 265 |
check_mode: true |
| 266 |
register: cm_remove_domain_again |
| 267 |
|
| 268 |
- name: Remove FC domain again (normal mode) |
| 269 |
cisco.aci.aci_domain: *domain_absent |
| 270 |
register: nm_remove_domain_again |
| 271 |
|
| 272 |
- name: Verify FC remove_domain_again |
| 273 |
ansible.builtin.assert: |
| 274 |
that: |
| 275 |
- cm_remove_domain_again is not changed |
| 276 |
- nm_remove_domain_again is not changed |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
- name: Query non-existing FC domain (check_mode) |
| 281 |
cisco.aci.aci_domain: |
| 282 |
<<: *domain_query |
| 283 |
domain: fc_dom |
| 284 |
check_mode: true |
| 285 |
register: cm_query_non_domain |
| 286 |
|
| 287 |
- name: Query non-existing FC domain (normal mode) |
| 288 |
cisco.aci.aci_domain: |
| 289 |
<<: *domain_query |
| 290 |
domain: fc_dom |
| 291 |
register: nm_query_non_domain |
| 292 |
|
| 293 |
- name: Verify FC query_non_domain |
| 294 |
ansible.builtin.assert: |
| 295 |
that: |
| 296 |
- cm_query_non_domain is not changed |
| 297 |
- nm_query_non_domain is not changed |
| 298 |
- cm_query_non_domain == nm_query_non_domain |
| 299 |
- nm_query_non_domain.current == [] |