|
312 | 312 | - results['vlan_group']['scope_id'] == 1 |
313 | 313 | - results['vlan_group']['description'] == "Ansible updated description" |
314 | 314 | - results['msg'] == "vlan_group VLAN Group Location already exists" |
| 315 | + |
| 316 | +- name: "VLAN_GROUP 13: Create VLAN group with tenant" |
| 317 | + netbox.netbox.netbox_vlan_group: |
| 318 | + netbox_url: http://localhost:32768 |
| 319 | + netbox_token: "0123456789abcdef0123456789abcdef01234567" |
| 320 | + data: |
| 321 | + name: VLAN Group Tenant Test |
| 322 | + scope_type: dcim.site |
| 323 | + scope: Test Site |
| 324 | + tenant: Test Tenant |
| 325 | + state: present |
| 326 | + register: results |
| 327 | + |
| 328 | +- name: "VLAN_GROUP 13: ASSERT - Create VLAN group with tenant" |
| 329 | + ansible.builtin.assert: |
| 330 | + that: |
| 331 | + - results is changed |
| 332 | + - results['diff']['before']['state'] == "absent" |
| 333 | + - results['diff']['after']['state'] == "present" |
| 334 | + - results['vlan_group']['name'] == "VLAN Group Tenant Test" |
| 335 | + - results['vlan_group']['slug'] == "vlan-group-tenant-test" |
| 336 | + - results['vlan_group']['scope_type'] == "dcim.site" |
| 337 | + - results['vlan_group']['scope_id'] == 1 |
| 338 | + - results['vlan_group']['tenant'] == 1 |
| 339 | + - results['msg'] == "vlan_group VLAN Group Tenant Test created" |
| 340 | + |
| 341 | +- name: "VLAN_GROUP 14: Create duplicate VLAN group with tenant (idempotency)" |
| 342 | + netbox.netbox.netbox_vlan_group: |
| 343 | + netbox_url: http://localhost:32768 |
| 344 | + netbox_token: "0123456789abcdef0123456789abcdef01234567" |
| 345 | + data: |
| 346 | + name: VLAN Group Tenant Test |
| 347 | + scope_type: dcim.site |
| 348 | + scope: Test Site |
| 349 | + tenant: Test Tenant |
| 350 | + state: present |
| 351 | + register: results |
| 352 | + |
| 353 | +- name: "VLAN_GROUP 14: ASSERT - Create duplicate VLAN group with tenant (idempotency)" |
| 354 | + ansible.builtin.assert: |
| 355 | + that: |
| 356 | + - results is not changed |
| 357 | + - results['vlan_group']['name'] == "VLAN Group Tenant Test" |
| 358 | + - results['vlan_group']['tenant'] == 1 |
| 359 | + - results['msg'] == "vlan_group VLAN Group Tenant Test already exists" |
| 360 | + |
| 361 | +- name: "VLAN_GROUP 15: Update VLAN group tenant" |
| 362 | + netbox.netbox.netbox_vlan_group: |
| 363 | + netbox_url: http://localhost:32768 |
| 364 | + netbox_token: "0123456789abcdef0123456789abcdef01234567" |
| 365 | + data: |
| 366 | + name: VLAN Group Tenant Test |
| 367 | + scope_type: dcim.site |
| 368 | + scope: Test Site |
| 369 | + tenant: Test Tenant 2 |
| 370 | + state: present |
| 371 | + register: results |
| 372 | + |
| 373 | +- name: "VLAN_GROUP 15: ASSERT - Update VLAN group tenant" |
| 374 | + ansible.builtin.assert: |
| 375 | + that: |
| 376 | + - results is changed |
| 377 | + - results['diff']['before']['tenant'] == 1 |
| 378 | + - results['diff']['after']['tenant'] == 2 |
| 379 | + - results['vlan_group']['name'] == "VLAN Group Tenant Test" |
| 380 | + - results['vlan_group']['tenant'] == 2 |
| 381 | + - results['msg'] == "vlan_group VLAN Group Tenant Test updated" |
| 382 | + |
| 383 | +- name: "VLAN_GROUP 16: Delete VLAN group with tenant" |
| 384 | + netbox.netbox.netbox_vlan_group: |
| 385 | + netbox_url: http://localhost:32768 |
| 386 | + netbox_token: "0123456789abcdef0123456789abcdef01234567" |
| 387 | + data: |
| 388 | + name: VLAN Group Tenant Test |
| 389 | + scope_type: dcim.site |
| 390 | + scope: Test Site |
| 391 | + state: absent |
| 392 | + register: results |
| 393 | + |
| 394 | +- name: "VLAN_GROUP 16: ASSERT - Delete VLAN group with tenant" |
| 395 | + ansible.builtin.assert: |
| 396 | + that: |
| 397 | + - results is changed |
| 398 | + - results['diff']['before']['state'] == "present" |
| 399 | + - results['diff']['after']['state'] == "absent" |
| 400 | + - results['msg'] == "vlan_group VLAN Group Tenant Test deleted" |
0 commit comments