diff options
author | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:34 +0000 |
---|---|---|
committer | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:34 +0000 |
commit | ad5be6f8fd604ad53c784af148965b20459884af (patch) | |
tree | ba0ee59f1423a6c0e65ae99ccce5e47f2725b007 /test | |
parent | aee8e4f5ff0cf2dcc25a2a72f446add6367bf539 (diff) | |
download | ansible-ad5be6f8fd604ad53c784af148965b20459884af.tar.gz |
Migrated to cisco.aci
Diffstat (limited to 'test')
108 files changed, 0 insertions, 11631 deletions
diff --git a/test/integration/targets/aci_aaa_user/aliases b/test/integration/targets/aci_aaa_user/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_aaa_user/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_aaa_user/tasks/main.yml b/test/integration/targets/aci_aaa_user/tasks/main.yml deleted file mode 100644 index 2202cb8b70..0000000000 --- a/test/integration/targets/aci_aaa_user/tasks/main.yml +++ /dev/null @@ -1,235 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (dagwieers) <dag@wieers.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 - - -# CLEAN ENVIRONMENT -- name: Remove any pre-existing user - aci_aaa_user: &user_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: ansible - state: absent - - -# ADD USER -- name: Add user (check_mode) - aci_aaa_user: &user_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: ansible - description: Ansible test user - email: ansible@ansible.lan - enabled: yes - expiration: never - expires: no - first_name: Test - last_name: User - phone: 1-234-555-678 - check_mode: yes - register: cm_add_user - -# NOTE: Setting password is not idempotent, see #35544 -- name: Add user (normal mode) - aci_aaa_user: - <<: *user_present - aaa_password: 12!Ab:cD!34 - register: nm_add_user - -- name: Add user again (check mode) - aci_aaa_user: *user_present - check_mode: yes - register: cm_add_user_again - -- name: Add user again (normal mode) - aci_aaa_user: *user_present - register: nm_add_user_again - -- name: Verify add user - assert: - that: - - cm_add_user is changed - - nm_add_user is changed - - nm_add_user.current.0.aaaUser.attributes.descr == 'Ansible test user' - - cm_add_user_again is not changed - - nm_add_user_again is not changed - - nm_add_user_again.current.0.aaaUser.attributes.descr == 'Ansible test user' - - -# MODIFY USER -- name: Modify user (check_mode) - aci_aaa_user: &user_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: ansible - description: Ansible test user for integration tests - email: aci-ansible@ansible.lan - expiration: '2123-12-12' - expires: yes - phone: 2-345-555-678 - check_mode: yes - register: cm_modify_user - -- name: Modify user (normal mode) - aci_aaa_user: *user_changed - register: nm_modify_user - -- name: Modify user again (check mode) - aci_aaa_user: *user_changed - check_mode: yes - register: cm_modify_user_again - -- name: Modify user again (normal mode) - aci_aaa_user: *user_changed - register: nm_modify_user_again - -- name: Verify modify user - assert: - that: - - cm_modify_user is changed - - nm_modify_user is changed - - nm_modify_user.current.0.aaaUser.attributes.descr == 'Ansible test user for integration tests' - - cm_modify_user_again is not changed - - nm_modify_user_again is not changed - - nm_modify_user_again.current.0.aaaUser.attributes.descr == 'Ansible test user for integration tests' - - -# CLEAR PASSWORD HISTORY -- name: Clear password history (check_mode) - aci_aaa_user: &clear_password_history - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: ansible - clear_password_history: yes - check_mode: yes - register: cm_clear_password_history - -- name: Clear password history (normal mode) - aci_aaa_user: *clear_password_history - register: nm_clear_password_history - -- name: Clear password history (check mode) - aci_aaa_user: *clear_password_history - check_mode: yes - register: cm_clear_password_history_again - -- name: Clear password history (normal mode) - aci_aaa_user: *clear_password_history - register: nm_clear_password_history_again - -- name: Verify clear password history - assert: - that: - # NOTE: Clearing password history is a changing action, everytime - - cm_clear_password_history is changed - - nm_clear_password_history is changed - - cm_clear_password_history_again is changed - - nm_clear_password_history_again is changed - - -# QUERY ALL USERS -- name: Query all users (check_mode) - aci_aaa_user: &user_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: ansible - state: query - check_mode: yes - register: cm_query_all_users - -- name: Query all users (normal mode) - aci_aaa_user: *user_query - register: nm_query_all_users - -- name: Verify query_all_users - assert: - that: - - cm_query_all_users is not changed - - nm_query_all_users is not changed - # NOTE: Order of users is not stable between calls - #- cm_query_all_users == nm_query_all_users - - -# QUERY OUR USER -- name: Query our user (check_mode) - aci_aaa_user: - <<: *user_query - check_mode: yes - register: cm_query_user - -- name: Query our user (normal mode) - aci_aaa_user: - <<: *user_query - register: nm_query_user - -- name: Verify query_user - assert: - that: - - cm_query_user is not changed - - nm_query_user is not changed - - cm_query_user == nm_query_user - - nm_query_user.current.0.aaaUser.attributes.accountStatus == 'active' - - nm_query_user.current.0.aaaUser.attributes.descr == 'Ansible test user for integration tests' - - nm_query_user.current.0.aaaUser.attributes.email == 'aci-ansible@ansible.lan' - - nm_query_user.current.0.aaaUser.attributes.expiration == '2123-12-12T00:00:00.000+00:00' - - nm_query_user.current.0.aaaUser.attributes.expires == 'yes' - - nm_query_user.current.0.aaaUser.attributes.phone == '2-345-555-678' - - -# REMOVE USER -- name: Remove user (check_mode) - aci_aaa_user: *user_absent - check_mode: yes - register: cm_remove_user - -- name: Remove user (normal mode) - aci_aaa_user: *user_absent - register: nm_remove_user - -- name: Remove user again (check_mode) - aci_aaa_user: *user_absent - check_mode: yes - register: cm_remove_user_again - -- name: Remove user again (normal mode) - aci_aaa_user: *user_absent - register: nm_remove_user_again - -- name: Verify remove_user - assert: - that: - - cm_remove_user is changed - - nm_remove_user is changed - - cm_remove_user_again is not changed - - nm_remove_user_again is not changed diff --git a/test/integration/targets/aci_aaa_user_certificate/aliases b/test/integration/targets/aci_aaa_user_certificate/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_aaa_user_certificate/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_aaa_user_certificate/pki/admin.crt b/test/integration/targets/aci_aaa_user_certificate/pki/admin.crt deleted file mode 100644 index cfac5531e9..0000000000 --- a/test/integration/targets/aci_aaa_user_certificate/pki/admin.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV -BAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX -DTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p -bjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i -v+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl -XHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw -AQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud -IwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI -hvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl -3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l -KU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00= ------END CERTIFICATE----- diff --git a/test/integration/targets/aci_aaa_user_certificate/pki/admin.key b/test/integration/targets/aci_aaa_user_certificate/pki/admin.key deleted file mode 100644 index 63bb00cc00..0000000000 --- a/test/integration/targets/aci_aaa_user_certificate/pki/admin.key +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKIRv+2sbbewm0mj -D+6/tpoUymzYIdFsN+gu02teIr/lZi8ipEB514pyhoaerstzboPteWvniLuwq4KQ -VTEHgoln7J8EaHCnECViGA61pVx8RkJ99cmCkepspROw3I96zBcm58oXs6+Q/BnD -/OWET5sBvR9oTv9GNRVJ1rvSMAEJAgMBAAECgYByu3QO0qF9h7X3JEu0Ld4cKBnB -giQ2uJC/et7KxIJ/LOvw9GopBthyt27KwG1ntBkJpkTuAaQHkyNns7vLkNB0S0IR -+owVFEcKYq9VCHTaiQU8TDp24gN+yPTrpRuH8YhDVq5SfVdVuTMgHVQdj4ya4VlF -Gj+a7+ipxtGiLsVGrQJBAM7p0Fm0xmzi+tBOASUAcVrPLcteFIaTBFwfq16dm/ON -00Khla8Et5kMBttTbqbukl8mxFjBEEBlhQqb6EdQQ0sCQQDIhHx1a9diG7y/4DQA -4KvR3FCYwP8PBORlSamegzCo+P1OzxiEo0amX7yQMA5UyiP/kUsZrme2JBZgna8S -p4R7AkEAr7rMhSOPUnMD6V4WgsJ5g1Jp5kqkzBaYoVUUSms5RASz4+cwJVCwTX91 -Y1jcpVIBZmaaY3a0wrx13ajEAa0dOQJBAIpjnb4wqpsEh7VpmJqOdSdGxb1XXfFQ -sA0T1OQYqQnFppWwqrxIL+d9pZdiA1ITnNqyvUFBNETqDSOrUHwwb2cCQGArE+vu -ffPUWQ0j+fiK+covFG8NL7H+26NSGB5+Xsn9uwOGLj7K/YT6CbBtr9hJiuWjM1Al -0V4ltlTuu2mTMaw= ------END PRIVATE KEY----- diff --git a/test/integration/targets/aci_aaa_user_certificate/tasks/main.yml b/test/integration/targets/aci_aaa_user_certificate/tasks/main.yml deleted file mode 100644 index 27ea5a1ebd..0000000000 --- a/test/integration/targets/aci_aaa_user_certificate/tasks/main.yml +++ /dev/null @@ -1,142 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (dagwieers) <dag@wieers.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 - - -# CLEAN ENVIRONMENT -- name: Remove any pre-existing certificate - aci_aaa_user_certificate: &cert_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: admin - certificate_name: admin - state: absent - - -# ADD USER CERTIFICATE -- name: Add user certificate (check_mode) - aci_aaa_user_certificate: &cert_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: admin - certificate_name: admin - certificate: "{{ lookup('file', 'pki/admin.crt') }}" - state: present - check_mode: yes - register: cm_add_cert - -- name: Add user certificate (normal mode) - aci_aaa_user_certificate: *cert_present - register: nm_add_cert - -- name: Add user certificate again (check mode) - aci_aaa_user_certificate: *cert_present - check_mode: yes - register: cm_add_cert_again - -- name: Add user certificate again (normal mode) - aci_aaa_user_certificate: *cert_present - register: nm_add_cert_again - -- name: Verify add_cert - assert: - that: - - cm_add_cert is changed - - nm_add_cert is change - - cm_add_cert_again is not changed - - nm_add_cert_again is not changed - - -# QUERY ALL USER CERTIFICATES -- name: Query all user certificates using signature-based authentication (check_mode) - aci_aaa_user_certificate: &cert_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - #password: '{{ aci_password }}' - private_key: '{{ role_path }}/pki/admin.key' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aaa_user: admin - state: query - check_mode: yes - register: cm_query_all_certs - -- name: Query all user certificates using signature-based authentication (normal mode) - aci_aaa_user_certificate: *cert_query - register: nm_query_all_certs - -- name: Verify query_all_certs - assert: - that: - - cm_query_all_certs is not changed - - nm_query_all_certs is not changed - # NOTE: Order of certs is not stable between calls - #- cm_query_all_certs == nm_query_all_certs - - -# QUERY OUR USER CERTIFICATE -- name: Query our certificate using signature-based authentication (check_mode) - aci_aaa_user_certificate: - <<: *cert_query - certificate_name: admin - check_mode: yes - register: cm_query_cert - -- name: Query our certificate using signature-based authentication (normal mode) - aci_aaa_user_certificate: - <<: *cert_query - certificate_name: admin - register: nm_query_cert - -- name: Verify query_cert - assert: - that: - - cm_query_cert is not changed - - nm_query_cert is not changed - - cm_query_cert == nm_query_cert - - -# REMOVE CERTIFICATE -- name: Remove certificate (check_mode) - aci_aaa_user_certificate: *cert_absent - check_mode: yes - register: cm_remove_cert - -- name: Remove certificate (normal mode) - aci_aaa_user_certificate: *cert_absent - register: nm_remove_cert - -- name: Remove certificate again (check_mode) - aci_aaa_user_certificate: *cert_absent - check_mode: yes - register: cm_remove_cert_again - -- name: Remove certificate again (normal mode) - aci_aaa_user_certificate: *cert_absent - register: nm_remove_cert_again - -- name: Verify remove_cert - assert: - that: - - cm_remove_cert is changed - - nm_remove_cert is changed - - cm_remove_cert_again is not changed - - nm_remove_cert_again is not changed diff --git a/test/integration/targets/aci_access_port_block_to_access_port/aliases b/test/integration/targets/aci_access_port_block_to_access_port/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_access_port_block_to_access_port/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_access_port_block_to_access_port/tasks/main.yml b/test/integration/targets/aci_access_port_block_to_access_port/tasks/main.yml deleted file mode 100644 index 543e8e0ba3..0000000000 --- a/test/integration/targets/aci_access_port_block_to_access_port/tasks/main.yml +++ /dev/null @@ -1,135 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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: 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - leaf_interface_profile: leafintprftest - register: leaf_profile_present - -- name: Ensure Interface Access Port Selector exists for kick of - aci_access_port_to_interface_policy_leaf_profile: &aci_access_port_to_interface_policy_leaf_profile_present - <<: *aci_interface_policy_leaf_profile_present - access_port_selector: anstest_accessportselector - -# TODO: Ensure that leaf Policy Group Exists (module missing) (infra:AccPortGrp) - -- name: Bind an Access Port Block to an Interface Access Port Selector - check mode works - aci_access_port_block_to_access_port: &aci_access_port_block_to_access_port_present - <<: *aci_access_port_to_interface_policy_leaf_profile_present - leaf_port_blk: anstest_leafportblkname - leaf_port_blk_description: anstest_leafportblkdesc - fromPort: 13 - toPort: 16 - check_mode: yes - register: accessportblock_to_accessport_check_mode_present - -- name: Bind an Access Port Block to an Interface Access Port Selector - creation works - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_present - register: accessportblock_to_accessport_present - -- name: Bind an Access Port Block to an Interface Access Port Selector - idempotency works - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_present - register: accessportblock_to_accessport_idempotent - -- name: Bind an Access Port Block to an Interface Access Port Selector - update works - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_present - toPort: 15 - register: accessportblock_to_accessport_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - accessportblock_to_accessport_check_mode_present is changed - - accessportblock_to_accessport_present is changed - - accessportblock_to_accessport_present.previous == [] - - 'accessportblock_to_accessport_present.sent == {"infraPortBlk": {"attributes": {"descr": "anstest_leafportblkdesc", "name": "anstest_leafportblkname", "fromPort": "13", "toPort": "16"}}}' - - accessportblock_to_accessport_idempotent is not changed - - accessportblock_to_accessport_idempotent.sent == {} - - accessportblock_to_accessport_update is changed - - 'accessportblock_to_accessport_update.sent == {"infraPortBlk": {"attributes": {"toPort": "15"}}}' - - -- name: Query Specific port block and access_port_selector binding - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_present - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"api/mo/uni/infra/accportprof-leafintprftest/hports-anstest_accessportselector-typ-range/portblk-anstest_leafportblkname.json" in binding_query.url' - -- name: Remove binding of Access Port Block and Interface Access Port Selector - check mode - aci_access_port_block_to_access_port: &aci_access_port_block_to_access_port_absent - <<: *aci_access_port_block_to_access_port_present - state: absent - check_mode: yes - register: accessportblock_to_accessport_check_mode_absent - -- name: Remove binding of Access Port Block and Interface Access Port Selector - delete works - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_absent - register: accessportblock_to_accessport_absent - -- name: Remove binding of Access Port Block and Interface Access Port Selector - idempotency works - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_absent - register: accessportblock_to_accessport_absent_idempotent - -- name: Remove binding of Access Port Block and Interface Access Port Selector - check mode - aci_access_port_block_to_access_port: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - #leaf_port_blk: anstest_leafportblkname - state: absent - ignore_errors: yes - register: accessportblock_to_accessport_absent_missing_param - -- name: absent assertions - assert: - that: - - accessportblock_to_accessport_check_mode_absent is changed - - accessportblock_to_accessport_check_mode_absent.previous != [] - - accessportblock_to_accessport_absent is changed - - accessportblock_to_accessport_absent.previous == accessportblock_to_accessport_check_mode_absent.previous - - accessportblock_to_accessport_absent_idempotent is not changed - - accessportblock_to_accessport_absent_idempotent.previous == [] - - accessportblock_to_accessport_absent_missing_param is failed - - 'accessportblock_to_accessport_absent_missing_param.msg == "state is absent but all of the following are missing: leaf_port_blk"' - - -- name: Remove binding of Access Port Block and Interface Access Port Selector - Clean up - aci_access_port_block_to_access_port: - <<: *aci_access_port_block_to_access_port_present - state: absent - -- name: Remove Interface Access Port Selector - Cleanup - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - state: absent - -- name: Remove Interface policy leaf profile - Cleanup - aci_interface_policy_leaf_profile: - <<: *aci_interface_policy_leaf_profile_present - state: absent diff --git a/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/aliases b/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/tasks/main.yml b/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/tasks/main.yml deleted file mode 100644 index c21c71282b..0000000000 --- a/test/integration/targets/aci_access_port_to_interface_policy_leaf_profile/tasks/main.yml +++ /dev/null @@ -1,135 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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: Ensuring bindings do not already exist - aci_access_port_to_interface_policy_leaf_profile: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - leaf_interface_profile: leafintprftest - access_port_selector: anstest_accessportselector - state: absent - -- 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - leaf_interface_profile: leafintprftest - register: leaf_profile_present - -# TODO: Ensure that leaf Policy Group Exists (module missing) (infra:AccPortGrp) - -- name: Bind an Interface Access Port Selector to an Interface Policy Leaf Profile with a Policy Group - check mode works - aci_access_port_to_interface_policy_leaf_profile: &aci_access_port_to_interface_policy_leaf_profile_present - <<: *aci_interface_policy_leaf_profile_present - access_port_selector: anstest_accessportselector - check_mode: yes - register: accessport_to_intf_check_mode_present - -- name: Bind an Interface Access Port Selector to an Interface Policy Leaf Profile with a Policy Group - creation works - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - register: accessport_to_intf_present - -- name: Bind an Interface Access Port Selector to an Interface Policy Leaf Profile with a Policy Group - idempotency works - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - register: accessport_to_intf_idempotent - -- name: Bind an Interface Access Port Selector to an Interface Policy Leaf Profile with a Policy Group - update works - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - policy_group: anstest_policygroupname - register: accessport_to_intf_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - accessport_to_intf_check_mode_present is changed - - accessport_to_intf_present is changed - - accessport_to_intf_present.previous == [] - - 'accessport_to_intf_present.sent == {"infraHPortS": {"attributes": {"name": "anstest_accessportselector"}}}' - - accessport_to_intf_idempotent is not changed - - accessport_to_intf_idempotent.sent == {} - - accessport_to_intf_update is changed - - 'accessport_to_intf_update.sent == {"infraHPortS": {"attributes": {},"children": [{"infraRsAccBaseGrp": {"attributes": {"tDn": "uni/infra/funcprof/accportgrp-anstest_policygroupname"}}}]}}' - -- name: Query Specific access_port_selector and leaf_interface_profile binding - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_interface_policy_leaf_profile_present - access_port_selector: anstest_accessportselector # "{{ fake_var | default(omit) }}" ? - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"api/mo/uni/infra/accportprof-leafintprftest/hports-anstest_accessportselector-typ-range.json" in binding_query.url' - -- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - check mode - aci_access_port_to_interface_policy_leaf_profile: &aci_access_port_to_interface_policy_leaf_profile_absent - <<: *aci_interface_policy_leaf_profile_present - access_port_selector: anstest_accessportselector - state: absent - check_mode: yes - register: accessport_to_intf_check_mode_absent - -- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - delete works - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_absent - register: accessport_to_intf_absent - -- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - idempotency works - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_absent - register: accessport_to_intf_absent_idempotent - -- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - check mode - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_interface_policy_leaf_profile_present - #access_port_selector: anstest_accessportselector - state: absent - ignore_errors: yes - register: accessport_to_intf_absent_missing_param - -- name: absent assertions - assert: - that: - - accessport_to_intf_check_mode_absent is changed - - accessport_to_intf_check_mode_absent.previous != [] - - accessport_to_intf_absent is changed - - accessport_to_intf_absent.previous == accessport_to_intf_check_mode_absent.previous - - accessport_to_intf_absent_idempotent is not changed - - accessport_to_intf_absent_idempotent.previous == [] - - accessport_to_intf_absent_missing_param is failed - - 'accessport_to_intf_absent_missing_param.msg == "state is absent but all of the following are missing: access_port_selector"' - - -- name: Remove an interface access port selector associated with an Interface Policy Leaf Profile - Clean up - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_absent - state: absent - -- name: Remove Interface policy leaf profile - Cleanup - aci_interface_policy_leaf_profile: - <<: *aci_interface_policy_leaf_profile_present - state: absent diff --git a/test/integration/targets/aci_access_sub_port_block_to_access_port/aliases b/test/integration/targets/aci_access_sub_port_block_to_access_port/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_access_sub_port_block_to_access_port/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_access_sub_port_block_to_access_port/tasks/main.yml b/test/integration/targets/aci_access_sub_port_block_to_access_port/tasks/main.yml deleted file mode 100644 index c8e20fb5fa..0000000000 --- a/test/integration/targets/aci_access_sub_port_block_to_access_port/tasks/main.yml +++ /dev/null @@ -1,137 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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: 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - leaf_interface_profile: leafintprftest - register: leaf_profile_present - -- name: Ensure Interface Access Port Selector exists for kick of - aci_access_port_to_interface_policy_leaf_profile: &aci_access_port_to_interface_policy_leaf_profile_present - <<: *aci_interface_policy_leaf_profile_present - access_port_selector: anstest_accessportselector - -# TODO: Ensure that leaf Policy Group Exists (module missing) (infra:AccPortGrp) - -- name: Bind an Access Sub Port Block to an Interface Access Port Selector - check mode works - aci_access_sub_port_block_to_access_port: &aci_access_sub_port_block_to_access_port_present - <<: *aci_access_port_to_interface_policy_leaf_profile_present - leaf_port_blk: anstest_leafportblkname - leaf_port_blk_description: anstest_leafportblkdesc - fromPort: 13 - toPort: 13 - fromSubPort: 1 - toSubPort: 3 - check_mode: yes - register: accesssubportblock_to_accessport_check_mode_present - -- name: Bind an Access Sub Port Block to an Interface Access Port Selector - creation works - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_present - register: accesssubportblock_to_accessport_present - -- name: Bind an Access Sub Port Block to an Interface Access Port Selector - idempotency works - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_present - register: accesssubportblock_to_accessport_idempotent - -- name: Bind an Access Sub Port Block to an Interface Access Port Selector - update works - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_present - toSubPort: 2 - register: accesssubportblock_to_accessport_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - accesssubportblock_to_accessport_check_mode_present is changed - - accesssubportblock_to_accessport_present is changed - - accesssubportblock_to_accessport_present.previous == [] - - 'accesssubportblock_to_accessport_present.sent == {"infraSubPortBlk": {"attributes": {"descr": "anstest_leafportblkdesc", "name": "anstest_leafportblkname", "fromPort": "13", "toPort": "13", "fromSubPort": "1", "toSubPort": "3"}}}' - - accesssubportblock_to_accessport_idempotent is not changed - - accesssubportblock_to_accessport_idempotent.sent == {} - - accesssubportblock_to_accessport_update is changed - - 'accesssubportblock_to_accessport_update.sent == {"infraSubPortBlk": {"attributes": {"toSubPort": "2"}}}' - - -- name: Query Specific sub port block and access_port_selector binding - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_present - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"api/mo/uni/infra/accportprof-leafintprftest/hports-anstest_accessportselector-typ-range/subportblk-anstest_leafportblkname.json" in binding_query.url' - -- name: Remove binding of Access Sub Port Block and Interface Access Port Selector - check mode - aci_access_sub_port_block_to_access_port: &aci_access_sub_port_block_to_access_port_absent - <<: *aci_access_sub_port_block_to_access_port_present - state: absent - check_mode: yes - register: accesssubportblock_to_accessport_check_mode_absent - -- name: Remove binding of Access Sub Port Block and Interface Access Port Selector - delete works - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_absent - register: accesssubportblock_to_accessport_absent - -- name: Remove binding of Access Sub Port Block and Interface Access Port Selector - idempotency works - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_absent - register: accesssubportblock_to_accessport_absent_idempotent - -- name: Remove binding of Access Sub Port Block and Interface Access Port Selector - check mode - aci_access_sub_port_block_to_access_port: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - #leaf_port_blk: anstest_leafportblkname - state: absent - ignore_errors: yes - register: accesssubportblock_to_accessport_absent_missing_param - -- name: absent assertions - assert: - that: - - accesssubportblock_to_accessport_check_mode_absent is changed - - accesssubportblock_to_accessport_check_mode_absent.previous != [] - - accesssubportblock_to_accessport_absent is changed - - accesssubportblock_to_accessport_absent.previous == accesssubportblock_to_accessport_check_mode_absent.previous - - accesssubportblock_to_accessport_absent_idempotent is not changed - - accesssubportblock_to_accessport_absent_idempotent.previous == [] - - accesssubportblock_to_accessport_absent_missing_param is failed - - 'accesssubportblock_to_accessport_absent_missing_param.msg == "state is absent but all of the following are missing: leaf_port_blk"' - - -- name: Remove binding of Access Sub Port Block and Interface Access Port Selector - Clean up - aci_access_sub_port_block_to_access_port: - <<: *aci_access_sub_port_block_to_access_port_present - state: absent - -- name: Remove Interface Access Port Selector - Cleanup - aci_access_port_to_interface_policy_leaf_profile: - <<: *aci_access_port_to_interface_policy_leaf_profile_present - state: absent - -- name: Remove Interface policy leaf profile - Cleanup - aci_interface_policy_leaf_profile: - <<: *aci_interface_policy_leaf_profile_present - state: absent diff --git a/test/integration/targets/aci_aep/aliases b/test/integration/targets/aci_aep/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_aep/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_aep/tasks/main.yml b/test/integration/targets/aci_aep/tasks/main.yml deleted file mode 100644 index d80ea57541..0000000000 --- a/test/integration/targets/aci_aep/tasks/main.yml +++ /dev/null @@ -1,272 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.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 - - -# CLEAN ENVIRONMENT -- name: Remove AEP - aci_aep: &aep_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aep: ansible_test - state: absent - - -# ADD AEP -- name: Add AEP (check_mode) - aci_aep: &aep_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aep: ansible_test - state: present - check_mode: yes - register: cm_add_aep - -- name: Add AEP (normal mode) - aci_aep: *aep_present - register: nm_add_aep - -- name: Verify add_aep - assert: - that: - - cm_add_aep is changed - - nm_add_aep is changed - - nm_add_aep.previous == nm_add_aep.previous == cm_add_aep.current == [] - - 'nm_add_aep.current == [{"infraAttEntityP": {"attributes": {"descr": "", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - 'cm_add_aep.proposed == nm_add_aep.proposed == cm_add_aep.sent == nm_add_aep.sent == {"infraAttEntityP": {"attributes": {"name": "ansible_test"}}}' - -- name: Add AEP again (check_mode) - aci_aep: *aep_present - check_mode: yes - register: cm_add_aep_again - -- name: Add AEP again (normal mode) - aci_aep: *aep_present - register: nm_add_aep_again - -- name: Verify add_aep_again - assert: - that: - - cm_add_aep_again is not changed - - nm_add_aep_again is not changed - - 'nm_add_aep_again.previous == nm_add_aep_again.previous == cm_add_aep_again.current == nm_add_aep_again.current == [{"infraAttEntityP": {"attributes": {"descr": "", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - 'cm_add_aep_again.proposed == nm_add_aep_again.proposed == {"infraAttEntityP": {"attributes": {"name": "ansible_test"}}}' - - cm_add_aep_again.sent == nm_add_aep_again.sent == {} - - -# CHANGE AEP -- name: Change description of AEP (check_mode) - aci_aep: - <<: *aep_present - description: Ansible test AEP - check_mode: yes - register: cm_add_aep_descr - -- name: Change description of AEP (normal mode) - aci_aep: - <<: *aep_present - description: Ansible test AEP - register: nm_add_aep_descr - -- name: Verify add_aep_descr - assert: - that: - - cm_add_aep_descr is changed - - nm_add_aep_descr is changed - - 'cm_add_aep_descr.proposed == nm_add_aep_descr.proposed == {"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "name": "ansible_test"}}}' - - 'cm_add_aep_descr.sent == nm_add_aep_descr.sent == {"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP"}}}' - - 'cm_add_aep_descr.previous == nm_add_aep_descr.previous == cm_add_aep_descr.current == [{"infraAttEntityP": {"attributes": {"descr": "", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - 'nm_add_aep_descr.current == [{"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - -- name: Change description of AEP again (check_mode) - aci_aep: - <<: *aep_present - description: Ansible test AEP - check_mode: yes - register: cm_add_aep_descr_again - -- name: Change description of AEP again (normal mode) - aci_aep: - <<: *aep_present - description: Ansible test AEP - register: nm_add_aep_descr_again - -- name: Verify add_aep_descr_again - assert: - that: - - cm_add_aep_descr_again is not changed - - nm_add_aep_descr_again is not changed - - 'cm_add_aep_descr_again.proposed == nm_add_aep_descr_again.proposed == {"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "name": "ansible_test"}}}' - - 'cm_add_aep_descr_again.sent == nm_add_aep_descr_again.sent == {}' - - 'cm_add_aep_descr_again.previous == nm_add_aep_descr_again.previous == cm_add_aep_descr_again.current == nm_add_aep_descr_again.current == [{"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - -# ADD AEP AGAIN -- name: Add AEP again with no description (check_mode) - aci_aep: *aep_present - check_mode: yes - register: cm_add_aep_again_no_descr - -- name: Add AEP again with no description (normal mode) - aci_aep: *aep_present - register: nm_add_aep_again_no_descr - -- name: Verify add_aep_again_no_descr - assert: - that: - - cm_add_aep_again_no_descr is not changed - - nm_add_aep_again_no_descr is not changed - - 'cm_add_aep_again_no_descr.proposed == nm_add_aep_again_no_descr.proposed == {"infraAttEntityP": {"attributes": {"name": "ansible_test"}}}' - - cm_add_aep_again_no_descr.sent == nm_add_aep_again_no_descr.sent == {} - - 'cm_add_aep_again_no_descr.previous == nm_add_aep_again_no_descr.previous == cm_add_aep_again_no_descr.current == nm_add_aep_again_no_descr.current == [{"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - -# QUERY ALL AEPS -- name: Query all AEPs (check_mode) - aci_aep: &aep_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_aeps - -- name: Query all AEPs (normal mode) - aci_aep: *aep_query - register: nm_query_all_aeps - -- name: Verify query_all_aeps - assert: - that: - - cm_query_all_aeps is not changed - - nm_query_all_aeps is not changed - - cm_query_all_aeps == nm_query_all_aeps - - nm_query_all_aeps.current|length >= 1 - - -# QUERY A AEP -- name: Query our AEP - aci_aep: - <<: *aep_query - aep: ansible_test - check_mode: yes - register: cm_query_aep - -- name: Query our AEP - aci_aep: - <<: *aep_query - aep: ansible_test - register: nm_query_aep - -- name: Verify query_aep - assert: - that: - - cm_query_aep is not changed - - nm_query_aep is not changed - - cm_query_aep == nm_query_aep - - nm_query_aep.current.0.infraAttEntityP.attributes.descr == "Ansible test AEP" - - nm_query_aep.current.0.infraAttEntityP.attributes.dn == "uni/infra/attentp-ansible_test" - - nm_query_aep.current.0.infraAttEntityP.attributes.name == "ansible_test" - - -# REMOVE AEP -- name: Remove AEP (check_mode) - aci_aep: *aep_absent - check_mode: yes - register: cm_remove_aep - -- name: Remove AEP (normal mode) - aci_aep: *aep_absent - register: nm_remove_aep - -- name: Verify remove_aep - assert: - that: - - cm_remove_aep is changed - - nm_remove_aep is changed - - cm_remove_aep.proposed == nm_remove_aep.proposed == {} - - cm_remove_aep.sent == nm_remove_aep.sent == {} - - 'cm_remove_aep.previous == nm_remove_aep.previous == cm_remove_aep.current == [{"infraAttEntityP": {"attributes": {"descr": "Ansible test AEP", "dn": "uni/infra/attentp-ansible_test", "name": "ansible_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_aep.current == [] - -- name: Remove AEP again (check_mode) - aci_aep: *aep_absent - check_mode: yes - register: cm_remove_aep_again - -- name: Remove AEP again (normal mode) - aci_aep: *aep_absent - register: nm_remove_aep_again - -- name: Verify remove_aep_again - assert: - that: - - cm_remove_aep_again is not changed - - nm_remove_aep_again is not changed - - cm_remove_aep_again.proposed == nm_remove_aep_again.proposed == {} - - cm_remove_aep_again.sent == nm_remove_aep_again.sent == {} - - cm_remove_aep_again.previous == nm_remove_aep_again.previous == cm_remove_aep_again.current == nm_remove_aep_again.current == [] - - -# QUERY NON-EXISTING AEP -- name: Query non-existing AEP (check_mode) - aci_aep: - <<: *aep_query - aep: ansible_test - check_mode: yes - register: cm_query_non_aep - -- name: Query non-existing AEP (normal mode) - aci_aep: - <<: *aep_query - aep: ansible_test - register: nm_query_non_aep - -- name: Verify query_non_aep - assert: - that: - - cm_query_non_aep is not changed - - nm_query_non_aep is not changed - - cm_query_non_aep == nm_query_non_aep - - cm_query_non_aep.current == nm_query_non_aep.current == [] - - -# PROVOKE ERRORS -- name: Error when required parameter is missing - aci_aep: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: present - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "state is present but all of the following are missing: aep"' diff --git a/test/integration/targets/aci_aep_to_domain/aliases b/test/integration/targets/aci_aep_to_domain/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_aep_to_domain/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_aep_to_domain/tasks/main.yml b/test/integration/targets/aci_aep_to_domain/tasks/main.yml deleted file mode 100644 index 5aafc367cf..0000000000 --- a/test/integration/targets/aci_aep_to_domain/tasks/main.yml +++ /dev/null @@ -1,210 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove AEP to domain binding - aci_aep_to_domain: &binding_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aep: test_aep - domain: phys_dom - domain_type: phys - state: absent - -- name: Create AEP - aci_aep: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aep: test_aep - description: Test AEP - state: present - -- name: Create physical domain - aci_domain: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - state: present - - -# ADD BINDING -- name: Add AEP to domain binding (check_mode) - aci_aep_to_domain: &binding_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - aep: test_aep - domain: phys_dom - domain_type: phys - state: present - check_mode: yes - register: cm_add_binding - -- name: Add AEP to domain binding (normal mode) - aci_aep_to_domain: *binding_present - register: nm_add_binding - -- name: Verify add_binding - assert: - that: - - cm_add_binding is changed - - nm_add_binding is changed - - 'cm_add_binding.sent == nm_add_binding.sent == {"infraRsDomP": {"attributes": {"tDn": "uni/phys-phys_dom"}}}' - - 'cm_add_binding.proposed == nm_add_binding.proposed == {"infraRsDomP": {"attributes": {"tDn": "uni/phys-phys_dom"}}}' - - cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == [] - - 'nm_add_binding.current == [{"infraRsDomP": {"attributes": {"dn": "uni/infra/attentp-test_aep/rsdomP-[uni/phys-phys_dom]", "tDn": "uni/phys-phys_dom"}}}]' - -- name: Add AEP to domain binding again (check_mode) - aci_aep_to_domain: *binding_present - check_mode: yes - register: cm_add_binding_again - -- name: Add AEP to domain binding again (normal mode) - aci_aep_to_domain: *binding_present - register: nm_add_binding_again - -- name: Verify add_binding_again - assert: - that: - - cm_add_binding_again is not changed - - nm_add_binding_again is not changed - - -# QUERY ALL BINDINGS -- name: Query all AEP to domain bindings (check_mode) - aci_aep_to_domain: &binding_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_bindings - -- name: Query all AEP to domain bindings (normal mode) - aci_aep_to_domain: *binding_query - register: nm_query_all_bindings - -- name: Verify query_all_bindings - assert: - that: - - cm_query_all_bindings is not changed - - nm_query_all_bindings is not changed - - cm_query_all_bindings == nm_query_all_bindings - - nm_query_all_bindings.current|length >= 1 - - -# QUERY A BINDING -- name: Query our AEP to domain binding (check_mode) - aci_aep_to_domain: - <<: *binding_query - aep: test_aep - domain: phys_dom - domain_type: phys - check_mode: yes - register: cm_query_binding - -- name: Query our AEP to domain binding (normal mode) - aci_aep_to_domain: - <<: *binding_query - aep: test_aep - domain: phys_dom - domain_type: phys - register: nm_query_binding - -- name: Verify query_binding - assert: - that: - - cm_query_binding is not changed - - nm_query_binding is not changed - - cm_query_binding == nm_query_binding - - nm_query_binding.current.0.infraRsDomP.attributes.dn == 'uni/infra/attentp-test_aep/rsdomP-[uni/phys-phys_dom]' - - nm_query_binding.current.0.infraRsDomP.attributes.tCl == 'physDomP' - - nm_query_binding.current.0.infraRsDomP.attributes.tDn == 'uni/phys-phys_dom' - - -# REMOVE BINDING -- name: Remove AEP to domain binding (check_mode) - aci_aep_to_domain: *binding_absent - check_mode: yes - register: cm_remove_binding - -- name: Remove AEP to domain binding (normal mode) - aci_aep_to_domain: *binding_absent - register: nm_remove_binding - -- name: Verify remove_binding - assert: - that: - - cm_remove_binding is changed - - nm_remove_binding is changed - - 'cm_remove_binding.current == cm_remove_binding.previous == nm_remove_binding.previous == [{"infraRsDomP": {"attributes": {"dn": "uni/infra/attentp-test_aep/rsdomP-[uni/phys-phys_dom]", "tDn": "uni/phys-phys_dom"}}}]' - - nm_remove_binding.current == [] - -- name: Remove AEP to domain binding again (check_mode) - aci_aep_to_domain: *binding_absent - check_mode: yes - register: cm_remove_binding_again - -- name: Remove AEP to domain binding again (normal mode) - aci_aep_to_domain: *binding_absent - register: nm_remove_binding_again - -- name: Verify remove_binding_again - assert: - that: - - cm_remove_binding_again is not changed - - nm_remove_binding_again is not changed - - -# QUERY NON-EXISTING BINDING -- name: Query non-existing AEP to domain binding (check_mode) - aci_aep_to_domain: - <<: *binding_query - aep: test_aep - domain: phys_dom - domain_type: phys - check_mode: yes - register: cm_query_non_binding - -- name: Query non-existing AEP to domain binding (normal mode) - aci_aep_to_domain: - <<: *binding_query - aep: test_aep - domain: phys_dom - domain_type: phys - register: nm_query_non_binding - -- name: Verify query_non_binding - assert: - that: - - cm_query_non_binding is not changed - - nm_query_non_binding is not changed - - cm_query_non_binding == nm_query_non_binding - - nm_query_non_binding.current == [] diff --git a/test/integration/targets/aci_ap/aliases b/test/integration/targets/aci_ap/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_ap/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_ap/tasks/main.yml b/test/integration/targets/aci_ap/tasks/main.yml deleted file mode 100644 index a31151c372..0000000000 --- a/test/integration/targets/aci_ap/tasks/main.yml +++ /dev/null @@ -1,173 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: ensure ap does not exist initially - aci_ap: - <<: *aci_tenant_present - ap: anstest - state: absent - -- name: create ap - check mode works - aci_ap: &aci_ap_present - <<: *aci_tenant_present - ap: anstest - description: Ansible Test - check_mode: yes - register: ap_present_check_mode - -- name: create ap - creation works - aci_ap: - <<: *aci_ap_present - register: ap_present - -- name: create ap - extra for query - aci_ap: - <<: *aci_tenant_present - ap: anstest2 - -- name: create ap - idempotency works - aci_ap: - <<: *aci_ap_present - register: ap_present_idempotent - -- name: update ap - update works - aci_ap: - <<: *aci_ap_present - description: Ansible Test Update - register: ap_present_update - -- name: create ap - creation works - aci_ap: - <<: *aci_tenant_present - ignore_errors: yes - register: ap_present_missing_param - -- name: present asserts - assert: - that: - - ap_present_check_mode is changed - - ap_present is changed - - ap_present.previous == [] - - ap_present.sent == ap_present_check_mode.sent - - 'ap_present.sent == {"fvAp": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}' - - ap_present_idempotent is not changed - - ap_present_idempotent.previous != [] - - ap_present_idempotent.sent == {} - - ap_present_update is changed - - 'ap_present_update.sent.fvAp.attributes == {"descr": "Ansible Test Update"}' - - ap_present_missing_param is failed - - 'ap_present_missing_param.msg == "state is present but all of the following are missing: ap"' - -- name: get ap - query specific ap - aci_ap: &aci_ap_query - <<: *aci_ap_present - state: query - register: query_ap - -- name: get all ap for tenant - query tenant aps - aci_ap: - <<: *aci_ap_query - ap: "{{ fakevar | default(omit) }}" - register: query_ap_tenant - -- name: get all ap by name - query ap name - aci_ap: - <<: *aci_ap_query - tenant: "{{ fakevar | default(omit) }}" - register: query_ap_ap - -- name: get all aps - query general - aci_ap: - <<: *aci_ap_query - tenant: "{{ fakevar | default(omit) }}" - ap: "{{ fakevar | default(omit) }}" - register: query_all - -- name: query assertions - assert: - that: - - query_ap is not changed - - query_ap.current | length == 1 - - query_ap.current.0.fvAp.attributes.name == "anstest" - - '"tn-anstest/ap-anstest.json" in query_ap.url' - - query_ap_tenant is not changed - - query_ap_tenant.current | length == 1 - - query_ap_tenant.current.0.fvTenant.children | length == 2 - - '"rsp-subtree-class=fvAp" in query_ap_tenant.filter_string' - - '"tn-anstest.json" in query_ap_tenant.url' - - query_ap_ap is not changed - - query_ap_ap.current != [] - - query_ap_ap.current.0.fvAp is defined - - '"query-target-filter=eq(fvAp.name, \"anstest\")" in query_ap_ap.filter_string' - - '"class/fvAp.json" in query_ap_ap.url' - - query_all is not changed - - query_all.current | length > 1 - - '"class/fvAp.json" in query_all.url' - -- name: delete ap - check_mode works - aci_ap: &aci_ap_absent - <<: *aci_ap_present - state: absent - check_mode: yes - register: ap_delete_check_mode - -- name: delete ap - delete works - aci_ap: - <<: *aci_ap_absent - register: ap_delete - -- name: delete ap - delete idempotency works - aci_ap: - <<: *aci_ap_absent - register: ap_delete_idempotent - -- name: delete ap - missing param error - aci_ap: - <<: *aci_ap_absent - tenant: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: ap_delete_missing_param - -- name: delete ap remove ap used for query - aci_ap: - <<: *aci_ap_absent - ap: anstest2 - -- name: absent assertions - assert: - that: - - ap_delete_check_mode is changed - - ap_delete_check_mode.previous != [] - - '"tn-anstest/ap-anstest.json" in ap_delete_check_mode.url' - - ap_delete is changed - - ap_delete.previous == ap_delete_check_mode.previous - - ap_delete_idempotent is not changed - - ap_delete_idempotent.previous == [] - - ap_delete_missing_param is failed - - 'ap_delete_missing_param.msg == "state is absent but all of the following are missing: tenant"' - -- name: delete tenant - cleanup before ending tests - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_bd/aliases b/test/integration/targets/aci_bd/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_bd/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_bd/tasks/main.yml b/test/integration/targets/aci_bd/tasks/main.yml deleted file mode 100644 index 3273fc1034..0000000000 --- a/test/integration/targets/aci_bd/tasks/main.yml +++ /dev/null @@ -1,205 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: ensure vrf exists for tests to kick off - aci_vrf: &aci_vrf_present - <<: *aci_tenant_present - vrf: anstest - register: vrf_present - -- name: ensure bd anstest does not exist - aci_bd: - <<: *aci_tenant_present - bd: anstest - state: absent - -- name: ensure bd anstest2 does not exist - aci_bd: - <<: *aci_tenant_present - bd: anstest2 - state: absent - -- name: create bd - check mode works - aci_bd: &aci_bd_present - <<: *aci_tenant_present - bd: anstest - description: Ansible Test - check_mode: yes - register: bd_present_check_mode - -- name: create bd - creation works - aci_bd: - <<: *aci_bd_present - register: bd_present - -- name: create bd again - idempotency works - aci_bd: - <<: *aci_bd_present - register: bd_present_idempotent - -- name: update bd - update works - aci_bd: - <<: *aci_bd_present - vrf: anstest - description: Ansible Test Update - register: bd_update - -- name: create another bd - check more params - aci_bd: - <<: *aci_bd_present - bd: anstest2 - ip_learning: "no" - l2_unknown_unicast: flood - l3_unknown_multicast: opt-flood - multi_dest: drop - enable_routing: "no" - arp_flooding: "yes" - register: bd_present_2 - -- name: create bd without all necessary params - failure message works - aci_bd: - <<: *aci_bd_present - tenant: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: bd_present_missing_param - -- name: present asserts - assert: - that: - - bd_present_check_mode is changed - - 'bd_present_check_mode.sent == {"fvBD": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}' - - bd_present is changed - - bd_present.sent == bd_present_check_mode.sent - - bd_present.previous == [] - - bd_present_idempotent is not changed - - bd_present_idempotent.previous != [] - - bd_update is changed - - bd_update.previous != [] - - bd_update.sent != bd_update.proposed - - 'bd_update.sent == {"fvBD": {"attributes": {"descr": "Ansible Test Update"}, "children": [{"fvRsCtx": {"attributes": {"tnFvCtxName": "anstest"}}}]}}' - - 'bd_present_2.sent.fvBD.attributes == {"arpFlood": "yes", "descr": "Ansible Test", "ipLearning": "no", "multiDstPktAct": "drop", "name": "anstest2", - "unicastRoute": "no", "unkMacUcastAct": "flood", "unkMcastAct": "opt-flood"}' - - bd_present_missing_param is failed - - 'bd_present_missing_param.msg == "state is present but all of the following are missing: tenant"' - -- name: get all bd - aci_bd: &aci_query - <<: *aci_tenant_present - state: query - tenant: "{{ fake_var | default(omit) }}" - register: query_all - -- name: get all in tenant - aci_bd: - <<: *aci_query - tenant: anstest - register: query_tenant - -- name: get all with name - aci_bd: - <<: *aci_query - bd: anstest - register: query_bd_bd - -- name: get bd - aci_bd: - <<: *aci_bd_present - state: query - register: query_bd - -- name: query asserts - assert: - that: - - query_all is not changed - - query_all.current | length > 1 - - query_all.current.0.fvBD is defined - - '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_all.filter_string' - - '"class/fvBD.json" in query_all.url' - - query_tenant is not changed - - query_tenant.current | length == 1 - - query_tenant.current.0.fvTenant.children | length == 2 - - '"rsp-subtree-class=fvRsBdToEpRet,fvBD,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_tenant.filter_string' - - '"tn-anstest.json" in query_tenant.url' - - query_bd_bd is not changed - - query_bd_bd.current != [] - - '"query-target-filter=eq(fvBD.name, \"anstest\")" in query_bd_bd.filter_string' - - '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd_bd.filter_string' - - '"class/fvBD.json" in query_bd_bd.url' - - query_bd is not changed - - query_bd.current | length == 1 - - query_bd.current.0.fvBD.attributes.name == "anstest" - - '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd.filter_string' - - '"tn-anstest/BD-anstest.json" in query_bd.url' - -- name: delete bd - check mode works - aci_bd: &aci_bd_absent - <<: *aci_bd_present - state: absent - check_mode: yes - register: bd_absent_check_mode - -- name: delete bd - delete works - aci_bd: - <<: *aci_bd_absent - register: bd_absent - -- name: delete bd again - idempotency works - aci_bd: - <<: *aci_bd_absent - register: bd_absent_idempotent - -- name: delete bd - cleanup - aci_bd: - <<: *aci_bd_absent - name: anstest2 - -- name: delete bd missing param - fails properly - aci_bd: - <<: *aci_bd_absent - bd: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: bd_absent_missing_param - -- name: asserts for deletion task - assert: - that: - - bd_absent_check_mode is changed - - bd_absent_check_mode.proposed == {} - - bd_absent is changed - - bd_absent.previous != [] - - bd_absent_idempotent is not changed - - bd_absent_idempotent.previous == [] - - bd_absent_missing_param is failed - - 'bd_absent_missing_param.msg == "state is absent but all of the following are missing: bd"' - -- name: delete vrf - cleanup before ending tests - aci_vrf: - <<: *aci_vrf_present - state: absent - when: vrf_present is changed - -- name: delete tenant - cleanup before ending tests - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_bd_subnet/aliases b/test/integration/targets/aci_bd_subnet/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_bd_subnet/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_bd_subnet/tasks/main.yml b/test/integration/targets/aci_bd_subnet/tasks/main.yml deleted file mode 100644 index d6ac5f5336..0000000000 --- a/test/integration/targets/aci_bd_subnet/tasks/main.yml +++ /dev/null @@ -1,237 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: ensure bd exists for tests to kick off - aci_bd: &aci_bd_present - <<: *aci_tenant_present - bd: anstest - register: bd_present - -- name: ensure subnet does not exist for tests to kick off - aci_bd_subnet: &aci_subnet_absent - <<: *aci_bd_present - state: absent - gateway: 10.100.100.1 - mask: 24 - -- name: ensure subnet does not exist for tests to kick off - aci_bd_subnet: &aci_subnet2_absent - <<: *aci_subnet_absent - gateway: 10.100.101.1 - mask: 25 - -- name: create subnet - check mode works - aci_bd_subnet: &aci_subnet_present - <<: *aci_subnet_absent - state: present - subnet_name: anstest - descr: Ansible Test - check_mode: yes - register: create_check_mode - -- name: create subnet - creation works - aci_bd_subnet: - <<: *aci_subnet_present - register: create_subnet - -- name: create new subnet - creation works - aci_bd_subnet: &aci_subnet2_present - <<: *aci_subnet2_absent - state: present - descr: Ansible Test - scope: [private, shared] - route_profile: default - route_profile_l3_out: default - register: create_subnet2 - -- name: create subnet again - idempotency works - aci_bd_subnet: - <<: *aci_subnet2_present - register: create_idempotency - -- name: modify subnet - update works - aci_bd_subnet: - <<: *aci_subnet_present - scope: [shared, public] - subnet_control: querier_ip - register: modify_subnet - -- name: create subnet with bad scope - failure message works - aci_bd_subnet: - <<: *aci_subnet_present - scope: [private, public] - register: create_bad_scope - ignore_errors: yes - -- name: create subnet without all necessary params - failure message works - aci_bd_subnet: - <<: *aci_subnet_present - bd: "{{ fake_var | default(omit) }}" - register: create_incomplete_data - ignore_errors: yes - -- name: asserts for subnet creation tasks - assert: - that: - - create_check_mode is changed - - 'create_check_mode.sent == {"fvSubnet": {"attributes": {"descr": "Ansible Test", "ip": "10.100.100.1/24", "name": "anstest"}}}' - - create_subnet is changed - - 'create_subnet.sent == {"fvSubnet": {"attributes": {"descr": "Ansible Test", "ip": "10.100.100.1/24", "name": "anstest"}}}' - - create_subnet.previous == [] - - create_subnet2 is changed - - create_subnet2.sent == create_subnet2.proposed - - create_subnet2.sent.fvSubnet.attributes.scope == "private,shared" - - 'create_subnet2.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes == {"tnL3extOutName": "default", "tnRtctrlProfileName": "default"}' - - create_idempotency is not changed - - create_idempotency.previous != [] - - modify_subnet is changed - - modify_subnet.previous != [] - - modify_subnet.sent != modify_subnet.proposed - - 'modify_subnet.sent == {"fvSubnet": {"attributes": {"ctrl": "querier", "scope": "public,shared"}}}' - - create_bad_scope is failed - - create_bad_scope.msg.startswith("Parameter 'scope' cannot be both 'private' and 'public'") - - create_incomplete_data is failed - - 'create_incomplete_data.msg == "state is present but all of the following are missing: bd"' - -- name: get all subnets - aci_bd_subnet: &aci_query - <<: *aci_tenant_present - state: query - tenant: "{{ fake_var | default(omit) }}" - register: get_all - -- name: get all in tenant - aci_bd_subnet: - <<: *aci_query - tenant: anstest - register: get_all_tenant - -- name: get all in bd - aci_bd_subnet: - <<: *aci_query - bd: anstest - register: get_all_bd - -- name: get all tenant and bd - aci_bd_subnet: - <<: *aci_bd_present - state: query - register: get_all_tenant_bd - -- name: get subnet in tenant - aci_bd_subnet: - <<: *aci_subnet_present - state: query - bd: "{{ fake_var | default(omit) }}" - register: get_subnet_tenant - -- name: get subnet in bd - aci_bd_subnet: - <<: *aci_subnet_present - state: query - tenant: "{{ fake_var | default(omit) }}" - register: get_subnet_bd - -- name: get specific subnet - aci_bd_subnet: - <<: *aci_subnet_present - state: query - register: get_subnet - -- name: get all subnets matching gateway - aci_bd_subnet: - <<: *aci_subnet_present - state: query - tenant: "{{ fake_var | default(omit) }}" - bd: "{{ fake_var | default(omit) }}" - register: get_subnets_gateway - -- name: asserts for query tasks - assert: - that: - - get_all is not changed - - get_all.current | length > 1 - - get_all_tenant is not changed - - '"tn-anstest.json" in get_all_tenant.url' - - get_all_bd is not changed - - '"query-target-filter=eq(fvBD.name, \"anstest\")" in get_all_bd.filter_string' - - '"class/fvBD.json" in get_all_bd.url' - - get_all_tenant_bd is not changed - - '"tn-anstest/BD-anstest.json" in get_all_tenant_bd.url' - - get_all_tenant_bd.current.0.fvBD.children | length > 1 - - get_subnet_tenant is not changed - - '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_tenant.filter_string' - - '"tn-anstest.json" in get_subnet_tenant.url' - - get_subnet_bd is not changed - - '"query-target-filter=eq(fvBD.name, \"anstest\")"' - - '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_bd.filter_string' - - '"class/fvBD.json" in get_subnet_bd.url' - - get_subnet is not changed - - get_subnet.current | length == 1 - - '"tn-anstest/BD-anstest/subnet-[10.100.100.1/24].json" in get_subnet.url' - - get_subnets_gateway is not changed - - '"query-target-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnets_gateway.filter_string' - - '"class/fvSubnet.json" in get_subnets_gateway.url' - -- name: delete subnet - check mode works - aci_bd_subnet: - <<: *aci_subnet_absent - check_mode: yes - register: delete_check_mode - -- name: delete subnet - delete works - aci_bd_subnet: - <<: *aci_subnet_absent - register: delete_subnet - -- name: delete subnet - cleanup - aci_bd_subnet: - <<: *aci_subnet2_absent - -- name: delete subnet again - idempotency works - aci_bd_subnet: - <<: *aci_subnet2_absent - register: delete_idempotency - -- name: asserts for deletion task - assert: - that: - - delete_check_mode is changed - - delete_check_mode.proposed == {} - - delete_subnet is changed - - delete_subnet.previous != [] - - delete_subnet.method == "DELETE" - - delete_idempotency is not changed - - delete_idempotency.previous == [] - -- name: delete bd - cleanup before ending tests - aci_bd: - <<: *aci_bd_present - state: absent - when: bd_present is changed - -- name: delete tenant - cleanup before ending tests - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_config_rollback/aliases b/test/integration/targets/aci_config_rollback/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_config_rollback/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_config_rollback/tasks/main.yml b/test/integration/targets/aci_config_rollback/tasks/main.yml deleted file mode 100644 index 47dc48431d..0000000000 --- a/test/integration/targets/aci_config_rollback/tasks/main.yml +++ /dev/null @@ -1,98 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant does not exist for tests to kick off - aci_tenant: &aci_tenant_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: absent - tenant: anstest - -- name: create a snapshot - aci_config_snapshot: &create_snapshot - <<: *aci_tenant_absent - state: present - tenant: "{{ fakevar | default(omit) }}" - export_policy: anstest - -- name: create a tenant - use for rollback - aci_tenant: &aci_tenant - <<: *create_snapshot - export_policy: "{{ fakevar | default(omit) }}" - tenant: anstest - register: tenant_present - -- name: create a new snapshot - aci_config_snapshot: - <<: *create_snapshot - -- name: get snapshots - aci_config_snapshot: - <<: *create_snapshot - state: query - register: snapshots - -- name: compare snapshots - aci_config_rollback: &preview_rollback - <<: *create_snapshot - state: preview - compare_export_policy: anstest - compare_snapshot: "{{ snapshots.current.0.configSnapshotCont.children[-1].configSnapshot.attributes.name }}" - snapshot: "{{ snapshots.current.0.configSnapshotCont.children[-2].configSnapshot.attributes.name }}" - register: rollback_preview - -- name: rollback to snapshot - aci_config_rollback: &aci_rollback - <<: *create_snapshot - state: rollback - snapshot: "{{ snapshots.current.0.configSnapshotCont.children[-1].configSnapshot.attributes.name }}" - ignore_errors: yes - register: rollback_missing_param - -- name: rollback to snapshot - aci_config_rollback: - <<: *aci_rollback - import_policy: anstest - import_type: replace - import_mode: atomic - register: rollback_rollback - -- name: pause execution to let rollback take effect - pause: - seconds: 15 - -- name: ensure tenant doesn't exist after rollback - aci_tenant: - <<: *aci_tenant_absent - register: tenant_removed - -- name: rollback assertions - assert: - that: - - rollback_preview is not changed -# FIXME: diff output not longer works ? -# - '"<fvTenant name=\"anstest\" rn=\"tn-anstest\" status=\"deleted\">" in rollback_preview.diff' - - '"snapshots.diff.xml" in rollback_preview.url' - - rollback_missing_param is failed - - 'rollback_missing_param.msg == "state is rollback but all of the following are missing: import_policy"' - - rollback_rollback is changed -# FIXME: fileName key is missing from 'sent' dictionary, but exists in 'proposed' dictionary -# - '"ce2_" in rollback_rollback.sent.configImportP.attributes.fileName' -# - '".tar.gz" in rollback_rollback.sent.configImportP.attributes.fileName' - - '"ce2_" in rollback_rollback.proposed.configImportP.attributes.fileName' - - '".tar.gz" in rollback_rollback.proposed.configImportP.attributes.fileName' - - '"fabric/configimp-anstest.json" in rollback_rollback.url' - - tenant_removed is not changed - - tenant_removed.previous == [] diff --git a/test/integration/targets/aci_config_snapshot/aliases b/test/integration/targets/aci_config_snapshot/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_config_snapshot/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_config_snapshot/tasks/main.yml b/test/integration/targets/aci_config_snapshot/tasks/main.yml deleted file mode 100644 index 62c779aa00..0000000000 --- a/test/integration/targets/aci_config_snapshot/tasks/main.yml +++ /dev/null @@ -1,142 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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: create a snapshot - creation works - aci_config_snapshot: &create_snapshot - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - export_policy: anstest - max_count: 10 - include_secure: no - format: json - description: ansible test - register: create - -- name: update snapshot to include secure and use xml - update works - aci_config_snapshot: - <<: *create_snapshot - include_secure: yes - format: xml - register: create_update - -- name: create a snapshot invalid max_count - error message - aci_config_snapshot: - <<: *create_snapshot - max_count: 11 - ignore_errors: yes - register: invalid_max_count - -- name: create a snapshot invalid max_count - error message - aci_config_snapshot: - <<: *create_snapshot - export_policy: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: missing_param - -- name: present assertion tests - assert: - that: - - create is not failed - - create is changed - - create.sent.configExportP.attributes.adminSt == "triggered" - - create_update is not failed - - create_update is changed - - 'create_update.sent == {"configExportP": {"attributes": {"adminSt": "triggered", "format": "xml", "includeSecureFields": "yes"}}}' - - invalid_max_count is failed - - invalid_max_count.msg == "Parameter 'max_count' must be a number between 1 and 10" - - missing_param is failed - - 'missing_param.msg == "state is present but all of the following are missing: export_policy"' - -- name: query with export_policy - aci_config_snapshot: &query_snapshot - <<: *create_snapshot - state: query - register: query_export - -- name: generate snapshot name - set_fact: - test_snapshot: "{{ query_export.current.0.configSnapshotCont.children.0.configSnapshot.attributes.rn.strip('snapshot-') }}" - -- name: query with export_policy and snapshot - aci_config_snapshot: &query_both - <<: *query_snapshot - snapshot: "{{ test_snapshot }}" - register: query_export_snapshot - -- name: query with snapshot - module add run- to snapshot - aci_config_snapshot: - <<: *query_snapshot - export_policy: "{{ fake_var | default(omit) }}" - snapshot: "{{ test_snapshot.strip('run-') }}" - register: query_snapshot - -- name: query no params - aci_config_snapshot: - <<: *query_snapshot - export_policy: "{{ fake_var | default(omit) }}" - register: query_all - -- name: query assertion tests - assert: - that: - - query_export is not failed - - query_export is not changed - - '"snapshots-[uni/fabric/configexp-anstest].json" in query_export.url' - - query_export.current.0.configSnapshotCont.attributes.name == "anstest" - - query_export.current.0.configSnapshotCont.children | length > 1 - - query_export_snapshot is not failed - - query_export_snapshot is not changed - - '"snapshots-[uni/fabric/configexp-anstest]/snapshot-{{ test_snapshot }}.json" in query_export_snapshot.url' - - query_export_snapshot.current | length == 1 - - query_snapshot is not failed - - query_snapshot is not changed - - '"class/configSnapshot.json" in query_snapshot.url' - - '"configSnapshot.name, \"{{ test_snapshot }}\"" in query_snapshot.filter_string' - - query_all is not failed - - query_all is not changed - - '"class/configSnapshot.json" in query_all.url' - - query_all.current | length > 1 - -- name: delete works - aci_config_snapshot: &delete - <<: *query_both - state: absent - register: delete_snapshot - -- name: delete works - idempotency - aci_config_snapshot: - <<: *delete - register: delete_idempotent - -- name: delete missing param - aci_config_snapshot: - <<: *delete - snapshot: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: delete_missing_param - -- name: absent assertion tests - assert: - that: - - delete_snapshot is not failed - - delete_snapshot is changed - - 'delete_snapshot.sent == {"configSnapshot": {"attributes": {"retire": "yes"}}}' - - delete_snapshot.previous != [] - - delete_snapshot.previous.0.configSnapshot.attributes.name == test_snapshot - - delete_idempotent is not failed - - delete_idempotent is not changed - - delete_idempotent.previous == [] - - delete_missing_param is failed - - 'delete_missing_param.msg == "state is absent but all of the following are missing: snapshot"' diff --git a/test/integration/targets/aci_contract/aliases b/test/integration/targets/aci_contract/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_contract/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_contract/tasks/main.yml b/test/integration/targets/aci_contract/tasks/main.yml deleted file mode 100644 index 24a054562a..0000000000 --- a/test/integration/targets/aci_contract/tasks/main.yml +++ /dev/null @@ -1,163 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: create contract - check mode works - aci_contract: &aci_contract_present - <<: *aci_tenant_present - contract: anstest - description: Ansible Test - check_mode: yes - register: present_check_mode - -- name: create contract - creation works - aci_contract: - <<: *aci_contract_present - register: contract_present - -- name: create contract - idempotency works - aci_contract: - <<: *aci_contract_present - register: present_idempotent - -- name: update contract - update works - aci_contract: - <<: *aci_contract_present - scope: application-profile - register: present_update - -- name: create contract - used for query - aci_contract: - <<: *aci_contract_present - contract: anstest2 - -- name: missing param - failure message works - aci_contract: - <<: *aci_tenant_present - ignore_errors: yes - register: present_missing_param - -- name: present assertions - assert: - that: - - present_check_mode is changed - - present_check_mode.previous == [] - - 'present_check_mode.sent == {"vzBrCP": {"attributes": {"name": "anstest", "descr": "Ansible Test"}}}' - - contract_present is changed - - contract_present.sent == present_check_mode.sent - - present_idempotent is not changed - - present_update is changed - - present_update.sent != present_update.proposed - - present_update.sent.vzBrCP.attributes.scope == "application-profile" - - present_missing_param is failed - - 'present_missing_param.msg == "state is present but all of the following are missing: contract"' - -- name: query contract - aci_contract: &aci_contract_query - <<: *aci_contract_present - state: query - register: query_contract - -- name: query all in tenant - aci_contract: - <<: *aci_contract_query - contract: "{{ fakevar | default(omit) }}" - register: query_tenant - -- name: query all with name - aci_contract: - <<: *aci_contract_query - tenant: "{{ fakevar | default(omit) }}" - register: query_name - -- name: query all - aci_contract: - <<: *aci_contract_query - tenant: "{{ fakevar | default(omit) }}" - contract: "{{ fakevar | default(omit) }}" - register: query_all - -- name: query assertions - assert: - that: - - query_contract is not changed - - query_contract.current | length == 1 - - '"tn-anstest/brc-anstest.json" in query_contract.url' - - query_tenant is not changed - - query_tenant.current | length == 1 - - query_tenant.current.0.fvTenant.children | length > 1 - - '"rsp-subtree-class=vzBrCP" in query_tenant.filter_string' - - '"tn-anstest.json" in query_tenant.url' - - query_name is not changed - - query_name.current != [] - - '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_name.filter_string' - - '"class/vzBrCP.json" in query_name.url' - - query_all is not changed - - query_all.current | length > 1 - - '"class/vzBrCP.json" in query_all.url' - -- name: delete contract - check mode works - aci_contract: &aci_contract_absent - <<: *aci_contract_present - state: absent - check_mode: yes - register: absent_check_mode - -- name: delete contract - deletion works - aci_contract: - <<: *aci_contract_absent - register: contract_absent - -- name: delete contract - idempotency works - aci_contract: - <<: *aci_contract_absent - register: absent_idempotent - -- name: delete contract - cleanup second contract - aci_contract: - <<: *aci_contract_absent - contract: anstest2 - -- name: missing param - fail message works - aci_contract: - <<: *aci_contract_absent - tenant: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: absent_missing_param - -- name: absent assertions - assert: - that: - - absent_check_mode is changed - - absent_check_mode.previous != [] - - contract_absent is changed - - contract_absent.previous == absent_check_mode.previous - - absent_idempotent is not changed - - absent_idempotent.previous == [] - - absent_missing_param is failed - - 'absent_missing_param.msg == "state is absent but all of the following are missing: tenant"' - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_contract_subject/aliases b/test/integration/targets/aci_contract_subject/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_contract_subject/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_contract_subject/tasks/main.yml b/test/integration/targets/aci_contract_subject/tasks/main.yml deleted file mode 100644 index e10b2838cf..0000000000 --- a/test/integration/targets/aci_contract_subject/tasks/main.yml +++ /dev/null @@ -1,241 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: ensure contract exists for tests to kick off - aci_contract: &aci_contract_present - <<: *aci_tenant_present - contract: anstest - register: contract_present - -- name: create subject - check mode works - aci_contract_subject: &aci_subject_present - <<: *aci_contract_present - subject: anstest - description: Ansible Test - check_mode: yes - register: subject_present_check_mode - -- name: create subject - creation works - aci_contract_subject: - <<: *aci_subject_present - register: subject_present - -- name: create subject - idempotency works - aci_contract_subject: - <<: *aci_subject_present - register: subject_present_idempotent - -- name: update subject - update works - aci_contract_subject: - <<: *aci_subject_present - description: Ansible Test - reverse_filter: "yes" - provider_match: at_most_one - priority: level2 - register: subject_update - -- name: create subject - try additional params - aci_contract_subject: &aci_subject_present_2 - <<: *aci_contract_present - subject: anstest2 - reverse_filter: "no" - consumer_match: all - priority: level3 - register: subject_present_2 - -- name: missing param - failure message works - aci_contract_subject: - <<: *aci_tenant_present - ignore_errors: yes - register: present_missing_param - -- name: present assertions - assert: - that: - - subject_present_check_mode is changed - - 'subject_present_check_mode.sent == {"vzSubj": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}' - - subject_present is changed - - subject_present.previous == [] - - subject_present.sent == subject_present_check_mode.sent - - subject_present_idempotent is not changed - - subject_present_idempotent.previous != [] - - subject_update is changed - - subject_update.sent != subject_update.proposed - - 'subject_update.sent.vzSubj.attributes == {"prio": "level2", "provMatchT": "AtmostOne"}' - - subject_present_2 is changed - - 'subject_present_2.sent.vzSubj.attributes == {"consMatchT": "All", "name": "anstest2", "prio": "level3", "revFltPorts": "no"}' - - present_missing_param is failed - - 'present_missing_param.msg == "state is present but all of the following are missing: contract, subject"' - -- name: query tenant contract subject - aci_contract_subject: &aci_query_subject - <<: *aci_subject_present - state: query - register: query_tenant_contract_subject - -- name: query tenant contract - aci_contract_subject: - <<: *aci_query_subject - subject: "{{ fakevar | default(omit) }}" - register: query_tenant_contract - -- name: query tenant subject - aci_contract_subject: - <<: *aci_query_subject - contract: "{{ fakevar | default(omit) }}" - register: query_tenant_subject - -- name: query contract subject - aci_contract_subject: - <<: *aci_query_subject - tenant: "{{ fakevar | default(omit) }}" - register: query_contract_subject - -- name: query tenant - aci_contract_subject: - <<: *aci_tenant_present - state: query - register: query_tenant - -- name: query contract - aci_contract_subject: - <<: *aci_contract_present - state: query - tenant: "{{ fakevar | default(omit) }}" - register: query_contract - -- name: query subject - aci_contract_subject: - <<: *aci_query_subject - tenant: "{{ fakevar | default(omit) }}" - contract: "{{ fakevar | default(omit) }}" - register: query_subject - -- name: query all - aci_contract_subject: - <<: *aci_tenant_present - state: query - tenant: "{{ fakevar | default(omit) }}" - register: query_all - -- name: query assertions - assert: - that: - - query_tenant_contract_subject is not changed - - query_tenant_contract_subject.current | length == 1 - - query_tenant_contract_subject.current.0.vzSubj.attributes.name == "anstest" - - '"tn-anstest/brc-anstest/subj-anstest.json" in query_tenant_contract_subject.url' - - query_tenant_contract is not changed - - query_tenant_contract.current | length == 1 - - query_tenant_contract.current.0.vzBrCP.attributes.name == "anstest" - - query_tenant_contract.current.0.vzBrCP.children | length == 2 - - '"rsp-subtree-class=vzSubj" in query_tenant_contract.filter_string' - - '"tn-anstest/brc-anstest.json" in query_tenant_contract.url' - - query_tenant_subject is not changed - - query_tenant_subject.current | length == 1 - - query_tenant_subject.current.0.fvTenant.attributes.name == "anstest" - - query_tenant_subject.current.0.fvTenant.children.0.vzBrCP.children | length == 1 - - query_tenant_subject.current.0.fvTenant.children.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest" - - '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_tenant_subject.filter_string' - - '"rsp-subtree-class=vzSubj" in query_tenant_subject.filter_string' - - '"tn-anstest.json" in query_tenant_subject.url' - - query_contract_subject is not changed - - query_contract_subject.current.0.vzBrCP.attributes.name == "anstest" - - query_contract_subject.current.0.vzBrCP.children | length == 1 - - query_contract_subject.current.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest" - - '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract_subject.filter_string' - - '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_contract_subject.filter_string' - - '"rsp-subtree-class=vzSubj" in query_contract_subject.filter_string' - - '"class/vzBrCP.json" in query_contract_subject.url' - - query_tenant is not changed - - query_tenant.current | length == 1 - - query_tenant.current.0.fvTenant.attributes.name == "anstest" - - '"rsp-subtree-class=vzBrCP,vzSubj" in query_tenant.filter_string' - - '"tn-anstest.json" in query_tenant.url' - - query_contract is not changed - - query_contract.current.0.vzBrCP.attributes.name == "anstest" - - '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract.filter_string' - - '"rsp-subtree-class=vzSubj" in query_contract.filter_string' - - '"class/vzBrCP.json" in query_contract.url' - - query_subject is not changed - - query_subject.current.0.vzSubj.attributes.name == "anstest" - - '"query-target-filter=eq(vzSubj.name, \"anstest\")" in query_subject.filter_string' - - '"class/vzSubj.json" in query_subject.url' - - query_all is not changed - - query_all.current > 1 - - query_all.current.0.vzSubj is defined - - '"class/vzSubj.json" in query_all.url' - -- name: delete subject - check mode works - aci_contract_subject: &aci_subject_absent - <<: *aci_subject_present - state: absent - check_mode: yes - register: subject_absent_check_mode - -- name: delete subject - deletion works - aci_contract_subject: - <<: *aci_subject_absent - register: subject_absent - -- name: delete subject - idempotency works - aci_contract_subject: - <<: *aci_subject_absent - register: subject_absent_idempotent - -- name: delete subject - cleanup - aci_contract_subject: - <<: *aci_subject_present_2 - state: absent - -- name: missing params - failure message works - aci_contract_subject: - <<: *aci_subject_absent - subject: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: absent_missing_param - -- name: absent assertions - assert: - that: - - subject_absent_check_mode is changed - - subject_absent_check_mode.previous != [] - - subject_absent_check_mode.proposed == {} - - subject_absent is changed - - subject_absent.previous == subject_absent_check_mode.previous - - subject_absent_idempotent is not changed - - subject_absent_idempotent.previous == [] - - absent_missing_param is failed - - 'absent_missing_param.msg == "state is absent but all of the following are missing: subject"' - -- name: cleanup contract - aci_contract: - <<: *aci_contract_present - state: absent - when: contract_present is changed - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_contract_subject_to_filter/aliases b/test/integration/targets/aci_contract_subject_to_filter/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_contract_subject_to_filter/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_contract_subject_to_filter/tasks/main.yml b/test/integration/targets/aci_contract_subject_to_filter/tasks/main.yml deleted file mode 100644 index eeb92a956c..0000000000 --- a/test/integration/targets/aci_contract_subject_to_filter/tasks/main.yml +++ /dev/null @@ -1,193 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - state: present - register: tenant_present - -- name: ensure filter exists for tests to kick off - aci_filter: &aci_filter_present - <<: *aci_tenant_present - filter: anstest - register: filter_present - -- name: ensure filter exists for tests to kick off - aci_filter: &aci_filter_present_2 - <<: *aci_tenant_present - filter: anstest2 - register: filter_present_2 - -- name: ensure contract exists for tests to kick off - aci_contract: &aci_contract_present - <<: *aci_tenant_present - contract: anstest - register: contract_present - -- name: ensure subject exists for tests to kick off - aci_contract_subject: &aci_subject_present - <<: *aci_contract_present - subject: anstest - register: subject_present - -- name: create subject filter binding - check mode works - aci_contract_subject_to_filter: &aci_subject_filter_present - <<: *aci_subject_present - filter: anstest - log: log - check_mode: yes - register: subject_filter_present_check_mode - -- name: create subject filter binding - creation works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_present - register: subject_filter_present - -- name: create subject filter binding - additional testing - aci_contract_subject_to_filter: &aci_subject_filter_present_2 - <<: *aci_subject_filter_present - filter: anstest2 - register: subject_filter_present_2 - -- name: create subject filter binding - idempotency works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_present - register: subject_filter_present_idempotent - -- name: update subject filter binding - update works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_present - log: none - register: subject_filter_update - -- name: missing param - failure message works - aci_contract_subject_to_filter: - <<: *aci_tenant_present - ignore_errors: yes - register: present_missing_param - -- name: present assertions - assert: - that: - - subject_filter_present_check_mode is changed - - subject_filter_present_check_mode.previous == [] - - 'subject_filter_present_check_mode.sent == {"vzRsSubjFiltAtt": {"attributes": {"directives": "log", "tnVzFilterName": "anstest"}}}' - - subject_filter_present is changed - - subject_filter_present.previous == [] - - subject_filter_present.sent == subject_filter_present_check_mode.sent - - subject_filter_present_2 is changed - - subject_filter_present_idempotent is not changed - - subject_filter_present_idempotent.previous != [] - - subject_filter_update is changed - - 'subject_filter_update.sent.vzRsSubjFiltAtt.attributes == {"directives": ""}' - - present_missing_param is failed - - 'present_missing_param.msg == "state is present but all of the following are missing: contract, filter, subject"' - -- name: query all - aci_contract_subject_to_filter: - <<: *aci_tenant_present - state: query - tenant: "{{ fakevar | default(omit) }}" - register: query_all - -- name: query binding - aci_contract_subject_to_filter: - <<: *aci_subject_filter_present - state: query - register: query_binding - -- name: query assertions - assert: - that: - - query_all is not changed - - query_all.current | length > 1 - - query_all.current.0.vzRsSubjFiltAtt is defined - - query_binding is not changed - - query_binding.current != [] - -- name: delete subject filter binding - check mode works - aci_contract_subject_to_filter: &aci_subject_filter_absent - <<: *aci_subject_filter_present - state: absent - check_mode: yes - register: subject_filter_absent_check_mode - -- name: delete subject filter binding - deletion works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_absent - register: subject_filter_absent - -- name: delete subject filter binding - idempotency works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_absent - register: subject_filter_absent_idempotent - -- name: missing param - failure message works - aci_contract_subject_to_filter: - <<: *aci_subject_filter_absent - filter: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: absent_missing_param - -- name: cleanup subject filter binding - aci_contract_subject_to_filter: - <<: *aci_subject_filter_present_2 - state: absent - -- name: absent assertions - assert: - that: - - subject_filter_absent_check_mode is changed - - subject_filter_absent_check_mode.proposed == {} - - subject_filter_absent_check_mode.previous != [] - - subject_filter_absent is changed - - subject_filter_absent.previous != [] - - subject_filter_absent_idempotent is not changed - - subject_filter_absent_idempotent.previous == [] - - absent_missing_param is failed - - 'absent_missing_param.msg == "state is absent but all of the following are missing: filter"' - -- name: cleanup subject - aci_contract_subject: - <<: *aci_subject_present - state: absent - when: subject_present is changed - -- name: cleanup contract - aci_contract: - <<: *aci_contract_present - state: absent - when: contract_present is changed - -- name: cleanup filter - aci_filter: - <<: *aci_filter_present - state: absent - when: filter_present is changed - -- name: cleanup filter - aci_filter: - <<: *aci_filter_present_2 - state: absent - when: filter_present_2 is changed - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_domain/aliases b/test/integration/targets/aci_domain/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_domain/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_domain/tasks/fc.yml b/test/integration/targets/aci_domain/tasks/fc.yml deleted file mode 100644 index 83dd61747b..0000000000 --- a/test/integration/targets/aci_domain/tasks/fc.yml +++ /dev/null @@ -1,174 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove FC domain - aci_domain: &domain_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: fc_dom - domain_type: fc - state: absent - - -# ADD DOMAIN -- name: Add FC domain (check_mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: fc_dom - domain_type: fc - state: present - check_mode: yes - register: cm_add_domain - -- name: Add FC domain (normal mode) - aci_domain: *domain_present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - cm_add_domain is changed - - nm_add_domain is changed - - 'cm_add_domain.sent == nm_add_domain.sent == {"fcDomP": {"attributes": {"name": "fc_dom"}}}' - - 'cm_add_domain.proposed == nm_add_domain.proposed == {"fcDomP": {"attributes": {"name": "fc_dom"}}}' - - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] - - 'nm_add_domain.current == [{"fcDomP": {"attributes": {"dn": "uni/fc-fc_dom", "name": "fc_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - -- name: Add FC domain again (check_mode) - aci_domain: *domain_present - check_mode: yes - register: cm_add_domain_again - -- name: Add FC domain again (normal mode) - aci_domain: *domain_present - register: nm_add_domain_again - -- name: Verify add_domain_again - assert: - that: - - cm_add_domain_again is not changed - - nm_add_domain_again is not changed - - -# QUERY ALL DOMAINS -- name: Query all FC domains (check_mode) - aci_domain: &domain_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: fc - state: query - check_mode: yes - register: cm_query_all_domains - -- name: Query all FC domains (normal mode) - aci_domain: *domain_query - register: nm_query_all_domains - -- name: Verify query_all_domains - assert: - that: - - cm_query_all_domains is not changed - - nm_query_all_domains is not changed - - cm_query_all_domains == nm_query_all_domains - - nm_query_all_domains.current|length >= 1 - - -# QUERY A DOMAIN -- name: Query our FC domain (check_mode) - aci_domain: - <<: *domain_query - domain: fc_dom - check_mode: yes - register: cm_query_domain - -- name: Query our FC domain (normal mode) - aci_domain: - <<: *domain_query - domain: fc_dom - register: nm_query_domain - -- name: Verify query_domain - assert: - that: - - cm_query_domain is not changed - - nm_query_domain is not changed - - cm_query_domain == nm_query_domain - - nm_query_domain.current.0.fcDomP.attributes.dn == 'uni/fc-fc_dom' - - nm_query_domain.current.0.fcDomP.attributes.name == 'fc_dom' - - -# REMOVE DOMAIN -- name: Remove FC domain (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain - -- name: Remove FC domain (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain - -- name: Verify remove_domain - assert: - that: - - cm_remove_domain is changed - - nm_remove_domain is changed - - 'cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous == [{"fcDomP": {"attributes": {"dn": "uni/fc-fc_dom", "name": "fc_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_domain.current == [] - -- name: Remove FC domain again (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain_again - -- name: Remove FC domain again (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain_again - -- name: Verify remove_domain_again - assert: - that: - - cm_remove_domain_again is not changed - - nm_remove_domain_again is not changed - - -# QUERY NON-EXISTING DOMAIN -- name: Query non-existing FC domain (check_mode) - aci_domain: - <<: *domain_query - domain: fc_dom - check_mode: yes - register: cm_query_non_domain - -- name: Query non-existing FC domain (normal mode) - aci_domain: - <<: *domain_query - domain: fc_dom - register: nm_query_non_domain - -- name: Verify query_non_domain - assert: - that: - - cm_query_non_domain is not changed - - nm_query_non_domain is not changed - - cm_query_non_domain == nm_query_non_domain - - nm_query_non_domain.current == [] diff --git a/test/integration/targets/aci_domain/tasks/l2dom.yml b/test/integration/targets/aci_domain/tasks/l2dom.yml deleted file mode 100644 index 0ec4f499fd..0000000000 --- a/test/integration/targets/aci_domain/tasks/l2dom.yml +++ /dev/null @@ -1,174 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove L2 domain - aci_domain: &domain_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: l2_dom - domain_type: l2dom - state: absent - - -# ADD DOMAIN -- name: Add L2 domain (check_mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: l2_dom - domain_type: l2dom - state: present - check_mode: yes - register: cm_add_domain - -- name: Add L2 domain (normal mode) - aci_domain: *domain_present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - cm_add_domain is changed - - nm_add_domain is changed - - 'cm_add_domain.sent == nm_add_domain.sent == {"l2extDomP": {"attributes": {"name": "l2_dom"}}}' - - 'cm_add_domain.proposed == nm_add_domain.proposed == {"l2extDomP": {"attributes": {"name": "l2_dom"}}}' - - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] - - 'nm_add_domain.current == [{"l2extDomP": {"attributes": {"dn": "uni/l2dom-l2_dom", "name": "l2_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - -- name: Add L2 domain again (check_mode) - aci_domain: *domain_present - check_mode: yes - register: cm_add_domain_again - -- name: Add L2 domain again (normal mode) - aci_domain: *domain_present - register: nm_add_domain_again - -- name: Verify add_domain_again - assert: - that: - - cm_add_domain_again is not changed - - nm_add_domain_again is not changed - - -# QUERY ALL DOMAINS -- name: Query all L2 domains (check_mode) - aci_domain: &domain_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: l2dom - state: query - check_mode: yes - register: cm_query_all_domains - -- name: Query all L2 domains (normal mode) - aci_domain: *domain_query - register: nm_query_all_domains - -- name: Verify query_all_domains - assert: - that: - - cm_query_all_domains is not changed - - nm_query_all_domains is not changed - - cm_query_all_domains == nm_query_all_domains - - nm_query_all_domains.current|length >= 1 - - -# QUERY A DOMAIN -- name: Query our L2 domain (check_mode) - aci_domain: - <<: *domain_query - domain: l2_dom - check_mode: yes - register: cm_query_domain - -- name: Query our L2 domain (normal mode) - aci_domain: - <<: *domain_query - domain: l2_dom - register: nm_query_domain - -- name: Verify query_domain - assert: - that: - - cm_query_domain is not changed - - nm_query_domain is not changed - - cm_query_domain == nm_query_domain - - nm_query_domain.current.0.l2extDomP.attributes.dn == 'uni/l2dom-l2_dom' - - nm_query_domain.current.0.l2extDomP.attributes.name == 'l2_dom' - - -# REMOVE DOMAIN -- name: Remove L2 domain (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain - -- name: Remove L2 domain (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain - -- name: Verify remove_domain - assert: - that: - - cm_remove_domain is changed - - nm_remove_domain is changed - - 'cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous == [{"l2extDomP": {"attributes": {"dn": "uni/l2dom-l2_dom", "name": "l2_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_domain.current == [] - -- name: Remove L2 domain again (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain_again - -- name: Remove L2 domain again (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain_again - -- name: Verify remove_domain_again - assert: - that: - - cm_remove_domain_again is not changed - - nm_remove_domain_again is not changed - - -# QUERY NON-EXISTING DOMAIN -- name: Query non-existing L2 domain (check_mode) - aci_domain: - <<: *domain_query - domain: l2_dom - check_mode: yes - register: cm_query_non_domain - -- name: Query non-existing L2 domain (normal mode) - aci_domain: - <<: *domain_query - domain: l2_dom - register: nm_query_non_domain - -- name: Verify query_non_domain - assert: - that: - - cm_query_non_domain is not changed - - nm_query_non_domain is not changed - - cm_query_non_domain == nm_query_non_domain - - nm_query_non_domain.current == [] diff --git a/test/integration/targets/aci_domain/tasks/l3dom.yml b/test/integration/targets/aci_domain/tasks/l3dom.yml deleted file mode 100644 index 9f101eb18b..0000000000 --- a/test/integration/targets/aci_domain/tasks/l3dom.yml +++ /dev/null @@ -1,174 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove L3 domain - aci_domain: &domain_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: l3_dom - domain_type: l3dom - state: absent - - -# ADD DOMAIN -- name: Add L3 domain (check_mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: l3_dom - domain_type: l3dom - state: present - check_mode: yes - register: cm_add_domain - -- name: Add L3 domain (normal mode) - aci_domain: *domain_present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - cm_add_domain is changed - - nm_add_domain is changed - - 'cm_add_domain.sent == nm_add_domain.sent == {"l3extDomP": {"attributes": {"name": "l3_dom"}}}' - - 'cm_add_domain.proposed == nm_add_domain.proposed == {"l3extDomP": {"attributes": {"name": "l3_dom"}}}' - - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] - - 'nm_add_domain.current == [{"l3extDomP": {"attributes": {"dn": "uni/l3dom-l3_dom", "name": "l3_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - -- name: Add L3 domain again (check_mode) - aci_domain: *domain_present - check_mode: yes - register: cm_add_domain_again - -- name: Add L3 domain again (normal mode) - aci_domain: *domain_present - register: nm_add_domain_again - -- name: Verify add_domain_again - assert: - that: - - cm_add_domain_again is not changed - - nm_add_domain_again is not changed - - -# QUERY ALL DOMAINS -- name: Query all L3 domains (check_mode) - aci_domain: &domain_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: l3dom - state: query - check_mode: yes - register: cm_query_all_domains - -- name: Query all L3 domains (normal mode) - aci_domain: *domain_query - register: nm_query_all_domains - -- name: Verify query_all_domains - assert: - that: - - cm_query_all_domains is not changed - - nm_query_all_domains is not changed - - cm_query_all_domains == nm_query_all_domains - - nm_query_all_domains.current|length >= 1 - - -# QUERY A DOMAIN -- name: Query our L3 domain (check_mode) - aci_domain: - <<: *domain_query - domain: l3_dom - check_mode: yes - register: cm_query_domain - -- name: Query our L3 domain (normal mode) - aci_domain: - <<: *domain_query - domain: l3_dom - register: nm_query_domain - -- name: Verify query_domain - assert: - that: - - cm_query_domain is not changed - - nm_query_domain is not changed - - cm_query_domain == nm_query_domain - - nm_query_domain.current.0.l3extDomP.attributes.dn == 'uni/l3dom-l3_dom' - - nm_query_domain.current.0.l3extDomP.attributes.name == 'l3_dom' - - -# REMOVE DOMAIN -- name: Remove L3 domain (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain - -- name: Remove L3 domain (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain - -- name: Verify remove_domain - assert: - that: - - cm_remove_domain is changed - - nm_remove_domain is changed - - 'cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous == [{"l3extDomP": {"attributes": {"dn": "uni/l3dom-l3_dom", "name": "l3_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_domain.current == [] - -- name: Remove L3 domain again (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain_again - -- name: Remove L3 domain again (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain_again - -- name: Verify remove_domain_again - assert: - that: - - cm_remove_domain_again is not changed - - nm_remove_domain_again is not changed - - -# QUERY NON-EXISTING DOMAIN -- name: Query non-existing L3 domain (check_mode) - aci_domain: - <<: *domain_query - domain: l3_dom - check_mode: yes - register: cm_query_non_domain - -- name: Query non-existing L3 domain (normal mode) - aci_domain: - <<: *domain_query - domain: l3_dom - register: nm_query_non_domain - -- name: Verify query_non_domain - assert: - that: - - cm_query_non_domain is not changed - - nm_query_non_domain is not changed - - cm_query_non_domain == nm_query_non_domain - - nm_query_non_domain.current == [] diff --git a/test/integration/targets/aci_domain/tasks/main.yml b/test/integration/targets/aci_domain/tasks/main.yml deleted file mode 100644 index 5a0585ef32..0000000000 --- a/test/integration/targets/aci_domain/tasks/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.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 - -- include_tasks: phys.yml - when: phys is not defined or phys - -- include_tasks: l2dom.yml - when: l2dom is not defined or l2dom - -- include_tasks: l3dom.yml - when: l3dom is not defined or l3dom - -- include_tasks: fc.yml - when: fc is not defined or fc - -- include_tasks: vmm-vmware.yml - when: vmm_vmware is not defined or vmm_vmware diff --git a/test/integration/targets/aci_domain/tasks/phys.yml b/test/integration/targets/aci_domain/tasks/phys.yml deleted file mode 100644 index 66bb87595a..0000000000 --- a/test/integration/targets/aci_domain/tasks/phys.yml +++ /dev/null @@ -1,174 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove physical domain - aci_domain: &domain_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - state: absent - - -# ADD DOMAIN -- name: Add physical domain (check_mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - state: present - check_mode: yes - register: cm_add_domain - -- name: Add physical domain (normal mode) - aci_domain: *domain_present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - cm_add_domain is changed - - nm_add_domain is changed - - 'cm_add_domain.sent == nm_add_domain.sent == {"physDomP": {"attributes": {"name": "phys_dom"}}}' - - 'cm_add_domain.proposed == nm_add_domain.proposed == {"physDomP": {"attributes": {"name": "phys_dom"}}}' - - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] - - 'nm_add_domain.current == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - -- name: Add physical domain again (check_mode) - aci_domain: *domain_present - check_mode: yes - register: cm_add_domain_again - -- name: Add physical domain again (normal mode) - aci_domain: *domain_present - register: nm_add_domain_again - -- name: Verify add_domain_again - assert: - that: - - cm_add_domain_again is not changed - - nm_add_domain_again is not changed - - -# QUERY ALL DOMAINS -- name: Query all physical domains (check_mode) - aci_domain: &domain_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: phys - state: query - check_mode: yes - register: cm_query_all_domains - -- name: Query all physical domains (normal mode) - aci_domain: *domain_query - register: nm_query_all_domains - -- name: Verify query_all_domains - assert: - that: - - cm_query_all_domains is not changed - - nm_query_all_domains is not changed - - cm_query_all_domains == nm_query_all_domains - - nm_query_all_domains.current|length >= 1 - - -# QUERY A DOMAIN -- name: Query our physical domain (check_mode) - aci_domain: - <<: *domain_query - domain: phys_dom - check_mode: yes - register: cm_query_domain - -- name: Query our physical domain (normal mode) - aci_domain: - <<: *domain_query - domain: phys_dom - register: nm_query_domain - -- name: Verify query_domain - assert: - that: - - cm_query_domain is not changed - - nm_query_domain is not changed - - cm_query_domain == nm_query_domain - - nm_query_domain.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom' - - nm_query_domain.current.0.physDomP.attributes.name == 'phys_dom' - - -# REMOVE DOMAIN -- name: Remove physical domain (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain - -- name: Remove physical domain (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain - -- name: Verify remove_domain - assert: - that: - - cm_remove_domain is changed - - nm_remove_domain is changed - - 'cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_domain.current == [] - -- name: Remove physical domain again (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain_again - -- name: Remove physical domain again (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain_again - -- name: Verify remove_domain_again - assert: - that: - - cm_remove_domain_again is not changed - - nm_remove_domain_again is not changed - - -# QUERY NON-EXISTING DOMAIN -- name: Query non-existing physical domain (check_mode) - aci_domain: - <<: *domain_query - domain: phys_dom - check_mode: yes - register: cm_query_non_domain - -- name: Query non-existing physical domain (normal mode) - aci_domain: - <<: *domain_query - domain: phys_dom - register: nm_query_non_domain - -- name: Verify query_non_domain - assert: - that: - - cm_query_non_domain is not changed - - nm_query_non_domain is not changed - - cm_query_non_domain == nm_query_non_domain - - nm_query_non_domain.current == [] diff --git a/test/integration/targets/aci_domain/tasks/vmm-vmware.yml b/test/integration/targets/aci_domain/tasks/vmm-vmware.yml deleted file mode 100644 index 2d737e4451..0000000000 --- a/test/integration/targets/aci_domain/tasks/vmm-vmware.yml +++ /dev/null @@ -1,184 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove VMM domain - aci_domain: &domain_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: vmm_dom - domain_type: vmm - vm_provider: vmware - state: absent - - -# ADD DOMAIN -- name: Add VMM domain (check_mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: vmm_dom - domain_type: vmm - vm_provider: vmware - state: present - check_mode: yes - register: cm_add_domain - -- name: Add VMM domain (normal mode) - aci_domain: *domain_present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - cm_add_domain is changed - - nm_add_domain is changed - - 'cm_add_domain.sent == nm_add_domain.sent == {"vmmDomP": {"attributes": {"name": "vmm_dom"}}}' - - 'cm_add_domain.proposed == nm_add_domain.proposed == {"vmmDomP": {"attributes": {"name": "vmm_dom"}}}' - - cm_add_domain.current == cm_add_domain.previous == nm_add_domain.previous == [] - - nm_add_domain.current.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom' - - nm_add_domain.current.0.vmmDomP.attributes.name == 'vmm_dom' - -- name: Add VMM domain again (check_mode) - aci_domain: *domain_present - check_mode: yes - register: cm_add_domain_again - -- name: Add physical domain again (normal mode) - aci_domain: *domain_present - register: nm_add_domain_again - -- name: Verify add_domain_again - assert: - that: - - cm_add_domain_again is not changed - - nm_add_domain_again is not changed - - -# QUERY ALL DOMAINS -- name: Query all VMM domains (check_mode) - aci_domain: &domain_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: vmm - vm_provider: vmware - state: query - check_mode: yes - register: cm_query_all_domains - -- name: Query all VMM domains (normal mode) - aci_domain: *domain_query - register: nm_query_all_domains - -- name: Verify query_all_domains - assert: - that: - - cm_query_all_domains is not changed - - nm_query_all_domains is not changed - - cm_query_all_domains == nm_query_all_domains - - nm_query_all_domains.current|length >= 1 - - -# QUERY A DOMAIN -- name: Query our VMM domain (check_mode) - aci_domain: - <<: *domain_query - domain: vmm_dom - vm_provider: vmware - check_mode: yes - register: cm_query_domain - -- name: Query our VMM domain (normal mode) - aci_domain: - <<: *domain_query - domain: vmm_dom - vm_provider: vmware - register: nm_query_domain - -- name: Verify query_domain - assert: - that: - - cm_query_domain is not changed - - nm_query_domain is not changed - - cm_query_domain == nm_query_domain - - nm_query_domain.current.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom' - - nm_query_domain.current.0.vmmDomP.attributes.name == 'vmm_dom' - - -# REMOVE DOMAIN -- name: Remove VMM domain (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain - -- name: Remove VMM domain (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain - -- name: Verify remove_domain - assert: - that: - - cm_remove_domain is changed - - nm_remove_domain is changed - - cm_remove_domain.current == cm_remove_domain.previous == nm_remove_domain.previous - - nm_remove_domain.previous.0.vmmDomP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom' - - nm_remove_domain.previous.0.vmmDomP.attributes.name == 'vmm_dom' - - nm_remove_domain.current == [] - -- name: Remove VMM domain again (check_mode) - aci_domain: *domain_absent - check_mode: yes - register: cm_remove_domain_again - -- name: Remove VMM domain again (normal mode) - aci_domain: *domain_absent - register: nm_remove_domain_again - -- name: Verify remove_domain_again - assert: - that: - - cm_remove_domain_again is not changed - - nm_remove_domain_again is not changed - - -# QUERY NON-EXISTING DOMAIN -- name: Query non-existing VMM domain (check_mode) - aci_domain: - <<: *domain_query - domain: vmm_dom - vm_provider: vmware - check_mode: yes - register: cm_query_non_domain - -- name: Query non-existing VMM domain (normal mode) - aci_domain: - <<: *domain_query - domain: vmm_dom - vm_provider: vmware - register: nm_query_non_domain - -- name: Verify query_non_domain - assert: - that: - - cm_query_non_domain is not changed - - nm_query_non_domain is not changed - - cm_query_non_domain == nm_query_non_domain - - nm_query_non_domain.current == [] diff --git a/test/integration/targets/aci_domain_to_vlan_pool/aliases b/test/integration/targets/aci_domain_to_vlan_pool/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_domain_to_vlan_pool/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_domain_to_vlan_pool/tasks/main.yml b/test/integration/targets/aci_domain_to_vlan_pool/tasks/main.yml deleted file mode 100644 index fcc8fea240..0000000000 --- a/test/integration/targets/aci_domain_to_vlan_pool/tasks/main.yml +++ /dev/null @@ -1,216 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove domain to VLAN pool binding - aci_domain_to_vlan_pool: &binding_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - pool: test_pool - pool_allocation_mode: dynamic - state: absent - -- name: Remove physical domain - aci_domain: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - state: absent - -- name: Create VLAN pool - aci_vlan_pool: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: test_pool - pool_allocation_mode: dynamic - description: Test VLAN pool - state: present - - -# ADD BINDING -- name: Add domain to VLAN pool binding (check_mode) - aci_domain_to_vlan_pool: &binding_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: phys_dom - domain_type: phys - pool: test_pool - pool_allocation_mode: dynamic - state: present - check_mode: yes - register: cm_add_binding - -- name: Add domain to VLAN pool binding (normal mode) - aci_domain_to_vlan_pool: *binding_present - register: nm_add_binding - -- name: Verify add_binding - assert: - that: - - cm_add_binding is changed - - nm_add_binding is changed - - 'cm_add_binding.sent == nm_add_binding.sent == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}' - - 'cm_add_binding.proposed == nm_add_binding.proposed == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}' - - cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == [] - - 'nm_add_binding.current == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}]' - -- name: Add domain to VLAN pool binding again (check_mode) - aci_domain_to_vlan_pool: *binding_present - check_mode: yes - register: cm_add_binding_again - -- name: Add domain to VLAN pool binding again (normal mode) - aci_domain_to_vlan_pool: *binding_present - register: nm_add_binding_again - -- name: Verify add_binding_again - assert: - that: - - cm_add_binding_again is not changed - - nm_add_binding_again is not changed - - -# QUERY ALL BINDINGS -- name: Query all domain to VLAN pool bindings (check_mode) - aci_domain_to_vlan_pool: &binding_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain_type: phys - pool_allocation_mode: dynamic - state: query - check_mode: yes - register: cm_query_all_bindings - -- name: Query all domain to VLAN pool bindings (normal mode) - aci_domain_to_vlan_pool: *binding_query - register: nm_query_all_bindings - -- name: Verify query_all_bindings - assert: - that: - - cm_query_all_bindings is not changed - - nm_query_all_bindings is not changed - - cm_query_all_bindings == nm_query_all_bindings - - nm_query_all_bindings.current|length >= 1 - - -# QUERY A BINDING -- name: Query our domain to VLAN pool binding (check_mode) - aci_domain_to_vlan_pool: - <<: *binding_query - domain: phys_dom - pool: test_pool - pool_allocation_mode: dynamic - check_mode: yes - register: cm_query_binding - -- name: Query our domain to VLAN pool binding (normal mode) - aci_domain_to_vlan_pool: - <<: *binding_query - domain: phys_dom - pool: test_pool - pool_allocation_mode: dynamic - register: nm_query_binding - -- name: Verify query_binding - assert: - that: - - cm_query_binding is not changed - - nm_query_binding is not changed - - cm_query_binding == nm_query_binding - - nm_query_binding.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom' - - nm_query_binding.current.0.physDomP.attributes.name == 'phys_dom' - - nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP' - - nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic' - - -# REMOVE BINDING -- name: Remove domain to VLAN pool binding (check_mode) - aci_domain_to_vlan_pool: *binding_absent - check_mode: yes - register: cm_remove_binding - -- name: Remove domain to VLAN pool binding (normal mode) - aci_domain_to_vlan_pool: *binding_absent - register: nm_remove_binding - -- name: Verify remove_binding - assert: - that: - - cm_remove_binding is changed - - nm_remove_binding is changed - - 'cm_remove_binding.current == cm_remove_binding.previous == nm_remove_binding.previous == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}]' - - nm_remove_binding.current == [] - -- name: Remove domain to VLAN pool binding again (check_mode) - aci_domain_to_vlan_pool: *binding_absent - check_mode: yes - register: cm_remove_binding_again - -- name: Remove domain to VLAN pool binding again (normal mode) - aci_domain_to_vlan_pool: *binding_absent - register: nm_remove_binding_again - -- name: Verify remove_binding_again - assert: - that: - - cm_remove_binding_again is not changed - - nm_remove_binding_again is not changed - - -# QUERY NON-EXISTING BINDING -- name: Query non-existing domain to VLAN pool binding (check_mode) - aci_domain_to_vlan_pool: - <<: *binding_query - domain: phys_dom - pool: test_pool - pool_allocation_mode: dynamic - check_mode: yes - register: cm_query_non_binding - -- name: Query non-existing domain to VLAN pool binding (normal mode) - aci_domain_to_vlan_pool: - <<: *binding_query - domain: phys_dom - pool: test_pool - pool_allocation_mode: dynamic - register: nm_query_non_binding - -- name: Verify query_non_binding - assert: - that: - - cm_query_non_binding is not changed - - nm_query_non_binding is not changed - - cm_query_non_binding == nm_query_non_binding - - nm_query_non_binding.current == [] diff --git a/test/integration/targets/aci_encap_pool/aliases b/test/integration/targets/aci_encap_pool/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_encap_pool/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_encap_pool/tasks/main.yml b/test/integration/targets/aci_encap_pool/tasks/main.yml deleted file mode 100644 index 971b42bfeb..0000000000 --- a/test/integration/targets/aci_encap_pool/tasks/main.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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 - -- include_tasks: vlan.yml - when: vlan is not defined or vlan - -- include_tasks: vxlan.yml - when: vxlan is not defined or vxlan - -- include_tasks: vsan.yml - when: vsan is not defined or vsan diff --git a/test/integration/targets/aci_encap_pool/tasks/vlan.yml b/test/integration/targets/aci_encap_pool/tasks/vlan.yml deleted file mode 100644 index da2242b89f..0000000000 --- a/test/integration/targets/aci_encap_pool/tasks/vlan.yml +++ /dev/null @@ -1,264 +0,0 @@ ---- -- name: ensure vlan pool does not exist for tests to kick off - aci_encap_pool: &aci_pool_absent_static - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: absent - pool: anstest - pool_type: vlan - pool_allocation_mode: static - -- name: ensure vlan pool does not exist for tests to kick off - aci_encap_pool: &aci_pool_absent_dynamic - <<: *aci_pool_absent_static - pool_allocation_mode: dynamic - -- name: create static vlan pool - check mode works - aci_encap_pool: &aci_pool_present_static - <<: *aci_pool_absent_static - state: present - descr: Ansible Test - check_mode: yes - register: create_check_mode - -- name: assertion test - present - assert: - that: - - create_check_mode is changed - - 'create_check_mode.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "name": "anstest"}}}' - -- name: create static vlan pool - creation works - aci_encap_pool: - <<: *aci_pool_present_static - register: create_static - -- name: assertion test - present - assert: - that: - - create_static is changed - - create_static.previous == [] - - create_static.sent == create_check_mode.sent - -- name: create dynamic vlan pool - creation works - aci_encap_pool: &aci_pool_present_dynamic - <<: *aci_pool_absent_dynamic - state: present - descr: Ansible Test - register: create_dynamic - -- name: assertion test - present - assert: - that: - - create_dynamic is changed - - create_dynamic.previous == [] - - 'create_dynamic.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "name": "anstest"}}}' - -- name: create static vlan pool again - idempotency works - aci_encap_pool: - <<: *aci_pool_present_static - register: idempotent_static - -- name: assertion test - present - assert: - that: - - idempotent_static is not changed - - 'idempotent_static.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-static", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - idempotent_static.sent == {} - -- name: create dynamic vlan pool again - idempotency works - aci_encap_pool: - <<: *aci_pool_present_dynamic - register: idempotent_dynamic - -- name: assertion test - present - assert: - that: - - idempotent_dynamic is not changed - - 'idempotent_dynamic.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-dynamic", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - idempotent_dynamic.sent == {} - -- name: update static vlan pool - update works - aci_encap_pool: - <<: *aci_pool_present_static - descr: Ansible Test Change - register: update_static - -- name: assertion test - present - assert: - that: - - update_static is changed - - 'update_static.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}' - -- name: update dynamic vlan pool - update works - aci_encap_pool: - <<: *aci_pool_present_dynamic - descr: Ansible Test Change - register: update_dynamic - -- name: assertion test - present - assert: - that: - - update_dynamic is changed - - 'update_dynamic.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}' - -- name: missing param - failure message works - aci_encap_pool: - <<: *aci_pool_present_dynamic - pool_allocation_mode: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: vlan_alloc_fail - -- name: assertion test - present - assert: - that: - - vlan_alloc_fail is failed - - "vlan_alloc_fail.msg == 'ACI requires parameter \\'pool_allocation_mode\\' for \\'pool_type\\' of \\'vlan\\' and \\'vsan\\' when parameter \\'pool\\' is provided'" - -- name: missing param - failure message works - aci_encap_pool: - <<: *aci_pool_present_dynamic - pool: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: vlan_pool_fail - -- name: assertion test - present - assert: - that: - - vlan_pool_fail is failed - - 'vlan_pool_fail.msg == "state is present but all of the following are missing: pool"' - -- name: missing param - failure message works - aci_encap_pool: - <<: *aci_pool_present_dynamic - pool_type: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: vlan_pool_type_fail - -- name: assertion test - present - assert: - that: - - vlan_pool_type_fail is failed - - 'vlan_pool_type_fail.msg == "missing required arguments: pool_type"' - -- name: get all vlan pools - get class works - aci_encap_pool: - <<: *aci_pool_absent_static - state: query - pool: "{{ fake_var | default(omit) }}" - pool_allocation_mode: "{{ fake_var | default(omit) }}" - register: get_all_pools - -- name: assertion test - query - assert: - that: - - get_all_pools is not changed - - get_all_pools.method == "GET" - - get_all_pools.current | length > 1 - -- name: get created static vlan pool - get mo works - aci_encap_pool: - <<: *aci_pool_absent_static - state: query - register: get_static_pool - -- name: assertion test - query - assert: - that: - - get_static_pool is not changed - - get_static_pool.method == "GET" - - get_static_pool.current | length == 1 - - get_static_pool.current.0.fvnsVlanInstP.attributes.allocMode == "static" - - get_static_pool.current.0.fvnsVlanInstP.attributes.name == "anstest" - -- name: get created dynamic vlan pool - get mo works - aci_encap_pool: - <<: *aci_pool_absent_dynamic - state: query - register: get_dynamic_pool - -- name: assertion test - query - assert: - that: - - get_dynamic_pool is not changed - - get_dynamic_pool.method == "GET" - - get_dynamic_pool.current | length == 1 - - get_dynamic_pool.current.0.fvnsVlanInstP.attributes.allocMode == "dynamic" - - get_dynamic_pool.current.0.fvnsVlanInstP.attributes.name == "anstest" - -- name: get created dynamic vlan pool - get mo works - aci_encap_pool: - <<: *aci_pool_absent_dynamic - state: query - pool_type: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: vlan_query_pool_type_fail - -- name: assertion test - query - assert: - that: - - vlan_query_pool_type_fail is failed - - 'vlan_query_pool_type_fail.msg == "missing required arguments: pool_type"' - -- name: delete static vlan pool - deletion works - aci_encap_pool: - <<: *aci_pool_absent_static - register: delete_static - -- name: assertion test - absent - assert: - that: - - delete_static is changed - - delete_static.method == "DELETE" - - delete_static.previous.0.fvnsVlanInstP.attributes.allocMode == "static" - - delete_static.previous.0.fvnsVlanInstP.attributes.name == "anstest" - -- name: delete dynamic vlan pool - check mode works - aci_encap_pool: - <<: *aci_pool_absent_dynamic - check_mode: yes - register: delete_check_mode - -- name: assertion test - absent - assert: - that: - - delete_check_mode is changed - -- name: delete dynamic vlan pool - deletion works - aci_encap_pool: - <<: *aci_pool_absent_dynamic - register: delete_dynamic - -- name: assertion test - absent - assert: - that: - - delete_dynamic is changed - - delete_dynamic.method == "DELETE" - - delete_dynamic.previous.0.fvnsVlanInstP.attributes.allocMode == "dynamic" - - delete_dynamic.previous.0.fvnsVlanInstP.attributes.name == "anstest" - -- name: delete static vlan pool again - idempotency works - aci_encap_pool: - <<: *aci_pool_absent_static - register: idempotent_delete_static - -- name: assertion test - absent - assert: - that: - - idempotent_delete_static is not changed - - idempotent_delete_static.previous == [] - -- name: delete dynamic vlan pool again - idempotency works - aci_encap_pool: - <<: *aci_pool_absent_dynamic - register: idempotent_delete_dynamic - -- name: assertion test - absent - assert: - that: - - idempotent_delete_dynamic is not changed - - idempotent_delete_dynamic.previous == [] diff --git a/test/integration/targets/aci_encap_pool/tasks/vsan.yml b/test/integration/targets/aci_encap_pool/tasks/vsan.yml deleted file mode 100644 index daaf3c245e..0000000000 --- a/test/integration/targets/aci_encap_pool/tasks/vsan.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: ensure vlan pool does not exist for tests to kick off - aci_encap_pool: &aci_pool_absent_static - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_type: vsan - pool_allocation_mode: static - state: absent diff --git a/test/integration/targets/aci_encap_pool/tasks/vxlan.yml b/test/integration/targets/aci_encap_pool/tasks/vxlan.yml deleted file mode 100644 index 2f45a98ea0..0000000000 --- a/test/integration/targets/aci_encap_pool/tasks/vxlan.yml +++ /dev/null @@ -1,177 +0,0 @@ ---- -- name: ensure vxlan pool anstest does not exist for tests to kick off - aci_encap_pool: &aci_vxlan_absent - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: absent - pool: anstest - pool_type: vxlan - -- name: ensure vxlan pool anstest_2 does not exist for tests to kick off - aci_encap_pool: - <<: *aci_vxlan_absent - pool: anstest_2 - -- name: ensure vxlan pool anstest_3 does not exist for tests to kick off - aci_encap_pool: - <<: *aci_vxlan_absent - pool: anstest_3 - -- 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 is changed - - 'create_vxlan_check_mode.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}' - -- name: create vxlan pool - creation works - aci_encap_pool: - <<: *aci_vxlan_present - register: create_vxlan - -- name: assertion test - present - assert: - that: - - create_vxlan is changed - - create_vxlan.previous == [] - - create_vxlan.sent == create_vxlan_check_mode.sent - -- name: create vxlan pool again - idempotency works - aci_encap_pool: - <<: *aci_vxlan_present - register: idempotent_vxlan - -- name: assertion test - present - assert: - that: - - idempotent_vxlan is not changed - - 'idempotent_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest"' - - idempotent_vxlan.sent == {} - -- 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 is changed - - 'update_vxlan.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}' - -- 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 is changed - -- name: create vxlan pool with pool allocation mode - failure message works - aci_encap_pool: - <<: *aci_vxlan_present - name: anstest_3 - pool_allocation_mode: dynamic - ignore_errors: yes - register: create_vxlan_alloc_mode - -- name: assertion test - present - assert: - that: - - create_vxlan_alloc_mode is failed - - "create_vxlan_alloc_mode.msg == 'vxlan pools do not support setting the \\'pool_allocation_mode\\'; please remove this parameter from the task'" - -- 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 is not changed - - query_vxlan.current | length == 1 - - '"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 is not changed - - query_vxlan_all.current | length > 1 - - '"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 is changed - - delete_vxlan_check_mode.previous != [] - -- name: delete vxlan pool - deletion works - aci_encap_pool: - <<: *aci_vxlan_absent - register: delete_vxlan - -- name: assertion test - absent - assert: - that: - - delete_vxlan is changed - - delete_vxlan.previous == delete_vxlan_check_mode.previous - - delete_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest" - -- 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 is not changed - - delete_vxlan_idempotent.previous == [] - -- name: delete vxlan pool - cleanup - aci_encap_pool: - <<: *aci_vxlan_absent - pool: anstest_2 - -- name: assertion test - absent - assert: - that: - - delete_vxlan_pool_fail is failed - - 'delete_vxlan_pool_fail.msg == "state is absent but all of the following are missing: pool"' diff --git a/test/integration/targets/aci_encap_pool_range/aliases b/test/integration/targets/aci_encap_pool_range/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_encap_pool_range/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_encap_pool_range/tasks/main.yml b/test/integration/targets/aci_encap_pool_range/tasks/main.yml deleted file mode 100644 index 99ff04a24b..0000000000 --- a/test/integration/targets/aci_encap_pool_range/tasks/main.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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 - -- include_tasks: vlan.yml - when: "vlan is not defined or (vlan is defined and vlan == 'True')" - -- include_tasks: vxlan.yml - when: "vxlan is not defined or (vxlan is defined and vxlan == 'True')" - -- include_tasks: vsan.yml - when: "vsan is not defined or (vsan is defined and vsan == 'True')" diff --git a/test/integration/targets/aci_encap_pool_range/tasks/vlan.yml b/test/integration/targets/aci_encap_pool_range/tasks/vlan.yml deleted file mode 100644 index 5f8d26e60f..0000000000 --- a/test/integration/targets/aci_encap_pool_range/tasks/vlan.yml +++ /dev/null @@ -1,383 +0,0 @@ -- name: ensure vlan pool exists for tests to kick off - aci_encap_pool: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: absent - pool: anstest - pool_type: vlan - allocation_mode: static - description: Ansible Test - -- name: ensure vlan pool exists for tests to kick off - aci_encap_pool: &aci_pool_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - pool: anstest - pool_type: vlan - allocation_mode: static - description: Ansible Test - register: pool_present - -- name: create vlan pool range - check mode works - aci_encap_pool_range: &aci_range_present - <<: *aci_pool_present - range_name: anstest - range_start: 20 - range_end: 40 - pool: anstest - pool_allocation_mode: static - allocation_mode: inherit - description: Ansible Test - check_mode: yes - register: range_present_check_mode - -- name: present assertions - assert: - that: - - range_present_check_mode is changed - - 'range_present_check_mode.sent == {"fvnsEncapBlk": {"attributes": {"allocMode": "inherit", "descr": "Ansible Test", "from": "vlan-20", "name": "anstest", "to": "vlan-40"}}}' - -- name: create vlan pool range - creation works - aci_encap_pool_range: - <<: *aci_range_present - register: range_present - -- name: present assertions - assert: - that: - - range_present is changed - - range_present.previous == [] - - range_present.sent == range_present_check_mode.sent - - range_present.sent == range_present.proposed - -- name: create vlan pool range - idempotency works - aci_encap_pool_range: - <<: *aci_range_present - register: range_present_idempotent - -- name: present assertions - assert: - that: - - range_present_idempotent is not changed - - range_present_idempotent.previous.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: update vlan pool range - update works - aci_encap_pool_range: - <<: *aci_range_present - description: Ansible Test Update - allocation_mode: inherit - register: range_present_update - -- name: present assertions - assert: - that: - - range_present_update is changed - - range_present_update.previous != [] - - range_present_update.sent != range_present.sent - -- name: create vlan pool range - used for query - aci_encap_pool_range: &aci_range_present_2 - <<: *aci_range_present - range_name: anstest_2 - range_start: 50 - range_end: 55 - register: range_present_2 - -- name: present assertions - assert: - that: - - range_present_2 is changed - - range_present_2.previous == [] - -- name: invalid range_start - error message works - aci_encap_pool_range: - <<: *aci_range_present - range_start: 0 - ignore_errors: yes - register: range_start_low - -- name: present assertions - assert: - that: - - range_start_low is failed - - range_start_low.msg == 'vlan pools must have "range_start" and "range_end" values between 1 and 4094' - -- name: invalid range_start - error message works - aci_encap_pool_range: - <<: *aci_range_present - range_start: 4096 - ignore_errors: yes - register: range_start_high - -- name: present assertions - assert: - that: - - range_start_high is failed - - range_start_high.msg == 'vlan pools must have "range_start" and "range_end" values between 1 and 4094' - -- name: invalid range_end - error message works - aci_encap_pool_range: - <<: *aci_range_present - range_end: 0 - ignore_errors: yes - register: range_end_low - -- name: present assertions - assert: - that: - - range_end_low is failed - - range_end_low.msg == 'vlan pools must have "range_start" and "range_end" values between 1 and 4094' - -- name: invalid range_end - error message works - aci_encap_pool_range: - <<: *aci_range_present - range_end: 4096 - ignore_errors: yes - register: range_end_high - -- name: present assertions - assert: - that: - - range_end_high is failed - - range_end_high.msg == 'vlan pools must have "range_start" and "range_end" values between 1 and 4094' - -- name: range start higher than range end - error message works - aci_encap_pool_range: - <<: *aci_range_present - range_start: 1000 - ignore_errors: yes - register: range_start_end - -- name: present assertions - assert: - that: - - range_start_end is failed - - range_start_end.msg == 'The "range_start" must be less than or equal to the "range_end"' - -- name: missing required param - error message works - aci_encap_pool_range: - <<: *aci_range_present - pool_type: '{{ omit }}' - ignore_errors: yes - register: range_present_pool_type - -- name: present assertions - assert: - that: - - range_present_pool_type is failed - - "range_present_pool_type.msg == 'missing required arguments: pool_type'" - -- name: missing required param - error message works - aci_encap_pool_range: - <<: *aci_pool_present - ignore_errors: yes - register: range_present_missing_param - -- name: present assertions - assert: - that: - - range_present_missing_param is failed - - "range_present_missing_param.msg == 'state is present but all of the following are missing: range_end, range_name, range_start'" - -- name: missing required param - error message works - aci_encap_pool_range: - <<: *aci_range_present - pool_allocation_mode: '{{ omit }}' - ignore_errors: yes - register: range_present_allocation - -- name: present assertions - assert: - that: - - range_present_allocation is failed - - range_present_allocation.msg == 'ACI requires the "pool_allocation_mode" for "pool_type" of "vlan" and "vsan" when the "pool" is provided' - -- name: query specific vlan pool range - aci_encap_pool_range: &aci_range_query - <<: *aci_range_present - state: query - register: range_query - -- name: query assertions - assert: - that: - - range_query is not changed - - range_query.url.endswith("infra/vlanns-[anstest]-static/from-[vlan-20]-to-[vlan-40].json") - - range_query.current | length == 1 - - range_query.current.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: query vlan pool range - from, to, and name are filtered - aci_encap_pool_range: &aci_range_query_filter - <<: *aci_range_query - pool: '{{ omit }}' - register: range_query_from_to_name - -- name: query assertions - assert: - that: - - range_query_from_to_name is not changed - - range_query_from_to_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to_name.filter_string' - - '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_to_name.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to_name.filter_string' - - range_query_from_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - range_query_from_to_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - - range_query_from_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: query vlan pool range - from and name are filtered - aci_encap_pool_range: - <<: *aci_range_query_filter - range_end: '{{ omit }}' - register: range_query_from_name - -- name: query assertions - assert: - that: - - range_query_from_name is not changed - - range_query_from_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_name.filter_string' - - '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_name.filter_string' - - range_query_from_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - range_query_from_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - -- name: query vlan pool range - to and name are filtered - aci_encap_pool_range: - <<: *aci_range_query_filter - range_start: '{{ omit }}' - register: range_query_to_name - -- name: query assertions - assert: - that: - - range_query_to_name is not changed - - range_query_to_name.url.endswith('class/fvnsEncapBlk.json') - - '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_to_name.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_to_name.filter_string' - - range_query_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - range_query_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: query vlan pool range - name is filtered - aci_encap_pool_range: - <<: *aci_range_query_filter - range_start: '{{ omit) }}' - range_end: '{{ omit }}' - register: range_query_name - -- name: query assertions - assert: - that: - - range_query_name is not changed - - range_query_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_name.filter_string' - - range_query_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: query vlan pool range - from and to are filtered - aci_encap_pool_range: - <<: *aci_range_query_filter - range_name: '{{ omit }}' - register: range_query_from_to - -- name: query assertions - assert: - that: - - range_query_from_to is not changed - - range_query_from_to.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to.filter_string' - - range_query_from_to.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - - range_query_from_to.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: query all ranges in a vlan pool - aci_encap_pool_range: - <<: *aci_pool_present - state: query - pool_allocation_mode: static - register: range_query_pool - -- name: query assertions - assert: - that: - - range_query_pool.current | length == 1 - - range_query_pool.current.0.fvnsVlanInstP.attributes.name == "anstest" - - range_query_pool.current.0.fvnsVlanInstP.children | length > 1 - - range_query_pool.url.endswith("infra/vlanns-[anstest]-static.json") - -- name: query all ranges - aci_encap_pool_range: - <<: *aci_pool_present - state: query - pool: '{{ omit }}' - register: range_query_all - -- name: query assertions - assert: - that: - - range_query_all is not changed - - range_query_all.current | length > 1 - - range_query_all.current.0.fvnsEncapBlk is defined - - range_query_all.url.endswith("class/fvnsEncapBlk.json") - -- name: delete vlan pool range - deletion works - aci_encap_pool_range: - <<: *aci_range_present - state: absent - register: delete_range - -- name: absent assertions - assert: - that: - - delete_range is changed - - delete_range.proposed == {} - - delete_range.previous.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: delete vlan pool range - check mode works - aci_encap_pool_range: &aci_range_absent - <<: *aci_range_present_2 - state: absent - check_mode: yes - register: delete_check_mode - -- name: absent assertions - assert: - that: - - delete_check_mode is changed - - delete_check_mode.previous != [] - -- name: delete vlan pool range - deletion works - aci_encap_pool_range: - <<: *aci_range_absent - register: delete_range_2 - -- name: absent assertions - assert: - that: - - delete_range_2 is changed - - delete_range_2.previous == delete_check_mode.previous - -- name: delete vlan pool range again - idempotency works - aci_encap_pool_range: - <<: *aci_range_absent - register: delete_idempotent - -- name: absent assertions - assert: - that: - - delete_idempotent is not changed - - delete_idempotent.previous == [] - -- name: cleanup vlan pool - aci_encap_pool: - <<: *aci_pool_present - state: absent - when: pool_present is changed diff --git a/test/integration/targets/aci_encap_pool_range/tasks/vsan.yml b/test/integration/targets/aci_encap_pool_range/tasks/vsan.yml deleted file mode 100644 index 6e71b709a2..0000000000 --- a/test/integration/targets/aci_encap_pool_range/tasks/vsan.yml +++ /dev/null @@ -1,20 +0,0 @@ -- name: ensure vsan pool exists for tests to kick off - aci_encap_pool: &aci_pool_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_type: vsan - allocation_mode: static - description: Ansible Test - state: present - -- name: cleanup vsan pool - aci_encap_pool: - <<: *aci_pool_present - state: absent - when: pool_present is changed diff --git a/test/integration/targets/aci_encap_pool_range/tasks/vxlan.yml b/test/integration/targets/aci_encap_pool_range/tasks/vxlan.yml deleted file mode 100644 index abfc57a6ed..0000000000 --- a/test/integration/targets/aci_encap_pool_range/tasks/vxlan.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: ensure vxlan pool exists for tests to kick off - aci_encap_pool: &aci_pool_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_type: vxlan - description: Ansible Test - state: present - -- name: cleanup vxlan pool - aci_encap_pool: - <<: *aci_pool_present - state: absent - when: pool_present is changed diff --git a/test/integration/targets/aci_epg/aliases b/test/integration/targets/aci_epg/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_epg/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_epg/tasks/main.yml b/test/integration/targets/aci_epg/tasks/main.yml deleted file mode 100644 index 11a4f0dc46..0000000000 --- a/test/integration/targets/aci_epg/tasks/main.yml +++ /dev/null @@ -1,171 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: ensure bd exists for tests to kick off - aci_bd: &aci_bd_present - <<: *aci_tenant_present - bd: anstest - register: bd_present - -- name: ensure ap exists for tests to kick off - aci_ap: &aci_ap_present - <<: *aci_tenant_present - ap: anstest - register: ap_present - -- name: create epg - check mode works - aci_epg: &aci_epg_present - <<: *aci_ap_present - epg: anstest - bd: anstest - description: Ansible Test - check_mode: yes - register: epg_present_check_mode - -- name: create epg - creation works - aci_epg: - <<: *aci_epg_present - register: epg_present - -- name: create epg - idempotency works - aci_epg: - <<: *aci_epg_present - register: epg_present_idempotent - -- name: update epg - update works - aci_epg: - <<: *aci_epg_present - description: Ansible Test Update - register: epg_present_update - -- name: create epg - missing param - aci_epg: - <<: *aci_epg_present - ap: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: epg_present_missing_param - -- name: create epg - used for query - aci_epg: - <<: *aci_epg_present - epg: anstest2 - -- name: present assertions - assert: - that: - - epg_present_check_mode is changed - - epg_present_check_mode.previous == [] - - epg_present_check_mode.sent.fvAEPg.attributes != {} - - epg_present_check_mode.sent.fvAEPg.children.0.fvRsBd.attributes.tnFvBDName == "anstest" - - epg_present is changed - - epg_present.sent == epg_present_check_mode.sent - - epg_present_idempotent is not changed - - epg_present_idempotent.sent == {} - - epg_present_update is changed - - 'epg_present_update.sent == {"fvAEPg": {"attributes": {"descr": "Ansible Test Update"}}}' - - epg_present_missing_param is failed - - 'epg_present_missing_param.msg == "state is present but all of the following are missing: ap"' - -- name: get specific epg - aci_epg: - <<: *aci_epg_present - state: query - register: epg_query - -- name: get all epgs - aci_epg: - <<: *aci_tenant_present - state: query - tenant: "{{ fakevar | default(omit) }}" - register: epg_query_all - -- name: query assertions - assert: - that: - - epg_query is not changed - - epg_query.current | length == 1 - - epg_query.current.0.fvAEPg.attributes.name == "anstest" - - '"tn-anstest/ap-anstest/epg-anstest.json" in epg_query.url' - - epg_query_all is not changed - - epg_query_all.current | length > 1 - - '"rsp-subtree-class=fvRsBd" in epg_query_all.filter_string' - - '"class/fvAEPg.json" in epg_query_all.url' - -- name: delete epg - check mode works - aci_epg: &aci_epg_absent - <<: *aci_epg_present - state: absent - check_mode: yes - register: delete_epg_check_mode - -- name: delete epg - delete works - aci_epg: - <<: *aci_epg_absent - register: delete_epg - -- name: delete epg - idempotency works - aci_epg: - <<: *aci_epg_absent - register: delete_epg_idempotent - -- name: delete epg - cleanup extra epg - aci_epg: - <<: *aci_epg_absent - epg: anstest2 - -- name: delete epg - missing param fails - aci_epg: - <<: *aci_epg_absent - tenant: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: delete_epg_missing_param - -- name: query assertions - assert: - that: - - delete_epg_check_mode is changed - - delete_epg_check_mode.previous != [] - - delete_epg is changed - - delete_epg.previous == delete_epg_check_mode.previous - - delete_epg_idempotent is not changed - - delete_epg_idempotent.previous == [] - - delete_epg_missing_param is failed - - 'delete_epg_missing_param.msg == "state is absent but all of the following are missing: tenant"' - -- name: cleanup bd - aci_bd: - <<: *aci_bd_present - state: absent - when: bd_present.previous == [] - -- name: cleanup ap - aci_ap: - <<: *aci_ap_present - state: absent - when: ap_present.previous == [] - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present.previous == [] diff --git a/test/integration/targets/aci_epg_to_contract/aliases b/test/integration/targets/aci_epg_to_contract/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_epg_to_contract/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_epg_to_contract/tasks/main.yml b/test/integration/targets/aci_epg_to_contract/tasks/main.yml deleted file mode 100644 index c9b06fd691..0000000000 --- a/test/integration/targets/aci_epg_to_contract/tasks/main.yml +++ /dev/null @@ -1,254 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: Ensure contract binding does not exist prior to testing - aci_epg_to_contract: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - ap: anstest - epg: anstest - contract_type: provider - contract: "anstest_http" - state: absent - -- name: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: ensure contracts exist for tests to kick off - aci_contract: - <<: *aci_tenant_present - contract: "{{ item }}" - with_items: ["anstest_http", "anstest_https", "anstest_db"] - -- name: ensure ap exists - aci_ap: &aci_ap_present - <<: *aci_tenant_present - ap: anstest - register: ap_present - -- name: ensure epg exists - aci_epg: &aci_epg_present - <<: *aci_ap_present - epg: anstest - register: epg_present - -- name: bind contract to epg - check mode works - aci_epg_to_contract: &aci_epg_provide_present - <<: *aci_epg_present - contract_type: provider - contract: anstest_http - check_mode: yes - register: provide_present_check_mode - -- name: bind contract to epg - provide works - aci_epg_to_contract: - <<: *aci_epg_provide_present - register: provide_present - -- name: bind contract to epg - consume works - aci_epg_to_contract: &aci_epg_consume_present - <<: *aci_epg_provide_present - contract_type: consumer - contract: anstest_db - register: consume_present - -- name: bind contract to epg - add additional contract - aci_epg_to_contract: &aci_epg_provide_present2 - <<: *aci_epg_provide_present - contract: anstest_https - provider_match: at_most_one - register: provide_present2 - -- name: bind contract to epg - idempotency works - aci_epg_to_contract: - <<: *aci_epg_provide_present - register: idempotent_present - -- name: missing param - failure message works - aci_epg_to_contract: - <<: *aci_tenant_present - contract_type: provider - ignore_errors: yes - register: missing_param_present - -- name: missing required param - failure message works - aci_epg_to_contract: - <<: *aci_tenant_present - ignore_errors: yes - register: missing_required_present - -- name: incompatible param - failure message works - aci_epg_to_contract: - <<: *aci_epg_consume_present - provider_match: all - ignore_errors: yes - register: incompatible_present - -- name: present assertions - assert: - that: - - provide_present_check_mode is changed - - 'provide_present_check_mode.sent == {"fvRsProv": {"attributes": {"tnVzBrCPName": "anstest_http"}}}' - - provide_present is changed - - provide_present.sent == provide_present_check_mode.sent - - provide_present.previous == [] - - consume_present is changed - - consume_present.previous == [] - - 'consume_present.sent == {"fvRsCons": {"attributes": {"tnVzBrCPName": "anstest_db"}}}' - - provide_present2 is changed - - provide_present2.previous == [] - - missing_param_present is failed - - 'missing_param_present.msg == "state is present but all of the following are missing: ap, contract, epg"' - - missing_required_present is failed - - 'missing_required_present.msg == "missing required arguments: contract_type"' - - incompatible_present is failed - - incompatible_present.msg == "the 'provider_match' is only configurable for Provided Contracts" - -- name: get binding - aci_epg_to_contract: - <<: *aci_epg_provide_present2 - state: query - register: query_provide_contract - -- name: get binding - aci_epg_to_contract: - <<: *aci_epg_consume_present - state: query - register: query_consume_contract - -- name: get all bindings - aci_epg_to_contract: - <<: *aci_tenant_present - state: query - tenant: "{{ fakevar | default(omit) }}" - contract_type: provider - register: query_all - -- name: missing required param - failure message works - aci_epg_to_contract: - <<: *aci_tenant_present - state: query - ignore_errors: yes - register: missing_required_query - -- name: query assertions - assert: - that: - - query_provide_contract is not changed - - query_provide_contract.current != [] - - '"uni/tn-anstest/ap-anstest/epg-anstest/rsprov-anstest_https.json" in query_provide_contract.url' - - query_consume_contract is not changed - - query_consume_contract.current != [] - - '"uni/tn-anstest/ap-anstest/epg-anstest/rscons-anstest_db.json" in query_consume_contract.url' - - query_all is not changed - - '"class/fvRsProv.json" in query_all.url' - - missing_required_query is failed - - 'missing_required_query.msg == "missing required arguments: contract_type"' - -- name: delete consume binding - check mode works - aci_epg_to_contract: &aci_epg_consume_absent - <<: *aci_epg_consume_present - state: absent - check_mode: yes - register: consume_absent_check_mode - -- name: delete consume binding - deletion works - aci_epg_to_contract: - <<: *aci_epg_consume_absent - register: consume_absent - -- name: delete provide binding - deletion works - aci_epg_to_contract: - <<: *aci_epg_provide_present - state: absent - register: provide_absent - -- name: delete provide binding - deletion works - aci_epg_to_contract: - <<: *aci_epg_provide_present2 - state: absent - register: provide_absent2 - -- name: delete consume binding - idempotency works - aci_epg_to_contract: - <<: *aci_epg_consume_absent - register: consume_absent_idempotent - -- name: missing param - failure message works - aci_epg_to_contract: - <<: *aci_epg_consume_absent - contract: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: missing_param_absent - -- name: missing required param - failure message works - aci_epg_to_contract: - <<: *aci_epg_consume_absent - contract_type: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: missing_required_absent - -- name: absent assertions - assert: - that: - - consume_absent_check_mode is changed - - consume_absent_check_mode.previous.0.fvRsCons is defined - - consume_absent is changed - - consume_absent.previous == consume_absent_check_mode.previous - - provide_absent is changed - - provide_absent.previous.0.fvRsProv is defined - - provide_absent2 is changed - - consume_absent_idempotent is not changed - - consume_absent_idempotent.previous == [] - - missing_param_absent is failed - - 'missing_param_absent.msg == "state is absent but all of the following are missing: contract"' - - missing_required_absent is failed - - 'missing_required_absent.msg == "missing required arguments: contract_type"' - -- name: cleanup contracts - aci_contract: - <<: *aci_tenant_present - state: absent - contract: "{{ item }}" - with_items: ["anstest_http", "anstest_https", "anstest_db"] - -- name: cleanup epg - aci_epg: - <<: *aci_epg_present - state: absent - when: epg_present is changed - -- name: cleanup ap - aci_ap: - <<: *aci_ap_present - state: absent - when: ap_present is changed - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_epg_to_domain/aliases b/test/integration/targets/aci_epg_to_domain/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_epg_to_domain/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_epg_to_domain/tasks/main.yml b/test/integration/targets/aci_epg_to_domain/tasks/main.yml deleted file mode 100644 index 5d95059a6e..0000000000 --- a/test/integration/targets/aci_epg_to_domain/tasks/main.yml +++ /dev/null @@ -1,217 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: ensure ap exists for tests to kick off - aci_ap: &aci_ap_present - <<: *aci_tenant_present - ap: anstest - register: ap_present - -- name: ensure epg exists for tests to kick off - aci_epg: &aci_epg_present - <<: *aci_ap_present - epg: anstest - register: epg_present - -- name: ensure phys domain exists for tests to kick off - aci_rest: &aci_rest_phys_domain - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - method: post - path: api/mo/uni/phys-anstest.json - content: {"physDomP": {"attributes": {}}} - register: phys_domain_post - -- name: ensure vmm domain exists for tests to kick off - aci_rest: &aci_rest_vmm_domain - <<: *aci_rest_phys_domain - path: api/mo/uni/vmmp-VMware/dom-anstest.json - content: {"vmmDomP": {"attributes": {}}} - register: vmm_domain_post - -- name: bind phys domain to epg - check mode works - aci_epg_to_domain: &aci_epg_to_domain_present - <<: *aci_epg_present - domain: anstest - domain_type: phys - check_mode: yes - register: phys_check_mode_present - -- name: bind phys domain to epg - creation works - aci_epg_to_domain: - <<: *aci_epg_to_domain_present - register: phys_present - -- name: bind phys domain to epg - idempotency works - aci_epg_to_domain: - <<: *aci_epg_to_domain_present - register: phys_idempotent - -- name: bind phys domain to epg - update works - aci_epg_to_domain: - <<: *aci_epg_to_domain_present - deploy_immediacy: immediate - register: phys_update - -- name: bind vmm domain to epg - creation works - aci_epg_to_domain: &aci_epg_to_domain_vmm_present - <<: *aci_epg_to_domain_present - domain_type: vmm - vm_provider: vmware - resolution_immediacy: pre-provision - register: vmm_present - -- name: bind vmm domain to epg - missing params - aci_epg_to_domain: - <<: *aci_epg_to_domain_vmm_present - vm_provider: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: present_missing_params - -- name: bind vmm domain to epg - invalid vlan - aci_epg_to_domain: - <<: *aci_epg_to_domain_present - encap: 4097 - ignore_errors: yes - register: invalid_vlan - -- name: bind vmm domain to epg - incompatible params - aci_epg_to_domain: - <<: *aci_epg_to_domain_present - vm_provider: vmware - ignore_errors: yes - register: incompatible_params - -- name: present assertions - assert: - that: - - phys_check_mode_present is changed - - phys_present is changed - - phys_present.previous == [] - - 'phys_present.sent == {"fvRsDomAtt": {"attributes": {}}}' - - '"[uni/phys-anstest].json" in phys_present.url' - - phys_idempotent is not changed - - phys_idempotent.sent == {} - - phys_update is changed - - 'phys_update.sent == {"fvRsDomAtt": {"attributes": {"instrImedcy": "immediate"}}}' - - vmm_present is changed - - 'vmm_present.sent == {"fvRsDomAtt": {"attributes": {"resImedcy": "pre-provision"}}}' - - '"[uni/vmmp-VMware/dom-anstest].json" in vmm_present.url' - - present_missing_params is failed - - 'present_missing_params.msg == "domain_type is vmm but all of the following are missing: vm_provider"' - - invalid_vlan is failed - - invalid_vlan.msg == "Valid VLAN assigments are from 1 to 4096" - - incompatible_params is failed - - incompatible_params.msg == "Domain type 'phys' cannot have a 'vm_provider'" - -- name: get domain epg binding - aci_epg_to_domain: &aci_epg_domain_query - <<: *aci_tenant_present - state: query - tenant: "{{ fake_var | default(omit) }}" - register: binding_query - -- name: query assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length > 1 - - '"class/fvRsDomAtt.json" in binding_query.url' - -- name: delete domain epg binding - check mode - aci_epg_to_domain: &aci_epg_to_domain_absent - <<: *aci_epg_to_domain_present - state: absent - check_mode: yes - register: epg_domain_check_mode_absent - -- name: delete phys domain epg binding - delete works - aci_epg_to_domain: - <<: *aci_epg_to_domain_absent - register: epg_domain_absent - -- name: delete vmm domain epg binding - delete works - aci_epg_to_domain: - <<: *aci_epg_to_domain_vmm_present - state: absent - register: epg_vmm_domain_absent - -- name: delete domain epg binding - idempotency works - aci_epg_to_domain: - <<: *aci_epg_to_domain_absent - register: idempotency_absent - -- name: delete domain epg binding - missing param - aci_epg_to_domain: - <<: *aci_tenant_present - state: absent - ignore_errors: true - register: absent_missing_param - -- name: absent assertions - assert: - that: - - epg_domain_check_mode_absent is changed - - epg_domain_check_mode_absent.previous != [] - - epg_domain_absent is changed - - epg_domain_absent.previous == epg_domain_check_mode_absent.previous - - epg_vmm_domain_absent is changed - - idempotency_absent is not changed - - idempotency_absent.previous == [] - - absent_missing_param is failed - - 'absent_missing_param.msg == "state is absent but all of the following are missing: ap, domain, domain_type, epg"' - -- name: remove vmm domain - cleanup - aci_rest: - <<: *aci_rest_vmm_domain - method: delete - when: vmm_domain_post is changed - -- name: remove phys domain - cleanup - aci_rest: - <<: *aci_rest_phys_domain - method: delete - when: phys_domain_post is changed - -- name: remove epg - cleanup - aci_epg: - <<: *aci_epg_present - state: absent - when: epg_present is changed - -- name: remove ap - cleanup - aci_ap: - <<: *aci_ap_present - state: absent - when: ap_present is changed - -- name: remove tenant - cleanup - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_fabric_node/aliases b/test/integration/targets/aci_fabric_node/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_fabric_node/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_fabric_node/tasks/main.yml b/test/integration/targets/aci_fabric_node/tasks/main.yml deleted file mode 100644 index 4b280300bf..0000000000 --- a/test/integration/targets/aci_fabric_node/tasks/main.yml +++ /dev/null @@ -1,217 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 - - -# CLEAN ENVIRONMENT -- name: Remove fabric node - aci_fabric_node: &aci_fabric_node_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - serial: ansible_test - node_id: 105 - state: absent - - -# ADD FABRIC NODE -- name: Add fabric node (check_mode) - aci_fabric_node: &aci_fabric_node_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - serial: ansible_test - node_id: 105 - switch: test - state: present - check_mode: yes - register: cm_add_fabric_node - -- name: Add fabric node (normal mode) - aci_fabric_node: *aci_fabric_node_present - register: nm_add_fabric_node - -- name: Add fabric node again (check_mode) - aci_fabric_node: *aci_fabric_node_present - check_mode: yes - register: cm_add_fabric_node_again - -- name: Add fabric node again (normal mode) - aci_fabric_node: *aci_fabric_node_present - register: nm_add_fabric_node_again - -- name: Verify add_fabric_node - assert: - that: - - cm_add_fabric_node is changed - - nm_add_fabric_node is changed - # FIXME: Module is not idempotent - - cm_add_fabric_node_again is not changed - - nm_add_fabric_node_again is not changed - - -# CHANGE FABRIC NODE -- name: Change description of fabric node (check_mode) - aci_fabric_node: - <<: *aci_fabric_node_present - description: Ansible test fabric node - check_mode: yes - register: cm_add_fabric_node_descr - -- name: Change description of fabric node (normal mode) - aci_fabric_node: - <<: *aci_fabric_node_present - description: Ansible test fabric node - register: nm_add_fabric_node_descr - -- name: Change description of fabric nodeagain (check_mode) - aci_fabric_node: - <<: *aci_fabric_node_present - description: Ansible test fabric node - check_mode: yes - register: cm_add_fabric_node_descr_again - -- name: Change description of fabric node again (normal mode) - aci_fabric_node: - <<: *aci_fabric_node_present - description: Ansible test fabric node - register: nm_add_fabric_node_descr_again - -- name: Verify add_fabric_node_descr - assert: - that: - - cm_add_fabric_node_descr is changed - - nm_add_fabric_node_descr is changed - # FIXME: Module is not idempotent - - cm_add_fabric_node_descr_again is not changed - - nm_add_fabric_node_descr_again is not changed - - -# ADD FABRIC NODE AGAIN -- name: Add fabric node again with no description (check_mode) - aci_fabric_node: *aci_fabric_node_present - check_mode: yes - register: cm_add_fabric_node_again_no_descr - -- name: Add fabric node again with no description (normal mode) - aci_fabric_node: *aci_fabric_node_present - register: nm_add_fabric_node_again_no_descr - -- name: Verify add_fabric_node_again_no_descr - assert: - that: - # FIXME: Module is not idempotent - - cm_add_fabric_node_again_no_descr is not changed - - nm_add_fabric_node_again_no_descr is not changed - - -# QUERY ALL FABRIC NODES -- name: Query fabric nodes (check_mode) - aci_fabric_node: &aci_fabric_node_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_fabric_nodes - -- name: Query all fabric nodes (normal mode) - aci_fabric_node: *aci_fabric_node_query - register: nm_query_all_fabric_nodes - -- name: Verify query_all_fabric_nodes - assert: - that: - - cm_query_all_fabric_nodes is not changed - - nm_query_all_fabric_nodes is not changed - - cm_query_all_fabric_nodes == nm_query_all_fabric_nodes - - -# QUERY A FABRIC NODE -- name: Query our fabric_node - aci_fabric_node: - <<: *aci_fabric_node_query - serial: ansible_test # might need node_id too - check_mode: yes - register: cm_query_fabric_node - -- name: Query our fabric_node - aci_fabric_node: - <<: *aci_fabric_node_query - serial: ansible_test - register: nm_query_fabric_node - -- name: Verify query_fabric_node - assert: - that: - - cm_query_fabric_node is not changed - - nm_query_fabric_node is not changed - - cm_query_fabric_node == nm_query_fabric_node - - -# REMOVE FABRIC NODE -- name: Remove fabric_node (check_mode) - aci_fabric_node: *aci_fabric_node_absent - check_mode: yes - register: cm_remove_fabric_node - -- name: Remove fabric_node (normal mode) - aci_fabric_node: *aci_fabric_node_absent - register: nm_remove_fabric_node - -- name: Remove fabric_node again (check_mode) - aci_fabric_node: *aci_fabric_node_absent - check_mode: yes - register: cm_remove_fabric_node_again - -- name: Remove fabric_node again (normal mode) - aci_fabric_node: *aci_fabric_node_absent - register: nm_remove_fabric_node_again - -- name: Verify remove_fabric_node - assert: - that: - - cm_remove_fabric_node is changed - - nm_remove_fabric_node is changed - - cm_remove_fabric_node_again is not changed - - nm_remove_fabric_node_again is not changed - - -# QUERY NON-EXISTING LEAF PROFILE -- name: Query non-existing fabric_node (check_mode) - aci_fabric_node: - <<: *aci_fabric_node_query - serial: ansible_test - check_mode: yes - register: cm_query_non_fabric_node - -- name: Query non-existing fabric_node (normal mode) - aci_fabric_node: - <<: *aci_fabric_node_query - serial: ansible_test - register: nm_query_non_fabric_node - -- name: Verify query_non_fabric_node - assert: - that: - - cm_query_non_fabric_node is not changed - - nm_query_non_fabric_node is not changed - - cm_query_non_fabric_node == nm_query_non_fabric_node diff --git a/test/integration/targets/aci_filter/aliases b/test/integration/targets/aci_filter/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_filter/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_filter/tasks/main.yml b/test/integration/targets/aci_filter/tasks/main.yml deleted file mode 100644 index 37513f9439..0000000000 --- a/test/integration/targets/aci_filter/tasks/main.yml +++ /dev/null @@ -1,223 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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 - -# CLEAN ENVIRONMENT -- name: Add tenant - aci_tenant: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - state: present - -- name: Remove filter - aci_filter: &filter_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - filter: filter_test - state: absent - -# ADD FILTER -- name: Add filter (check_mode) - aci_filter: &filter_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - filter: filter_test - state: present - check_mode: yes - register: cm_add_filter - -- name: Add filter again (check_mode) - aci_filter: *filter_present - check_mode: yes - register: cm_add_filter_again - -- name: Add filter (normal mode) - aci_filter: *filter_present - register: nm_add_filter - -- name: Add filter again (normal mode) - aci_filter: *filter_present - register: nm_add_filter_again - -- name: Verify add_filter - assert: - that: - - cm_add_filter is changed - - cm_add_filter_again is changed - - nm_add_filter is changed - - nm_add_filter_again is not changed - -# CHANGE FILTER -- name: Change description of filter (check_mode) - aci_filter: - <<: *filter_present - description: Ansible test filter - check_mode: yes - register: cm_add_filter_descr - -- name: Change description of filter again (check_mode) - aci_filter: - <<: *filter_present - description: Ansible test filter - check_mode: yes - register: cm_add_filter_descr_again - -- name: Change description of filter (normal mode) - aci_filter: - <<: *filter_present - description: Ansible test filter - register: nm_add_filter_descr - -- name: Change description of filter again (normal mode) - aci_filter: - <<: *filter_present - description: Ansible test filter - register: nm_add_filter_descr_again - -- name: Verify add_filter_descr - assert: - that: - - cm_add_filter_descr is changed - - cm_add_filter_descr_again is changed - - nm_add_filter_descr is changed - - nm_add_filter_descr_again is not changed - -# ADD FILTER AGAIN -- name: Add filter again with no description (check_mode) - aci_filter: *filter_present - check_mode: yes - register: cm_add_filter_again_no_descr - -- name: Add filter again with no description (normal mode) - aci_filter: *filter_present - register: nm_add_filter_again_no_descr - -- name: Verify add_filter_again_no_descr - assert: - that: - - cm_add_filter_again_no_descr is not changed - - nm_add_filter_again_no_descr is not changed - -# QUERY ALL FILTERS -- name: Query all filters (check_mode) - aci_filter: &filter_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_filters - -- name: Query all filters (normal mode) - aci_filter: *filter_query - register: nm_query_all_filters - -- name: Verify query_all_filters - assert: - that: - - cm_query_all_filters is not changed - - nm_query_all_filters is not changed - # NOTE: Order of filters is not stable between calls - #- cm_query_all_filters == nm_query_all_filters - -# QUERY A FILTER -- name: Query our filter - aci_filter: - <<: *filter_query - tenant: ansible_test - filter: filter_test - check_mode: yes - register: cm_query_filter - -- name: Query our filter - aci_filter: - <<: *filter_query - tenant: ansible_test - filter: filter_test - register: nm_query_filter - -- name: Verify query_filter - assert: - that: - - cm_query_filter is not changed - - nm_query_filter is not changed - - cm_query_filter == nm_query_filter - -# REMOVE FILTER -- name: Remove filter (check_mode) - aci_filter: *filter_absent - check_mode: yes - register: cm_remove_filter - -- name: Remove filter again (check_mode) - aci_filter: *filter_absent - check_mode: yes - register: cm_remove_filter_again - -- name: Remove filter (normal mode) - aci_filter: *filter_absent - register: nm_remove_filter - -- name: Remove filter again (normal mode) - aci_filter: *filter_absent - register: nm_remove_filter_again - -- name: Verify remove_filter - assert: - that: - - cm_remove_filter is changed - - cm_remove_filter_again is changed - - nm_remove_filter is changed - - nm_remove_filter_again is not changed - -# QUERY NON-EXISTING FILTER -# FIXME: Should this fail or return empty values ? -- name: Query non-existing filter (check_mode) - aci_filter: - <<: *filter_query - tenant: ansible_test - filter: filter_test - check_mode: yes - register: cm_query_non_filter - -- name: Query non-existing filter (normal mode) - aci_filter: - <<: *filter_query - tenant: ansible_test - filter: filter_test - register: nm_query_non_filter - -- name: Verify query_non_filter - assert: - that: - - cm_query_non_filter is not changed - - nm_query_non_filter is not changed - - cm_query_non_filter == nm_query_non_filter diff --git a/test/integration/targets/aci_filter_entry/aliases b/test/integration/targets/aci_filter_entry/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_filter_entry/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_filter_entry/tasks/main.yml b/test/integration/targets/aci_filter_entry/tasks/main.yml deleted file mode 100644 index ca1bfa61bd..0000000000 --- a/test/integration/targets/aci_filter_entry/tasks/main.yml +++ /dev/null @@ -1,285 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - state: absent - -- name: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: ensure filter exists for tests to kick off - aci_filter: &aci_filter_present - <<: *aci_tenant_present - filter: anstest - register: filter_present - -- name: create filter entry - check mode works - aci_filter_entry: &aci_entry_present - <<: *aci_filter_present - entry: anstest - description: Ansible Test - ether_type: ip - ip_protocol: tcp - dst_port_start: 80 - dst_port_end: 88 - check_mode: yes - register: entry_present_check_mode - -- name: create filter entry - creation works - aci_filter_entry: - <<: *aci_entry_present - register: entry_present - -- name: create filter entry - idempotency works - aci_filter_entry: - <<: *aci_entry_present - register: entry_present_idempotent - -- name: update filter entry - update works - aci_filter_entry: - <<: *aci_entry_present - description: Ansible Test Update - dst_port_start: 80 - dst_port_end: 90 - register: entry_present_update - -- name: create filter entry - test different types - aci_filter_entry: - <<: *aci_filter_present - entry: anstest2 - ether_type: arp - arp_flag: arp_reply - register: entry_present_2 - -- name: create filter entry - test different types - aci_filter_entry: - <<: *aci_filter_present - entry: anstest3 - ether_type: ip - ip_protocol: icmp - icmp_msg_type: echo - register: entry_present_3 - -- name: create filter entry - test different types - aci_filter_entry: - <<: *aci_filter_present - entry: anstest4 - ether_type: ip - ip_protocol: udp - dst_port: 1000 - register: entry_present_4 - -- name: missing param - failure message works - aci_filter_entry: - <<: *aci_filter_present - ignore_errors: yes - register: present_missing_param - -- name: incompatable params - failure message works - aci_filter_entry: - <<: *aci_entry_present - dst_port: 99 - ignore_errors: yes - register: present_incompatible_params - -- name: present assertions - assert: - that: - - entry_present_check_mode is changed - - entry_present_check_mode.previous == [] - - 'entry_present_check_mode.sent == {"vzEntry": {"attributes": {"dFromPort": "http","dToPort": "88","descr": "Ansible Test","etherT": "ip","name": "anstest","prot": "tcp"}}}' - - entry_present is changed - - entry_present.previous == [] - - entry_present.sent == entry_present_check_mode.sent - - entry_present_idempotent is not changed - - entry_present_idempotent.previous != [] - - entry_present_idempotent.sent == {} - - entry_present_update is changed - - entry_present_update.previous != [] - - entry_present_update.sent != entry_present_update.proposed - - entry_present_2 is changed - - 'entry_present_2.sent.vzEntry.attributes == {"arpOpc": "reply", "etherT": "arp", "name": "anstest2"}' - - entry_present_3 is changed - - 'entry_present_3.sent.vzEntry.attributes == {"etherT": "ip", "icmpv4T": "echo", "name": "anstest3", "prot": "icmp"}' - - entry_present_4 is changed - - 'entry_present_4.sent.vzEntry.attributes == {"dFromPort": "1000", "dToPort": "1000", "etherT": "ip", "name": "anstest4", "prot": "udp"}' - - present_missing_param is failed - - 'present_missing_param.msg == "state is present but all of the following are missing: entry"' - - present_incompatible_params is failed - - present_incompatible_params.msg.startswith("Parameter") - -- name: query tenant filter entry - aci_filter_entry: &aci_query_entry - <<: *aci_entry_present - state: query - register: query_tenant_filter_entry - -- name: query filter entry - aci_filter_entry: - <<: *aci_query_entry - tenant: "{{ fakevar | default(omit) }}" - register: query_filter_entry - -- name: query tenant entry - aci_filter_entry: - <<: *aci_query_entry - filter: "{{ fakevar | default(omit) }}" - register: query_tenant_entry - -- name: query tenant filter - aci_filter_entry: - <<: *aci_query_entry - entry: "{{ fakevar | default(omit) }}" - register: query_tenant_filter - -- name: query entry - aci_filter_entry: &aci_query_entry_2 - <<: *aci_query_entry - tenant: "{{ fakevar | default(omit) }}" - filter: "{{ fakevar | default(omit) }}" - register: query_entry - -- name: query filter - aci_filter_entry: - <<: *aci_query_entry - tenant: "{{ fakevar | default(omit) }}" - entry: "{{ fakevar | default(omit) }}" - register: query_filter - -- name: query tenant - aci_filter_entry: - <<: *aci_query_entry - filter: "{{ fakevar | default(omit) }}" - entry: "{{ fakevar | default(omit) }}" - register: query_tenant - -- name: query all - aci_filter_entry: - <<: *aci_query_entry_2 - entry: "{{ fakevar | default(omit) }}" - register: query_all - -- name: query assertions - assert: - that: - - query_tenant_filter_entry is not changed - - query_tenant_filter_entry.current | length == 1 - - query_tenant_filter_entry.current.0.vzEntry.attributes.name == "anstest" - - '"tn-anstest/flt-anstest/e-anstest.json" in query_tenant_filter_entry.url' - - query_filter_entry is not changed - - query_filter_entry.current.0.vzFilter.attributes.name == "anstest" - - query_filter_entry.current.0.vzFilter.children | length == 1 - - '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter_entry.filter_string' - - '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_filter_entry.filter_string' - - '"class/vzFilter.json" in query_filter_entry.url' - - query_tenant_entry is not changed - - query_tenant_entry.current | length == 1 - - query_tenant_entry.current.0.fvTenant.attributes.name == "anstest" - - '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_tenant_entry.filter_string' - - '"rsp-subtree-class=vzEntry" in query_tenant_entry.filter_string' - - '"tn-anstest.json" in query_tenant_entry.url' - - query_tenant_filter is not changed - - query_tenant_filter.current | length == 1 - - query_tenant_filter.current.0.vzFilter.attributes.name == "anstest" - - query_tenant_filter.current.0.vzFilter.children | length == 4 - - '"rsp-subtree-class=vzEntry" in query_tenant_filter.filter_string' - - '"tn-anstest/flt-anstest.json" in query_tenant_filter.url' - - query_entry is not changed - - query_entry.current.0.vzEntry.attributes.name == "anstest" - - '"query-target-filter=eq(vzEntry.name, \"anstest\")" in query_entry.filter_string' - - '"class/vzEntry.json" in query_entry.url' - - query_filter is not changed - - query_filter.current.0.vzFilter.attributes.name == "anstest" - - '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter.filter_string' - - '"rsp-subtree-class=vzEntry" in query_filter.filter_string' - - '"class/vzFilter.json" in query_filter.url' - - query_tenant is not changed - - query_tenant.current | length == 1 - - query_tenant.current.0.fvTenant.attributes.name == "anstest" - - '"rsp-subtree-class=vzEntry,vzFilter" in query_tenant.filter_string' - - '"tn-anstest.json" in query_tenant.url' - - query_all is not changed - - query_all.current | length > 1 - - query_all.current.0.vzEntry is defined - - '"class/vzEntry.json" in query_all.url' - -- name: delete entry - check mode works - aci_filter_entry: &aci_entry_absent - <<: *aci_entry_present - state: absent - check_mode: yes - register: entry_absent_check_mode - -- name: delete entry - deletion works - aci_filter_entry: - <<: *aci_entry_absent - register: entry_absent - -- name: delete entry - idempotency works - aci_filter_entry: - <<: *aci_entry_absent - register: entry_absent_idempotent - -- name: missing param - failure message works - aci_filter_entry: - <<: *aci_tenant_present - state: absent - ignore_errors: yes - register: absent_missing_param - -- name: cleanup remaining entries - aci_filter_entry: - <<: *aci_entry_absent - entry: "{{ item }}" - with_items: ["anstest2", "anstest3", "anstest4"] - -- name: absent assertions - assert: - that: - - entry_absent_check_mode is changed - - entry_absent_check_mode.previous != [] - - entry_absent is changed - - entry_absent.previous == entry_absent_check_mode.previous - - entry_absent.proposed == {} - - entry_absent_idempotent is not changed - - entry_absent_idempotent.previous == [] - - absent_missing_param is failed - - 'absent_missing_param.msg == "state is absent but all of the following are missing: entry, filter"' - -- name: cleanup filter - aci_filter: - <<: *aci_filter_present - state: absent - when: filter_present is changed - -- name: cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/integration/targets/aci_firmware_source/aliases b/test/integration/targets/aci_firmware_source/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_firmware_source/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_firmware_source/tasks/main.yml b/test/integration/targets/aci_firmware_source/tasks/main.yml deleted file mode 100644 index 344a2ced80..0000000000 --- a/test/integration/targets/aci_firmware_source/tasks/main.yml +++ /dev/null @@ -1,197 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove firmware source - aci_firmware_source: &source_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - source: aci-msft-pkg-3.1.1i.zip - state: absent - - -# ADD SOURCE -#- name: Add source (check_mode) -# aci_firmware_source: &source_present -# host: '{{ aci_hostname }}' -# username: '{{ aci_username }}' -# password: '{{ aci_password }}' -# validate_certs: '{{ aci_validate_certs | default(false) }}' -# use_ssl: '{{ aci_use_ssl | default(true) }}' -# use_proxy: '{{ aci_use_proxy | default(true) }}' -# output_level: '{{ aci_output_level | default("info") }}' -# source: aci-msft-pkg-3.1.1i.zip -# url: foobar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip -# url_protocol: http -# state: present -# check_mode: yes -# register: cm_add_source -# -#- name: Add source (normal mode) -# aci_firmware_source: *source_present -# register: nm_add_source -# -#- name: Verify add_source -# assert: -# that: -# - cm_add_source is changed -# - nm_add_source is changed -# - 'cm_add_source.sent == nm_add_source.sent == {"firmwareOSource": {"attributes": {"name": "aci-msft-pkg-3.1.1i.zip", "proto": "http", "url": "foobar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip"}}}' -# - 'cm_add_source.proposed == nm_add_source.proposed == {"firmwareOSource": {"attributes": {"name": "aci-msft-pkg-3.1.1i.zip", "proto": "http", "url": "foobar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip"}}}' -# - cm_add_source.current == cm_add_source.previous == nm_add_source.previous == [] -# - nm_add_source.current.0.firmwareOSource.attributes.name == 'aci-msft-pkg-3.1.1i.zip' -# - nm_add_source.current.0.firmwareOSource.attributes.proto == 'http' -# - nm_add_source.current.0.firmwareOSource.attributes.url == 'foobar.cisco.com/download/cisco/aci/aci-msft-pkg-3.1.1i.zip' -# -#- name: Add source again (check_mode) -# aci_firmware_source: *source_present -# check_mode: yes -# register: cm_add_source_again -# -#- name: Add source again (normal mode) -# aci_firmware_source: *souce_present -# register: nm_add_source_again -# -#- name: Verify add_source_again -# assert: -# that: -# - cm_add_source_again is not changed -# - nm_add_source_again is not changed - - -# QUERY ALL SOURCES -- name: Query all sources (check_mode) - aci_firmware_source: &source_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_sources - -- name: Query all sources (normal mode) - aci_firmware_source: *source_query - register: nm_query_all_sources - -- name: Verify query_all_sources - assert: - that: - - cm_query_all_sources is not changed - - nm_query_all_sources is not changed - - cm_query_all_sources == nm_query_all_sources -# - nm_query_all_sources.current|length >= 1 - - -# QUERY A SOURCE -#- name: Query our source (check_mode) -# aci_firmware_source: -# <<: *source_query -# source: aci-msft-pkg-3.1.1i.zip -# check_mode: yes -# register: cm_query_source -# -#- name: Query our source (normal mode) -# aci_firmware_source: -# <<: *source_query -# source: aci-msft-pkg-3.1.1i.zip -# register: nm_query_source -# -#- name: Verify query_source -# assert: -# that: -# - cm_query_source is not changed -# - nm_query_source is not changed -# - cm_query_source == nm_query_source -# - nm_query_source.current.0.infraRsDomP.attributes.dn == 'uni/infra/attentp-test_aep/rsdomP-[uni/phys-phys_dom]' -# - nm_query_source.current.0.infraRsDomP.attributes.tCl == 'physDomP' -# - nm_query_source.current.0.infraRsDomP.attributes.tDn == 'uni/phys-phys_dom' - - -# REMOVE SOURCE -#- name: Remove source (check_mode) -# aci_firmware_source: *source_absent -# check_mode: yes -# register: cm_remove_source - -#- name: Remove source (normal mode) -# aci_firmware_source: *source_absent -# register: nm_remove_source -# -#- name: Verify remove_source -# assert: -# that: -# - cm_remove_source is changed -# - nm_remove_source is changed -# - 'cm_remove_source.current == cm_remove_source.previous == nm_remove_source.previous == [{"infraRsDomP": {"attributes": {"dn": "uni/infra/attentp-test_aep/rsdomP-[uni/phys-phys_dom]", "tDn": "uni/phys-phys_dom"}}}]' -# - nm_remove_source.current == [] -# -#- name: Remove source again (check_mode) -# aci_firmware_source: *source_absent -# check_mode: yes -# register: cm_remove_source_again -# -#- name: Remove source again (normal mode) -# aci_firmware_source: *source_absent -# register: nm_remove_source_again -# -#- name: Verify remove_source_again -# assert: -# that: -# - cm_remove_source_again is not changed -# - nm_remove_source_again is not changed - - -# QUERY NON-EXISTING SOURCE -#- name: Query non-existing source (check_mode) -# aci_firmware_source: -# <<: *source_query -# source: aci-msft-pkg-3.1.1i.zip -# check_mode: yes -# register: cm_query_non_source -# -#- name: Query non-existing source (normal mode) -# aci_firmware_source: -# <<: *source_query -# source: aci-msft-pkg-3.1.1i.zip -# register: nm_query_non_source -# -#- name: Verify query_non_source -# assert: -# that: -# - cm_query_non_source is not changed -# - nm_query_non_source is not changed -# - cm_query_non_source == nm_query_non_source -# - nm_query_non_source.current == [] - - -# PROVOKE ERRORS -- name: Error when required parameter is missing - aci_firmware_source: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: present - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "state is present but all of the following are missing: source, url"' diff --git a/test/integration/targets/aci_interface_policy_cdp/aliases b/test/integration/targets/aci_interface_policy_cdp/aliases deleted file mode 100644 index ad7ccf7ada..0000000000 --- a/test/integration/targets/aci_interface_policy_cdp/aliases +++ /dev/null @@ -1 +0,0 @@ -unsupported diff --git a/test/integration/targets/aci_interface_policy_cdp/tasks/main.yml b/test/integration/targets/aci_interface_policy_cdp/tasks/main.yml deleted file mode 100644 index f82b3b78a0..0000000000 --- a/test/integration/targets/aci_interface_policy_cdp/tasks/main.yml +++ /dev/null @@ -1,106 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2019, Tim Knipper (tknipper11) <tim.knipper@gmail.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 - -# CLEAN ENVIRONMENT -- name: Remove CDP Test Policy - aci_interface_policy_cdp: - name: Ansible_CDP_Test_Policy - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(false) }}' - output_level: debug - state: absent - register: cdp_delete - - - -- name: Create CDP Test Policy - aci_interface_policy_cdp: - name: Ansible_CDP_Test_Policy - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(false) }}' -# output_level: debug - state: present - register: cdp_create -- debug: - var: cdp_create - -- assert: - that: - - cdp_create is changed - - -- name: test for idempotency - aci_interface_policy_cdp: - name: Ansible_CDP_Test_Policy - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(false) }}' -# output_level: debug - state: present - register: cdp_idem - -- name: Assert that idempotency is not changed - assert: - that: - - cdp_idem is not changed - - - -- name: Create CDP Disable Test Policy - aci_interface_policy_cdp: - name: Ansible_CDP_Test_Policy - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(false) }}' -# output_level: debug - state: present - admin_state: no - register: cdp_disable -- debug: - var: cdp_disable - -- name: Assert that CDP is Disabled - assert: - that: - - 'cdp_disable.current.0.cdpIfPol.attributes.adminSt == "disabled"' - - -- name: Query CDP Policy - aci_interface_policy_cdp: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(false) }}' -# output_level: debug - state: query - register: cdp_query -- debug: - var: cdp_query - -- name: CDP Query Assertion - assert: - that: - - cdp_query is not changed
\ No newline at end of file diff --git a/test/integration/targets/aci_interface_policy_leaf_policy_group/aliases b/test/integration/targets/aci_interface_policy_leaf_policy_group/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_interface_policy_leaf_policy_group/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_interface_policy_leaf_policy_group/tasks/main.yml b/test/integration/targets/aci_interface_policy_leaf_policy_group/tasks/main.yml deleted file mode 100644 index c9204101f0..0000000000 --- a/test/integration/targets/aci_interface_policy_leaf_policy_group/tasks/main.yml +++ /dev/null @@ -1,436 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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: Making sure interface_policy_leaf_policy_group doesn't exist at beginning of test (PC) - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_link_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_link - lag_type: link - state: absent - -- name: Making sure interface_policy_leaf_policy_group doesn't exist at beginning of test (VPC) - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_node_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_node - lag_type: node - state: absent - -- name: Making sure interface_policy_leaf_policy_group doesn't exist at beginning of test (Leaf Access Port) - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_leaf_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_leaf - lag_type: leaf - state: absent - - -# ==== TESTING Port Channel (PC), lag_type: link ==== - -- name: Adding a interface policy leaf policy group (PC) - check mode works - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_link_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_link - lag_type: link - link_level_policy: linklevelpolicy - fibre_channel_interface_policy: fiberchannelpolicy - state: present - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_present - -- name: Adding a interface policy leaf policy group (PC) - creation works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_present - register: intf_policy_leaf_polgrp_present - -- name: Adding a interface policy leaf policy group (PC) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_present - register: intf_policy_leaf_polgrp_idempotent - -- name: Adding a interface policy leaf policy group description (PC) - update works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_present - description: policygroup description - register: intf_policy_leaf_polgrp_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_present is changed - - intf_policy_leaf_polgrp_present is changed - - intf_policy_leaf_polgrp_present.previous == [] - - 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "link","name": "policygroupname_link"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - - intf_policy_leaf_polgrp_idempotent is not changed - - intf_policy_leaf_polgrp_idempotent.sent == {} - - intf_policy_leaf_polgrp_update is changed - - 'intf_policy_leaf_polgrp_update.sent == {"infraAccBndlGrp": {"attributes": {"descr": "policygroup description"}}}' - -- name: Query interface policy leaf policy group (PC) - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_link - lag_type: link - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"/api/mo/uni/infra/funcprof/accbundle-policygroupname_link.json" in binding_query.url' - -- name: Remove interface policy leaf policy group (PC) - check mode - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_absent - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_absent - -- name: Remove interface policy leaf policy group (PC) - delete works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_absent - register: intf_policy_leaf_polgrp_absent - -- name: Remove interface policy leaf policy group (PC) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_absent - register: intf_policy_leaf_polgrp_absent_idempotent - -- name: Remove interface policy leaf policy group (PC) - check mode - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_link - #lag_type: link - state: absent - ignore_errors: yes - register: intf_policy_leaf_polgrp_absent_missing_param - -- name: absent assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_absent is changed - - intf_policy_leaf_polgrp_check_mode_absent.previous != [] - - intf_policy_leaf_polgrp_absent is changed - - intf_policy_leaf_polgrp_absent.previous == intf_policy_leaf_polgrp_absent.previous - - intf_policy_leaf_polgrp_absent_idempotent is not changed - - intf_policy_leaf_polgrp_absent_idempotent.previous == [] - - intf_policy_leaf_polgrp_absent_missing_param is failed - - 'intf_policy_leaf_polgrp_absent_missing_param.msg == "missing required arguments: lag_type"' - -# ==== END TESTING Port Channel (PC), lag_type: link ==== - - -# ==== START TESTING Virtual Port Channel (VPC), lag_type: node ==== - -- name: Making sure interface_policy_leaf_policy_group doesn't exist at beginning of test (VPC) - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_absent - -- name: Adding a interface policy leaf policy group (VPC) - check mode works - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_node_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_node - lag_type: node - link_level_policy: linklevelpolicy - fibre_channel_interface_policy: fiberchannelpolicy - state: present - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_present - -- name: Adding a interface policy leaf policy group (VPC) - creation works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_present - register: intf_policy_leaf_polgrp_present - -- name: Adding a interface policy leaf policy group (VPC) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_present - register: intf_policy_leaf_polgrp_idempotent - -- name: Adding a interface policy leaf policy group description (VPC) - update works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_present - description: policygroup description - register: intf_policy_leaf_polgrp_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_present is changed - - intf_policy_leaf_polgrp_present is changed - - intf_policy_leaf_polgrp_present.previous == [] - - 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "node","name": "policygroupname_node"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - - intf_policy_leaf_polgrp_idempotent is not changed - - intf_policy_leaf_polgrp_idempotent.sent == {} - - intf_policy_leaf_polgrp_update is changed - - 'intf_policy_leaf_polgrp_update.sent == {"infraAccBndlGrp": {"attributes": {"descr": "policygroup description"}}}' - -- name: Query interface policy leaf policy group (VPC) - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_node - lag_type: node - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"/api/mo/uni/infra/funcprof/accbundle-policygroupname_node.json" in binding_query.url' - -# Add lag_type link to see what we get back -- name: Adding a interface policy leaf policy group (PC) - creation works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_link_present - register: intf_policy_leaf_polgrp_present - -- name: Query interface policy leaf policy group (VPC) - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - lag_type: node - state: query - register: binding_query_node_all - -- name: present assertions - assert: - that: - - binding_query_node_all is not changed - - binding_query_node_all.current | length >= 1 - - binding_query_node_all.current | selectattr("infraAccBndlGrp.attributes.lagT", "equalto", "link") | list == [] - - '"/api/class/infraAccBndlGrp.json" in binding_query_node_all.url' - -- name: Remove interface policy leaf policy group (VPC) - check mode - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_absent - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_absent - -- name: Remove interface policy leaf policy group (VPC) - delete works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_absent - register: intf_policy_leaf_polgrp_absent - -- name: Remove interface policy leaf policy group (VPC) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_node_absent - register: intf_policy_leaf_polgrp_absent_idempotent - -- name: Remove interface policy leaf policy group (VPC) - check mode - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_node - #lag_type: node - state: absent - ignore_errors: yes - register: intf_policy_leaf_polgrp_absent_missing_param - -- name: absent assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_absent is changed - - intf_policy_leaf_polgrp_check_mode_absent.previous != [] - - intf_policy_leaf_polgrp_absent is changed - - intf_policy_leaf_polgrp_absent.previous == intf_policy_leaf_polgrp_absent.previous - - intf_policy_leaf_polgrp_absent_idempotent is not changed - - intf_policy_leaf_polgrp_absent_idempotent.previous == [] - - intf_policy_leaf_polgrp_absent_missing_param is failed - - 'intf_policy_leaf_polgrp_absent_missing_param.msg == "missing required arguments: lag_type"' - -# ==== END TESTING Virtual Port Channel (VPC), lag_type: node ==== - - -# ==== START TESTING Virtual Port Channel (VPC), lag_type: leaf ==== - -- name: Making sure interface_policy_leaf_policy_group doesn't exist at beginning of test (Leaf Access Port) - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_absent - -- name: Adding a interface policy leaf policy group (Leaf Access Port) - check mode works - aci_interface_policy_leaf_policy_group: &aci_interface_policy_leaf_policy_group_leaf_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_leaf - lag_type: leaf - link_level_policy: linklevelpolicy - fibre_channel_interface_policy: fiberchannelpolicy - state: present - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_present - -- name: Adding a interface policy leaf policy group (Leaf Access Port) - creation works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_present - register: intf_policy_leaf_polgrp_present - -- name: Adding a interface policy leaf policy group (Leaf Access Port) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_present - register: intf_policy_leaf_polgrp_idempotent - -- name: Adding a interface policy leaf policy group description (Leaf Access Port) - update works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_present - description: policygroup description - register: intf_policy_leaf_polgrp_update - -- name: hello - debug: - msg: "{{ intf_policy_leaf_polgrp_present.sent }}" - -- name: hello - debug: - msg: "{{ intf_policy_leaf_polgrp_update.sent }}" - -# TODO: also test for errors -- name: present assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_present is changed - - intf_policy_leaf_polgrp_present is changed - - intf_policy_leaf_polgrp_present.previous == [] - - 'intf_policy_leaf_polgrp_present.sent == {"infraAccPortGrp": {"attributes": {"name": "policygroupname_leaf"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - - intf_policy_leaf_polgrp_idempotent is not changed - - intf_policy_leaf_polgrp_idempotent.sent == {} - - intf_policy_leaf_polgrp_update is changed - - 'intf_policy_leaf_polgrp_update.sent == {"infraAccPortGrp": {"attributes": {"descr": "policygroup description"}}}' - -- name: Query interface policy leaf policy group (Leaf Access Port) - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_leaf - lag_type: leaf - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"/api/mo/uni/infra/funcprof/accportgrp-policygroupname_leaf.json" in binding_query.url' - -- name: Remove interface policy leaf policy group (Leaf Access Port) - check mode - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_absent - check_mode: yes - register: intf_policy_leaf_polgrp_check_mode_absent - -- name: Remove interface policy leaf policy group (Leaf Access Port) - delete works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_absent - register: intf_policy_leaf_polgrp_absent - -- name: Remove interface policy leaf policy group (Leaf Access Port) - idempotency works - aci_interface_policy_leaf_policy_group: - <<: *aci_interface_policy_leaf_policy_group_leaf_absent - register: intf_policy_leaf_polgrp_absent_idempotent - -- name: Remove interface policy leaf policy group (Leaf Access Port) - check mode - aci_interface_policy_leaf_policy_group: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - policy_group: policygroupname_leaf - #lag_type: leaf - state: absent - ignore_errors: yes - register: intf_policy_leaf_polgrp_absent_missing_param - -- name: absent assertions - assert: - that: - - intf_policy_leaf_polgrp_check_mode_absent is changed - - intf_policy_leaf_polgrp_check_mode_absent.previous != [] - - intf_policy_leaf_polgrp_absent is changed - - intf_policy_leaf_polgrp_absent.previous == intf_policy_leaf_polgrp_absent.previous - - intf_policy_leaf_polgrp_absent_idempotent is not changed - - intf_policy_leaf_polgrp_absent_idempotent.previous == [] - - intf_policy_leaf_polgrp_absent_missing_param is failed - - 'intf_policy_leaf_polgrp_absent_missing_param.msg == "missing required arguments: lag_type"' - -# ==== END TESTING Virtual Port Channel (VPC), lag_type: leaf ==== diff --git a/test/integration/targets/aci_interface_policy_leaf_profile/aliases b/test/integration/targets/aci_interface_policy_leaf_profile/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_interface_policy_leaf_profile/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_interface_policy_leaf_profile/tasks/main.yml b/test/integration/targets/aci_interface_policy_leaf_profile/tasks/main.yml deleted file mode 100644 index 70902a71e2..0000000000 --- a/test/integration/targets/aci_interface_policy_leaf_profile/tasks/main.yml +++ /dev/null @@ -1,213 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 - - -# CLEAN ENVIRONMENT -- name: Remove leaf profile - aci_interface_policy_leaf_profile: &interface_policy_leaf_profile_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_interface_profile: ansible_test - state: absent - - -# ADD LEAF INTERFACE PROFILE -- name: Add leaf interface profile (check_mode) - aci_interface_policy_leaf_profile: &interface_policy_leaf_profile_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_interface_profile: ansible_test - state: present - check_mode: yes - register: cm_add_leaf_interface_profile - -- name: Add leaf interface profile (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_present - register: nm_add_leaf_interface_profile - -- name: Add leaf interface profile again (check_mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_present - check_mode: yes - register: cm_add_leaf_interface_profile_again - -- name: Add leaf interface profile again (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_present - register: nm_add_leaf_interface_profile_again - -- name: Verify add_leaf_interface_profile - assert: - that: - - cm_add_leaf_interface_profile is changed - - nm_add_leaf_interface_profile is changed - - cm_add_leaf_interface_profile_again is not changed - - nm_add_leaf_interface_profile_again is not changed - - -# CHANGE LEAF INTERFACE PROFILE -- name: Change description of leaf interface profile (check_mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_present - description: Ansible test leaf interface profile - check_mode: yes - register: cm_add_leaf_interface_profile_descr - -- name: Change description of leaf interface profile (normal mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_present - description: Ansible test leaf interface profile - register: nm_add_leaf_interface_profile_descr - -- name: Change description of leaf interface profile again (check_mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_present - description: Ansible test leaf interface profile - check_mode: yes - register: cm_add_leaf_interface_profile_descr_again - -- name: Change description of leaf interface profile again (normal mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_present - description: Ansible test leaf interface profile - register: nm_add_leaf_interface_profile_descr_again - -- name: Verify add_leaf_interface_profile_descr - assert: - that: - - cm_add_leaf_interface_profile_descr is changed - - nm_add_leaf_interface_profile_descr is changed - - cm_add_leaf_interface_profile_descr_again is not changed - - nm_add_leaf_interface_profile_descr_again is not changed - - -# ADD LEAF INTERFACE PROFILE AGAIN -- name: Add leaf interface profile again with no description (check_mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_present - check_mode: yes - register: cm_add_leaf_interface_profile_again_no_descr - -- name: Add leaf interface profile again with no description (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_present - register: nm_add_leaf_interface_profile_again_no_descr - -- name: Verify add_leaf_interface_profile_again_no_descr - assert: - that: - - cm_add_leaf_interface_profile_again_no_descr is not changed - - nm_add_leaf_interface_profile_again_no_descr is not changed - - -# QUERY ALL LEAF INTERFACE PROFILES -- name: Query all interface profiles (check_mode) - aci_interface_policy_leaf_profile: &interface_policy_leaf_profile_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_leaf_interface_profiles - -- name: Query all leaf_interface_profiles (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_query - register: nm_query_all_leaf_interface_profiles - -- name: Verify query_all_leaf_interface_profiles - assert: - that: - - cm_query_all_leaf_interface_profiles is not changed - - nm_query_all_leaf_interface_profiles is not changed - # NOTE: Order of leaf_interface_profiles is not stable between calls - #- cm_query_all_leaf_interface_profiles == nm_query_all_leaf_interface_profiles - - -# QUERY A LEAF INTERFACE PROFILE -- name: Query our leaf_interface_profile - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_query - leaf_interface_profile: ansible_test - check_mode: yes - register: cm_query_leaf_interface_profile - -- name: Query our leaf_interface_profile - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_query - leaf_interface_profile: ansible_test - register: nm_query_leaf_interface_profile - -- name: Verify query_leaf_interface_profile - assert: - that: - - cm_query_leaf_interface_profile is not changed - - nm_query_leaf_interface_profile is not changed - - cm_query_leaf_interface_profile == nm_query_leaf_interface_profile - - -# REMOVE LEAF INTERFACE PROFILE -- name: Remove leaf_interface_profile (check_mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_absent - check_mode: yes - register: cm_remove_leaf_interface_profile - -- name: Remove leaf_interface_profile (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_absent - register: nm_remove_leaf_interface_profile - -- name: Remove leaf_interface_profile again (check_mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_absent - check_mode: yes - register: cm_remove_leaf_interface_profile_again - -- name: Remove leaf_interface_profile again (normal mode) - aci_interface_policy_leaf_profile: *interface_policy_leaf_profile_absent - register: nm_remove_leaf_interface_profile_again - -- name: Verify remove_leaf_interface_profile - assert: - that: - - cm_remove_leaf_interface_profile is changed - - nm_remove_leaf_interface_profile is changed - - cm_remove_leaf_interface_profile_again is not changed - - nm_remove_leaf_interface_profile_again is not changed - - -# QUERY NON-EXISTING LEAF INTERFACE PROFILE -- name: Query non-existing leaf_interface_profile (check_mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_query - leaf_interface_profile: ansible_test - check_mode: yes - register: cm_query_non_leaf_interface_profile - -- name: Query non-existing leaf_interface_profile (normal mode) - aci_interface_policy_leaf_profile: - <<: *interface_policy_leaf_profile_query - leaf_interface_profile: ansible_test - register: nm_query_non_leaf_interface_profile - -# TODO: Implement more tests -- name: Verify query_non_leaf_interface_profile - assert: - that: - - cm_query_non_leaf_interface_profile is not changed - - nm_query_non_leaf_interface_profile is not changed - - cm_query_non_leaf_interface_profile == nm_query_non_leaf_interface_profile diff --git a/test/integration/targets/aci_interface_policy_ospf/aliases b/test/integration/targets/aci_interface_policy_ospf/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_interface_policy_ospf/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_interface_policy_ospf/tasks/main.yml b/test/integration/targets/aci_interface_policy_ospf/tasks/main.yml deleted file mode 100644 index 2aa07a4e3b..0000000000 --- a/test/integration/targets/aci_interface_policy_ospf/tasks/main.yml +++ /dev/null @@ -1,231 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (dagwieers) <dag@wieers.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 - - -# CLEAN ENVIRONMENT -- name: Ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: Remove OSPF interface policy - aci_interface_policy_ospf: &interface_policy_ospf_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - ospf: ansible_ospf - state: absent - - -# ADD OSPF INTERFACE POLICY -- name: Add ospf interface policy (check_mode) - aci_interface_policy_ospf: &interface_policy_ospf_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - ospf: ansible_ospf - state: present - check_mode: yes - register: cm_add_ospf_interface_policy - -- name: Add ospf interface policy (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_present - register: nm_add_ospf_interface_policy - -- name: Add ospf interface policy again (check_mode) - aci_interface_policy_ospf: *interface_policy_ospf_present - check_mode: yes - register: cm_add_ospf_interface_policy_again - -- name: Add ospf interface policy again (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_present - register: nm_add_ospf_interface_policy_again - -- name: Verify add_ospf_interface_policy - assert: - that: - - cm_add_ospf_interface_policy is changed - - nm_add_ospf_interface_policy is changed - - cm_add_ospf_interface_policy_again is not changed - - nm_add_ospf_interface_policy_again is not changed - - -# CHANGE OSPF INTERFACE POLICY -- name: Change description of ospf interface policy (check_mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_present - description: Ansible test ospf interface policy - check_mode: yes - register: cm_add_ospf_descr - -- name: Change description of ospf interface policy (normal mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_present - description: Ansible test ospf interface policy - register: nm_add_ospf_descr - -- name: Change description of ospf interface policy again (check_mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_present - description: Ansible test ospf interface policy - check_mode: yes - register: cm_add_ospf_descr_again - -- name: Change description of ospf interface policy again (normal mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_present - description: Ansible test ospf interface policy - register: nm_add_ospf_descr_again - -- name: Verify add_ospf_descr - assert: - that: - - cm_add_ospf_descr is changed - - nm_add_ospf_descr is changed - - cm_add_ospf_descr_again is not changed - - nm_add_ospf_descr_again is not changed - - -# ADD OSPF INTERFACE POLICY AGAIN -- name: Add ospf interface policy again with no description (check_mode) - aci_interface_policy_ospf: *interface_policy_ospf_present - check_mode: yes - register: cm_add_ospf_again_no_descr - -- name: Add ospf interface policy again with no description (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_present - register: nm_add_ospf_again_no_descr - -- name: Verify add_ospf_again_no_descr - assert: - that: - - cm_add_ospf_again_no_descr is not changed - - nm_add_ospf_again_no_descr is not changed - - -# QUERY ALL OSPF INTERFACE POLICIES -- name: Query all ospf interface policies (check_mode) - aci_interface_policy_ospf: &interface_policy_ospf_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: anstest - state: query - check_mode: yes - register: cm_query_all_ospfs - -- name: Query all ospfs (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_query - register: nm_query_all_ospfs - -- name: Verify query_all_ospfs - assert: - that: - - cm_query_all_ospfs is not changed - - nm_query_all_ospfs is not changed - # NOTE: Order of ospfs is not stable between calls - #- cm_query_all_ospfs == nm_query_all_ospfs - - -# QUERY A OSPF INTERFACE POLICY -- name: Query our ospf - aci_interface_policy_ospf: - <<: *interface_policy_ospf_query - tenant: anstest - ospf: ansible_ospf - check_mode: yes - register: cm_query_ospf - -- name: Query our ospf - aci_interface_policy_ospf: - <<: *interface_policy_ospf_query - tenant: anstest - ospf: ansible_ospf - register: nm_query_ospf - -- name: Verify query_ospf - assert: - that: - - cm_query_ospf is not changed - - nm_query_ospf is not changed - - cm_query_ospf == nm_query_ospf - - -# REMOVE OSPF INTERFACE POLICY -- name: Remove ospf (check_mode) - aci_interface_policy_ospf: *interface_policy_ospf_absent - check_mode: yes - register: cm_remove_ospf - -- name: Remove ospf (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_absent - register: nm_remove_ospf - -- name: Remove ospf again (check_mode) - aci_interface_policy_ospf: *interface_policy_ospf_absent - check_mode: yes - register: cm_remove_ospf_again - -- name: Remove ospf again (normal mode) - aci_interface_policy_ospf: *interface_policy_ospf_absent - register: nm_remove_ospf_again - -- name: Verify remove_ospf - assert: - that: - - cm_remove_ospf is changed - - nm_remove_ospf is changed - - cm_remove_ospf_again is not changed - - nm_remove_ospf_again is not changed - - -# QUERY NON-EXISTING OSPF INTERFACE POLICY -- name: Query non-existing ospf (check_mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_query - ospf: ansible_ospf - check_mode: yes - register: cm_query_non_ospf - -- name: Query non-existing ospf (normal mode) - aci_interface_policy_ospf: - <<: *interface_policy_ospf_query - ospf: ansible_ospf - register: nm_query_non_ospf - -# TODO: Implement more tests -- name: Verify query_non_ospf - assert: - that: - - cm_query_non_ospf is not changed - - nm_query_non_ospf is not changed - - cm_query_non_ospf == nm_query_non_ospf diff --git a/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/aliases b/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/tasks/main.yml b/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/tasks/main.yml deleted file mode 100644 index 2f97034fec..0000000000 --- a/test/integration/targets/aci_interface_selector_to_switch_policy_leaf_profile/tasks/main.yml +++ /dev/null @@ -1,154 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_profile: swleafprftest - 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_interface_profile: leafintprftest - 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - leaf_profile: swleafprftest - 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_interface_profile: leafintprftest - 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 is changed - - intftoleaf_present is changed - - intftoleaf_present.previous == [] - - 'intftoleaf_present.sent == {"infraRsAccPortP": {"attributes": {"tDn": "uni/infra/accportprof-leafintprftest"}}}' - - intftoleaf_idempotent is not changed - - intftoleaf_idempotent.sent == {} - -- 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 is not changed - - binding_query.current | 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 is changed - - intftoleaf_check_mode_absent.previous != [] - - intftoleaf_absent is changed - - intftoleaf_absent.previous == intftoleaf_check_mode_absent.previous - - intftoleaf_absent_idempotent is not changed - - intftoleaf_absent_idempotent.previous == [] - - intftoleaf_absent_missing_param is failed - - '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 diff --git a/test/integration/targets/aci_rest/aliases b/test/integration/targets/aci_rest/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_rest/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_rest/tasks/error_handling.yml b/test/integration/targets/aci_rest/tasks/error_handling.yml deleted file mode 100644 index b438a1e43b..0000000000 --- a/test/integration/targets/aci_rest/tasks/error_handling.yml +++ /dev/null @@ -1,191 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# PROVOKE ERRORS -- name: Error on name resolution - aci_rest: - host: foo.bar.cisco.com - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - path: /api/mo/uni.json - method: post - content: - fvTenant: - attributes: - name: ansible_test - ignore_errors: yes - register: error_on_name_resolution - -- name: Verify error_on_name_resolution - assert: - that: - - error_on_name_resolution is failed - - "error_on_name_resolution.msg == 'Connection failed for https://foo.bar.cisco.com/api/aaaLogin.json. Request failed: <urlopen error [Errno -2] Name or service not known>'" - - "'current' not in error_on_name_resolution" - - "'previous' not in error_on_name_resolution" - - "'sent' not in error_on_name_resolution" - - "'proposed' not in error_on_name_resolution" - - "'filter_string' not in error_on_name_resolution" - -- name: Error when required parameter is missing - aci_rest: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - method: post - content: - fvTenant: - attributes: - name: ansible_test - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "missing required arguments: path"' - - "'current' not in error_on_missing_required_param" - - "'previous' not in error_on_missing_required_param" - - "'sent' not in error_on_missing_required_param" - - "'proposed' not in error_on_missing_required_param" - - "'filter_string' not in error_on_missing_required_param" - -- name: Error when attributes are missing - aci_rest: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - path: /api/mo/uni/tn-ansible_test.json - method: post - content: - fvTenant: - children: - ignore_errors: yes - register: error_on_missing_attributes - -- name: Verify error_on_missing_attributes - assert: - that: - - error_on_missing_attributes is failed - - error_on_missing_attributes.method == 'POST' - - "error_on_missing_attributes.msg == 'APIC Error 400: invalid data at line \\'1\\'. Attributes are missing, tag \\'attributes\\' must be specified first, before any other tag'" - - 'error_on_missing_attributes.response == "HTTP Error 400: Bad Request"' - - error_on_missing_attributes.status == 400 - - "'current' not in error_on_missing_attributes" - - "'previous' not in error_on_missing_attributes" - - "'sent' not in error_on_missing_attributes" - - "'proposed' not in error_on_missing_attributes" - - "'filter_string' not in error_on_missing_attributes" - -- name: Error when input does not validate - aci_rest: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - path: /api/mo/uni.json - method: post - content: - fvTenant: - attributes: - name: ansible_test - descr: This is an [invalid] description - ignore_errors: yes - register: error_on_input_validation - -- name: Verify error_on_input_validation - assert: - that: - - error_on_input_validation is failed - - error_on_input_validation.method == 'POST' - - "error_on_input_validation.msg == 'APIC Error 801: property descr of tn-ansible_test failed validation for value \\'This is an [invalid] description\\''" - - 'error_on_input_validation.response == "HTTP Error 400: Bad Request"' - - error_on_input_validation.status == 400 - - "'current' not in error_on_input_validation" - - "'previous' not in error_on_input_validation" - - "'sent' not in error_on_input_validation" - - "'proposed' not in error_on_input_validation" - - "'filter_string' not in error_on_input_validation" - -- name: Error when invalid attributes are used - aci_rest: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - path: /api/mo/uni.json - method: post - content: - fvTenant: - attributes: - name: ansible_test - description: This is an "invalid" description - ignore_errors: yes - register: error_on_invalid_attributes - -- name: Verify error_on_invalid_attributes - assert: - that: - - error_on_invalid_attributes is failed - - error_on_invalid_attributes.method == 'POST' - - "error_on_invalid_attributes.msg == 'APIC Error 400: unknown attribute \\'description\\' in element \\'fvTenant\\''" - - 'error_on_invalid_attributes.response == "HTTP Error 400: Bad Request"' - - error_on_invalid_attributes.status == 400 - - "'current' not in error_on_invalid_attributes" - - "'previous' not in error_on_invalid_attributes" - - "'sent' not in error_on_invalid_attributes" - - "'proposed' not in error_on_invalid_attributes" - - "'filter_string' not in error_on_invalid_attributes" - -- name: Error on invalid object - aci_rest: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - path: /api/mo/uni.json - method: post - content: - fvFoobar: - attributes: - name: ansible_test - ignore_errors: yes - register: error_on_invalid_object - -- name: Verify error_on_invalid_object - assert: - that: - - error_on_invalid_object is failed - - error_on_invalid_object.method == 'POST' - - "error_on_invalid_object.msg == 'APIC Error 122: unknown managed object class fvFoobar'" - - 'error_on_invalid_object.response == "HTTP Error 400: Bad Request"' - - error_on_invalid_object.status == 400 - - "'current' not in error_on_invalid_object" - - "'previous' not in error_on_invalid_object" - - "'sent' not in error_on_invalid_object" - - "'proposed' not in error_on_invalid_object" diff --git a/test/integration/targets/aci_rest/tasks/json_inline.yml b/test/integration/targets/aci_rest/tasks/json_inline.yml deleted file mode 100644 index 110dd09e4f..0000000000 --- a/test/integration/targets/aci_rest/tasks/json_inline.yml +++ /dev/null @@ -1,166 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_rest: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: delete - -# ADD TENANT -- name: Add tenant (normal mode) - aci_rest: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: - { - "fvTenant": { - "attributes": { - "name": "ansible_test" - } - } - } - delegate_to: localhost - register: nm_add_tenant - -- name: Add tenant again (normal mode) - aci_rest: *tenant_present - delegate_to: localhost - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - nm_add_tenant is changed - - nm_add_tenant_again is not changed - -# CHANGE TENANT -- name: Change description of tenant (normal mode) - aci_rest: &tenant_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: - { - "fvTenant": { - "attributes": { - "descr": "Ansible test tenant", - "name": "ansible_test" - } - } - } - delegate_to: localhost - register: nm_add_tenant_descr - -- name: Change description of tenant again (normal mode) - aci_rest: *tenant_changed - delegate_to: localhost - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - nm_add_tenant_descr is changed - - nm_add_tenant_descr_again is not changed - -# ADD TENANT AGAIN -- name: Add tenant again with no description (normal mode) - aci_rest: *tenant_present - delegate_to: localhost - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - nm_add_tenant_again_no_descr is not changed - -# QUERY ALL TENANTS -- name: Query all tenants (normal mode) - aci_rest: &tenant_query_all - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - delegate_to: localhost - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - nm_query_all_tenants is not changed - -# QUERY A TENANT -- name: Query our tenant - aci_rest: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - delegate_to: localhost - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - nm_query_tenant is not changed - -# REMOVE TENANT -- name: Remove tenant (normal mode) - aci_rest: *tenant_absent - delegate_to: localhost - register: nm_remove_tenant - -- name: Remove tenant again (normal mode) - aci_rest: *tenant_absent - delegate_to: localhost - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - nm_remove_tenant is changed - - nm_remove_tenant_again is not changed - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (normal mode) - aci_rest: *tenant_query - delegate_to: localhost - register: nm_query_non_tenant - -- name: Verify query_non_tenant - assert: - that: - - nm_query_non_tenant is not changed diff --git a/test/integration/targets/aci_rest/tasks/json_string.yml b/test/integration/targets/aci_rest/tasks/json_string.yml deleted file mode 100644 index 34d0ff4c98..0000000000 --- a/test/integration/targets/aci_rest/tasks/json_string.yml +++ /dev/null @@ -1,156 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_rest: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: delete - -# ADD TENANT -- name: Add tenant (normal mode) - aci_rest: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: | - { - "fvTenant": { - "attributes": { - "name": "ansible_test" - } - } - } - register: nm_add_tenant - -- name: Add tenant again (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - nm_add_tenant is changed - - nm_add_tenant_again is not changed - -# CHANGE TENANT -- name: Change description of tenant (normal mode) - aci_rest: &tenant_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: | - { - "fvTenant": { - "attributes": { - "descr": "Ansible test tenant", - "name": "ansible_test" - } - } - } - register: nm_add_tenant_descr - -- name: Change description of tenant again (normal mode) - aci_rest: *tenant_changed - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - nm_add_tenant_descr is changed - - nm_add_tenant_descr_again is not changed - -# ADD TENANT AGAIN -- name: Add tenant again with no description (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - nm_add_tenant_again_no_descr is not changed - -# QUERY ALL TENANTS -- name: Query all tenants (normal mode) - aci_rest: &tenant_query_all - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - nm_query_all_tenants is not changed - -# QUERY A TENANT -- name: Query our tenant - aci_rest: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - nm_query_tenant is not changed - -# REMOVE TENANT -- name: Remove tenant (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant - -- name: Remove tenant again (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - nm_remove_tenant is changed - - nm_remove_tenant_again is not changed - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (normal mode) - aci_rest: *tenant_query - register: nm_query_non_tenant - -- name: Verify query_non_tenant - assert: - that: - - nm_query_non_tenant is not changed diff --git a/test/integration/targets/aci_rest/tasks/main.yml b/test/integration/targets/aci_rest/tasks/main.yml deleted file mode 100644 index c7f7f20e9d..0000000000 --- a/test/integration/targets/aci_rest/tasks/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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 - -- include_tasks: yaml_inline.yml - tags: yaml_inline - -- include_tasks: yaml_string.yml - tags: yaml_string - -- include_tasks: json_inline.yml - tags: json_inline - -- include_tasks: json_string.yml - tags: json_string - -- include_tasks: xml_string.yml - tags: xml_string - -- include_tasks: error_handling.yml - tags: error_handling diff --git a/test/integration/targets/aci_rest/tasks/xml_string.yml b/test/integration/targets/aci_rest/tasks/xml_string.yml deleted file mode 100644 index c58aa488a9..0000000000 --- a/test/integration/targets/aci_rest/tasks/xml_string.yml +++ /dev/null @@ -1,143 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_rest: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].xml - method: delete - -# ADD TENANT -- name: Add tenant (normal mode) - aci_rest: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.xml - method: post - content: | - <fvTenant name="ansible_test"/> - register: nm_add_tenant - -- name: Add tenant again (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - nm_add_tenant is changed - - nm_add_tenant_again is not changed - -# CHANGE TENANT -- name: Change description of tenant (normal mode) - aci_rest: &tenant_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.xml - method: post - content: | - <fvTenant name="ansible_test" descr="Ansible test tenant"/> - register: nm_add_tenant_descr - -- name: Change description of tenant again (normal mode) - aci_rest: *tenant_changed - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - nm_add_tenant_descr is changed - - nm_add_tenant_descr_again is not changed - -# ADD TENANT AGAIN -- name: Add tenant again with no description (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - nm_add_tenant_again_no_descr is not changed - -# QUERY ALL TENANTS -- name: Query all tenants (normal mode) - aci_rest: &tenant_query_all - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].xml - method: get - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - nm_query_all_tenants is not changed - -# QUERY A TENANT -- name: Query our tenant - aci_rest: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].xml - method: get - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - nm_query_tenant is not changed - -# REMOVE TENANT -- name: Remove tenant (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant - -- name: Remove tenant again (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - nm_remove_tenant is changed - - nm_remove_tenant_again is not changed - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (normal mode) - aci_rest: *tenant_query - register: nm_query_non_tenant - -- name: Verify query_non_tenant - assert: - that: - - nm_query_non_tenant is not changed diff --git a/test/integration/targets/aci_rest/tasks/yaml_inline.yml b/test/integration/targets/aci_rest/tasks/yaml_inline.yml deleted file mode 100644 index 58b139d354..0000000000 --- a/test/integration/targets/aci_rest/tasks/yaml_inline.yml +++ /dev/null @@ -1,148 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_rest: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: delete - -# ADD TENANT -- name: Add tenant (normal mode) - aci_rest: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: - fvTenant: - attributes: - name: ansible_test - register: nm_add_tenant - -- name: Add tenant again (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - nm_add_tenant is changed - - nm_add_tenant_again is not changed - -# CHANGE TENANT -- name: Change description of tenant (normal mode) - aci_rest: &tenant_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: - fvTenant: - attributes: - name: ansible_test - descr: Ansible test tenant - register: nm_add_tenant_descr - -- name: Change description of tenant again (normal mode) - aci_rest: *tenant_changed - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - nm_add_tenant_descr is changed - - nm_add_tenant_descr_again is not changed - -# ADD TENANT AGAIN -- name: Add tenant again with no description (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - nm_add_tenant_again_no_descr is not changed - -# QUERY ALL TENANTS -- name: Query all tenants (normal mode) - aci_rest: &tenant_query_all - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - nm_query_all_tenants is not changed - -# QUERY A TENANT -- name: Query our tenant - aci_rest: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - nm_query_tenant is not changed - -# REMOVE TENANT -- name: Remove tenant (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant - -- name: Remove tenant again (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - nm_remove_tenant is changed - - nm_remove_tenant_again is not changed - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (normal mode) - aci_rest: *tenant_query - register: nm_query_non_tenant - -- name: Verify query_non_tenant - assert: - that: - - nm_query_non_tenant is not changed diff --git a/test/integration/targets/aci_rest/tasks/yaml_string.yml b/test/integration/targets/aci_rest/tasks/yaml_string.yml deleted file mode 100644 index d9b5e767bf..0000000000 --- a/test/integration/targets/aci_rest/tasks/yaml_string.yml +++ /dev/null @@ -1,148 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_rest: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: delete - -# ADD TENANT -- name: Add tenant (normal mode) - aci_rest: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: | - fvTenant: - attributes: - name: ansible_test - register: nm_add_tenant - -- name: Add tenant again (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - nm_add_tenant is changed - - nm_add_tenant_again is not changed - -# CHANGE TENANT -- name: Change description of tenant (normal mode) - aci_rest: &tenant_changed - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni.json - method: post - content: | - fvTenant: - attributes: - name: ansible_test - descr: Ansible test tenant - register: nm_add_tenant_descr - -- name: Change description of tenant again (normal mode) - aci_rest: *tenant_changed - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - nm_add_tenant_descr is changed - - nm_add_tenant_descr_again is not changed - -# ADD TENANT AGAIN -- name: Add tenant again with no description (normal mode) - aci_rest: *tenant_present - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - nm_add_tenant_again_no_descr is not changed - -# QUERY ALL TENANTS -- name: Query all tenants (normal mode) - aci_rest: &tenant_query_all - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - nm_query_all_tenants is not changed - -# QUERY A TENANT -- name: Query our tenant - aci_rest: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - path: /api/mo/uni/tn-[ansible_test].json - method: get - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - nm_query_tenant is not changed - -# REMOVE TENANT -- name: Remove tenant (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant - -- name: Remove tenant again (normal mode) - aci_rest: *tenant_absent - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - nm_remove_tenant is changed - - nm_remove_tenant_again is not changed - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (normal mode) - aci_rest: *tenant_query - register: nm_query_non_tenant - -- name: Verify query_non_tenant - assert: - that: - - nm_query_non_tenant is not changed diff --git a/test/integration/targets/aci_static_binding_to_epg/aliases b/test/integration/targets/aci_static_binding_to_epg/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_static_binding_to_epg/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml b/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml deleted file mode 100644 index 7f3d3ce632..0000000000 --- a/test/integration/targets/aci_static_binding_to_epg/tasks/main.yml +++ /dev/null @@ -1,203 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 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: Ensure static path to epg is deleted for test kick off - aci_static_binding_to_epg: &aci_static_binding_to_epg_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - ap: anstest - epg: anstest - interface_type: switch_port - pod: 1 - leafs: 101 - interface: '1/7' - state: absent - -- name: Ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - tenant: anstest - state: present - register: tenant_present - -- name: Ensure ap exists - aci_ap: &aci_ap_present - <<: *aci_tenant_present - ap: anstest - register: ap_present - -- name: Ensure epg exists - aci_epg: &aci_epg_present - <<: *aci_ap_present - epg: anstest - register: epg_present - -- name: Bind static-binding to epg - check mode works - aci_static_binding_to_epg: &aci_static_binding_to_epg_present - <<: *aci_epg_present - encap_id: 222 - deploy_immediacy: lazy - interface_mode: trunk - interface_type: switch_port - pod: 1 - leafs: 101 - interface: '1/7' - check_mode: yes - register: provide_present_check_mode - -- name: Bind static-binding to epg - provide works (creation w/o check-mode) - aci_static_binding_to_epg: - <<: *aci_static_binding_to_epg_present - ignore_errors: yes - register: provide_present - -- name: Bind static-binding to epg - primary_encap_id works - aci_static_binding_to_epg: &primary_encap_id_present - <<: *aci_static_binding_to_epg_present - primary_encap_id: 50 - register: primary_ecap_id_present - -- name: Bind contract to epg - idempotency works again - aci_static_binding_to_epg: - <<: *primary_encap_id_present - register: idempotent_present - -- name: Bind contract to epg - update description (check mode) - aci_static_binding_to_epg: - <<: *primary_encap_id_present - description: Binding description - check_mode: yes - register: description_cm - -- name: Bind contract to epg - update description (run mode) - aci_static_binding_to_epg: - <<: *primary_encap_id_present - description: Binding description - register: description - -- name: Bind contract to epg - update description (check mode) - aci_static_binding_to_epg: - <<: *primary_encap_id_present - description: Binding description - register: idempotent_description_cm - -- name: Bind contract to epg - update description (run mode) - aci_static_binding_to_epg: - <<: *primary_encap_id_present - description: Binding description - register: idempotent_description - -- name: Missing required param - failure message works - aci_static_binding_to_epg: - <<: *aci_tenant_present - ignore_errors: yes - register: missing_required_present - -- name: Present assertions - assert: - that: - - provide_present_check_mode is changed - - 'provide_present_check_mode.sent == {"fvRsPathAtt": {"attributes": { "encap": "vlan-222", "instrImedcy": "lazy", "mode": "regular", "tDn": "topology/pod-1/paths-101/pathep-[eth1/7]"}}}' - - provide_present is changed - - provide_present.sent == provide_present_check_mode.sent - - provide_present.previous == [] - - primary_ecap_id_present is changed - - 'primary_ecap_id_present.sent == {"fvRsPathAtt": {"attributes": {"primaryEncap": "vlan-50"}}}' - - description_cm is changed - - description is changed - - idempotent_description_cm is not changed - - idempotent_description is not changed - - missing_required_present is failed - - 'missing_required_present.msg == "state is present but all of the following are missing: ap, encap_id, epg, interface, leafs, pod_id"' - - missing_required_present is failed - - -- name: Query specific binding - aci_static_binding_to_epg: - <<: *primary_encap_id_present - state: query - register: query_static_binding - -- name: Query all bindings - aci_static_binding_to_epg: - <<: *aci_tenant_present - state: query - register: query_all - -- name: Query assertions - assert: - that: - - query_static_binding is not changed - - query_static_binding.current != [] - - '"uni/tn-anstest/ap-anstest/epg-anstest/rspathAtt-[topology/pod-1/paths-101/pathep-[eth1/7]]" in query_static_binding.url' - - query_all is not changed - - '"uni/tn-anstest.json" in query_all.url' - - -- name: Delete provide binding - deletion works - aci_static_binding_to_epg: - <<: *primary_encap_id_present - state: absent - register: provide_absent - -- name: Delete provide binding - idempotency works - aci_static_binding_to_epg: - <<: *primary_encap_id_present - state: absent - register: provide_absent_idempotent - -- name: Missing param - failure message works - aci_static_binding_to_epg: - <<: *aci_tenant_present - state: absent - ignore_errors: yes - register: missing_param_absent - -- name: Absent assertions - assert: - that: - - provide_absent is changed - - provide_absent.previous.0.fvRsPathAtt is defined - - provide_absent_idempotent is not changed - - provide_absent_idempotent.previous == [] - - missing_param_absent is failed - - missing_param_absent is failed - - 'missing_param_absent.msg == "state is absent but all of the following are missing: ap, epg, interface, leafs, pod_id"' - -- name: Cleanup binding - aci_static_binding_to_epg: - <<: *aci_static_binding_to_epg_absent - -- name: Cleanup epg - aci_epg: - <<: *aci_epg_present - state: absent - -- name: Cleanup ap - aci_ap: - <<: *aci_ap_present - state: absent - -- name: Cleanup tenant - aci_tenant: - <<: *aci_tenant_present - state: absent diff --git a/test/integration/targets/aci_switch_leaf_selector/aliases b/test/integration/targets/aci_switch_leaf_selector/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_switch_leaf_selector/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_switch_leaf_selector/tasks/main.yml b/test/integration/targets/aci_switch_leaf_selector/tasks/main.yml deleted file mode 100644 index fccc77c983..0000000000 --- a/test/integration/targets/aci_switch_leaf_selector/tasks/main.yml +++ /dev/null @@ -1,138 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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: Deleting Switch Policy Leaf profile exists for kick off - aci_switch_policy_leaf_profile: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_profile: sw_name_test - 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 }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - leaf_profile: sw_name_test - state: present - register: leaf_profile_present - -# TODO: Ensure that leaf Policy Group Exists (module missing) (infra:AccPortGrp) - -- name: Adding a switch policy leaf profile selector associated Node Block range (w/o policy group) - check mode works - aci_switch_leaf_selector: &aci_switch_leaf_selector_present - <<: *aci_switch_policy_leaf_profile_present - leaf: leaf_selector_name - leaf_node_blk: node_blk_name - from: 1011 - to: 1011 - check_mode: yes - register: sw_leaf_selec_check_mode_present - -- name: Adding a switch policy leaf profile selector associated Node Block range (w/o policy group) - creation works - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_present - register: sw_leaf_selec_present - -- name: Adding a switch policy leaf profile selector associated Node Block range (w/o policy group) - idempotency works - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_present - register: sw_leaf_selec_idempotent - -- name: Adding a switch policy leaf profile selector associated Node Block range (w/ policy group) - update works - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_present - policy_group: anstest_policygroupname - register: sw_leaf_selec_update - -# TODO: also test for errors -- name: present assertions - assert: - that: - - sw_leaf_selec_check_mode_present is changed - - sw_leaf_selec_present is changed - - sw_leaf_selec_present.previous == [] - - 'sw_leaf_selec_present.sent == {"infraLeafS": {"attributes": {"name": "leaf_selector_name"}, "children": [{"infraNodeBlk": {"attributes": {"from_": "1011", "name": "node_blk_name", "to_": "1011"}}}]}}' - - sw_leaf_selec_idempotent is not changed - - sw_leaf_selec_idempotent.sent == {} - - sw_leaf_selec_update is changed - - 'sw_leaf_selec_update.sent == {"infraLeafS": {"attributes": {},"children": [{"infraRsAccNodePGrp": {"attributes": {"tDn": "uni/infra/funcprof/accnodepgrp-anstest_policygroupname"}}}]}}' - -- name: Query Specific switch policy leaf profile selector - aci_switch_leaf_selector: - <<: *aci_switch_policy_leaf_profile_present - leaf: leaf_selector_name # "{{ fake_var | default(omit) }}" ? - state: query - register: binding_query - -- name: present assertions - assert: - that: - - binding_query is not changed - - binding_query.current | length >= 1 - - '"api/mo/uni/infra/nprof-sw_name_test/leaves-leaf_selector_name-typ-range.json" in binding_query.url' - -- name: Remove binding of interface access port selector and Interface Policy Leaf Profile - check mode - aci_switch_leaf_selector: &aci_switch_leaf_selector_absent - <<: *aci_switch_policy_leaf_profile_present - leaf: leaf_selector_name - state: absent - check_mode: yes - register: sw_leaf_selec_check_mode_absent - -- name: Remove switch policy leaf profile selector - delete works - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_absent - register: sw_leaf_selec_absent - -- name: Remove switch policy leaf profile selector - idempotency works - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_absent - register: sw_leaf_selec_absent_idempotent - -- name: Remove switch policy leaf profile selector - check mode - aci_switch_leaf_selector: - <<: *aci_switch_policy_leaf_profile_present - #access_port_selector: anstest_accessportselector - state: absent - ignore_errors: yes - register: sw_leaf_selec_absent_missing_param - -- name: absent assertions - assert: - that: - - sw_leaf_selec_check_mode_absent is changed - - sw_leaf_selec_check_mode_absent.previous != [] - - sw_leaf_selec_absent is changed - - sw_leaf_selec_absent.previous == sw_leaf_selec_check_mode_absent.previous - - sw_leaf_selec_absent_idempotent is not changed - - sw_leaf_selec_absent_idempotent.previous == [] - - sw_leaf_selec_absent_missing_param is failed - - 'sw_leaf_selec_absent_missing_param.msg == "state is absent but all of the following are missing: leaf"' - - -- name: Remove switch policy leaf profile selector - Clean up - aci_switch_leaf_selector: - <<: *aci_switch_leaf_selector_absent - state: absent - -- name: Deleting Switch Policy Leaf profile exists for kick off - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_present - state: absent diff --git a/test/integration/targets/aci_switch_policy_leaf_profile/aliases b/test/integration/targets/aci_switch_policy_leaf_profile/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_switch_policy_leaf_profile/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_switch_policy_leaf_profile/tasks/main.yml b/test/integration/targets/aci_switch_policy_leaf_profile/tasks/main.yml deleted file mode 100644 index cee1c26d3c..0000000000 --- a/test/integration/targets/aci_switch_policy_leaf_profile/tasks/main.yml +++ /dev/null @@ -1,213 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 - - -# CLEAN ENVIRONMENT -- name: Remove leaf profile - aci_switch_policy_leaf_profile: &aci_switch_policy_leaf_profile_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_profile: ansible_test - state: absent - - -# ADD LEAF PROFILE -- name: Add switch policy leaf profile (check_mode) - aci_switch_policy_leaf_profile: &aci_switch_policy_leaf_profile_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - leaf_profile: ansible_test - state: present - check_mode: yes - register: cm_add_switch_leaf_profile - -- name: Add leaf profile (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_present - register: nm_add_switch_leaf_profile - -- name: Add leaf profile again (check_mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_present - check_mode: yes - register: cm_add_switch_leaf_profile_again - -- name: Add leaf profile again (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_present - register: nm_add_switch_leaf_profile_again - -- name: Verify add_switch_leaf_profile - assert: - that: - - cm_add_switch_leaf_profile is changed - - nm_add_switch_leaf_profile is changed - - cm_add_switch_leaf_profile_again is not changed - - nm_add_switch_leaf_profile_again is not changed - - -# CHANGE SWITCH LEAF PROFILE -- name: Change description of leaf profile (check_mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_present - description: Ansible test leaf profile - check_mode: yes - register: cm_add_switch_leaf_profile_descr - -- name: Change description of leaf profile (normal mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_present - description: Ansible test leaf profile - register: nm_add_switch_leaf_profile_descr - -- name: Change description of leaf profile again (check_mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_present - description: Ansible test leaf profile - check_mode: yes - register: cm_add_switch_leaf_profile_descr_again - -- name: Change description of leaf profile again (normal mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_present - description: Ansible test leaf profile - register: nm_add_switch_leaf_profile_descr_again - -- name: Verify add_switch_leaf_profile_descr - assert: - that: - - cm_add_switch_leaf_profile_descr is changed - - nm_add_switch_leaf_profile_descr is changed - - cm_add_switch_leaf_profile_descr_again is not changed - - nm_add_switch_leaf_profile_descr_again is not changed - - -# ADD LEAF PROFILE AGAIN -- name: Add leaf profile again with no description (check_mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_present - check_mode: yes - register: cm_add_switch_leaf_profile_again_no_descr - -- name: Add leaf profile again with no description (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_present - register: nm_add_switch_leaf_profile_again_no_descr - -- name: Verify add_switch_leaf_profile_again_no_descr - assert: - that: - - cm_add_switch_leaf_profile_again_no_descr is not changed - - nm_add_switch_leaf_profile_again_no_descr is not changed - - -# QUERY ALL LEAF PROFILES -- name: Query all profiles (check_mode) - aci_switch_policy_leaf_profile: &aci_switch_policy_leaf_profile_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_switch_leaf_profiles - -- name: Query all switch_leaf_profiles (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_query - register: nm_query_all_switch_leaf_profiles - -- name: Verify query_all_switch_leaf_profiles - assert: - that: - - cm_query_all_switch_leaf_profiles is not changed - - nm_query_all_switch_leaf_profiles is not changed - # NOTE: Order of switch_leaf_profiles is not stable between calls - #- cm_query_all_switch_leaf_profiles == nm_query_all_switch_leaf_profiles - - -# QUERY A LEAF PROFILE -- name: Query our switch_leaf_profile - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_query - leaf_profile: ansible_test - check_mode: yes - register: cm_query_switch_leaf_profile - -- name: Query our switch_leaf_profile - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_query - leaf_profile: ansible_test - register: nm_query_switch_leaf_profile - -- name: Verify query_switch_leaf_profile - assert: - that: - - cm_query_switch_leaf_profile is not changed - - nm_query_switch_leaf_profile is not changed - - cm_query_switch_leaf_profile == nm_query_switch_leaf_profile - - -# REMOVE LEAF PROFILE -- name: Remove switch_leaf_profile (check_mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_absent - check_mode: yes - register: cm_remove_switch_leaf_profile - -- name: Remove switch_leaf_profile (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_absent - register: nm_remove_switch_leaf_profile - -- name: Remove switch_leaf_profile again (check_mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_absent - check_mode: yes - register: cm_remove_switch_leaf_profile_again - -- name: Remove switch_leaf_profile again (normal mode) - aci_switch_policy_leaf_profile: *aci_switch_policy_leaf_profile_absent - register: nm_remove_switch_leaf_profile_again - -- name: Verify remove_switch_leaf_profile - assert: - that: - - cm_remove_switch_leaf_profile is changed - - nm_remove_switch_leaf_profile is changed - - cm_remove_switch_leaf_profile_again is not changed - - nm_remove_switch_leaf_profile_again is not changed - - -# QUERY NON-EXISTING LEAF PROFILE -- name: Query non-existing switch_leaf_profile (check_mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_query - leaf_profile: ansible_test - check_mode: yes - register: cm_query_non_switch_leaf_profile - -- name: Query non-existing switch_leaf_profile (normal mode) - aci_switch_policy_leaf_profile: - <<: *aci_switch_policy_leaf_profile_query - leaf_profile: ansible_test - register: nm_query_non_switch_leaf_profile - -# TODO: Implement more tests -- name: Verify query_non_switch_leaf_profile - assert: - that: - - cm_query_non_switch_leaf_profile is not changed - - nm_query_non_switch_leaf_profile is not changed - - cm_query_non_switch_leaf_profile == nm_query_non_switch_leaf_profile diff --git a/test/integration/targets/aci_switch_policy_vpc_protection_group/aliases b/test/integration/targets/aci_switch_policy_vpc_protection_group/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_switch_policy_vpc_protection_group/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_switch_policy_vpc_protection_group/tasks/main.yml b/test/integration/targets/aci_switch_policy_vpc_protection_group/tasks/main.yml deleted file mode 100644 index 3924800d5d..0000000000 --- a/test/integration/targets/aci_switch_policy_vpc_protection_group/tasks/main.yml +++ /dev/null @@ -1,213 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 - -# CLEAN ENVIRONMENT -- name: Remove vpc protection group - aci_switch_policy_vpc_protection_group: &aci_switch_policy_vpc_protection_group_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - protection_group: ansible_test - state: absent - - -# ADD VPC PROTECTION GROUP -- name: Add vpc protection group (check_mode) - aci_switch_policy_vpc_protection_group: &aci_switch_policy_vpc_protection_group_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - protection_group: ansible_test - protection_group_id: 6 - switch_1_id: 3811 - switch_2_id: 3812 - state: present - check_mode: yes - register: cm_add_vpc_prot_grp - -- name: Add vpc protection group (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_present - register: nm_add_vpc_prot_grp - -- name: Add vpc protection group again (check_mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_present - check_mode: yes - register: cm_add_vpc_prot_grp_again - -- name: Add vpc protection group again (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_present - register: nm_add_vpc_prot_grp_again - -- name: Verify add_vpc_prot_grp_again - assert: - that: - - cm_add_vpc_prot_grp is changed - - nm_add_vpc_prot_grp is changed - - cm_add_vpc_prot_grp_again is not changed - - nm_add_vpc_prot_grp_again is not changed - - -# CHANGE VPC PROTECTION GROUP -- name: Change vpc domain policy of vpc protection group (check_mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_present - vpc_domain_policy: ansible_test_pol - check_mode: yes - register: cm_add_vpc_prot_grp_pol - -- name: Change vpc domain policy of vpc protection group (normal mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_present - vpc_domain_policy: ansible_test_pol - register: nm_add_vpc_prot_grp_pol - -- name: Change vpc domain policy of vpc protection group again (check_mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_present - vpc_domain_policy: ansible_test_pol - check_mode: yes - register: cm_add_vpc_prot_grp_pol_again - -- name: Change vpc domain policy of vpc protection group again (normal mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_present - vpc_domain_policy: ansible_test_pol - register: nm_add_vpc_prot_grp_pol_again - -- name: Verify add_vpc_prot_grp_pol - assert: - that: - - cm_add_vpc_prot_grp_pol is changed - - nm_add_vpc_prot_grp_pol is changed - - cm_add_vpc_prot_grp_pol_again is not changed - - nm_add_vpc_prot_grp_pol_again is not changed - - -# ADD FABRIC NODE AGAIN -- name: Add vpc protection group again with no domain policy (check_mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_present - check_mode: yes - register: cm_add_vpc_prot_grp_again_no_pol - -- name: Add vpc protection group again with no domain policy (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_present - register: nm_add_vpc_prot_grp_again_no_pol - -- name: Verify add_vpc_prot_grp_again_no_pol - assert: - that: - - cm_add_vpc_prot_grp_again_no_pol is not changed - - nm_add_vpc_prot_grp_again_no_pol is not changed - - -# QUERY ALL VPC PROTECTION GROUPS -- name: Query vpc protection groups (check_mode) - aci_switch_policy_vpc_protection_group: &aci_switch_policy_vpc_protection_group_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_vpc_prot_grps - -- name: Query all vpc protection groups (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_query - register: nm_query_all_vpc_prot_grps - -- name: Verify query_all_vpc_prot_grps - assert: - that: - - cm_query_all_vpc_prot_grps is not changed - - nm_query_all_vpc_prot_grps is not changed - - cm_query_all_vpc_prot_grps == nm_query_all_vpc_prot_grps - - -# QUERY A VPC PROTECTION GROUP -- name: Query our vpc protection group - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_query - protection_group: ansible_test # might need node_id too - check_mode: yes - register: cm_query_vpc_prot_grp - -- name: Query our vpc protection group - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_query - protection_group: ansible_test - register: nm_query_vpc_prot_grp - -- name: Verify query_vpc_prot_grp - assert: - that: - - cm_query_vpc_prot_grp is not changed - - nm_query_vpc_prot_grp is not changed - - cm_query_vpc_prot_grp == nm_query_vpc_prot_grp - - -# REMOVE FABRIC NODE -- name: Remove vpc protection group (check_mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_absent - check_mode: yes - register: cm_remove_vpc_prot_grp - -- name: Remove vpc protection group (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_absent - register: nm_remove_vpc_prot_grp - -- name: Remove vpc protection group again (check_mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_absent - check_mode: yes - register: cm_remove_vpc_prot_grp_again - -- name: Remove vpc protection group again (normal mode) - aci_switch_policy_vpc_protection_group: *aci_switch_policy_vpc_protection_group_absent - register: nm_remove_vpc_prot_grp_again - -- name: Verify remove_vpc_prot_grp - assert: - that: - - cm_remove_vpc_prot_grp is changed - - nm_remove_vpc_prot_grp is changed - - cm_remove_vpc_prot_grp_again is not changed - - nm_remove_vpc_prot_grp_again is not changed - - -# QUERY NON-EXISTING LEAF PROFILE -- name: Query non-existing vpc protection group (check_mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_query - protection_group: ansible_test - check_mode: yes - register: cm_query_non_vpc_prot_grp - -- name: Query non-existing vpc protection group (normal mode) - aci_switch_policy_vpc_protection_group: - <<: *aci_switch_policy_vpc_protection_group_query - protection_group: ansible_test - register: nm_query_non_vpc_prot_grp - -- name: Verify query_non_vpc_prot_grp - assert: - that: - - cm_query_non_vpc_prot_grp is not changed - - nm_query_non_vpc_prot_grp is not changed - - cm_query_non_vpc_prot_grp == nm_query_non_vpc_prot_grp diff --git a/test/integration/targets/aci_taboo_contract/aliases b/test/integration/targets/aci_taboo_contract/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_taboo_contract/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_taboo_contract/tasks/main.yml b/test/integration/targets/aci_taboo_contract/tasks/main.yml deleted file mode 100644 index a2099e7ff7..0000000000 --- a/test/integration/targets/aci_taboo_contract/tasks/main.yml +++ /dev/null @@ -1,286 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -# CLEAN ENVIRONMENT -- name: Remove taboo contract - aci_taboo_contract: &taboo_contract_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - taboo_contract: taboo_contract_test - state: absent - -- name: Add tenant - aci_tenant: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - state: present - - -# ADD TABOO CONTRACT -- name: Add taboo contract (check_mode) - aci_taboo_contract: &taboo_contract_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - taboo_contract: taboo_contract_test - state: present - check_mode: yes - register: cm_add_taboo_contract - -- name: Add taboo contract (normal mode) - aci_taboo_contract: *taboo_contract_present - register: nm_add_taboo_contract - -- name: Verify add_taboo_contract - assert: - that: - - cm_add_taboo_contract is changed - - nm_add_taboo_contract is changed - - 'cm_add_taboo_contract.sent == nm_add_taboo_contract.sent == {"vzTaboo": {"attributes": {"name": "taboo_contract_test"}}}' - - 'cm_add_taboo_contract.proposed == nm_add_taboo_contract.proposed == {"vzTaboo": {"attributes": {"name": "taboo_contract_test"}}}' - - cm_add_taboo_contract.previous == nm_add_taboo_contract.previous == [] - # NOTE: We cannot fix this easily - - cm_add_taboo_contract.current == [] - - nm_add_taboo_contract.current.0.vzTaboo.attributes.descr == '' - - nm_add_taboo_contract.current.0.vzTaboo.attributes.dn == 'uni/tn-ansible_test/taboo-taboo_contract_test' - - nm_add_taboo_contract.current.0.vzTaboo.attributes.name == 'taboo_contract_test' - -- name: Add taboo_contract again (check_mode) - aci_taboo_contract: *taboo_contract_present - check_mode: yes - register: cm_add_taboo_contract_again - -- name: Add taboo contract again (normal mode) - aci_taboo_contract: *taboo_contract_present - register: nm_add_taboo_contract_again - -- name: Verify add_taboo_contract_again - assert: - that: - - cm_add_taboo_contract_again is not changed - - nm_add_taboo_contract_again is not changed - - cm_add_taboo_contract_again.current == nm_add_taboo_contract_again.current == nm_add_taboo_contract.current - - -# CHANGE TABOO CONTRACT -- name: Change description of taboo contract (check_mode) - aci_taboo_contract: - <<: *taboo_contract_present - description: Ansible test taboo contract - check_mode: yes - register: cm_add_taboo_contract_descr - -- name: Change description of taboo contract (normal mode) - aci_taboo_contract: - <<: *taboo_contract_present - description: Ansible test taboo contract - register: nm_add_taboo_contract_descr - -- name: Verify add_taboo_contract_descr - assert: - that: - - cm_add_taboo_contract_descr is changed - - nm_add_taboo_contract_descr is changed - - 'cm_add_taboo_contract_descr.sent == nm_add_taboo_contract_descr.sent == {"vzTaboo": {"attributes": {"descr": "Ansible test taboo contract"}}}' - - 'cm_add_taboo_contract_descr.proposed == nm_add_taboo_contract_descr.proposed == {"vzTaboo": {"attributes": {"descr": "Ansible test taboo contract", "name": "taboo_contract_test"}}}' - - cm_add_taboo_contract_descr.previous == nm_add_taboo_contract_descr.previous == cm_add_taboo_contract_descr.current == nm_add_taboo_contract.current - - nm_add_taboo_contract_descr.current.0.vzTaboo.attributes.descr == 'Ansible test taboo contract' - - nm_add_taboo_contract_descr.current.0.vzTaboo.attributes.dn == 'uni/tn-ansible_test/taboo-taboo_contract_test' - - nm_add_taboo_contract_descr.current.0.vzTaboo.attributes.name == 'taboo_contract_test' - -- name: Change description of taboo contract again (check_mode) - aci_taboo_contract: - <<: *taboo_contract_present - description: Ansible test taboo contract - check_mode: yes - register: cm_add_taboo_contract_descr_again - -- name: Change description of taboo contract again (normal mode) - aci_taboo_contract: - <<: *taboo_contract_present - description: Ansible test taboo contract - register: nm_add_taboo_contract_descr_again - -- name: Verify add_taboo_contract_descr_again - assert: - that: - - cm_add_taboo_contract_descr_again is not changed - - nm_add_taboo_contract_descr_again is not changed - - cm_add_taboo_contract_descr_again.current == nm_add_taboo_contract_descr_again.current == nm_add_taboo_contract_descr.current - - -# ADD TABOO CONTRACT AGAIN -- name: Add taboo contract again with no description (check_mode) - aci_taboo_contract: *taboo_contract_present - check_mode: yes - register: cm_add_taboo_contract_again_no_descr - -- name: Add taboo contract again with no description (normal mode) - aci_taboo_contract: *taboo_contract_present - register: nm_add_taboo_contract_again_no_descr - -- name: Verify add_taboo_contract_again_no_descr - assert: - that: - - cm_add_taboo_contract_again_no_descr is not changed - - nm_add_taboo_contract_again_no_descr is not changed - - cm_add_taboo_contract_again_no_descr.current == nm_add_taboo_contract_again_no_descr.current == nm_add_taboo_contract_descr.current - - -# QUERY ALL TABOO CONTRACTS -- name: Query all taboo contracts (check_mode) - aci_taboo_contract: &taboo_contract_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_taboo_contracts - -- name: Query all taboo contracts (normal mode) - aci_taboo_contract: *taboo_contract_query - register: nm_query_all_taboo_contracts - -- name: Verify query_all_taboo_contracts - assert: - that: - - cm_query_all_taboo_contracts is not changed - - nm_query_all_taboo_contracts is not changed - - cm_query_all_taboo_contracts == nm_query_all_taboo_contracts - - cm_query_all_taboo_contracts.current|length >= 1 - - -# QUERY A TABOO CONTRACT -- name: Query our taboo contract - aci_taboo_contract: - <<: *taboo_contract_query - tenant: ansible_test - taboo_contract: taboo_contract_test - check_mode: yes - register: cm_query_taboo_contract - -- name: Query our taboo contract - aci_taboo_contract: - <<: *taboo_contract_query - tenant: ansible_test - taboo_contract: taboo_contract_test - register: nm_query_taboo_contract - -- name: Verify query_taboo_contract - assert: - that: - - cm_query_taboo_contract is not changed - - nm_query_taboo_contract is not changed - - cm_query_taboo_contract == nm_query_taboo_contract - - nm_query_taboo_contract.current.0.vzTaboo.attributes.descr == 'Ansible test taboo contract' - - nm_query_taboo_contract.current.0.vzTaboo.attributes.dn == 'uni/tn-ansible_test/taboo-taboo_contract_test' - - nm_query_taboo_contract.current.0.vzTaboo.attributes.name == 'taboo_contract_test' - - -# REMOVE TABOO CONTRACT -- name: Remove taboo contract (check_mode) - aci_taboo_contract: *taboo_contract_absent - check_mode: yes - register: cm_remove_taboo_contract - -- name: Remove taboo contract (normal mode) - aci_taboo_contract: *taboo_contract_absent - register: nm_remove_taboo_contract - -- name: Verify remove_taboo_contract - assert: - that: - - cm_remove_taboo_contract is changed - - nm_remove_taboo_contract is changed - - 'cm_remove_taboo_contract.current == cm_remove_taboo_contract.previous == nm_remove_taboo_contract.previous == [{"vzTaboo": {"attributes": {"descr": "Ansible test taboo contract", "dn": "uni/tn-ansible_test/taboo-taboo_contract_test", "name": "taboo_contract_test", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_taboo_contract.current == [] - -- name: Remove taboo contract again (check_mode) - aci_taboo_contract: *taboo_contract_absent - check_mode: yes - register: cm_remove_taboo_contract_again - -- name: Remove taboo contract again (normal mode) - aci_taboo_contract: *taboo_contract_absent - register: nm_remove_taboo_contract_again - -- name: Verify remove_taboo_contract_again - assert: - that: - - cm_remove_taboo_contract_again is not changed - - nm_remove_taboo_contract_again is not changed - - cm_remove_taboo_contract_again.proposed == nm_remove_taboo_contract_again.proposed == {} - - cm_remove_taboo_contract_again.sent == nm_remove_taboo_contract_again.sent == {} - - cm_remove_taboo_contract_again.previous == nm_remove_taboo_contract_again.previous == [] - - cm_remove_taboo_contract_again.current == nm_remove_taboo_contract_again.current == [] - - -# QUERY NON-EXISTING TABOO CONTRACT -- name: Query non-existing taboo contract (check_mode) - aci_taboo_contract: - <<: *taboo_contract_query - tenant: ansible_test - taboo_contract: taboo_contract_test - check_mode: yes - register: cm_query_non_taboo_contract - -- name: Query non-existing taboo contract (normal mode) - aci_taboo_contract: - <<: *taboo_contract_query - tenant: ansible_test - taboo_contract: taboo_contract_test - register: nm_query_non_taboo_contract - -# TODO: Implement more tests -- name: Verify query_non_taboo_contract - assert: - that: - - cm_query_non_taboo_contract is not changed - - nm_query_non_taboo_contract is not changed - - cm_remove_taboo_contract_again.previous == nm_remove_taboo_contract_again.previous == [] - - cm_remove_taboo_contract_again.current == nm_remove_taboo_contract_again.current == [] - - -# PROVOKE ERRORS -- name: Error when required parameter is missing - aci_taboo_contract: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: present - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "state is present but all of the following are missing: tenant, taboo_contract"' diff --git a/test/integration/targets/aci_tenant/aliases b/test/integration/targets/aci_tenant/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_tenant/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_tenant/tasks/main.yml b/test/integration/targets/aci_tenant/tasks/main.yml deleted file mode 100644 index 0098fce7c0..0000000000 --- a/test/integration/targets/aci_tenant/tasks/main.yml +++ /dev/null @@ -1,213 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.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 - - -# CLEAN ENVIRONMENT -- name: Remove tenant - aci_tenant: &tenant_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - state: absent - - -# ADD TENANT -- name: Add tenant (check_mode) - aci_tenant: &tenant_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - tenant: ansible_test - state: present - check_mode: yes - register: cm_add_tenant - -- name: Add tenant (normal mode) - aci_tenant: *tenant_present - register: nm_add_tenant - -- name: Add tenant again (check_mode) - aci_tenant: *tenant_present - check_mode: yes - register: cm_add_tenant_again - -- name: Add tenant again (normal mode) - aci_tenant: *tenant_present - register: nm_add_tenant_again - -- name: Verify add_tenant - assert: - that: - - cm_add_tenant is changed - - nm_add_tenant is changed - - cm_add_tenant_again is not changed - - nm_add_tenant_again is not changed - - -# CHANGE TENANT -- name: Change description of tenant (check_mode) - aci_tenant: - <<: *tenant_present - description: Ansible test tenant - check_mode: yes - register: cm_add_tenant_descr - -- name: Change description of tenant (normal mode) - aci_tenant: - <<: *tenant_present - description: Ansible test tenant - register: nm_add_tenant_descr - -- name: Change description of tenant again (check_mode) - aci_tenant: - <<: *tenant_present - description: Ansible test tenant - check_mode: yes - register: cm_add_tenant_descr_again - -- name: Change description of tenant again (normal mode) - aci_tenant: - <<: *tenant_present - description: Ansible test tenant - register: nm_add_tenant_descr_again - -- name: Verify add_tenant_descr - assert: - that: - - cm_add_tenant_descr is changed - - nm_add_tenant_descr is changed - - cm_add_tenant_descr_again is not changed - - nm_add_tenant_descr_again is not changed - - -# ADD TENANT AGAIN -- name: Add tenant again with no description (check_mode) - aci_tenant: *tenant_present - check_mode: yes - register: cm_add_tenant_again_no_descr - -- name: Add tenant again with no description (normal mode) - aci_tenant: *tenant_present - register: nm_add_tenant_again_no_descr - -- name: Verify add_tenant_again_no_descr - assert: - that: - - cm_add_tenant_again_no_descr is not changed - - nm_add_tenant_again_no_descr is not changed - - -# QUERY ALL TENANTS -- name: Query all tenants (check_mode) - aci_tenant: &tenant_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_tenants - -- name: Query all tenants (normal mode) - aci_tenant: *tenant_query - register: nm_query_all_tenants - -- name: Verify query_all_tenants - assert: - that: - - cm_query_all_tenants is not changed - - nm_query_all_tenants is not changed - # NOTE: Order of tenants is not stable between calls - #- cm_query_all_tenants == nm_query_all_tenants - - -# QUERY A TENANT -- name: Query our tenant - aci_tenant: - <<: *tenant_query - tenant: ansible_test - check_mode: yes - register: cm_query_tenant - -- name: Query our tenant - aci_tenant: - <<: *tenant_query - tenant: ansible_test - register: nm_query_tenant - -- name: Verify query_tenant - assert: - that: - - cm_query_tenant is not changed - - nm_query_tenant is not changed - - cm_query_tenant == nm_query_tenant - - -# REMOVE TENANT -- name: Remove tenant (check_mode) - aci_tenant: *tenant_absent - check_mode: yes - register: cm_remove_tenant - -- name: Remove tenant (normal mode) - aci_tenant: *tenant_absent - register: nm_remove_tenant - -- name: Remove tenant again (check_mode) - aci_tenant: *tenant_absent - check_mode: yes - register: cm_remove_tenant_again - -- name: Remove tenant again (normal mode) - aci_tenant: *tenant_absent - register: nm_remove_tenant_again - -- name: Verify remove_tenant - assert: - that: - - cm_remove_tenant is changed - - nm_remove_tenant is changed - - cm_remove_tenant_again is not changed - - nm_remove_tenant_again is not changed - - -# QUERY NON-EXISTING TENANT -- name: Query non-existing tenant (check_mode) - aci_tenant: - <<: *tenant_query - tenant: ansible_test - check_mode: yes - register: cm_query_non_tenant - -- name: Query non-existing tenant (normal mode) - aci_tenant: - <<: *tenant_query - tenant: ansible_test - register: nm_query_non_tenant - -# TODO: Implement more tests -- name: Verify query_non_tenant - assert: - that: - - cm_query_non_tenant is not changed - - nm_query_non_tenant is not changed - - cm_query_non_tenant == nm_query_non_tenant diff --git a/test/integration/targets/aci_vlan_pool/aliases b/test/integration/targets/aci_vlan_pool/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_vlan_pool/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_vlan_pool/tasks/dynamic.yml b/test/integration/targets/aci_vlan_pool/tasks/dynamic.yml deleted file mode 100644 index 7b9257332a..0000000000 --- a/test/integration/targets/aci_vlan_pool/tasks/dynamic.yml +++ /dev/null @@ -1,296 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# CLEAN ENVIRONMENT -- name: Remove dynamic vlan pool - aci_vlan_pool: &dynamic_vlan_pool_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_allocation_mode: dynamic - state: absent - - -# ADD VLAN POOL -- name: Add dynamic vlan pool (check_mode) - aci_vlan_pool: &dynamic_vlan_pool_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_allocation_mode: dynamic - state: present - check_mode: yes - register: cm_add_dynamic_vlan_pool - -- name: Add dynamic vlan pool (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_present - register: nm_add_dynamic_vlan_pool - -- name: Verify add_dynamic_vlan_pool - assert: - that: - - cm_add_dynamic_vlan_pool is changed - - nm_add_dynamic_vlan_pool is changed - - 'cm_add_dynamic_vlan_pool.sent == nm_add_dynamic_vlan_pool.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "name": "anstest"}}}' - - 'cm_add_dynamic_vlan_pool.proposed == nm_add_dynamic_vlan_pool.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "name": "anstest"}}}' - - cm_add_dynamic_vlan_pool.previous == nm_add_dynamic_vlan_pool.previous == [] - # NOTE: We cannot fix this easily - - cm_add_dynamic_vlan_pool.current == [] - - nm_add_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'dynamic' - - nm_add_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == '' - - nm_add_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-dynamic' - - nm_add_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.name == 'anstest' - -- name: Add dynamic_vlan_pool again (check_mode) - aci_vlan_pool: *dynamic_vlan_pool_present - check_mode: yes - register: cm_add_dynamic_vlan_pool_again - -- name: Add dynamic vlan pool again (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_present - register: nm_add_dynamic_vlan_pool_again - -- name: Verify add_dynamic_vlan_pool_again - assert: - that: - - cm_add_dynamic_vlan_pool_again is not changed - - nm_add_dynamic_vlan_pool_again is not changed - - cm_add_dynamic_vlan_pool_again.current == nm_add_dynamic_vlan_pool_again.current == nm_add_dynamic_vlan_pool.current - - -# CHANGE VLAN POOL -- name: Change description of dynamic vlan pool (check_mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_present - description: Ansible test dynamic vlan pool - check_mode: yes - register: cm_add_dynamic_vlan_pool_descr - -- name: Change description of dynamic vlan pool (normal mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_present - description: Ansible test dynamic vlan pool - register: nm_add_dynamic_vlan_pool_descr - -- name: Verify add_dynamic_vlan_pool_descr - assert: - that: - - cm_add_dynamic_vlan_pool_descr is changed - - nm_add_dynamic_vlan_pool_descr is changed - - 'cm_add_dynamic_vlan_pool_descr.sent == nm_add_dynamic_vlan_pool_descr.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible test dynamic vlan pool"}}}' - - 'cm_add_dynamic_vlan_pool_descr.proposed == nm_add_dynamic_vlan_pool_descr.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible test dynamic vlan pool", "name": "anstest"}}}' - - cm_add_dynamic_vlan_pool_descr.previous == nm_add_dynamic_vlan_pool_descr.previous == cm_add_dynamic_vlan_pool_descr.current == nm_add_dynamic_vlan_pool.current - - nm_add_dynamic_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.allocMode == 'dynamic' - - nm_add_dynamic_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test dynamic vlan pool' - - nm_add_dynamic_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-dynamic' - - nm_add_dynamic_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.name == 'anstest' - -- name: Change description of dynamic vlan pool again (check_mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_present - description: Ansible test dynamic vlan pool - check_mode: yes - register: cm_add_dynamic_vlan_pool_descr_again - -- name: Change description of dynamic vlan pool again (normal mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_present - description: Ansible test dynamic vlan pool - register: nm_add_dynamic_vlan_pool_descr_again - -- name: Verify add_dynamic_vlan_pool_descr_again - assert: - that: - - cm_add_dynamic_vlan_pool_descr_again is not changed - - nm_add_dynamic_vlan_pool_descr_again is not changed - - cm_add_dynamic_vlan_pool_descr_again.current == nm_add_dynamic_vlan_pool_descr_again.current == nm_add_dynamic_vlan_pool_descr.current - - -# ADD VLAN POOL AGAIN -- name: Add dynamic vlan pool again with no description (check_mode) - aci_vlan_pool: *dynamic_vlan_pool_present - check_mode: yes - register: cm_add_dynamic_vlan_pool_again_no_descr - -- name: Add dynamic vlan pool again with no description (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_present - register: nm_add_dynamic_vlan_pool_again_no_descr - -- name: Verify add_dynamic_vlan_pool_again_no_descr - assert: - that: - - cm_add_dynamic_vlan_pool_again_no_descr is not changed - - nm_add_dynamic_vlan_pool_again_no_descr is not changed - - cm_add_dynamic_vlan_pool_again_no_descr.current == nm_add_dynamic_vlan_pool_again_no_descr.current == nm_add_dynamic_vlan_pool_descr.current - - -# QUERY ALL VLAN POOLS -- name: Query all dynamic vlan pools (check_mode) - aci_vlan_pool: &dynamic_vlan_pool_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_dynamic_vlan_pools - -- name: Query all dynamic vlan pools (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_query - register: nm_query_all_dynamic_vlan_pools - -- name: Verify query_all_dynamic_vlan_pools - assert: - that: - - cm_query_all_dynamic_vlan_pools is not changed - - nm_query_all_dynamic_vlan_pools is not changed - - cm_query_all_dynamic_vlan_pools == nm_query_all_dynamic_vlan_pools - - cm_query_all_dynamic_vlan_pools.current|length >= 1 - - -# QUERY A VLAN POOL -- name: Query our dynamic vlan pool - aci_vlan_pool: - <<: *dynamic_vlan_pool_query - pool: anstest - pool_allocation_mode: dynamic - check_mode: yes - register: cm_query_dynamic_vlan_pool - -- name: Query our dynamic vlan pool - aci_vlan_pool: - <<: *dynamic_vlan_pool_query - pool: anstest - pool_allocation_mode: dynamic - register: nm_query_dynamic_vlan_pool - -- name: Verify query_dynamic_vlan_pool - assert: - that: - - cm_query_dynamic_vlan_pool is not changed - - nm_query_dynamic_vlan_pool is not changed - - cm_query_dynamic_vlan_pool == nm_query_dynamic_vlan_pool - - nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'dynamic' - - nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test dynamic vlan pool' - - nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-dynamic' - - nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.name == 'anstest' - - -# REMOVE VLAN POOL -- name: Remove dynamic vlan pool (check_mode) - aci_vlan_pool: *dynamic_vlan_pool_absent - check_mode: yes - register: cm_remove_dynamic_vlan_pool - -- name: Remove dynamic vlan pool (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_absent - register: nm_remove_dynamic_vlan_pool - -- name: Verify remove_dynamic_vlan_pool - assert: - that: - - cm_remove_dynamic_vlan_pool is changed - - nm_remove_dynamic_vlan_pool is changed - - 'cm_remove_dynamic_vlan_pool.current == cm_remove_dynamic_vlan_pool.previous == nm_remove_dynamic_vlan_pool.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible test dynamic vlan pool", "dn": "uni/infra/vlanns-[anstest]-dynamic", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_dynamic_vlan_pool.current == [] - -- name: Remove dynamic vlan pool again (check_mode) - aci_vlan_pool: *dynamic_vlan_pool_absent - check_mode: yes - register: cm_remove_dynamic_vlan_pool_again - -- name: Remove dynamic vlan pool again (normal mode) - aci_vlan_pool: *dynamic_vlan_pool_absent - register: nm_remove_dynamic_vlan_pool_again - -- name: Verify remove_dynamic_vlan_pool_again - assert: - that: - - cm_remove_dynamic_vlan_pool_again is not changed - - nm_remove_dynamic_vlan_pool_again is not changed - - cm_remove_dynamic_vlan_pool_again.proposed == nm_remove_dynamic_vlan_pool_again.proposed == {} - - cm_remove_dynamic_vlan_pool_again.sent == nm_remove_dynamic_vlan_pool_again.sent == {} - - cm_remove_dynamic_vlan_pool_again.previous == nm_remove_dynamic_vlan_pool_again.previous == [] - - cm_remove_dynamic_vlan_pool_again.current == nm_remove_dynamic_vlan_pool_again.current == [] - - -# QUERY NON-EXISTING VLAN POOL -- name: Query non-existing dynamic vlan pool (check_mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_query - pool: anstest - pool_allocation_mode: dynamic - check_mode: yes - register: cm_query_non_dynamic_vlan_pool - -- name: Query non-existing dynamic vlan pool (normal mode) - aci_vlan_pool: - <<: *dynamic_vlan_pool_query - pool: anstest - pool_allocation_mode: dynamic - register: nm_query_non_dynamic_vlan_pool - -# TODO: Implement more tests -- name: Verify query_non_dynamic_vlan_pool - assert: - that: - - cm_query_non_dynamic_vlan_pool is not changed - - nm_query_non_dynamic_vlan_pool is not changed - - cm_remove_dynamic_vlan_pool_again.previous == nm_remove_dynamic_vlan_pool_again.previous == [] - - cm_remove_dynamic_vlan_pool_again.current == nm_remove_dynamic_vlan_pool_again.current == [] - - -# PROVOKE ERRORS -- name: Error when required parameter is missing - aci_vlan_pool: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: present - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "state is present but all of the following are missing: pool"' - -- name: Error when together parameter is missing - aci_vlan_pool: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - state: present - ignore_errors: yes - register: error_on_missing_together_param - -- name: Verify error_on_missing_together_param - assert: - that: - - error_on_missing_together_param is failed - - error_on_missing_together_param.msg == "ACI requires the 'pool_allocation_mode' when 'pool' is provided" diff --git a/test/integration/targets/aci_vlan_pool/tasks/main.yml b/test/integration/targets/aci_vlan_pool/tasks/main.yml deleted file mode 100644 index 7838dc8c45..0000000000 --- a/test/integration/targets/aci_vlan_pool/tasks/main.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.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 - -- include_tasks: static.yml - when: static is not defined or static - -- include_tasks: dynamic.yml - when: dynamic is not defined or dynamic diff --git a/test/integration/targets/aci_vlan_pool/tasks/static.yml b/test/integration/targets/aci_vlan_pool/tasks/static.yml deleted file mode 100644 index 9d3cebec58..0000000000 --- a/test/integration/targets/aci_vlan_pool/tasks/static.yml +++ /dev/null @@ -1,296 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# CLEAN ENVIRONMENT -- name: Remove static vlan pool - aci_vlan_pool: &static_vlan_pool_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_allocation_mode: static - state: absent - - -# ADD VLAN POOL -- name: Add static vlan pool (check_mode) - aci_vlan_pool: &static_vlan_pool_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - pool_allocation_mode: static - state: present - check_mode: yes - register: cm_add_static_vlan_pool - -- name: Add static vlan pool (normal mode) - aci_vlan_pool: *static_vlan_pool_present - register: nm_add_static_vlan_pool - -- name: Verify add_static_vlan_pool - assert: - that: - - cm_add_static_vlan_pool is changed - - nm_add_static_vlan_pool is changed - - 'cm_add_static_vlan_pool.sent == nm_add_static_vlan_pool.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "name": "anstest"}}}' - - 'cm_add_static_vlan_pool.proposed == nm_add_static_vlan_pool.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "name": "anstest"}}}' - - cm_add_static_vlan_pool.previous == nm_add_static_vlan_pool.previous == [] - # NOTE: We cannot fix this easily - - cm_add_static_vlan_pool.current == [] - - nm_add_static_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'static' - - nm_add_static_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == '' - - nm_add_static_vlan_pool.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-static' - - nm_add_static_vlan_pool.current.0.fvnsVlanInstP.attributes.name == 'anstest' - -- name: Add static_vlan_pool again (check_mode) - aci_vlan_pool: *static_vlan_pool_present - check_mode: yes - register: cm_add_static_vlan_pool_again - -- name: Add static vlan pool again (normal mode) - aci_vlan_pool: *static_vlan_pool_present - register: nm_add_static_vlan_pool_again - -- name: Verify add_static_vlan_pool_again - assert: - that: - - cm_add_static_vlan_pool_again is not changed - - nm_add_static_vlan_pool_again is not changed - - cm_add_static_vlan_pool_again.current == nm_add_static_vlan_pool_again.current == nm_add_static_vlan_pool.current - - -# CHANGE VLAN POOL -- name: Change description of static vlan pool (check_mode) - aci_vlan_pool: - <<: *static_vlan_pool_present - description: Ansible test static vlan pool - check_mode: yes - register: cm_add_static_vlan_pool_descr - -- name: Change description of static vlan pool (normal mode) - aci_vlan_pool: - <<: *static_vlan_pool_present - description: Ansible test static vlan pool - register: nm_add_static_vlan_pool_descr - -- name: Verify add_static_vlan_pool_descr - assert: - that: - - cm_add_static_vlan_pool_descr is changed - - nm_add_static_vlan_pool_descr is changed - - 'cm_add_static_vlan_pool_descr.sent == nm_add_static_vlan_pool_descr.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible test static vlan pool"}}}' - - 'cm_add_static_vlan_pool_descr.proposed == nm_add_static_vlan_pool_descr.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible test static vlan pool", "name": "anstest"}}}' - - cm_add_static_vlan_pool_descr.previous == nm_add_static_vlan_pool_descr.previous == cm_add_static_vlan_pool_descr.current == nm_add_static_vlan_pool.current - - nm_add_static_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.allocMode == 'static' - - nm_add_static_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test static vlan pool' - - nm_add_static_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-static' - - nm_add_static_vlan_pool_descr.current.0.fvnsVlanInstP.attributes.name == 'anstest' - -- name: Change description of static vlan pool again (check_mode) - aci_vlan_pool: - <<: *static_vlan_pool_present - description: Ansible test static vlan pool - check_mode: yes - register: cm_add_static_vlan_pool_descr_again - -- name: Change description of static vlan pool again (normal mode) - aci_vlan_pool: - <<: *static_vlan_pool_present - description: Ansible test static vlan pool - register: nm_add_static_vlan_pool_descr_again - -- name: Verify add_static_vlan_pool_descr_again - assert: - that: - - cm_add_static_vlan_pool_descr_again is not changed - - nm_add_static_vlan_pool_descr_again is not changed - - cm_add_static_vlan_pool_descr_again.current == nm_add_static_vlan_pool_descr_again.current == nm_add_static_vlan_pool_descr.current - - -# ADD VLAN POOL AGAIN -- name: Add static vlan pool again with no description (check_mode) - aci_vlan_pool: *static_vlan_pool_present - check_mode: yes - register: cm_add_static_vlan_pool_again_no_descr - -- name: Add static vlan pool again with no description (normal mode) - aci_vlan_pool: *static_vlan_pool_present - register: nm_add_static_vlan_pool_again_no_descr - -- name: Verify add_static_vlan_pool_again_no_descr - assert: - that: - - cm_add_static_vlan_pool_again_no_descr is not changed - - nm_add_static_vlan_pool_again_no_descr is not changed - - cm_add_static_vlan_pool_again_no_descr.current == nm_add_static_vlan_pool_again_no_descr.current == nm_add_static_vlan_pool_descr.current - - -# QUERY ALL VLAN POOLS -- name: Query all static vlan pools (check_mode) - aci_vlan_pool: &static_vlan_pool_query - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: query - check_mode: yes - register: cm_query_all_static_vlan_pools - -- name: Query all static vlan pools (normal mode) - aci_vlan_pool: *static_vlan_pool_query - register: nm_query_all_static_vlan_pools - -- name: Verify query_all_static_vlan_pools - assert: - that: - - cm_query_all_static_vlan_pools is not changed - - nm_query_all_static_vlan_pools is not changed - - cm_query_all_static_vlan_pools == nm_query_all_static_vlan_pools - - cm_query_all_static_vlan_pools.current|length >= 1 - - -# QUERY A VLAN POOL -- name: Query our static vlan pool - aci_vlan_pool: - <<: *static_vlan_pool_query - pool: anstest - pool_allocation_mode: static - check_mode: yes - register: cm_query_static_vlan_pool - -- name: Query our static vlan pool - aci_vlan_pool: - <<: *static_vlan_pool_query - pool: anstest - pool_allocation_mode: static - register: nm_query_static_vlan_pool - -- name: Verify query_static_vlan_pool - assert: - that: - - cm_query_static_vlan_pool is not changed - - nm_query_static_vlan_pool is not changed - - cm_query_static_vlan_pool == nm_query_static_vlan_pool - - nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'static' - - nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test static vlan pool' - - nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.dn == 'uni/infra/vlanns-[anstest]-static' - - nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.name == 'anstest' - - -# REMOVE VLAN POOL -- name: Remove static vlan pool (check_mode) - aci_vlan_pool: *static_vlan_pool_absent - check_mode: yes - register: cm_remove_static_vlan_pool - -- name: Remove static vlan pool (normal mode) - aci_vlan_pool: *static_vlan_pool_absent - register: nm_remove_static_vlan_pool - -- name: Verify remove_static_vlan_pool - assert: - that: - - cm_remove_static_vlan_pool is changed - - nm_remove_static_vlan_pool is changed - - 'cm_remove_static_vlan_pool.current == cm_remove_static_vlan_pool.previous == nm_remove_static_vlan_pool.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible test static vlan pool", "dn": "uni/infra/vlanns-[anstest]-static", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]' - - nm_remove_static_vlan_pool.current == [] - -- name: Remove static vlan pool again (check_mode) - aci_vlan_pool: *static_vlan_pool_absent - check_mode: yes - register: cm_remove_static_vlan_pool_again - -- name: Remove static vlan pool again (normal mode) - aci_vlan_pool: *static_vlan_pool_absent - register: nm_remove_static_vlan_pool_again - -- name: Verify remove_static_vlan_pool_again - assert: - that: - - cm_remove_static_vlan_pool_again is not changed - - nm_remove_static_vlan_pool_again is not changed - - cm_remove_static_vlan_pool_again.proposed == nm_remove_static_vlan_pool_again.proposed == {} - - cm_remove_static_vlan_pool_again.sent == nm_remove_static_vlan_pool_again.sent == {} - - cm_remove_static_vlan_pool_again.previous == nm_remove_static_vlan_pool_again.previous == [] - - cm_remove_static_vlan_pool_again.current == nm_remove_static_vlan_pool_again.current == [] - - -# QUERY NON-EXISTING VLAN POOL -- name: Query non-existing static vlan pool (check_mode) - aci_vlan_pool: - <<: *static_vlan_pool_query - pool: anstest - pool_allocation_mode: static - check_mode: yes - register: cm_query_non_static_vlan_pool - -- name: Query non-existing static vlan pool (normal mode) - aci_vlan_pool: - <<: *static_vlan_pool_query - pool: anstest - pool_allocation_mode: static - register: nm_query_non_static_vlan_pool - -# TODO: Implement more tests -- name: Verify query_non_static_vlan_pool - assert: - that: - - cm_query_non_static_vlan_pool is not changed - - nm_query_non_static_vlan_pool is not changed - - cm_remove_static_vlan_pool_again.previous == nm_remove_static_vlan_pool_again.previous == [] - - cm_remove_static_vlan_pool_again.current == nm_remove_static_vlan_pool_again.current == [] - - -# PROVOKE ERRORS -- name: Error when required parameter is missing - aci_vlan_pool: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: present - ignore_errors: yes - register: error_on_missing_required_param - -- name: Verify error_on_missing_required_param - assert: - that: - - error_on_missing_required_param is failed - - 'error_on_missing_required_param.msg == "state is present but all of the following are missing: pool"' - -- name: Error when together parameter is missing - aci_vlan_pool: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - pool: anstest - state: present - ignore_errors: yes - register: error_on_missing_together_param - -- name: Verify error_on_missing_together_param - assert: - that: - - error_on_missing_together_param is failed - - error_on_missing_together_param.msg == "ACI requires the 'pool_allocation_mode' when 'pool' is provided" diff --git a/test/integration/targets/aci_vlan_pool_encap_block/aliases b/test/integration/targets/aci_vlan_pool_encap_block/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_vlan_pool_encap_block/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_vlan_pool_encap_block/tasks/main.yml b/test/integration/targets/aci_vlan_pool_encap_block/tasks/main.yml deleted file mode 100644 index 95259fb936..0000000000 --- a/test/integration/targets/aci_vlan_pool_encap_block/tasks/main.yml +++ /dev/null @@ -1,380 +0,0 @@ -# Test code for the ACI modules - -# Copyright: (c) 2017, Jacob McGill (jmcgill298) -# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.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: Ensure vlan pool exists for tests to kick off - aci_vlan_pool: - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - state: absent - pool: anstest - allocation_mode: static - description: Ansible Test - -- name: Ensure vlan pool exists for tests to kick off - aci_vlan_pool: &aci_pool_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - pool: anstest - allocation_mode: static - description: Ansible Test - register: pool_present - -- name: Create vlan pool encap block - check mode works - aci_vlan_pool_encap_block: &aci_encap_block_present - <<: *aci_pool_present - block_name: anstest - block_start: 20 - block_end: 40 - pool: anstest - pool_allocation_mode: static - allocation_mode: inherit - description: Ansible Test - check_mode: yes - register: encap_block_present_check_mode - -- name: Present assertions - assert: - that: - - encap_block_present_check_mode is changed - - 'encap_block_present_check_mode.sent == {"fvnsEncapBlk": {"attributes": {"allocMode": "inherit", "descr": "Ansible Test", "from": "vlan-20", "name": "anstest", "to": "vlan-40"}}}' - -- name: Create vlan pool encap_block - creation works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - register: encap_block_present - -- name: Present assertions - assert: - that: - - encap_block_present is changed - - encap_block_present.previous == [] - - encap_block_present.sent == encap_block_present_check_mode.sent - - encap_block_present.sent == encap_block_present.proposed - -- name: Create vlan pool range - idempotency works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - register: encap_block_present_idempotent - -- name: Present assertions - assert: - that: - - encap_block_present_idempotent is not changed - - encap_block_present_idempotent.previous.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: Update vlan pool range - update works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - description: Ansible Test Update - allocation_mode: inherit - register: encap_block_present_update - -- name: Present assertions - assert: - that: - - encap_block_present_update is changed - - encap_block_present_update.previous != [] - - encap_block_present_update.sent != encap_block_present.sent - -- name: Create vlan pool range - used for query - aci_vlan_pool_encap_block: &aci_encap_block_present_2 - <<: *aci_encap_block_present - block_name: anstest_2 - block_start: 50 - block_end: 55 - register: encap_block_present_2 - -- name: Present assertions - assert: - that: - - encap_block_present_2 is changed - - encap_block_present_2.previous == [] - -- name: Invalid encap_block_start - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - block_start: 0 - ignore_errors: yes - register: encap_block_start_low - -- name: Present assertions - assert: - that: - - encap_block_start_low is failed - - encap_block_start_low.msg == "vlan pools must have 'block_start' and 'block_end' values between 1 and 4094" - -- name: Invalid encap_block_start - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - block_start: 4096 - ignore_errors: yes - register: encap_block_start_high - -- name: Present assertions - assert: - that: - - encap_block_start_high is failed - - encap_block_start_high.msg == "vlan pools must have 'block_start' and 'block_end' values between 1 and 4094" - -- name: Invalid encap_block_end - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - block_end: 0 - ignore_errors: yes - register: encap_block_end_low - -- name: Present assertions - assert: - that: - - encap_block_end_low is failed - - encap_block_end_low.msg == "vlan pools must have 'block_start' and 'block_end' values between 1 and 4094" - -- name: Invalid encap_block_end - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - block_end: 4096 - ignore_errors: yes - register: encap_block_end_high - -- name: Present assertions - assert: - that: - - encap_block_end_high is failed - - encap_block_end_high.msg == "vlan pools must have 'block_start' and 'block_end' values between 1 and 4094" - -- name: Range start higher than range end - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - block_start: 1000 - ignore_errors: yes - register: encap_block_start_end - -- name: Present assertions - assert: - that: - - encap_block_start_end is failed - - encap_block_start_end.msg == "The 'block_start' must be less than or equal to the 'block_end'" - -- name: Missing required param - error message works - aci_vlan_pool_encap_block: - <<: *aci_pool_present - ignore_errors: yes - register: encap_block_present_missing_param - -- name: Present assertions - assert: - that: - - encap_block_present_missing_param is failed - - 'encap_block_present_missing_param.msg == "state is present but all of the following are missing: block_end, block_name, block_start"' - -- name: Missing required param - error message works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - pool_allocation_mode: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: encap_block_present_allocation - -- name: Present assertions - assert: - that: - - encap_block_present_allocation is failed - - encap_block_present_allocation.msg == "ACI requires the 'pool_allocation_mode' when 'pool' is provided" - -- name: Query specific vlan pool range - aci_vlan_pool_encap_block: &aci_encap_block_query - <<: *aci_encap_block_present - state: query - register: encap_block_query - -- name: Query assertions - assert: - that: - - encap_block_query is not changed - - encap_block_query.url.endswith("infra/vlanns-[anstest]-static/from-[vlan-20]-to-[vlan-40].json") - - encap_block_query.current | length == 1 - - encap_block_query.current.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: Query vlan pool range - from, to, and name are filtered - aci_vlan_pool_encap_block: &aci_encap_block_query_filter - <<: *aci_encap_block_query - pool: "{{ fake_var | default(omit) }}" - register: encap_block_query_from_to_name - -- name: Query assertions - assert: - that: - - encap_block_query_from_to_name is not changed - - encap_block_query_from_to_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to_name.filter_string' - - '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_to_name.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to_name.filter_string' - - encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - - encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: Query vlan pool range - from and name are filtered - aci_vlan_pool_encap_block: - <<: *aci_encap_block_query_filter - block_end: "{{ fake_var | default(omit) }}" - register: encap_block_query_from_name - -- name: Query assertions - assert: - that: - - encap_block_query_from_name is not changed - - encap_block_query_from_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_name.filter_string' - - '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_name.filter_string' - - encap_block_query_from_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - encap_block_query_from_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - -- name: Query vlan pool range - to and name are filtered - aci_vlan_pool_encap_block: - <<: *aci_encap_block_query_filter - block_start: "{{ fake_var | default(omit) }}" - register: encap_block_query_to_name - -- name: Query assertions - assert: - that: - - encap_block_query_to_name is not changed - - encap_block_query_to_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_to_name.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_to_name.filter_string' - - encap_block_query_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - - encap_block_query_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: Query vlan pool range - name is filtered - aci_vlan_pool_encap_block: - <<: *aci_encap_block_query_filter - block_start: "{{ fake_var | default(omit) }}" - block_end: "{{ fake_var | default(omit) }}" - register: encap_block_query_name - -- name: Query assertions - assert: - that: - - encap_block_query_name is not changed - - encap_block_query_name.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_name.filter_string' - - encap_block_query_name.current.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: Query vlan pool range - from and to are filtered - aci_vlan_pool_encap_block: - <<: *aci_encap_block_query_filter - block_name: "{{ fake_var | default(omit) }}" - register: encap_block_query_from_to - -- name: Query assertions - assert: - that: - - encap_block_query_from_to is not changed - - encap_block_query_from_to.url.endswith("class/fvnsEncapBlk.json") - - '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to.filter_string' - - '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to.filter_string' - - encap_block_query_from_to.current.0.fvnsEncapBlk.attributes.from == "vlan-20" - - encap_block_query_from_to.current.0.fvnsEncapBlk.attributes.to == "vlan-40" - -- name: Query all ranges in a vlan pool - aci_vlan_pool_encap_block: - <<: *aci_pool_present - state: query - pool_allocation_mode: static - register: encap_block_query_pool - -- name: Query assertions - assert: - that: - - encap_block_query_pool is not changed - - encap_block_query_pool.current | length == 1 - - encap_block_query_pool.current.0.fvnsVlanInstP.attributes.name == "anstest" - - encap_block_query_pool.current.0.fvnsVlanInstP.children | length > 1 - - encap_block_query_pool.url.endswith("infra/vlanns-[anstest]-static.json") - -- name: Query all ranges - aci_vlan_pool_encap_block: - <<: *aci_pool_present - state: query - pool: "{{ fake_var | default(omit) }}" - register: encap_block_query_all - -- name: Query assertions - assert: - that: - - encap_block_query_all is not changed - - encap_block_query_all.current | length > 1 - - encap_block_query_all.current.0.fvnsEncapBlk is defined - - encap_block_query_all.url.endswith("class/fvnsEncapBlk.json") - -- name: Delete vlan pool range - deletion works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_present - state: absent - register: delete_range - -- name: Absent assertions - assert: - that: - - delete_range is changed - - delete_range.proposed == {} - - delete_range.previous.0.fvnsEncapBlk.attributes.name == "anstest" - -- name: Delete vlan pool range - check mode works - aci_vlan_pool_encap_block: &aci_encap_block_absent - <<: *aci_encap_block_present_2 - state: absent - check_mode: yes - register: delete_check_mode - -- name: Absent assertions - assert: - that: - - delete_check_mode is changed - - delete_check_mode.previous != [] - -- name: Delete vlan pool range - deletion works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_absent - register: delete_encap_block_2 - -- name: Absent assertions - assert: - that: - - delete_encap_block_2 is changed - - delete_encap_block_2.previous == delete_check_mode.previous - -- name: Delete vlan pool range again - idempotency works - aci_vlan_pool_encap_block: - <<: *aci_encap_block_absent - register: delete_idempotent - -- name: Absent assertions - assert: - that: - - delete_idempotent is not changed - - delete_idempotent.previous == [] - -- name: Cleanup vlan pool - aci_vlan_pool: - <<: *aci_pool_present - state: absent - when: pool_present is changed diff --git a/test/integration/targets/aci_vmm_credential/aliases b/test/integration/targets/aci_vmm_credential/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_vmm_credential/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_vmm_credential/tasks/main.yml b/test/integration/targets/aci_vmm_credential/tasks/main.yml deleted file mode 100644 index 3095ed5027..0000000000 --- a/test/integration/targets/aci_vmm_credential/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.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 - -- include_tasks: vmware.yml - when: vmware is not defined or vmware
\ No newline at end of file diff --git a/test/integration/targets/aci_vmm_credential/tasks/vmware.yml b/test/integration/targets/aci_vmm_credential/tasks/vmware.yml deleted file mode 100644 index be386718d9..0000000000 --- a/test/integration/targets/aci_vmm_credential/tasks/vmware.yml +++ /dev/null @@ -1,239 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Remove VMM domain -- name: Remove VMM domain (normal mode) - aci_domain: &domain_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: vmm_dom - domain_type: vmm - vm_provider: vmware - state: absent - register: nm_remove_domain - -# ADD VMM domain for testing -- name: Add VMM domain (normal mode) - aci_domain: &domain_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - domain: vmm_dom - domain_type: vmm - vm_provider: vmware - state: present - register: nm_add_domain - -- name: Verify add_domain - assert: - that: - - nm_add_domain is changed - -# REMOVE credential -- name: Remove credential (check mode) - aci_vmm_credential: &credential_absent - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - name: vmm_cred - description: my_new_cred - domain: vmm_dom - credential_username: myUsername - credential_password: mySecretPassword - vm_provider: vmware - state: absent - check_mode: yes - register: cm_remove_credential - -- name: Remove vmware VMM credential (normal mode) - aci_vmm_credential: *credential_absent - register: nm_remove_credential - -- name: Verify remove_credential - assert: - that: - - cm_remove_credential is not changed - - nm_remove_credential is not changed - -# ADD credential -- name: Add vmware VMM credential (check mode) - aci_vmm_credential: &credential_present - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - name: vmm_cred - description: my_new_cred - domain: vmm_dom - credential_username: myUsername - credential_password: mySecretPassword - vm_provider: vmware - state: present - check_mode: yes - register: cm_add_credential - -# NOTE: Setting password is not idempotent -- name: Add vmware VMM credential (normal mode) - aci_vmm_credential: *credential_present - register: nm_add_credential - -# NOTE: Setting password is not idempotent -- name: Add vmware VMM credential again (check mode) - aci_vmm_credential: *credential_present - check_mode: yes - register: cm_add_credential_again - -- name: Verify add_credential - assert: - that: - - cm_add_credential is changed - - nm_add_credential is changed - - 'cm_add_credential.sent == nm_add_credential.sent == {"vmmUsrAccP": {"attributes": {"descr": "my_new_cred", "name": "vmm_cred", "pwd": "mySecretPassword", "usr": "myUsername"}}}' - - 'cm_add_credential.proposed == nm_add_credential.proposed == {"vmmUsrAccP": {"attributes": {"descr": "my_new_cred", "name": "vmm_cred", "pwd": "mySecretPassword", "usr": "myUsername"}}}' - - cm_add_credential.current == cm_add_credential.previous == nm_add_credential.previous == [] - - nm_add_credential.current.0.vmmUsrAccP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom/usracc-vmm_cred' - - nm_add_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - -# MODIFY credential -- name: Modify vmware VMM credential (check mode) - aci_vmm_credential: &credential_mod - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - name: vmm_cred - description: my_updated_descr - domain: vmm_dom - credential_username: myNewUsername - credential_password: myNewSecretPassword - vm_provider: vmware - state: present - check_mode: yes - register: cm_mod_credential - -- name: Modify vmware VMM credential (normal mode) - aci_vmm_credential: *credential_mod - register: nm_mod_credential - -- name: Verify mod_credential - assert: - that: - - cm_mod_credential is changed - - nm_mod_credential is changed - - 'cm_mod_credential.sent == nm_mod_credential.sent == {"vmmUsrAccP": {"attributes": {"descr": "my_updated_descr", "pwd": "myNewSecretPassword", "usr": "myNewUsername"}}}' - - 'cm_mod_credential.proposed == nm_mod_credential.proposed == {"vmmUsrAccP": {"attributes": {"descr": "my_updated_descr", "name": "vmm_cred", "pwd": "myNewSecretPassword", "usr": "myNewUsername"}}}' - - nm_mod_credential.current.0.vmmUsrAccP.attributes.dn == 'uni/vmmp-VMware/dom-vmm_dom/usracc-vmm_cred' - - nm_mod_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - -- name: Query existing vmware VMM credential (check mode) - aci_vmm_credential: &query_existing_cred - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - name: vmm_cred - domain: vmm_dom - vm_provider: vmware - state: query - check_mode: yes - register: cm_query_credential - -- name: Query existing vmware VMM credential (normal mode) - aci_vmm_credential: *query_existing_cred - register: nm_query_credential - -- name: Query non-existent vmware VMM credential - aci_vmm_credential: - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - name: vmm_fake_cred - domain: vmm_dom - vm_provider: vmware - state: query - register: nm_query_fake_credential - -- name: Query all vmware VMM credentials (check mode) - aci_vmm_credential: &query_all_creds - host: '{{ aci_hostname }}' - username: '{{ aci_username }}' - password: '{{ aci_password }}' - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: '{{ aci_output_level | default("info") }}' - vm_provider: vmware - state: query - check_mode: yes - register: cm_query_all_credential - -- name: Query all vmware VMM credentials (normal mode) - aci_vmm_credential: *query_all_creds - register: nm_query_all_credential - -- name: Verify query_credential - assert: - that: - - cm_query_credential is not changed - - nm_query_credential is not changed - - nm_query_fake_credential is not changed - - cm_query_all_credential is not changed - - nm_query_all_credential is not changed - - cm_query_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - - nm_query_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - - nm_query_fake_credential.current == [] - - cm_query_all_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - - nm_query_all_credential.current.0.vmmUsrAccP.attributes.name == 'vmm_cred' - -- name: Remove credential (check_mode) - aci_vmm_credential: *credential_absent - check_mode: yes - register: cm_remove_credential_again - -- name: Remove credential (normal_mode) - aci_vmm_credential: *credential_absent - register: nm_remove_credential_again - -- name: Remove credential (normal_mode) - aci_vmm_credential: *credential_absent - register: nm_remove_credential_final - -- name: Verify remove_credential - assert: - that: - - cm_remove_credential_again is changed - - nm_remove_credential_again is changed - - nm_remove_credential_final is not changed - -# Remove VMM domain after testing -- name: Remove VMM domain (normal_mode) - aci_domain: *domain_absent - register: nm_remove_domain_again
\ No newline at end of file diff --git a/test/integration/targets/aci_vrf/aliases b/test/integration/targets/aci_vrf/aliases deleted file mode 100644 index f16b250929..0000000000 --- a/test/integration/targets/aci_vrf/aliases +++ /dev/null @@ -1,2 +0,0 @@ -# No ACI simulator yet, so not enabled -unsupported diff --git a/test/integration/targets/aci_vrf/tasks/main.yml b/test/integration/targets/aci_vrf/tasks/main.yml deleted file mode 100644 index ca8b89d611..0000000000 --- a/test/integration/targets/aci_vrf/tasks/main.yml +++ /dev/null @@ -1,174 +0,0 @@ -# Test code for the ACI modules -# Copyright: (c) 2017, Jacob McGill (@jmcgill298) - -# 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: ensure tenant exists for tests to kick off - aci_tenant: &aci_tenant_present - host: "{{ aci_hostname }}" - username: "{{ aci_username }}" - password: "{{ aci_password }}" - validate_certs: '{{ aci_validate_certs | default(false) }}' - use_ssl: '{{ aci_use_ssl | default(true) }}' - use_proxy: '{{ aci_use_proxy | default(true) }}' - output_level: debug - state: present - tenant: anstest - register: tenant_present - -- name: create vrf - check mode works - aci_vrf: &aci_vrf_present - <<: *aci_tenant_present - vrf: anstest - description: Ansible Test - check_mode: yes - register: vrf_present_check_mode - -- name: create vrf - creation works - aci_vrf: - <<: *aci_vrf_present - register: vrf_present - -- name: create vrf again - idempotency works - aci_vrf: - <<: *aci_vrf_present - register: vrf_present_idempotent - -- name: update vrf - update works - aci_vrf: - <<: *aci_vrf_present - description: Ansible Test Update - policy_control_preference: unenforced - register: vrf_update - -- name: create another vrf - check more params - aci_vrf: - <<: *aci_vrf_present - vrf: anstest2 - policy_control_direction: egress - register: vrf_present_2 - -- name: create vrf without all necessary params - failure message works - aci_vrf: - <<: *aci_vrf_present - tenant: "{{ fake_var | default(omit) }}" - ignore_errors: yes - register: vrf_present_missing_param - -- name: present asserts - assert: - that: - - vrf_present_check_mode is changed - - 'vrf_present_check_mode.sent == {"fvCtx": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}' - - vrf_present is changed - - vrf_present.sent == vrf_present_check_mode.sent - - vrf_present.previous == [] - - vrf_present_idempotent is not changed - - vrf_present_idempotent.previous != [] - - vrf_update is changed - - vrf_update.previous != [] - - vrf_update.sent != vrf_update.proposed - - 'vrf_update.sent == {"fvCtx": {"attributes": {"descr": "Ansible Test Update", "pcEnfPref": "unenforced"}}}' - - 'vrf_present_2.sent.fvCtx.attributes == {"name": "anstest2", "pcEnfDir": "egress", "descr": "Ansible Test"}' - - vrf_present_missing_param is failed - - 'vrf_present_missing_param.msg == "state is present but all of the following are missing: tenant"' - -- name: get all vrf - aci_vrf: &aci_query - <<: *aci_tenant_present - state: query - tenant: "{{ fake_var | default(omit) }}" - register: query_all - -- name: get all in tenant - aci_vrf: - <<: *aci_query - tenant: anstest - register: query_tenant - -- name: get all with name - aci_vrf: - <<: *aci_query - vrf: anstest - register: query_vrf_vrf - -- name: get vrf - aci_vrf: - <<: *aci_vrf_present - state: query - register: query_vrf - -- name: query asserts - assert: - that: - - query_all is not changed - - query_all.current | length > 1 - - query_all.current.0.fvCtx is defined - - '"class/fvCtx.json" in query_all.url' - - query_tenant is not changed - - query_tenant.current | length == 1 - - query_tenant.current.0.fvTenant.children | length == 2 - - query_tenant.current.0.fvTenant.attributes.name == "anstest" - - '"rsp-subtree-class=fvCtx" in query_tenant.filter_string' - - '"tn-anstest.json" in query_tenant.url' - - query_vrf_vrf is not changed - - query_vrf_vrf.current != [] - - query_vrf_vrf.current.0.fvCtx.attributes.name == "anstest" - - '"query-target-filter=eq(fvCtx.name, \"anstest\")" in query_vrf_vrf.filter_string' - - '"class/fvCtx.json" in query_vrf_vrf.url' - - query_vrf is not changed - - query_vrf.current | length == 1 - - '"tn-anstest/ctx-anstest.json" in query_vrf.url' - -- name: delete vrf - check mode works - aci_vrf: &aci_vrf_absent - <<: *aci_vrf_present - state: absent - check_mode: yes - register: vrf_absent_check_mode - -- name: delete vrf - delete works - aci_vrf: - <<: *aci_vrf_absent - register: vrf_absent - -- name: delete vrf again - idempotency works - aci_vrf: - <<: *aci_vrf_absent - register: vrf_absent_idempotent - -- name: delete vrf - cleanup - aci_vrf: - <<: *aci_vrf_absent - name: anstest2 - -- name: delete vrf missing param - fails properly - aci_vrf: - <<: *aci_vrf_absent - vrf: "{{ fakevar | default(omit) }}" - ignore_errors: yes - register: vrf_absent_missing_param - -- name: asserts for deletion task - assert: - that: - - vrf_absent_check_mode is changed - - vrf_absent_check_mode.previous != [] - - vrf_absent_check_mode.proposed == {} - - vrf_absent is changed - - vrf_absent.previous == vrf_absent_check_mode.previous - - vrf_absent_idempotent is not changed - - vrf_absent_idempotent.previous == [] - - vrf_absent_missing_param is failed - - 'vrf_absent_missing_param.msg == "state is absent but all of the following are missing: vrf"' - -- name: delete tenant - cleanup before ending tests - aci_tenant: - <<: *aci_tenant_present - state: absent - when: tenant_present is changed diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 948c760854..ff1e5d18d3 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -1488,84 +1488,6 @@ lib/ansible/modules/net_tools/basics/uri.py pylint:blacklisted-name lib/ansible/modules/net_tools/basics/uri.py validate-modules:doc-required-mismatch lib/ansible/modules/net_tools/basics/uri.py validate-modules:parameter-list-no-elements lib/ansible/modules/net_tools/basics/uri.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/aci/aci_aaa_user.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_aaa_user_certificate.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_access_port_block_to_access_port.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_access_port_to_interface_policy_leaf_profile.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_access_sub_port_block_to_access_port.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_aep.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_aep_to_domain.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_ap.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_bd.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_bd_subnet.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_bd_subnet.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/aci/aci_bd_to_l3out.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_bd_to_l3out.py validate-modules:required_together-unknown -lib/ansible/modules/network/aci/aci_config_rollback.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_config_snapshot.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_contract.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_contract_subject.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_contract_subject_to_filter.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_domain.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_domain_to_encap_pool.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_domain_to_vlan_pool.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_encap_pool.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_encap_pool_range.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_epg.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_epg_monitoring_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_epg_to_contract.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_epg_to_domain.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_fabric_node.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_fabric_scheduler.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_fabric_scheduler.py validate-modules:parameter-alias-self -lib/ansible/modules/network/aci/aci_filter.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_filter_entry.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_firmware_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_firmware_group.py validate-modules:parameter-alias-self -lib/ansible/modules/network/aci/aci_firmware_group_node.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_firmware_group_node.py validate-modules:parameter-alias-self -lib/ansible/modules/network/aci/aci_firmware_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_firmware_policy.py validate-modules:parameter-alias-self -lib/ansible/modules/network/aci/aci_firmware_source.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_cdp.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_fc.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_l2.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_leaf_profile.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_lldp.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_mcp.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_ospf.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_ospf.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/aci/aci_interface_policy_port_channel.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_policy_port_security.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_interface_selector_to_switch_policy_leaf_profile.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_l3out.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_l3out.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/aci/aci_l3out_extepg.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_l3out_extsubnet.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_l3out_extsubnet.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/aci/aci_l3out_route_tag_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_maintenance_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_maintenance_group_node.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_maintenance_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_rest.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_static_binding_to_epg.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_static_binding_to_epg.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/aci/aci_switch_leaf_selector.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_switch_policy_leaf_profile.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_switch_policy_vpc_protection_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_taboo_contract.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant_action_rule_profile.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant_ep_retention_policy.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant_span_dst_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant_span_src_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_vlan_pool.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_vlan_pool_encap_block.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_vmm_credential.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/aci/aci_vmm_credential.py validate-modules:invalid-ansiblemodule-schema -lib/ansible/modules/network/aci/aci_vrf.py validate-modules:doc-required-mismatch lib/ansible/modules/network/aci/mso_label.py validate-modules:doc-required-mismatch lib/ansible/modules/network/aci/mso_role.py validate-modules:doc-required-mismatch lib/ansible/modules/network/aci/mso_role.py validate-modules:parameter-list-no-elements diff --git a/test/units/module_utils/network/aci/test_aci.py b/test/units/module_utils/network/aci/test_aci.py deleted file mode 100644 index 0d53b29c3d..0000000000 --- a/test/units/module_utils/network/aci/test_aci.py +++ /dev/null @@ -1,328 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import sys - -from units.compat import unittest -from ansible.module_utils.network.aci.aci import ACIModule -from ansible.module_utils.six import PY2 -from ansible.module_utils._text import to_native - -import pytest - - -class AltModule(): - params = dict( - hostname='dummy', - port=123, - protocol='https', - state='present', - ) - - -class AltACIModule(ACIModule): - def __init__(self): - self.result = dict(changed=False) - self.module = AltModule - self.params = self.module.params - - -aci = AltACIModule() - - -try: - from lxml import etree - if sys.version_info >= (2, 7): - from xmljson import cobra -except ImportError: - pytestmark = pytest.mark.skip("ACI Ansible modules require the lxml and xmljson Python libraries") - - -class AciRest(unittest.TestCase): - - def test_invalid_aci_login(self): - self.maxDiff = None - - error = dict( - code='401', - text='Username or password is incorrect - FAILED local authentication', - ) - - imdata = [{ - 'error': { - 'attributes': { - 'code': '401', - 'text': 'Username or password is incorrect - FAILED local authentication', - }, - }, - }] - - totalCount = 1 - - json_response = '{"totalCount":"1","imdata":[{"error":{"attributes":{"code":"401","text":"Username or password is incorrect - FAILED local authentication"}}}]}' # NOQA - json_result = dict() - aci.response_json(json_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - # Python 2.7+ is needed for xmljson - if sys.version_info < (2, 7): - return - - xml_response = '''<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"> - <error code="401" text="Username or password is incorrect - FAILED local authentication"/> - </imdata> - ''' - xml_result = dict() - aci.response_xml(xml_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - def test_valid_aci_login(self): - self.maxDiff = None - - imdata = [{ - 'aaaLogin': { - 'attributes': { - 'token': 'ZldYAsoO9d0FfAQM8xaEVWvQPSOYwpnqzhwpIC1r4MaToknJjlIuAt9+TvXqrZ8lWYIGPj6VnZkWiS8nJfaiaX/AyrdD35jsSxiP3zydh+849xym7ALCw/fFNsc7b5ik1HaMuSUtdrN8fmCEUy7Pq/QNpGEqkE8m7HaxAuHpmvXgtdW1bA+KKJu2zY1c/tem', # NOQA - 'siteFingerprint': 'NdxD72K/uXaUK0wn', - 'refreshTimeoutSeconds': '600', - 'maximumLifetimeSeconds': '86400', - 'guiIdleTimeoutSeconds': '1200', - 'restTimeoutSeconds': '90', - 'creationTime': '1500134817', - 'firstLoginTime': '1500134817', - 'userName': 'admin', - 'remoteUser': 'false', - 'unixUserId': '15374', - 'sessionId': 'o7hObsqNTfCmDGcZI5c4ng==', - 'lastName': '', - 'firstName': '', - 'version': '2.0(2f)', - 'buildTime': 'Sat Aug 20 23:07:07 PDT 2016', - 'node': 'topology/pod-1/node-1', - }, - 'children': [{ - 'aaaUserDomain': { - 'attributes': { - 'name': 'all', - 'rolesR': 'admin', - 'rolesW': 'admin', - }, - 'children': [{ - 'aaaReadRoles': { - 'attributes': {}, - }, - }, { - 'aaaWriteRoles': { - 'attributes': {}, - 'children': [{ - 'role': { - 'attributes': { - 'name': 'admin', - }, - }, - }], - }, - }], - }, - }, { - 'DnDomainMapEntry': { - 'attributes': { - 'dn': 'uni/tn-common', - 'readPrivileges': 'admin', - 'writePrivileges': 'admin', - }, - }, - }, { - 'DnDomainMapEntry': { - 'attributes': { - 'dn': 'uni/tn-infra', - 'readPrivileges': 'admin', - 'writePrivileges': 'admin', - }, - }, - }, { - 'DnDomainMapEntry': { - 'attributes': { - 'dn': 'uni/tn-mgmt', - 'readPrivileges': 'admin', - 'writePrivileges': 'admin', - }, - }, - }], - }, - }] - - totalCount = 1 - - json_response = '{"totalCount":"1","imdata":[{"aaaLogin":{"attributes":{"token":"ZldYAsoO9d0FfAQM8xaEVWvQPSOYwpnqzhwpIC1r4MaToknJjlIuAt9+TvXqrZ8lWYIGPj6VnZkWiS8nJfaiaX/AyrdD35jsSxiP3zydh+849xym7ALCw/fFNsc7b5ik1HaMuSUtdrN8fmCEUy7Pq/QNpGEqkE8m7HaxAuHpmvXgtdW1bA+KKJu2zY1c/tem","siteFingerprint":"NdxD72K/uXaUK0wn","refreshTimeoutSeconds":"600","maximumLifetimeSeconds":"86400","guiIdleTimeoutSeconds":"1200","restTimeoutSeconds":"90","creationTime":"1500134817","firstLoginTime":"1500134817","userName":"admin","remoteUser":"false","unixUserId":"15374","sessionId":"o7hObsqNTfCmDGcZI5c4ng==","lastName":"","firstName":"","version":"2.0(2f)","buildTime":"Sat Aug 20 23:07:07 PDT 2016","node":"topology/pod-1/node-1"},"children":[{"aaaUserDomain":{"attributes":{"name":"all","rolesR":"admin","rolesW":"admin"},"children":[{"aaaReadRoles":{"attributes":{}}},{"aaaWriteRoles":{"attributes":{},"children":[{"role":{"attributes":{"name":"admin"}}}]}}]}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-common","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-infra","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-mgmt","readPrivileges":"admin","writePrivileges":"admin"}}}]}}]}' # NOQA - json_result = dict() - aci.response_json(json_response) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - # Python 2.7+ is needed for xmljson - if sys.version_info < (2, 7): - return - - xml_response = '<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1">\n<aaaLogin token="ZldYAsoO9d0FfAQM8xaEVWvQPSOYwpnqzhwpIC1r4MaToknJjlIuAt9+TvXqrZ8lWYIGPj6VnZkWiS8nJfaiaX/AyrdD35jsSxiP3zydh+849xym7ALCw/fFNsc7b5ik1HaMuSUtdrN8fmCEUy7Pq/QNpGEqkE8m7HaxAuHpmvXgtdW1bA+KKJu2zY1c/tem" siteFingerprint="NdxD72K/uXaUK0wn" refreshTimeoutSeconds="600" maximumLifetimeSeconds="86400" guiIdleTimeoutSeconds="1200" restTimeoutSeconds="90" creationTime="1500134817" firstLoginTime="1500134817" userName="admin" remoteUser="false" unixUserId="15374" sessionId="o7hObsqNTfCmDGcZI5c4ng==" lastName="" firstName="" version="2.0(2f)" buildTime="Sat Aug 20 23:07:07 PDT 2016" node="topology/pod-1/node-1">\n<aaaUserDomain name="all" rolesR="admin" rolesW="admin">\n<aaaReadRoles/>\n<aaaWriteRoles>\n<role name="admin"/>\n</aaaWriteRoles>\n</aaaUserDomain>\n<DnDomainMapEntry dn="uni/tn-common" readPrivileges="admin" writePrivileges="admin"/>\n<DnDomainMapEntry dn="uni/tn-infra" readPrivileges="admin" writePrivileges="admin"/>\n<DnDomainMapEntry dn="uni/tn-mgmt" readPrivileges="admin" writePrivileges="admin"/>\n</aaaLogin></imdata>\n''' # NOQA - xml_result = dict() - aci.response_xml(xml_response) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - def test_invalid_input(self): - self.maxDiff = None - - error = dict( - code='401', - text='Username or password is incorrect - FAILED local authentication', - ) - - imdata = [{ - 'error': { - 'attributes': { - 'code': '401', - 'text': 'Username or password is incorrect - FAILED local authentication', - }, - }, - }] - - totalCount = 1 - - json_response = '{"totalCount":"1","imdata":[{"error":{"attributes":{"code":"401","text":"Username or password is incorrect - FAILED local authentication"}}}]}' # NOQA - json_result = dict() - aci.response_json(json_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - # Python 2.7+ is needed for xmljson - if sys.version_info < (2, 7): - return - - xml_response = '''<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"> - <error code="401" text="Username or password is incorrect - FAILED local authentication"/> - </imdata> - ''' - xml_result = dict() - aci.response_xml(xml_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.imdata, imdata) - self.assertEqual(aci.totalCount, totalCount) - - def test_empty_response(self): - self.maxDiffi = None - - if PY2: - error_text = "Unable to parse output as JSON, see 'raw' output. No JSON object could be decoded" - else: - error_text = "Unable to parse output as JSON, see 'raw' output. Expecting value: line 1 column 1 (char 0)" - - error = dict( - code=-1, - text=error_text, - ) - raw = '' - - json_response = '' - json_result = dict() - aci.response_json(json_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.result['raw'], raw) - - # Python 2.7+ is needed for xmljson - if sys.version_info < (2, 7): - return - - elif etree.LXML_VERSION < (3, 3, 0, 0): - error_text = "Unable to parse output as XML, see 'raw' output. None", - elif etree.LXML_VERSION < (4, 0, 0, 0): - error_text = to_native(u"Unable to parse output as XML, see 'raw' output. None (line 0)", errors='surrogate_or_strict') - elif PY2: - error_text = "Unable to parse output as XML, see 'raw' output. Document is empty, line 1, column 1 (line 1)" - else: - error_text = None - - xml_response = '' - aci.response_xml(xml_response) - - if error_text is None: - # errors vary on Python 3.8+ for unknown reasons - # accept any of the following error messages - errors = ( - "Unable to parse output as XML, see 'raw' output. None (line 0)", - "Unable to parse output as XML, see 'raw' output. Document is empty, line 1, column 1 (<string>, line 1)", - ) - - for error in errors: - if error in aci.error['text']: - error_text = error - break - - error = dict( - code=-1, - text=error_text, - ) - - raw = '' - - self.assertEqual(aci.error, error) - self.assertEqual(aci.result['raw'], raw) - - def test_invalid_response(self): - self.maxDiff = None - - if sys.version_info < (2, 7): - error_text = "Unable to parse output as JSON, see 'raw' output. Expecting object: line 1 column 8 (char 8)" - elif PY2: - error_text = "Unable to parse output as JSON, see 'raw' output. No JSON object could be decoded" - else: - error_text = "Unable to parse output as JSON, see 'raw' output. Expecting value: line 1 column 9 (char 8)" - - error = dict( - code=-1, - text=error_text, - ) - - raw = '{ "aaa":' - - json_response = '{ "aaa":' - json_result = dict() - aci.response_json(json_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.result['raw'], raw) - - # Python 2.7+ is needed for xmljson - if sys.version_info < (2, 7): - return - - elif etree.LXML_VERSION < (3, 3, 0, 0): - error_text = "Unable to parse output as XML, see 'raw' output. Couldn't find end of Start Tag aaa line 1, line 1, column 5" # NOQA - - elif PY2: - error_text = "Unable to parse output as XML, see 'raw' output. Couldn't find end of Start Tag aaa line 1, line 1, column 6 (line 1)" # NOQA - - else: - error_text = "Unable to parse output as XML, see 'raw' output. Couldn't find end of Start Tag aaa line 1, line 1, column 6 (<string>, line 1)" # NOQA - - error = dict( - code=-1, - text=error_text, - ) - - raw = '<aaa ' - - xml_response = '<aaa ' - xml_result = dict() - aci.response_xml(xml_response) - self.assertEqual(aci.error, error) - self.assertEqual(aci.result['raw'], raw) |