2017-12-12 07:51:19 +00:00
|
|
|
---
|
|
|
|
- name: ensure vxlan pool does not exist for tests to kick off
|
|
|
|
aci_encap_pool: &aci_vxlan_absent
|
|
|
|
host: "{{ aci_hostname }}"
|
|
|
|
username: "{{ aci_username }}"
|
|
|
|
password: "{{ aci_password }}"
|
2018-01-20 23:38:20 +00:00
|
|
|
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
|
|
|
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
|
|
|
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
2018-02-02 23:41:56 +00:00
|
|
|
output_level: debug
|
2017-12-12 07:51:19 +00:00
|
|
|
state: absent
|
|
|
|
pool: anstest
|
|
|
|
pool_type: vxlan
|
|
|
|
|
|
|
|
- name: create vxlan pool - check mode works
|
|
|
|
aci_encap_pool: &aci_vxlan_present
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
state: present
|
|
|
|
descr: Ansible Test
|
|
|
|
check_mode: yes
|
|
|
|
register: create_vxlan_check_mode
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- create_vxlan_check_mode.changed == true
|
2018-02-02 23:41:56 +00:00
|
|
|
- 'create_vxlan_check_mode.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: create vxlan pool - creation works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
register: create_vxlan
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- create_vxlan.changed == true
|
2018-02-02 23:41:56 +00:00
|
|
|
- create_vxlan.previous == []
|
|
|
|
- create_vxlan.sent == create_vxlan_check_mode.sent
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: create vxlan pool again - idempotency works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
register: idempotent_vxlan
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- idempotent_vxlan.changed == false
|
2018-02-02 23:41:56 +00:00
|
|
|
- 'idempotent_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest"'
|
|
|
|
- idempotent_vxlan.sent == {}
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: update vxlan pool - update works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
descr: Ansible Test Change
|
|
|
|
register: update_vxlan
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- update_vxlan.changed == true
|
2018-02-02 23:41:56 +00:00
|
|
|
- 'update_vxlan.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: create vxlan pool - used for query
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
name: anstest_2
|
|
|
|
register: create_vxlan_2
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- create_vxlan_2.changed == true
|
|
|
|
|
2018-02-15 01:59:54 +00:00
|
|
|
- name: create vxlan pool with pool allocation mode - failure message works
|
2017-12-12 07:51:19 +00:00
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
name: anstest_3
|
2018-02-15 01:59:54 +00:00
|
|
|
pool_allocation_mode: dynamic
|
2017-12-12 07:51:19 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
register: create_vxlan_alloc_mode
|
|
|
|
|
|
|
|
- name: assertion test - present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- create_vxlan_alloc_mode.failed == true
|
2018-02-15 01:59:54 +00:00
|
|
|
- 'create_vxlan_alloc_mode.msg == "vxlan pools do not support setting the pool_allocation_mode; please remove this parameter from the task"'
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: get vxlan pool - get object works
|
|
|
|
aci_encap_pool: &aci_vxlan_query
|
|
|
|
<<: *aci_vxlan_present
|
|
|
|
state: query
|
|
|
|
register: query_vxlan
|
|
|
|
|
|
|
|
- name: assertion test - query
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- query_vxlan.changed == false
|
2018-02-14 22:07:07 +00:00
|
|
|
- query_vxlan.current | length == 1
|
2017-12-12 07:51:19 +00:00
|
|
|
- '"infra/vxlanns-anstest.json" in query_vxlan.url'
|
|
|
|
|
|
|
|
- name: get created static vlan pool - get class works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_query
|
|
|
|
pool: "{{ fake_var | default(omit) }}"
|
|
|
|
register: query_vxlan_all
|
|
|
|
|
|
|
|
- name: assertion test - query
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- query_vxlan_all.changed == false
|
2018-02-14 22:07:07 +00:00
|
|
|
- query_vxlan_all.current | length > 1
|
2017-12-12 07:51:19 +00:00
|
|
|
- '"class/fvnsVxlanInstP.json" in query_vxlan_all.url'
|
|
|
|
|
|
|
|
- name: delete vxlan pool - check mode works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
check_mode: yes
|
|
|
|
register: delete_vxlan_check_mode
|
|
|
|
|
|
|
|
- name: assertion test - absent
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- delete_vxlan_check_mode.changed == true
|
2018-02-02 23:41:56 +00:00
|
|
|
- delete_vxlan_check_mode.previous != []
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: delete vxlan pool - deletion works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
register: delete_vxlan
|
|
|
|
|
|
|
|
- name: assertion test - absent
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- delete_vxlan.changed == true
|
2018-02-02 23:41:56 +00:00
|
|
|
- delete_vxlan.previous == delete_vxlan_check_mode.previous
|
|
|
|
- delete_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest"
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: delete vxlan pool again - idempotency works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
register: delete_vxlan_idempotent
|
|
|
|
|
|
|
|
- name: missing param - failure message works
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
pool: "{{ fake_var | default(omit) }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
register: delete_vxlan_pool_fail
|
|
|
|
|
|
|
|
- name: assertion test - absent
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- delete_vxlan_idempotent.changed == false
|
2018-02-02 23:41:56 +00:00
|
|
|
- delete_vxlan_idempotent.previous == []
|
2017-12-12 07:51:19 +00:00
|
|
|
|
|
|
|
- name: delete vxlan pool - cleanup
|
|
|
|
aci_encap_pool:
|
|
|
|
<<: *aci_vxlan_absent
|
|
|
|
pool: anstest_2
|
|
|
|
|
|
|
|
- name: assertion test - absent
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- delete_vxlan_pool_fail.failed == true
|
|
|
|
- 'delete_vxlan_pool_fail.msg == "state is absent but all of the following are missing: pool"'
|