| 1 |
--- |
| 2 |
- block: |
| 3 |
- name: Define anchor for Intersight API login info |
| 4 |
ansible.builtin.set_fact: |
| 5 |
api_info: &api_info |
| 6 |
api_private_key: "{{ api_private_key }}" |
| 7 |
api_key_id: "{{ api_key_id }}" |
| 8 |
api_uri: "{{ api_uri | default(omit) }}" |
| 9 |
validate_certs: "{{ validate_certs | default(omit) }}" |
| 10 |
|
| 11 |
- name: Make sure Env is clean |
| 12 |
cisco.intersight.intersight_vnic_template: |
| 13 |
<<: *api_info |
| 14 |
organization: "{{ organization }}" |
| 15 |
name: "{{ item }}" |
| 16 |
state: absent |
| 17 |
loop: |
| 18 |
- test_vnic_template |
| 19 |
- test_vnic_template_2 |
| 20 |
- test_vnic_template_minimal |
| 21 |
- test_vnic_template_custom_cdn |
| 22 |
- test_vnic_template_usnic |
| 23 |
- test_vnic_template_vmq |
| 24 |
- test_vnic_template_vmq_multiqueue |
| 25 |
- test_vnic_template_sriov |
| 26 |
|
| 27 |
# Create required policies for testing |
| 28 |
- name: Get Organization MOID for tests |
| 29 |
cisco.intersight.intersight_rest_api: |
| 30 |
<<: *api_info |
| 31 |
resource_path: /organization/Organizations |
| 32 |
query_params: |
| 33 |
$filter: "Name eq '{{ organization }}'" |
| 34 |
register: org_query_result |
| 35 |
|
| 36 |
- name: Create MAC pool for testing |
| 37 |
cisco.intersight.intersight_mac_pool: |
| 38 |
<<: *api_info |
| 39 |
organization: "{{ organization }}" |
| 40 |
name: mac_pool_for_vnic_template |
| 41 |
description: "Test MAC pool for vNIC template" |
| 42 |
mac_blocks: |
| 43 |
- address_from: "00:25:B5:00:00:00" |
| 44 |
size: 256 |
| 45 |
register: mac_pool_res |
| 46 |
|
| 47 |
- name: Create Multicast policy for testing |
| 48 |
cisco.intersight.intersight_multicast_policy: |
| 49 |
<<: *api_info |
| 50 |
organization: "{{ organization }}" |
| 51 |
name: multicast_policy_for_vnic_template |
| 52 |
description: "Test multicast policy for vNIC template" |
| 53 |
register: multicast_policy_res |
| 54 |
|
| 55 |
- name: Create Ethernet Network Group policy for testing |
| 56 |
cisco.intersight.intersight_ethernet_network_group_policy: |
| 57 |
<<: *api_info |
| 58 |
organization: "{{ organization }}" |
| 59 |
name: eth_network_group_policy_for_vnic_template |
| 60 |
description: "Test Ethernet Network Group policy for vNIC template" |
| 61 |
allowed_vlans: "1-100" |
| 62 |
register: eth_network_group_policy_res |
| 63 |
|
| 64 |
- name: Create Ethernet Network Control policy for testing |
| 65 |
cisco.intersight.intersight_ethernet_network_control_policy: |
| 66 |
<<: *api_info |
| 67 |
organization: "{{ organization }}" |
| 68 |
name: eth_network_control_policy_for_vnic_template |
| 69 |
description: "Test Ethernet Network Control policy for vNIC template" |
| 70 |
cdp_enabled: true |
| 71 |
forge_mac: "allow" |
| 72 |
lldp_transmit_enabled: true |
| 73 |
lldp_receive_enabled: true |
| 74 |
mac_registration_mode: "nativeVlanOnly" |
| 75 |
uplink_fail_action: "linkDown" |
| 76 |
register: eth_network_control_policy_res |
| 77 |
|
| 78 |
- name: Create Ethernet QoS policy for testing |
| 79 |
cisco.intersight.intersight_ethernet_qos_policy: |
| 80 |
<<: *api_info |
| 81 |
organization: "{{ organization }}" |
| 82 |
name: eth_qos_policy_for_vnic_template |
| 83 |
description: "Test Ethernet QoS policy for vNIC template" |
| 84 |
mtu: 1500 |
| 85 |
rate_limit: 0 |
| 86 |
cos: 0 |
| 87 |
trust_host_cos: false |
| 88 |
register: eth_qos_policy_res |
| 89 |
|
| 90 |
- name: Create Ethernet Adapter policy for testing |
| 91 |
cisco.intersight.intersight_ethernet_adapter_policy: |
| 92 |
<<: *api_info |
| 93 |
organization: "{{ organization }}" |
| 94 |
name: eth_adapter_policy_for_vnic_template |
| 95 |
description: "Test Ethernet Adapter policy for vNIC template" |
| 96 |
rss_enabled: true |
| 97 |
rss_tcp_ipv4_hash: true |
| 98 |
rss_tcp_ipv6_hash: true |
| 99 |
rss_udp_ipv4_hash: false |
| 100 |
rss_udp_ipv6_hash: false |
| 101 |
uplink_failback_timeout: 5 |
| 102 |
register: eth_adapter_policy_res |
| 103 |
|
| 104 |
- name: Create iSCSI Boot Policy for testing |
| 105 |
cisco.intersight.intersight_rest_api: |
| 106 |
<<: *api_info |
| 107 |
resource_path: /vnic/IscsiBootPolicies |
| 108 |
api_body: |
| 109 |
Name: "iscsi_boot_policy_for_vnic_template" |
| 110 |
Description: "Test iSCSI Boot policy for vNIC template" |
| 111 |
IscsiIpType: "IPv4" |
| 112 |
AutoTargetvendorName: "8" |
| 113 |
TargetSourceType: "Auto" |
| 114 |
IscsiAdapterPolicy: "" |
| 115 |
PrimaryTargetPolicy: "" |
| 116 |
SecondaryTargetPolicy: "" |
| 117 |
Chap: |
| 118 |
UserId: "" |
| 119 |
Password: "" |
| 120 |
IsPasswordSet: false |
| 121 |
MutualChap: |
| 122 |
UserId: "" |
| 123 |
Password: "" |
| 124 |
IsPasswordSet: false |
| 125 |
InitiatorIpSource: "DHCP" |
| 126 |
InitiatorIpPool: "" |
| 127 |
InitiatorStaticIpV4Address: "" |
| 128 |
InitiatorStaticIpV4Config: null |
| 129 |
InitiatorStaticIpV6Address: "" |
| 130 |
InitiatorStaticIpV6Config: null |
| 131 |
Organization: |
| 132 |
ObjectType: "organization.Organization" |
| 133 |
Moid: "{{ org_query_result.api_response.Moid }}" |
| 134 |
update_method: post |
| 135 |
register: iscsi_boot_policy_res |
| 136 |
|
| 137 |
- name: Create vNIC template - check-mode |
| 138 |
cisco.intersight.intersight_vnic_template: |
| 139 |
<<: *api_info |
| 140 |
organization: "{{ organization }}" |
| 141 |
name: test_vnic_template |
| 142 |
description: "Test vNIC template description" |
| 143 |
enable_override: false |
| 144 |
switch_id: "A" |
| 145 |
failover_enabled: false |
| 146 |
cdn_source: "vnic" |
| 147 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 148 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 149 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 150 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 151 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 152 |
connection_type: "none" |
| 153 |
tags: |
| 154 |
- Key: Site |
| 155 |
Value: Test |
| 156 |
- Key: Site2 |
| 157 |
Value: Test2 |
| 158 |
check_mode: true |
| 159 |
register: creation_res_check_mode |
| 160 |
|
| 161 |
- name: Verify vNIC template was not created - check-mode |
| 162 |
ansible.builtin.assert: |
| 163 |
that: |
| 164 |
- creation_res_check_mode is changed |
| 165 |
- creation_res_check_mode.api_response == {} |
| 166 |
|
| 167 |
- name: Create vNIC template |
| 168 |
cisco.intersight.intersight_vnic_template: |
| 169 |
<<: *api_info |
| 170 |
organization: "{{ organization }}" |
| 171 |
name: test_vnic_template |
| 172 |
description: "Test vNIC template description" |
| 173 |
enable_override: false |
| 174 |
switch_id: "A" |
| 175 |
failover_enabled: false |
| 176 |
cdn_source: "vnic" |
| 177 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 178 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 179 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 180 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 181 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 182 |
connection_type: "none" |
| 183 |
tags: |
| 184 |
- Key: Site |
| 185 |
Value: Test |
| 186 |
- Key: Site2 |
| 187 |
Value: Test2 |
| 188 |
register: creation_res |
| 189 |
|
| 190 |
- name: Fetch info after creation |
| 191 |
cisco.intersight.intersight_vnic_template_info: |
| 192 |
<<: *api_info |
| 193 |
organization: "{{ organization }}" |
| 194 |
name: test_vnic_template |
| 195 |
register: creation_info_res |
| 196 |
|
| 197 |
- name: Verify vNIC template creation by info |
| 198 |
ansible.builtin.assert: |
| 199 |
that: |
| 200 |
- creation_res.changed |
| 201 |
- creation_info_res.api_response.Name == 'test_vnic_template' |
| 202 |
|
| 203 |
- name: Verify vNIC template creation response aligns with info response |
| 204 |
ansible.builtin.assert: |
| 205 |
that: |
| 206 |
- creation_res.api_response.Name == creation_info_res.api_response.Name |
| 207 |
|
| 208 |
- name: Create vNIC template (idempotency check) |
| 209 |
cisco.intersight.intersight_vnic_template: |
| 210 |
<<: *api_info |
| 211 |
organization: "{{ organization }}" |
| 212 |
name: test_vnic_template |
| 213 |
description: "Test vNIC template description" |
| 214 |
enable_override: false |
| 215 |
switch_id: "A" |
| 216 |
failover_enabled: false |
| 217 |
cdn_source: "vnic" |
| 218 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 219 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 220 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 221 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 222 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 223 |
connection_type: "none" |
| 224 |
tags: |
| 225 |
- Key: Site |
| 226 |
Value: Test |
| 227 |
- Key: Site2 |
| 228 |
Value: Test2 |
| 229 |
register: creation_res_ide |
| 230 |
|
| 231 |
- name: Verify vNIC template creation (idempotency check) |
| 232 |
ansible.builtin.assert: |
| 233 |
that: |
| 234 |
- not creation_res_ide.changed |
| 235 |
|
| 236 |
- name: Update description of an existing vNIC template |
| 237 |
cisco.intersight.intersight_vnic_template: |
| 238 |
<<: *api_info |
| 239 |
organization: "{{ organization }}" |
| 240 |
name: test_vnic_template |
| 241 |
description: "Updated vNIC template description" |
| 242 |
enable_override: false |
| 243 |
switch_id: "A" |
| 244 |
failover_enabled: false |
| 245 |
cdn_source: "vnic" |
| 246 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 247 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 248 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 249 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 250 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 251 |
connection_type: "none" |
| 252 |
tags: |
| 253 |
- Key: Site |
| 254 |
Value: Test |
| 255 |
- Key: Site2 |
| 256 |
Value: Test2 |
| 257 |
register: changed_res |
| 258 |
|
| 259 |
- name: Fetch info after change |
| 260 |
cisco.intersight.intersight_vnic_template_info: |
| 261 |
<<: *api_info |
| 262 |
organization: "{{ organization }}" |
| 263 |
name: test_vnic_template |
| 264 |
register: change_info_res |
| 265 |
|
| 266 |
- name: Verify vNIC template change by info |
| 267 |
ansible.builtin.assert: |
| 268 |
that: |
| 269 |
- changed_res.changed |
| 270 |
- change_info_res.api_response.Name == 'test_vnic_template' |
| 271 |
- change_info_res.api_response.Description == 'Updated vNIC template description' |
| 272 |
|
| 273 |
- name: Update vNIC template with operational changes |
| 274 |
cisco.intersight.intersight_vnic_template: |
| 275 |
<<: *api_info |
| 276 |
organization: "{{ organization }}" |
| 277 |
name: test_vnic_template |
| 278 |
description: "Comprehensive update test - operational changes" |
| 279 |
enable_override: true |
| 280 |
switch_id: "B" |
| 281 |
failover_enabled: true |
| 282 |
cdn_source: "user" |
| 283 |
cdn_value: "updated-template-name" |
| 284 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 285 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 286 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 287 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 288 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 289 |
connection_type: "usnic" |
| 290 |
usnic_settings: |
| 291 |
count: 10 |
| 292 |
cos: 2 |
| 293 |
usnic_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 294 |
tags: |
| 295 |
- Key: Environment |
| 296 |
Value: Updated |
| 297 |
register: operational_update_res |
| 298 |
|
| 299 |
- name: Verify operational update results |
| 300 |
ansible.builtin.assert: |
| 301 |
that: |
| 302 |
- operational_update_res.changed |
| 303 |
- operational_update_res.api_response.Name == 'test_vnic_template' |
| 304 |
- operational_update_res.api_response.Description == 'Comprehensive update test - operational changes' |
| 305 |
- operational_update_res.api_response.EnableOverride == true |
| 306 |
- operational_update_res.api_response.SwitchId == 'B' |
| 307 |
- operational_update_res.api_response.FailoverEnabled == true |
| 308 |
- operational_update_res.api_response.Cdn.Source == 'user' |
| 309 |
- operational_update_res.api_response.Cdn.Value == 'updated-template-name' |
| 310 |
- operational_update_res.api_response.UsnicSettings.Count == 10 |
| 311 |
- operational_update_res.api_response.UsnicSettings.Cos == 2 |
| 312 |
- operational_update_res.api_response.Tags | length >= 1 |
| 313 |
|
| 314 |
- name: Create another vNIC template |
| 315 |
cisco.intersight.intersight_vnic_template: |
| 316 |
<<: *api_info |
| 317 |
organization: "{{ organization }}" |
| 318 |
name: test_vnic_template_2 |
| 319 |
description: "Test another vNIC template description" |
| 320 |
enable_override: true |
| 321 |
switch_id: "B" |
| 322 |
failover_enabled: true |
| 323 |
cdn_source: "vnic" |
| 324 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 325 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 326 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 327 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 328 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 329 |
connection_type: "none" |
| 330 |
register: creation_res_b |
| 331 |
|
| 332 |
- name: Fetch all vNIC templates under selected organization |
| 333 |
cisco.intersight.intersight_vnic_template_info: |
| 334 |
<<: *api_info |
| 335 |
organization: "{{ organization }}" |
| 336 |
register: creation_info_res_b |
| 337 |
|
| 338 |
- name: Check that there are at least 2 vNIC templates under this organization |
| 339 |
ansible.builtin.assert: |
| 340 |
that: |
| 341 |
- creation_info_res_b.api_response | length > 1 |
| 342 |
|
| 343 |
- name: Test creation without optional parameters |
| 344 |
cisco.intersight.intersight_vnic_template: |
| 345 |
<<: *api_info |
| 346 |
organization: "{{ organization }}" |
| 347 |
name: test_vnic_template_minimal |
| 348 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 349 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 350 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 351 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 352 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 353 |
register: creation_res_minimal |
| 354 |
|
| 355 |
- name: Verify minimal vNIC template creation |
| 356 |
ansible.builtin.assert: |
| 357 |
that: |
| 358 |
- creation_res_minimal.changed |
| 359 |
- creation_res_minimal.api_response.Name == 'test_vnic_template_minimal' |
| 360 |
|
| 361 |
- name: Create vNIC template with custom CDN |
| 362 |
cisco.intersight.intersight_vnic_template: |
| 363 |
<<: *api_info |
| 364 |
organization: "{{ organization }}" |
| 365 |
name: test_vnic_template_custom_cdn |
| 366 |
description: "vNIC template with custom CDN" |
| 367 |
enable_override: false |
| 368 |
switch_id: "A" |
| 369 |
failover_enabled: false |
| 370 |
cdn_source: "user" |
| 371 |
cdn_value: "Custom-Management-NIC" |
| 372 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 373 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 374 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 375 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 376 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 377 |
connection_type: "none" |
| 378 |
register: custom_cdn_res |
| 379 |
|
| 380 |
- name: Verify custom CDN template creation |
| 381 |
ansible.builtin.assert: |
| 382 |
that: |
| 383 |
- custom_cdn_res.changed |
| 384 |
- custom_cdn_res.api_response.Name == 'test_vnic_template_custom_cdn' |
| 385 |
- custom_cdn_res.api_response.Cdn.Source == 'user' |
| 386 |
- custom_cdn_res.api_response.Cdn.Value == 'Custom-Management-NIC' |
| 387 |
|
| 388 |
- name: Create vNIC template with USNIC |
| 389 |
cisco.intersight.intersight_vnic_template: |
| 390 |
<<: *api_info |
| 391 |
organization: "{{ organization }}" |
| 392 |
name: test_vnic_template_usnic |
| 393 |
description: "vNIC template with USNIC configuration" |
| 394 |
enable_override: false |
| 395 |
switch_id: "A" |
| 396 |
failover_enabled: false |
| 397 |
cdn_source: "vnic" |
| 398 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 399 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 400 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 401 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 402 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 403 |
connection_type: "usnic" |
| 404 |
usnic_settings: |
| 405 |
count: 0 |
| 406 |
cos: 5 |
| 407 |
usnic_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 408 |
register: usnic_template_res |
| 409 |
|
| 410 |
- name: Verify USNIC template creation |
| 411 |
ansible.builtin.assert: |
| 412 |
that: |
| 413 |
- usnic_template_res.changed |
| 414 |
- usnic_template_res.api_response.Name == 'test_vnic_template_usnic' |
| 415 |
- usnic_template_res.api_response.UsnicSettings.Count == 0 |
| 416 |
- usnic_template_res.api_response.UsnicSettings.Cos == 5 |
| 417 |
|
| 418 |
- name: Create vNIC template with VMQ |
| 419 |
cisco.intersight.intersight_vnic_template: |
| 420 |
<<: *api_info |
| 421 |
organization: "{{ organization }}" |
| 422 |
name: test_vnic_template_vmq |
| 423 |
description: "vNIC template with VMQ configuration" |
| 424 |
enable_override: false |
| 425 |
switch_id: "A" |
| 426 |
failover_enabled: false |
| 427 |
cdn_source: "vnic" |
| 428 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 429 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 430 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 431 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 432 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 433 |
connection_type: "vmq" |
| 434 |
vmq_settings: |
| 435 |
enabled: true |
| 436 |
multi_queue_support: false |
| 437 |
num_interrupts: 16 |
| 438 |
num_vmqs: 4 |
| 439 |
register: vmq_template_res |
| 440 |
|
| 441 |
- name: Verify VMQ template creation |
| 442 |
ansible.builtin.assert: |
| 443 |
that: |
| 444 |
- vmq_template_res.changed |
| 445 |
- vmq_template_res.api_response.Name == 'test_vnic_template_vmq' |
| 446 |
- vmq_template_res.api_response.VmqSettings.Enabled == true |
| 447 |
- vmq_template_res.api_response.VmqSettings.MultiQueueSupport == false |
| 448 |
- vmq_template_res.api_response.VmqSettings.NumInterrupts == 16 |
| 449 |
- vmq_template_res.api_response.VmqSettings.NumVmqs == 4 |
| 450 |
|
| 451 |
- name: Create vNIC template with VMQ multi-queue support |
| 452 |
cisco.intersight.intersight_vnic_template: |
| 453 |
<<: *api_info |
| 454 |
organization: "{{ organization }}" |
| 455 |
name: test_vmq_multiqueue |
| 456 |
description: "vNIC template with VMQ multi-queue configuration" |
| 457 |
enable_override: false |
| 458 |
switch_id: "A" |
| 459 |
failover_enabled: false |
| 460 |
cdn_source: "vnic" |
| 461 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 462 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 463 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 464 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 465 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 466 |
connection_type: "vmq" |
| 467 |
vmq_settings: |
| 468 |
enabled: true |
| 469 |
multi_queue_support: true |
| 470 |
num_sub_vnics: 64 |
| 471 |
vmmq_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 472 |
register: vmq_multiqueue_template_res |
| 473 |
|
| 474 |
- name: Verify VMQ multi-queue template creation |
| 475 |
ansible.builtin.assert: |
| 476 |
that: |
| 477 |
- vmq_multiqueue_template_res.changed |
| 478 |
- vmq_multiqueue_template_res.api_response.Name == 'test_vmq_multiqueue' |
| 479 |
- vmq_multiqueue_template_res.api_response.VmqSettings.Enabled == true |
| 480 |
- vmq_multiqueue_template_res.api_response.VmqSettings.MultiQueueSupport == true |
| 481 |
- vmq_multiqueue_template_res.api_response.VmqSettings.NumSubVnics == 64 |
| 482 |
|
| 483 |
- name: Create vNIC template with SR-IOV |
| 484 |
cisco.intersight.intersight_vnic_template: |
| 485 |
<<: *api_info |
| 486 |
organization: "{{ organization }}" |
| 487 |
name: test_vnic_template_sriov |
| 488 |
description: "vNIC template with SR-IOV configuration" |
| 489 |
enable_override: false |
| 490 |
switch_id: "A" |
| 491 |
failover_enabled: false |
| 492 |
cdn_source: "vnic" |
| 493 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 494 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 495 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 496 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 497 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 498 |
connection_type: "sriov" |
| 499 |
sriov_settings: |
| 500 |
enabled: true |
| 501 |
vf_count: 64 |
| 502 |
rx_count_per_vf: 4 |
| 503 |
tx_count_per_vf: 1 |
| 504 |
comp_count_per_vf: 5 |
| 505 |
int_count_per_vf: 8 |
| 506 |
register: sriov_template_res |
| 507 |
|
| 508 |
- name: Verify SR-IOV template creation |
| 509 |
ansible.builtin.assert: |
| 510 |
that: |
| 511 |
- sriov_template_res.changed |
| 512 |
- sriov_template_res.api_response.Name == 'test_vnic_template_sriov' |
| 513 |
- sriov_template_res.api_response.SriovSettings.Enabled == true |
| 514 |
- sriov_template_res.api_response.SriovSettings.VfCount == 64 |
| 515 |
- sriov_template_res.api_response.SriovSettings.RxCountPerVf == 4 |
| 516 |
- sriov_template_res.api_response.SriovSettings.TxCountPerVf == 1 |
| 517 |
- sriov_template_res.api_response.SriovSettings.CompCountPerVf == 5 |
| 518 |
- sriov_template_res.api_response.SriovSettings.IntCountPerVf == 8 |
| 519 |
|
| 520 |
- name: Create vNIC template with iSCSI boot policy |
| 521 |
cisco.intersight.intersight_vnic_template: |
| 522 |
<<: *api_info |
| 523 |
organization: "{{ organization }}" |
| 524 |
name: test_vnic_template_iscsi |
| 525 |
description: "Test vNIC template with iSCSI boot policy" |
| 526 |
enable_override: true |
| 527 |
switch_id: "B" |
| 528 |
failover_enabled: true |
| 529 |
cdn_source: "user" |
| 530 |
cdn_value: "iscsi-boot-nic" |
| 531 |
mac_pool_name: "mac_pool_for_vnic_template" |
| 532 |
fabric_eth_network_group_policy_name: "eth_network_group_policy_for_vnic_template" |
| 533 |
fabric_eth_network_control_policy_name: "eth_network_control_policy_for_vnic_template" |
| 534 |
eth_qos_policy_name: "eth_qos_policy_for_vnic_template" |
| 535 |
eth_adapter_policy_name: "eth_adapter_policy_for_vnic_template" |
| 536 |
iscsi_boot_policy_name: "iscsi_boot_policy_for_vnic_template" |
| 537 |
connection_type: "none" |
| 538 |
tags: |
| 539 |
- Key: "BootType" |
| 540 |
Value: "iSCSI" |
| 541 |
register: iscsi_template_res |
| 542 |
|
| 543 |
- name: Verify iSCSI template creation |
| 544 |
ansible.builtin.assert: |
| 545 |
that: |
| 546 |
- iscsi_template_res.changed |
| 547 |
- iscsi_template_res.api_response.Name == 'test_vnic_template_iscsi' |
| 548 |
- iscsi_template_res.api_response.EnableOverride == true |
| 549 |
- iscsi_template_res.api_response.SwitchId == 'B' |
| 550 |
- iscsi_template_res.api_response.FailoverEnabled == true |
| 551 |
- iscsi_template_res.api_response.Cdn.Source == 'user' |
| 552 |
- iscsi_template_res.api_response.Cdn.Value == 'iscsi-boot-nic' |
| 553 |
- iscsi_template_res.api_response.IscsiBootPolicy is defined |
| 554 |
|
| 555 |
# Test info module with various filters |
| 556 |
- name: Test info module - fetch specific template |
| 557 |
cisco.intersight.intersight_vnic_template_info: |
| 558 |
<<: *api_info |
| 559 |
organization: "{{ organization }}" |
| 560 |
name: test_vnic_template |
| 561 |
register: specific_template_info |
| 562 |
|
| 563 |
- name: Verify specific template info |
| 564 |
ansible.builtin.assert: |
| 565 |
that: |
| 566 |
- specific_template_info.api_response.Name == 'test_vnic_template' |
| 567 |
- specific_template_info.api_response.Description == 'Comprehensive update test - operational changes' |
| 568 |
|
| 569 |
- name: Test info module - fetch all templates |
| 570 |
cisco.intersight.intersight_vnic_template_info: |
| 571 |
<<: *api_info |
| 572 |
organization: "{{ organization }}" |
| 573 |
register: all_templates_info |
| 574 |
|
| 575 |
- name: Verify all templates info |
| 576 |
ansible.builtin.assert: |
| 577 |
that: |
| 578 |
- all_templates_info.api_response | length >= 7 |
| 579 |
|
| 580 |
always: |
| 581 |
- name: Remove vNIC templates |
| 582 |
cisco.intersight.intersight_vnic_template: |
| 583 |
<<: *api_info |
| 584 |
organization: "{{ organization }}" |
| 585 |
name: "{{ item }}" |
| 586 |
state: absent |
| 587 |
loop: |
| 588 |
- test_vnic_template |
| 589 |
- test_vnic_template_2 |
| 590 |
- test_vnic_template_minimal |
| 591 |
- test_vnic_template_custom_cdn |
| 592 |
- test_vnic_template_usnic |
| 593 |
- test_vnic_template_vmq |
| 594 |
- test_vmq_multiqueue |
| 595 |
- test_vnic_template_sriov |
| 596 |
- test_vnic_template_iscsi |
| 597 |
|
| 598 |
- name: Remove test policies |
| 599 |
cisco.intersight.intersight_mac_pool: |
| 600 |
<<: *api_info |
| 601 |
organization: "{{ organization }}" |
| 602 |
name: mac_pool_for_vnic_template |
| 603 |
state: absent |
| 604 |
|
| 605 |
- name: Remove test multicast policy |
| 606 |
cisco.intersight.intersight_multicast_policy: |
| 607 |
<<: *api_info |
| 608 |
organization: "{{ organization }}" |
| 609 |
name: multicast_policy_for_vnic_template |
| 610 |
state: absent |
| 611 |
|
| 612 |
- name: Remove test Ethernet Network Group policy |
| 613 |
cisco.intersight.intersight_ethernet_network_group_policy: |
| 614 |
<<: *api_info |
| 615 |
organization: "{{ organization }}" |
| 616 |
name: eth_network_group_policy_for_vnic_template |
| 617 |
state: absent |
| 618 |
|
| 619 |
- name: Remove test Ethernet Network Control policy |
| 620 |
cisco.intersight.intersight_ethernet_network_control_policy: |
| 621 |
<<: *api_info |
| 622 |
organization: "{{ organization }}" |
| 623 |
name: eth_network_control_policy_for_vnic_template |
| 624 |
state: absent |
| 625 |
|
| 626 |
- name: Remove test Ethernet QoS policy |
| 627 |
cisco.intersight.intersight_ethernet_qos_policy: |
| 628 |
<<: *api_info |
| 629 |
organization: "{{ organization }}" |
| 630 |
name: eth_qos_policy_for_vnic_template |
| 631 |
state: absent |
| 632 |
|
| 633 |
- name: Remove test Ethernet Adapter policy |
| 634 |
cisco.intersight.intersight_ethernet_adapter_policy: |
| 635 |
<<: *api_info |
| 636 |
organization: "{{ organization }}" |
| 637 |
name: eth_adapter_policy_for_vnic_template |
| 638 |
state: absent |
| 639 |
|
| 640 |
- name: Remove test iSCSI Boot policy |
| 641 |
cisco.intersight.intersight_rest_api: |
| 642 |
<<: *api_info |
| 643 |
resource_path: /vnic/IscsiBootPolicies |
| 644 |
query_params: |
| 645 |
$filter: "Name eq 'iscsi_boot_policy_for_vnic_template'" |
| 646 |
state: absent |