mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 09:55:26 -07:00
added aci_interface_selector_to_switch_policy_leaf_profile integration test (#34903)
This commit is contained in:
parent
ac4b031cc0
commit
bf69f987f9
2 changed files with 148 additions and 0 deletions
|
@ -0,0 +1,148 @@
|
||||||
|
# Test code for the ACI modules
|
||||||
|
# Copyright 2017, Bruno Calogero <bcalogero@cisco.com>
|
||||||
|
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
- name: Test that we have an ACI APIC host, ACI username and ACI password
|
||||||
|
fail:
|
||||||
|
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
|
||||||
|
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
|
||||||
|
|
||||||
|
- name: delete Switch Policy Leaf profile for kick off
|
||||||
|
aci_switch_policy_leaf_profile:
|
||||||
|
host: "{{ aci_hostname }}"
|
||||||
|
username: "{{ aci_username }}"
|
||||||
|
password: "{{ aci_password }}"
|
||||||
|
leaf_profile: swleafprftest
|
||||||
|
validate_certs: no
|
||||||
|
use_ssl: no
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: delete Interface Policy Leaf profile for kick off
|
||||||
|
aci_interface_policy_leaf_profile:
|
||||||
|
host: "{{ aci_hostname }}"
|
||||||
|
username: "{{ aci_username }}"
|
||||||
|
password: "{{ aci_password }}"
|
||||||
|
leaf_interface_profile: leafintprftest
|
||||||
|
validate_certs: no
|
||||||
|
use_ssl: no
|
||||||
|
use_proxy: no
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Ensuring Switch Policy Leaf profile exists for kick off
|
||||||
|
aci_switch_policy_leaf_profile: &aci_switch_policy_leaf_profile_present
|
||||||
|
host: "{{ aci_hostname }}"
|
||||||
|
username: "{{ aci_username }}"
|
||||||
|
password: "{{ aci_password }}"
|
||||||
|
leaf_profile: swleafprftest
|
||||||
|
validate_certs: no
|
||||||
|
use_ssl: no
|
||||||
|
state: present
|
||||||
|
register: leaf_profile_present
|
||||||
|
|
||||||
|
- name: Ensuring Interface Policy Leaf profile exists for kick off
|
||||||
|
aci_interface_policy_leaf_profile: &aci_interface_policy_leaf_profile_present
|
||||||
|
host: "{{ aci_hostname }}"
|
||||||
|
username: "{{ aci_username }}"
|
||||||
|
password: "{{ aci_password }}"
|
||||||
|
leaf_interface_profile: leafintprftest
|
||||||
|
validate_certs: no
|
||||||
|
use_ssl: no
|
||||||
|
use_proxy: no
|
||||||
|
state: present
|
||||||
|
register: leaf_profile_present
|
||||||
|
|
||||||
|
- name: Bind an Interface Selector to a Switch Policy Leaf Profile - check mode works
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile: &aci_interface_selector_to_switch_policy_leaf_profile_present
|
||||||
|
<<: *aci_switch_policy_leaf_profile_present
|
||||||
|
interface_selector: leafintprftest
|
||||||
|
check_mode: yes
|
||||||
|
register: intftoleaf_check_mode_present
|
||||||
|
|
||||||
|
- name: Bind an Interface Selector to a Switch Policy Leaf Profile - creation works
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_selector_to_switch_policy_leaf_profile_present
|
||||||
|
register: intftoleaf_present
|
||||||
|
|
||||||
|
- name: Bind an Interface Selector to a Switch Policy Leaf Profile - idempotency works
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_selector_to_switch_policy_leaf_profile_present
|
||||||
|
register: intftoleaf_idempotent
|
||||||
|
|
||||||
|
# TODO: also test for errors
|
||||||
|
- name: present assertions
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- intftoleaf_check_mode_present.changed == true
|
||||||
|
- intftoleaf_present.changed == true
|
||||||
|
- intftoleaf_present.existing == []
|
||||||
|
- 'intftoleaf_present.config == {"infraRsAccPortP": {"attributes": {"tDn": "uni/infra/accportprof-leafintprftest"}}}'
|
||||||
|
- intftoleaf_idempotent.changed == false
|
||||||
|
- intftoleaf_idempotent.config == {}
|
||||||
|
|
||||||
|
- name: Query an interface selector profile associated with a switch policy leaf profile
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_switch_policy_leaf_profile_present
|
||||||
|
interface_selector: leafintprftest
|
||||||
|
state: query
|
||||||
|
register: binding_query
|
||||||
|
|
||||||
|
- name: query assertions
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- binding_query.changed == false
|
||||||
|
- binding_query.existing | length >= 1
|
||||||
|
- '"api/mo/uni/infra/nprof-swleafprftest/rsaccPortP-[uni/infra/accportprof-leafintprftest].json" in binding_query.url'
|
||||||
|
|
||||||
|
- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - check mode
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile: &aci_interface_selector_to_switch_policy_leaf_profile_absent
|
||||||
|
<<: *aci_switch_policy_leaf_profile_present
|
||||||
|
interface_selector: leafintprftest
|
||||||
|
state: absent
|
||||||
|
check_mode: yes
|
||||||
|
register: intftoleaf_check_mode_absent
|
||||||
|
|
||||||
|
- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - delete works
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_selector_to_switch_policy_leaf_profile_absent
|
||||||
|
register: intftoleaf_absent
|
||||||
|
|
||||||
|
- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - idempotency works
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_selector_to_switch_policy_leaf_profile_absent
|
||||||
|
register: intftoleaf_absent_idempotent
|
||||||
|
|
||||||
|
- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - check mode
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_switch_policy_leaf_profile_present
|
||||||
|
state: absent
|
||||||
|
ignore_errors: yes
|
||||||
|
register: intftoleaf_absent_missing_param
|
||||||
|
|
||||||
|
- name: absent assertions
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- intftoleaf_check_mode_absent.changed == true
|
||||||
|
- intftoleaf_check_mode_absent.existing != []
|
||||||
|
- intftoleaf_absent.changed == true
|
||||||
|
- intftoleaf_absent.existing == intftoleaf_check_mode_absent.existing
|
||||||
|
- intftoleaf_absent_idempotent.changed == false
|
||||||
|
- intftoleaf_absent_idempotent.existing == []
|
||||||
|
- intftoleaf_absent_missing_param.failed == true
|
||||||
|
- 'intftoleaf_absent_missing_param.msg == "state is absent but all of the following are missing: interface_selector"'
|
||||||
|
|
||||||
|
- name: Remove an interface selector associated with a Switch Policy Leaf Profile - Clean up
|
||||||
|
aci_interface_selector_to_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_selector_to_switch_policy_leaf_profile_absent
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: delete Switch Policy Leaf profile - Clean up
|
||||||
|
aci_switch_policy_leaf_profile:
|
||||||
|
<<: *aci_switch_policy_leaf_profile_present
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: delete Interface Policy Leaf profile - Clean up
|
||||||
|
aci_interface_policy_leaf_profile:
|
||||||
|
<<: *aci_interface_policy_leaf_profile_present
|
||||||
|
leaf_interface_profile: leafintprftest
|
||||||
|
state: absent
|
Loading…
Add table
Add a link
Reference in a new issue