diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 04:06:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 04:06:02 +0000 |
commit | e3eb94c23206603103f3c4faec6c227f59a1544c (patch) | |
tree | f2639459807ba88f55fc9c54d745bd7075d7f15c /ansible_collections/cisco/mso/tests/integration/targets | |
parent | Releasing progress-linux version 9.4.0+dfsg-1~progress7.99u1. (diff) | |
download | ansible-e3eb94c23206603103f3c4faec6c227f59a1544c.tar.xz ansible-e3eb94c23206603103f3c4faec6c227f59a1544c.zip |
Merging upstream version 9.5.1+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/mso/tests/integration/targets')
79 files changed, 9740 insertions, 4549 deletions
diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_backup/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_backup/tasks/main.yml index 9fe4d1a9a..c266ff1a6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_backup/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_backup/tasks/main.yml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Clear tenant - mso_tenant: &tenant1_absent + cisco.mso.mso_tenant: &tenant1_absent <<: *mso_info tenant: Tenant1 display_name: Test_Tenant @@ -53,13 +53,13 @@ state: present - name: Query all backups - mso_backup: &query_all_backups + cisco.mso.mso_backup: &query_all_backups <<: *mso_info state: query register: query_ansibleBackup_for_delete - name: Remove all backups - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup_id: '{{ item.id }}' state: absent @@ -70,7 +70,7 @@ when: version.current.version is version('3.2', '<') block: - name: Create local ansibleBackup1 in check mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup1 description: via Ansible @@ -80,12 +80,12 @@ check_mode: true - name: Verify local cm_add_ansibleBackup1 - assert: + ansible.builtin.assert: that: - cm_add_ansibleBackup1 is changed - name: Create local ansibleBackup1 in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup1 description: via Ansible @@ -94,7 +94,7 @@ register: nm_add_ansibleBackup1 - name: Query ansibleBackup1 to check if it exists - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup1 state: query @@ -107,13 +107,13 @@ delay: 10 - name: Verify nm_add_ansibleBackup1 - assert: + ansible.builtin.assert: that: - nm_add_ansibleBackup1 is changed - check_ansibleBackup1.current[0].backupEntry.metadata.name is match("ansibleBackup1_[0-9a-zA-Z]*") - name: Create local ansibleBackup3 in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 description: via Ansible @@ -122,7 +122,7 @@ register: nm_add_ansibleBackup3 - name: Query ansibleBackup3 to check if it exists - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 state: query @@ -136,7 +136,7 @@ delay: 10 - name: Assertions check for create local ansibleBackup3 in normal mode - assert: + ansible.builtin.assert: that: - query_ansibleBackup3 is not changed - query_ansibleBackup3.current.0.status.statusType == "success" @@ -145,7 +145,7 @@ # Creating duplicate backups with the name of ansibleBackup3 - to validate "Multiple backups with same name found" error message - name: Create local ansibleBackup3 in normal mode again - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 description: via Ansible @@ -154,7 +154,7 @@ register: nm_add_ansibleBackup3_again - name: Query duplicate ansibleBackup3 to check if it exists - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 state: query @@ -168,7 +168,7 @@ delay: 10 - name: Assertions check for create local ansibleBackup3 in normal mode again - assert: + ansible.builtin.assert: that: - query_ansibleBackup3_again is not changed - query_ansibleBackup3_again.current.1.status.statusType == "success" @@ -180,7 +180,7 @@ when: version.current.version is version('3.2', '<') block: - name: Move ansibleBackup1 from local to remote location in check mode - mso_backup: &move_ab1_cm + cisco.mso.mso_backup: &move_ab1_cm <<: *mso_info remote_location: ansible_test remote_path: "" @@ -191,12 +191,12 @@ register: move_ab1_cm - name: Move ansibleBackup1 from local to remote location in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *move_ab1_cm register: move_ab1_nm - name: Move a non existent backup from local location to remote - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: non_existent_backup remote_location: ansible_test @@ -206,7 +206,7 @@ ignore_errors: true - name: Move a ansibleBackup3 from local location to remote - check mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 remote_location: ansible_test @@ -216,7 +216,7 @@ ignore_errors: true - name: Move a ansibleBackup3 from local location to remote - normal mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackup3 remote_location: ansible_test @@ -226,7 +226,7 @@ ignore_errors: true - name: Assertions check for move a backup from local location to remote location - assert: + ansible.builtin.assert: that: - move_ab1_cm is changed - move_ab1_nm is changed @@ -236,7 +236,7 @@ # Create Remote backup - For all version - name: Create ansibleBackupRemote1 in check mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackupRemote1 description: Remote via Ansible @@ -248,7 +248,7 @@ register: cm_add_ansibleBackupRemote1 - name: Create ansibleBackupRemote1 in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackupRemote1 description: Remote via Ansible @@ -259,7 +259,7 @@ register: nm_add_ansibleBackupRemote1 - name: Query ansibleBackupRemote1 to check if it exists - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: ansibleBackupRemote1 state: query @@ -272,7 +272,7 @@ delay: 10 - name: Assertions check for the backups present on the remote location - assert: + ansible.builtin.assert: that: - cm_add_ansibleBackupRemote1 is changed - nm_add_ansibleBackupRemote1 is changed @@ -280,13 +280,13 @@ # Remove additional backups - to handle "Multiple backups with same name" during the download - name: Query all backups to handle "Multiple backups with same name" during the download - mso_backup: + cisco.mso.mso_backup: <<: *mso_info state: query register: query_ansibleBackup_for_delete - name: Delete all backups except for one to handle "Multiple backups with same name" during the download - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup_id: '{{ item.id }}' state: absent @@ -301,7 +301,7 @@ mode: '0755' - name: Download non existent backup - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: non_existent_backup destination: './{{mso_hostname}}' @@ -310,7 +310,7 @@ register: download_non_existent_backup - name: Download ansibleBackupRemote1 in check mode - mso_backup: &download_ab1_cm + cisco.mso.mso_backup: &download_ab1_cm <<: *mso_info backup: ansibleBackupRemote1 destination: './{{mso_hostname}}' @@ -319,12 +319,12 @@ register: download_ab1_cm - name: Download ansibleBackupRemote1 in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *download_ab1_cm register: download_ab1_nm - name: Assertions check for download a backup form MSO/NDO - assert: + ansible.builtin.assert: that: - download_ab1_cm is changed - download_ab1_nm is changed @@ -332,7 +332,7 @@ # Find Backup - name: Find backup - find: + ansible.builtin.find: paths: './{{mso_hostname}}' patterns: "*.tar.gz" register: backup_match @@ -342,7 +342,7 @@ when: version.current.version is version('3.2', '<') block: - name: Upload a backup from local machine to local location in check mode - mso_backup: &upload_backup_to_local_cm + cisco.mso.mso_backup: &upload_backup_to_local_cm <<: *mso_info backup: "{{ backup_match.files[0].path }}" state: upload @@ -350,12 +350,12 @@ check_mode: true - name: Upload a backup from local machine to local location in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *upload_backup_to_local_cm register: upload_backup_to_local_nm - name: Upload a non existent backup from local machine to local location - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: non_existent_backup state: upload @@ -363,7 +363,7 @@ ignore_errors: true - name: Assertions check for the upload a backup form local machine to local location - assert: + ansible.builtin.assert: that: - upload_backup_to_local_cm is changed - upload_backup_to_local_nm is changed @@ -372,12 +372,12 @@ # Upload backup to remote location for all platforms # To Support NDO Backup upload - name: Check present working directory with Shell command - shell: + ansible.builtin.shell: "pwd" register: present_working_directory - name: Upload an existing backup from local machine to remote location - check mode - mso_backup: &upload_backup_cm + cisco.mso.mso_backup: &upload_backup_cm <<: *mso_info backup: "{{present_working_directory.stdout}}/{{ backup_match.files[0].path }}" location_type: remote @@ -388,7 +388,7 @@ register: upload_backup_cm - name: Upload an existing backup from local machine to remote location - normal mode - mso_backup: + cisco.mso.mso_backup: <<: *upload_backup_cm register: upload_backup_nm ignore_errors: true @@ -400,25 +400,25 @@ - upload_backup_nm.current == [] block: - name: Query all backups - clear existing backups before uploading - to handle "Backup already existing issue" - mso_backup: + cisco.mso.mso_backup: <<: *mso_info state: query register: query_ansibleBackup_for_delete - name: Delete all backups from MSO/NDO before uploading the backup form local machine - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup_id: '{{ item.id }}' state: absent loop: '{{ query_ansibleBackup_for_delete.current | list | sort(attribute="name", reverse=True) }}' - name: Upload an existing backup from local machine to remote location - normal mode - after removing existing backups - mso_backup: + cisco.mso.mso_backup: <<: *upload_backup_cm register: upload_backup_nm - name: Upload a non existent backup from local location - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: non_existent_backup location_type: remote @@ -429,7 +429,7 @@ ignore_errors: true - name: Assertions check for the upload a backup form local machine to remote location - assert: + ansible.builtin.assert: that: - upload_non_existent_backup is not changed - "{{ 'Upload failed due to' in upload_non_existent_backup.msg }}" @@ -442,21 +442,21 @@ when: - version.current.version is version('2.2.4e', '!=') - version.current.version is version('3.2', '<') - set_fact: + ansible.builtin.set_fact: uploaded_backup_name: '{{ upload_backup_nm.current.backupEntry.metadata.name.split("_") | first }}' - name: Set Uploaded Backup Name for NDO when: - version.current.version is version('2.2.4e', '!=') - version.current.version is version('3.2', '>=') - set_fact: + ansible.builtin.set_fact: uploaded_backup_name: '{{ upload_backup_nm.current.body.backupEntry.metadata.name.split("_") | first }}' - name: Restore backup check when: version.current.version is version('2.2.4e', '!=') block: - name: Restore non existent backup - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup: non_existent_backup state: restore @@ -465,13 +465,13 @@ register: restore_non_existent_backup - name: Add a new tenant - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant1_absent state: present register: tenant1_present - name: Restore {{ uploaded_backup_name }} in check mode - mso_backup: &restore_backup_cm + cisco.mso.mso_backup: &restore_backup_cm <<: *mso_info backup: '{{ uploaded_backup_name }}' state: restore @@ -480,23 +480,23 @@ register: restore_backup_cm - name: Restore {{ uploaded_backup_name }} in normal mode - mso_backup: + cisco.mso.mso_backup: <<: *restore_backup_cm register: restore_backup_nm - name: Query Tenant1 after restoring the backup - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant1_absent state: query register: query_tenant1 - name: Restore {{ uploaded_backup_name }} in normal mode - idempotency check - mso_backup: + cisco.mso.mso_backup: <<: *restore_backup_cm register: idm_restore_backup_nm - name: Assertions check for the backup restore - assert: + ansible.builtin.assert: that: - restore_non_existent_backup.msg is match ("Backup 'non_existent_backup' does not exist") - restore_backup_cm is changed @@ -509,25 +509,25 @@ # Cleaning part # Remove all other backups - name: Query all backups before deleting - mso_backup: + cisco.mso.mso_backup: <<: *query_all_backups state: query register: query_all_backups_bf_delete - name: Ensure backups does not exists - mso_backup: + cisco.mso.mso_backup: <<: *mso_info backup_id: '{{ item.id }}' state: absent loop: '{{ query_all_backups_bf_delete.current | list | sort(attribute="name", reverse=True) }}' - name: Query all backups after deleting - to ensure all are absent - mso_backup: + cisco.mso.mso_backup: <<: *query_all_backups register: query_all_backups_af_delete - name: Assertions check for the query and remove all backups - assert: + ansible.builtin.assert: that: - query_all_backups_bf_delete is not changed - query_all_backups_af_delete is not changed @@ -541,6 +541,6 @@ # Remove Tenant1 - name: Ensure Tenant1 is absent - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant1_absent state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_backup_schedule/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_backup_schedule/tasks/main.yml index 1a50284f8..02f6885aa 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_backup_schedule/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_backup_schedule/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -25,7 +25,6 @@ cisco.mso.mso_backup_schedule: <<: *mso_info state: absent - delegate_to: localhost - name: Ensure remote location is present cisco.mso.mso_remote_location: @@ -45,11 +44,10 @@ cisco.mso.mso_backup_schedule: <<: *mso_info state: query - delegate_to: localhost register: no_schedule - name: Verify empty backup schedule - assert: + ansible.builtin.assert: that: - no_schedule is not changed - no_schedule.current == {} @@ -62,7 +60,6 @@ remote_location: ansible_test state: present check_mode: true - delegate_to: localhost register: cm_schedule_create - name: Set backup schedule (normal mode) @@ -72,12 +69,11 @@ frequency_length: 7 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_create # add date tests - name: Verify success set backup schedule - assert: + ansible.builtin.assert: that: - cm_schedule_create is changed - cm_schedule_create.current.intervalLength == 7 @@ -97,7 +93,6 @@ remote_location: ansible_test state: present check_mode: true - delegate_to: localhost register: cm_schedule_adjust - name: Adjust backup schedule (normal mode) @@ -107,11 +102,10 @@ frequency_length: 1 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_adjust - name: Verify success set backup schedule - assert: + ansible.builtin.assert: that: - cm_schedule_adjust is changed - cm_schedule_adjust.current.intervalLength == 1 @@ -126,11 +120,10 @@ cisco.mso.mso_backup_schedule: <<: *mso_info state: query - delegate_to: localhost register: schedule - name: Verify success get backup schedule - assert: + ansible.builtin.assert: that: - schedule is not changed - nm_schedule_adjust.current.timeInterval.length == 1 @@ -142,23 +135,20 @@ <<: *mso_info state: absent check_mode: true - delegate_to: localhost - name: Delete backup schedule (normal mode) cisco.mso.mso_backup_schedule: <<: *mso_info state: absent - delegate_to: localhost - name: Get empty backup schedule cisco.mso.mso_backup_schedule: <<: *mso_info state: query - delegate_to: localhost register: no_schedule - name: Verify empty backup schedule - assert: + ansible.builtin.assert: that: - no_schedule is not changed - no_schedule.current == {} @@ -171,7 +161,6 @@ frequency_length: 7 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_incorrect_time ignore_errors: true @@ -183,7 +172,6 @@ frequency_length: 7 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_incorrect_date ignore_errors: true @@ -195,7 +183,6 @@ frequency_length: 7 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_incorrect_date_from_start_date ignore_errors: true @@ -207,12 +194,11 @@ frequency_length: 7 remote_location: ansible_test state: present - delegate_to: localhost register: nm_schedule_incorrect_time_from_start_time ignore_errors: true - name: Verify error messages - assert: + ansible.builtin.assert: that: - nm_schedule_incorrect_time is failed - nm_schedule_incorrect_time.msg.startswith("Failed to parse time format") @@ -233,11 +219,10 @@ remote_location: ansible_test remote_path: remote_add state: present - delegate_to: localhost register: nm_schedule_full - name: Verify success set backup schedule - assert: + ansible.builtin.assert: that: - nm_schedule_full is changed - nm_schedule_full.current.timeInterval.length == 1 @@ -250,17 +235,15 @@ cisco.mso.mso_backup_schedule: <<: *mso_info state: absent - delegate_to: localhost - name: Get empty backup schedule cisco.mso.mso_backup_schedule: <<: *mso_info state: query - delegate_to: localhost register: no_schedule - name: Verify empty backup schedule - assert: + ansible.builtin.assert: that: - no_schedule is not changed - - no_schedule.current == {}
\ No newline at end of file + - no_schedule.current == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy/tasks/main.yaml b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy/tasks/main.yaml index b24749eb6..5d8225553 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy/tasks/main.yaml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy/tasks/main.yaml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined #CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -31,7 +31,7 @@ when: version.current.version is version('4.0', '<') block: - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -40,7 +40,7 @@ register: ansible_tenant - name: Stop consuming DHCP Policy CLIENT_BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -51,7 +51,7 @@ ignore_errors: true - name: Stop consuming DHCP Policy ansible_test_2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -60,7 +60,7 @@ ignore_errors: true - name: Stop consuming DHCP Policy ansible_test_multiple_dhcp - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -69,7 +69,7 @@ ignore_errors: true - name: Stop consuming DHCP Policy ansible_test_5 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test_2") }}' template: Template 5 @@ -78,7 +78,7 @@ ignore_errors: true - name: Remove DHCP Option Policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent @@ -91,7 +91,7 @@ # ADD DHCP Policy - name: Add a new DHCP Option Policy 1 (check mode) - mso_dhcp_option_policy: &create_dhcp + cisco.mso.mso_dhcp_option_policy: &create_dhcp <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 description: "My Test DHCP Policy 1" @@ -101,12 +101,12 @@ register: dhcp_pol1_cm - name: Add a new DHCP Option Policy 1 (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp register: dhcp_pol1_nm - name: Verify dhcp_pol1_cm and dhcp_pol1_nm - assert: + ansible.builtin.assert: that: - dhcp_pol1_cm is changed - dhcp_pol1_nm is changed @@ -117,18 +117,18 @@ - dhcp_pol1_cm.current.tenantId == dhcp_pol1_nm.current.tenantId == ansible_tenant.current.id - name: Add a new DHCP Option Policy 1 again (check mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp check_mode: true register: dhcp_pol1_again_cm - name: Add a new DHCP Option Policy 1 again (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp register: dhcp_pol1_again_nm - name: Verify dhcp_pol1_again_cm and dhcp_pol1_again_nm - assert: + ansible.builtin.assert: that: - dhcp_pol1_again_cm is not changed - dhcp_pol1_again_nm is not changed @@ -139,25 +139,25 @@ - dhcp_pol1_again_cm.current.tenantId == dhcp_pol1_again_nm.current.tenantId == ansible_tenant.current.id - name: Add a new DHCP Option Policy 2 (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp dhcp_option_policy: ansible_dhcp_option_2 - name: Change DHCP Option Policy 1 description (check mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp description: "My Changed Test DHCP Policy 1" check_mode: true register: change_dhcp_pol1_cm - name: Change DHCP Option Policy 1 description (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *create_dhcp description: "My Changed Test DHCP Policy 1" register: change_dhcp_pol1_nm - name: Verify change_dhcp_pol1_cm and change_dhcp_pol1_nm - assert: + ansible.builtin.assert: that: - change_dhcp_pol1_cm is changed - change_dhcp_pol1_nm is changed @@ -169,7 +169,7 @@ # QUERY A DHCP OPTION POLICY - name: Query DHCP Option Policy 1 (check mode) - mso_dhcp_option_policy: &query_dhcp + cisco.mso.mso_dhcp_option_policy: &query_dhcp <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 state: query @@ -177,12 +177,12 @@ register: dhcp_pol1_query_cm - name: Query DHCP Option Policy 1 (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *query_dhcp register: dhcp_pol1_query_nm - name: Verify dhcp_pol1_query - assert: + ansible.builtin.assert: that: - dhcp_pol1_query_cm is not changed - dhcp_pol1_query_nm is not changed @@ -193,33 +193,33 @@ # QUERY A NON-EXISTING DHCP OPTION POLICY - name: Query non-existing DHCP Option Policy (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: non_existing state: query register: quey_non_dhcp_pol - name: Verify quey_non_dhcp_pol - assert: + ansible.builtin.assert: that: - quey_non_dhcp_pol is not changed # QUERY ALL DHCP OPTION POLICIES - name: Query all DHCP Option Policies (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info state: query register: dhcp_policies_query - name: Verify dhcp_policies_query - assert: + ansible.builtin.assert: that: - dhcp_policies_query is not changed - dhcp_policies_query.current | length == 2 # REMOVE DHCP POLICY - name: Remove DHCP Option Policy 1 (check mode) - mso_dhcp_option_policy: &remove_dhcp + cisco.mso.mso_dhcp_option_policy: &remove_dhcp <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 state: absent @@ -227,12 +227,12 @@ register: dhcp_pol1_removed_cm - name: Remove DHCP Option Policy 1 (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *remove_dhcp register: dhcp_pol1_removed_nm - name: Verify dhcp_policies_removed - assert: + ansible.builtin.assert: that: - dhcp_pol1_removed_cm is changed - dhcp_pol1_removed_nm is changed @@ -240,18 +240,18 @@ # REMOVE DHCP POLICY AGAIN - name: Remove DHCP Option Policy 1 again (check mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *remove_dhcp check_mode: true register: dhcp_pol1_removed_again_cm - name: Remove DHCP Option Policy 1 again (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *remove_dhcp register: dhcp_pol1_removed_again_nm - name: Verify dhcp_pol1_removed_again - assert: + ansible.builtin.assert: that: - dhcp_pol1_removed_again_cm is not changed - dhcp_pol1_removed_again_nm is not changed @@ -261,7 +261,7 @@ # USE A NON-EXISTING TENANT - name: Non Existing Tenant for DHCP Option Policy 3 (normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_3 description: "My Test DHCP Policy 3" @@ -271,14 +271,14 @@ register: nm_non_existing_tenant - name: Verify nm_non_existing_tenant - assert: + ansible.builtin.assert: that: - nm_non_existing_tenant is not changed - nm_non_existing_tenant.msg == "Tenant 'non_existing' is not valid tenant name." # CLEAN UP - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -289,7 +289,7 @@ ignore_errors: true - name: Remove DHCP Option Policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy_option/tasks/main.yaml b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy_option/tasks/main.yaml index f6a79204f..b7c5cd66f 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy_option/tasks/main.yaml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_option_policy_option/tasks/main.yaml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined #CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -31,7 +31,7 @@ when: version.current.version is version('4.0', '<') block: - name: Remove options from DHCP Option Policy - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 name: "{{ item }}" @@ -42,7 +42,7 @@ ignore_errors: true - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -53,7 +53,7 @@ ignore_errors: true - name: Remove DHCP Relay Policy 1 - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -62,7 +62,7 @@ - ansible_dhcp_relay_2 - name: Remove DHCP Option Policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent @@ -72,7 +72,7 @@ - ansible_dhcp_option_2 - name: Undeploy sites in schema 1 template 1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -86,7 +86,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Undeploy sites in schema 1 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}' @@ -100,7 +100,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -109,7 +109,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -118,7 +118,7 @@ register: tenant_ansible - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -126,7 +126,7 @@ state: present - name: Add a new VRF - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -134,7 +134,7 @@ state: present - name: Add BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -145,7 +145,7 @@ # ADD DHCP RELAY AND OPTION POLICY - name: Add a new DHCP Option Policy 1 (Normal mode) - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 description: "My Test DHCP Policy 1" @@ -153,7 +153,7 @@ state: present - name: Add a new DHCP Relay Policy 1 (Normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 description: "My Test DHCP Policy 1" @@ -162,7 +162,7 @@ # ADD OPTION TO DHCP OPTION POLICY - name: Add Option to DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: &create_option + cisco.mso.mso_dhcp_option_policy_option: &create_option <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 name: ansibletest @@ -173,12 +173,12 @@ register: dhcp_pol1_opt1_cm - name: Add Option to DHCP Option Policy (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option register: dhcp_pol1_opt1_nm - name: Verify dhcp_pol1_opt1 - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_cm is changed - dhcp_pol1_opt1_nm is changed @@ -187,18 +187,18 @@ - dhcp_pol1_opt1_cm.current.data == dhcp_pol1_opt1_nm.current.data == 'DHCP Data' - name: Add Option to DHCP Option Policy again (check mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option check_mode: true register: dhcp_pol1_opt1_again_cm - name: Add Option to DHCP Option Policy again (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option register: dhcp_pol1_opt1_again_nm - name: Verify dhcp_pol1_opt1_again - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_again_cm is not changed - dhcp_pol1_opt1_again_nm is not changed @@ -207,20 +207,20 @@ - dhcp_pol1_opt1_again_cm.current.data == dhcp_pol1_opt1_again_nm.current.data == 'DHCP Data' - name: Change Option IP to DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option data: Changed DHCP Data check_mode: true register: dhcp_pol1_opt1_change_cm - name: Change Option IP to DHCP Option Policy (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option data: Changed DHCP Data register: dhcp_pol1_opt1_change_nm - name: Verify dhcp_pol1_opt1_change - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_change_cm is changed - dhcp_pol1_opt1_change_nm is changed @@ -229,20 +229,20 @@ - dhcp_pol1_opt1_change_cm.current.data == dhcp_pol1_opt1_change_nm.current.data == 'Changed DHCP Data' - name: Add 2nd Option to DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option name: ansibletest2 check_mode: true register: dhcp_pol1_opt2_cm - name: Add 2nd Option to DHCP Option Policy (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *create_option name: ansibletest2 register: dhcp_pol1_opt2_nm - name: Verify dhcp_pol1_opt2 - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt2_cm is changed - dhcp_pol1_opt2_nm is changed @@ -252,7 +252,7 @@ # QUERY OPTION FROM DHCP OPTION POLICY - name: Query Option from DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: &query_option + cisco.mso.mso_dhcp_option_policy_option: &query_option <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 name: ansibletest @@ -260,26 +260,26 @@ register: dhcp_pol1_opt1_query_cm - name: Query Option from DHCP Option Policy (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *query_option register: dhcp_pol1_opt1_query_nm - name: Query nonexisting Option from DHCP Option Policy - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *query_option name: nonexisting state: query register: dhcp_pol1_opt1_query_non_existing - name: Query all Options from a DHCP Option Policy - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 state: query register: dhcp_pol1_query_all - name: Verify all query variables - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_query_cm is not changed - dhcp_pol1_opt1_query_nm is not changed @@ -293,7 +293,7 @@ # REMOVE OPTION FROM DHCP OPTION POLICY - name: Remove Option from DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: &delete_option + cisco.mso.mso_dhcp_option_policy_option: &delete_option <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 name: ansibletest @@ -302,64 +302,64 @@ register: dhcp_pol1_opt1_del_cm - name: Remove Option from DHCP Option Policy (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *delete_option register: dhcp_pol1_opt1_del_nm - name: Verify dhcp_pol1_opt1_del - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_del_cm is changed - dhcp_pol1_opt1_del_nm is changed - dhcp_pol1_opt1_del_cm.current == dhcp_pol1_opt1_del_nm.current == {} - name: Remove Option from DHCP Option Policy again (check mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *delete_option check_mode: true register: dhcp_pol1_opt1_del_again_cm - name: Remove Option from DHCP Option Policy again (normal mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *delete_option register: dhcp_pol1_opt1_del_again_nm - name: Verify dhcp_pol1_opt1_again_del - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_del_again_cm is not changed - dhcp_pol1_opt1_del_again_nm is not changed - dhcp_pol1_opt1_del_again_cm.current == dhcp_pol1_opt1_del_again_nm.current == {} - name: Remove Non-Existing Option - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *delete_option name: nonexisting register: dhcp_pol1_opt1_del_nm_non_existing - name: Verify dhcp_pol1_opt1_del_nm_non_existing - assert: + ansible.builtin.assert: that: - dhcp_pol1_opt1_del_nm_non_existing is not changed - dhcp_pol1_opt1_del_nm_non_existing.current == {} # CONSUME DHCP POLICIES - name: Get DHCP Relay Policy version - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 state: query register: dhcp_relay_policy_version - name: Get DHCP Option Policy version - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 state: query register: dhcp_option_policy_version - name: Consume DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -376,7 +376,7 @@ register: bd_dhcp_policy - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -388,7 +388,7 @@ # QUERY OPTION FROM non_existing DHCP OPTION POLICY - name: Query Option from DHCP Option Policy (check mode) - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *mso_info dhcp_option_policy: nonexisting state: query @@ -396,14 +396,14 @@ register: dhcp_non_existing - name: Verify dhcp_non_existing - assert: + ansible.builtin.assert: that: - dhcp_non_existing is not changed - dhcp_non_existing.msg == "DHCP Option Policy 'nonexisting' is not a valid DHCP Option Policy name." # CLEAN UP - name: Remove options from DHCP Option Policy - mso_dhcp_option_policy_option: + cisco.mso.mso_dhcp_option_policy_option: <<: *mso_info dhcp_option_policy: ansible_dhcp_option_1 name: "{{ item }}" @@ -414,7 +414,7 @@ ignore_errors: true - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -425,7 +425,7 @@ ignore_errors: true - name: Remove DHCP Relay Policy 1 - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -434,7 +434,7 @@ - ansible_dhcp_relay_2 - name: Remove DHCP Option Policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy/tasks/main.yaml b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy/tasks/main.yaml index 4a7db2dca..a500c12f9 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy/tasks/main.yaml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy/tasks/main.yaml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined #CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,7 +21,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -30,7 +30,7 @@ when: version.current.version is version('4.0', '<') block: - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -39,7 +39,7 @@ register: ansible_tenant - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -50,7 +50,7 @@ ignore_errors: true - name: Remove DHCP Relay Policy 1 - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -63,7 +63,7 @@ # ADD DHCP Policy - name: Add a new DHCP Relay Policy 1 (check mode) - mso_dhcp_relay_policy: &create_dhcp + cisco.mso.mso_dhcp_relay_policy: &create_dhcp <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 description: "My Test DHCP Policy 1" @@ -73,12 +73,12 @@ register: dhcp_pol1_cm - name: Add a new DHCP Relay Policy 1 (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp register: dhcp_pol1_nm - name: Verify dhcp_pol1_cm and dhcp_pol1_nm - assert: + ansible.builtin.assert: that: - dhcp_pol1_cm is changed - dhcp_pol1_nm is changed @@ -89,18 +89,18 @@ - dhcp_pol1_cm.current.tenantId == dhcp_pol1_nm.current.tenantId == ansible_tenant.current.id - name: Add a new DHCP Relay Policy 1 again (check mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp check_mode: true register: dhcp_pol1_again_cm - name: Add a new DHCP Relay Policy 1 again (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp register: dhcp_pol1_again_nm - name: Verify dhcp_pol1_again_cm and dhcp_pol1_again_nm - assert: + ansible.builtin.assert: that: - dhcp_pol1_again_cm is not changed - dhcp_pol1_again_nm is not changed @@ -111,25 +111,25 @@ - dhcp_pol1_again_cm.current.tenantId == dhcp_pol1_again_nm.current.tenantId == ansible_tenant.current.id - name: Add a new DHCP Relay Policy 2 (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp dhcp_relay_policy: ansible_dhcp_relay_2 - name: Change DHCP Relay Policy 1 description (check mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp description: "My Changed Test DHCP Policy 1" check_mode: true register: change_dhcp_pol1_cm - name: Change DHCP Relay Policy 1 description (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *create_dhcp description: "My Changed Test DHCP Policy 1" register: change_dhcp_pol1_nm - name: Verify change_dhcp_pol1_cm and change_dhcp_pol1_nm - assert: + ansible.builtin.assert: that: - change_dhcp_pol1_cm is changed - change_dhcp_pol1_nm is changed @@ -141,7 +141,7 @@ # QUERY A DHCP RELAY POLICY - name: Query DHCP Relay Policy 1 (check mode) - mso_dhcp_relay_policy: &query_dhcp + cisco.mso.mso_dhcp_relay_policy: &query_dhcp <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 state: query @@ -149,12 +149,12 @@ register: dhcp_pol1_query_cm - name: Query DHCP Relay Policy 1 (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *query_dhcp register: dhcp_pol1_query_nm - name: Verify dhcp_pol1_query - assert: + ansible.builtin.assert: that: - dhcp_pol1_query_cm is not changed - dhcp_pol1_query_nm is not changed @@ -165,33 +165,33 @@ # QUERY A NON-EXISTING DHCP RELAY POLICY - name: Query non-existing DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: non_existing state: query register: quey_non_dhcp_pol - name: Verify quey_non_dhcp_pol - assert: + ansible.builtin.assert: that: - quey_non_dhcp_pol is not changed # QUERY ALL DHCP RELAY POLICIES - name: Query all DHCP Relay Policies (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info state: query register: dhcp_policies_query - name: Verify dhcp_policies_query - assert: + ansible.builtin.assert: that: - dhcp_policies_query is not changed - dhcp_policies_query.current | length == 2 # REMOVE DHCP POLICY - name: Remove DHCP Relay Policy 1 (check mode) - mso_dhcp_relay_policy: &remove_dhcp + cisco.mso.mso_dhcp_relay_policy: &remove_dhcp <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 state: absent @@ -199,12 +199,12 @@ register: dhcp_pol1_removed_cm - name: Remove DHCP Relay Policy 1 (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *remove_dhcp register: dhcp_pol1_removed_nm - name: Verify dhcp_policies_removed - assert: + ansible.builtin.assert: that: - dhcp_pol1_removed_cm is changed - dhcp_pol1_removed_nm is changed @@ -212,18 +212,18 @@ # REMOVE DHCP POLICY AGAIN - name: Remove DHCP Relay Policy 1 again (check mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *remove_dhcp check_mode: true register: dhcp_pol1_removed_again_cm - name: Remove DHCP Relay Policy 1 again (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *remove_dhcp register: dhcp_pol1_removed_again_nm - name: Verify dhcp_pol1_removed_again - assert: + ansible.builtin.assert: that: - dhcp_pol1_removed_again_cm is not changed - dhcp_pol1_removed_again_nm is not changed @@ -233,7 +233,7 @@ # USE A NON-EXISTING TENANT - name: Non Existing Tenant for DHCP Relay Policy 3 (normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_3 description: "My Test DHCP Policy 3" @@ -243,14 +243,14 @@ register: nm_non_existing_tenant - name: Verify nm_non_existing_tenant - assert: + ansible.builtin.assert: that: - nm_non_existing_tenant is not changed - nm_non_existing_tenant.msg == "Tenant 'non_existing' is not valid tenant name." # CLEAN UP DHCP POLICIES - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -261,7 +261,7 @@ ignore_errors: true - name: Remove DHCP Relay Policy 1 - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy_provider/tasks/main.yaml b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy_provider/tasks/main.yaml index 828a34424..a3506099c 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy_provider/tasks/main.yaml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_dhcp_relay_policy_provider/tasks/main.yaml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined #CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,7 +21,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -30,7 +30,7 @@ when: version.current.version is version('4.0', '<') block: - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -44,7 +44,7 @@ - EXT_EPG_2 - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -59,7 +59,7 @@ - EPG_2 - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -70,7 +70,7 @@ ignore_errors: true - name: Remove DHCP Relay Policies - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -80,7 +80,7 @@ - ansible_dhcp_relay_2 - name: Undeploy sites in schema 1 template 1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -94,7 +94,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Undeploy sites in schema 1 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}' @@ -108,7 +108,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -117,7 +117,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -126,7 +126,7 @@ register: tenant_ansible - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -135,7 +135,7 @@ # CREATE EPG PROVIDER - name: Add a new VRF - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -143,7 +143,7 @@ state: present - name: Add a new BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -153,7 +153,7 @@ state: present - name: Add 2nd BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -163,7 +163,7 @@ state: present - name: Add a new ANP - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -171,7 +171,7 @@ state: present - name: Add a new EPG - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -184,7 +184,7 @@ state: present - name: Add 2nd EPG - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -197,7 +197,7 @@ state: present - name: Add a new L3out - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -240,7 +240,7 @@ # ADD DHCP RELAY POLICY - name: Add a new DHCP Relay Policy 1 (Normal mode) - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 description: "My Test DHCP Policy 1" @@ -249,7 +249,7 @@ # ADD PROVIDER TO DHCP RELAY POLICY - name: Add Provider to DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: &create_provider + cisco.mso.mso_dhcp_relay_policy_provider: &create_provider <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 ip: "1.1.1.1" @@ -263,12 +263,12 @@ register: dhcp_pol1_prov1_cm - name: Add Provider to DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider register: dhcp_pol1_prov1_nm - name: Verify dhcp_pol1_prov1 - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_cm is changed - dhcp_pol1_prov1_nm is changed @@ -283,18 +283,18 @@ - dhcp_pol1_prov1_nm.current.tenantId == tenant_ansible.current.id - name: Add Provider to DHCP Relay Policy again (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider check_mode: true register: dhcp_pol1_prov1_again_cm - name: Add Provider to DHCP Relay Policy again (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider register: dhcp_pol1_prov1_again_nm - name: Verify dhcp_pol1_prov1_again - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_again_cm is not changed - dhcp_pol1_prov1_again_nm is not changed @@ -309,20 +309,20 @@ - dhcp_pol1_prov1_again_nm.current.tenantId == tenant_ansible.current.id - name: Change Provider IP to DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider ip: "2.2.2.2" check_mode: true register: dhcp_pol1_prov1_change_cm - name: Change Provider IP to DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider ip: "2.2.2.2" register: dhcp_pol1_prov1_change_nm - name: Verify dhcp_pol1_prov1_change - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_change_cm is changed - dhcp_pol1_prov1_change_nm is changed @@ -337,7 +337,7 @@ - dhcp_pol1_prov1_change_nm.current.tenantId == tenant_ansible.current.id - name: Add 2nd Provider (EPG_2) to DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider ip: "2.2.2.2" endpoint_group: EPG_2 @@ -345,14 +345,14 @@ register: dhcp_pol1_prov2_cm - name: Add 2nd Provider (EPG_2) to DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider ip: "2.2.2.2" endpoint_group: EPG_2 register: dhcp_pol1_prov2_nm - name: Add 3rd Provider (EXT_EPG_1) to DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: &create_provider_external_epg + cisco.mso.mso_dhcp_relay_policy_provider: &create_provider_external_epg <<: *create_provider ip: "2.2.2.2" external_endpoint_group: EXT_EPG_1 @@ -362,26 +362,26 @@ register: dhcp_pol1_prov3_cm - name: Add 3rd Provider (EXT_EPG_1) to DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider_external_epg external_endpoint_group: EXT_EPG_1 register: dhcp_pol1_prov3_nm - name: Add 4th Provider (EXT_EPG_2) to DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider_external_epg external_endpoint_group: EXT_EPG_2 check_mode: true register: dhcp_pol1_prov4_cm - name: Add 4th Provider (EXT_EPG_2) to DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *create_provider_external_epg external_endpoint_group: EXT_EPG_2 register: dhcp_pol1_prov4_nm - name: Verify dhcp_pol1_prov2, dhcp_pol1_prov3 and dhcp_pol1_prov4 - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov2_cm is changed - dhcp_pol1_prov2_nm is changed @@ -409,7 +409,7 @@ # ADD DHCP RELAY PROVIDER WITH WRONG Attributes - name: Add Provider to DHCP Relay Policy - wrong tenant (Normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 ip: "2.2.2.2" @@ -423,7 +423,7 @@ register: dhcp_pol1_prov2_nm_ten_wrong - name: Add Provider to DHCP Relay Policy - wrong Schema (Normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 ip: "2.2.2.2" @@ -437,7 +437,7 @@ register: dhcp_pol1_prov2_nm_sch_wrong - name: Verify dhcp_pol1_prov2_nm_ten_wrong, dhcp_pol1_prov2_nm_sch_wrong & dhcp_pol1_prov2_nm_tmp_wrong - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov2_nm_ten_wrong is not changed - dhcp_pol1_prov2_nm_ten_wrong.msg == "Tenant 'ansible_test_wrong' is not valid tenant name." @@ -447,7 +447,7 @@ # QUERY PROVIDER FROM DHCP RELAY POLICY - name: Query Provider from DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: &query_provider + cisco.mso.mso_dhcp_relay_policy_provider: &query_provider <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -459,26 +459,26 @@ register: dhcp_pol1_prov1_query_cm - name: Query Provider from DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *query_provider register: dhcp_pol1_prov1_query_nm - name: Query non_existing Provider from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *query_provider endpoint_group: non_existing state: query register: dhcp_pol1_prov1_query_non_existing - name: Query all Providers from a DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 state: query register: dhcp_pol1_query_all - name: Verify all query variables - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_query_cm is not changed - dhcp_pol1_prov1_query_nm is not changed @@ -496,7 +496,7 @@ # REMOVE PROVIDER FROM DHCP RELAY POLICY - name: Remove Provider (EXT_EPG) from DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: &delete_provider + cisco.mso.mso_dhcp_relay_policy_provider: &delete_provider <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -508,43 +508,43 @@ register: dhcp_pol1_prov1_del_cm - name: Remove Provider (EXT_EPG) from DHCP Relay Policy (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *delete_provider register: dhcp_pol1_prov1_del_nm - name: Verify dhcp_pol1_prov1_del - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_del_cm is changed - dhcp_pol1_prov1_del_nm is changed - dhcp_pol1_prov1_del_cm.current == dhcp_pol1_prov1_del_nm.current == {} - name: Remove Provider (EXT_EPG) from DHCP Relay Policy again (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *delete_provider check_mode: true register: dhcp_pol1_prov1_del_again_cm - name: Remove Provider (EXT_EPG) from DHCP Relay Policy again (normal mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *delete_provider register: dhcp_pol1_prov1_del_again_nm - name: Verify dhcp_pol1_prov1_again_del - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_del_again_cm is not changed - dhcp_pol1_prov1_del_again_nm is not changed - dhcp_pol1_prov1_del_again_cm.current == dhcp_pol1_prov1_del_again_nm.current == {} - name: Remove Non-Existing Provider (EXT_EPG) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *delete_provider external_endpoint_group: non_existing register: dhcp_pol1_prov1_del_nm_non_existing - name: Remove Provider without epg or ext_epg - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -555,7 +555,7 @@ register: dhcp_pol1_prov1_del_none - name: Verify dhcp_pol1_prov1_del_nm_non_existing - assert: + ansible.builtin.assert: that: - dhcp_pol1_prov1_del_nm_non_existing is not changed - dhcp_pol1_prov1_del_none is not changed @@ -564,14 +564,14 @@ # CONSUME DHCP POLICIES - name: Get DHCP Relay Policy version - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 state: query register: dhcp_relay_policy_version - name: Consume DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -585,7 +585,7 @@ register: bd_dhcp_policy - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -597,7 +597,7 @@ # QUERY PROVIDER FROM non_existing DHCP RELAY POLICY - name: Query Provider from DHCP Relay Policy (check mode) - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: non_existing state: query @@ -605,14 +605,14 @@ register: dhcp_non_existing - name: Verify dhcp_non_existing - assert: + ansible.builtin.assert: that: - dhcp_non_existing is not changed - dhcp_non_existing.msg == "DHCP Relay Policy 'non_existing' is not a valid DHCP Relay Policy name." # CLEAN UP - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -626,7 +626,7 @@ - EXT_EPG_2 - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -641,7 +641,7 @@ - EPG_2 - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -652,7 +652,7 @@ ignore_errors: true - name: Remove DHCP Relay Policies - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_label/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_label/tasks/main.yml index fffb0ce78..e9e2e5a46 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_label/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_label/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -31,14 +31,14 @@ when: version.current.version is version('3.2', '<') block: - name: GET auth radius providers - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/auth/providers/radius method: get register: radius_providers - name: Add auth radius provider - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/auth/providers/radius method: post @@ -57,25 +57,25 @@ when: mso_radius_server not in (radius_providers.jsondata.radiusProviders | map(attribute='host')) - name: GET login domains - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/auth/domains method: get register: login_domains - name: GET auth radius providers again after creation - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/auth/providers/radius method: get register: radius_providers - name: GET auth radius provider ID - set_fact: + ansible.builtin.set_fact: radius_provider_id: "{{ (radius_providers.jsondata.radiusProviders | selectattr('host', 'eq', mso_radius_server) | first)['id'] }}" - name: Add test login domain - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/auth/domains method: post @@ -95,7 +95,7 @@ # REMOVE DHCP POLICY - name: Remove DHCP Option Policy - mso_dhcp_option_policy: &remove_dhcp + cisco.mso.mso_dhcp_option_policy: &remove_dhcp <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent @@ -104,7 +104,7 @@ - ansible_dhcp_option_2 - name: Remove DHCP Relay Policy - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -113,19 +113,19 @@ - ansible_dhcp_relay_2 - name: Remove label ansible_test - mso_label: &label_absent + cisco.mso.mso_label: &label_absent <<: *mso_info label: ansible_test state: absent - name: Remove label ansible_test2 - mso_label: + cisco.mso.mso_label: <<: *label_absent label: ansible_test2 register: cm_remove_label - name: Remove label ansible_test3 - mso_label: &domain_label_absent + cisco.mso.mso_label: &domain_label_absent <<: *mso_info state: absent label: ansible_test3 @@ -133,14 +133,14 @@ register: nm_remove_label3 - name: Remove label ansible_test4 - mso_label: + cisco.mso.mso_label: <<: *domain_label_absent label: ansible_test4 login_domain: '{{ mso_login_domain | default("test") }}' # ADD LABEL - name: Add label (check_mode) - mso_label: &label_present + cisco.mso.mso_label: &label_present <<: *mso_info label: ansible_test state: present @@ -148,7 +148,7 @@ register: cm_add_label - name: Verify cm_add_label - assert: + ansible.builtin.assert: that: - cm_add_label is changed - cm_add_label.previous == {} @@ -157,11 +157,11 @@ - cm_add_label.current.type == 'site' - name: Add label (normal mode) - mso_label: *label_present + cisco.mso.mso_label: *label_present register: nm_add_label - name: Verify nm_add_label - assert: + ansible.builtin.assert: that: - nm_add_label is changed - nm_add_label.previous == {} @@ -170,12 +170,12 @@ - nm_add_label.current.type == 'site' - name: Add label again (check_mode) - mso_label: *label_present + cisco.mso.mso_label: *label_present check_mode: true register: cm_add_label_again - name: Verify cm_add_label_again - assert: + ansible.builtin.assert: that: - cm_add_label_again is not changed - cm_add_label_again.previous.displayName == 'ansible_test' @@ -185,11 +185,11 @@ - cm_add_label_again.current.type == 'site' - name: Add label again (normal mode) - mso_label: *label_present + cisco.mso.mso_label: *label_present register: nm_add_label_again - name: Verify nm_add_label_again - assert: + ansible.builtin.assert: that: - nm_add_label_again is not changed - nm_add_label_again.previous.displayName == 'ansible_test' @@ -201,7 +201,7 @@ # CHANGE LABEL # - name: Change label (check_mode) -# mso_label: +# cisco.mso.mso_label: # <<: *label_present # label_id: '{{ nm_add_label.current.id }}' # label: ansible_test2 @@ -209,7 +209,7 @@ # register: cm_change_label # - name: Verify cm_change_label -# assert: +# ansible.builtin.assert: # that: # - cm_change_label is changed # - cm_change_label.current.displayName == 'ansible_test2' @@ -217,7 +217,7 @@ # - cm_change_label.current.type == 'site' # - name: Change label (normal mode) -# mso_label: +# cisco.mso.mso_label: # <<: *label_present # label_id: '{{ nm_add_label.current.id }}' # label: ansible_test2 @@ -225,7 +225,7 @@ # register: nm_change_label # - name: Verify nm_change_label -# assert: +# ansible.builtin.assert: # that: # - nm_change_label is changed # - cm_change_label.current.displayName == 'ansible_test2' @@ -233,7 +233,7 @@ # - nm_change_label.current.type == 'site' # - name: Change label again (check_mode) -# mso_label: +# cisco.mso.mso_label: # <<: *label_present # label_id: '{{ nm_add_label.current.id }}' # label: ansible_test2 @@ -241,7 +241,7 @@ # register: cm_change_label_again # - name: Verify cm_change_label_again -# assert: +# ansible.builtin.assert: # that: # - cm_change_label_again is not changed # - cm_change_label_again.current.displayName == 'ansible_test2' @@ -249,14 +249,14 @@ # - cm_change_label_again.current.type == 'site' # - name: Change label again (normal mode) -# mso_label: +# cisco.mso.mso_label: # <<: *label_present # label_id: '{{ nm_add_label.current.id }}' # label: ansible_test2 # register: nm_change_label_again # - name: Verify nm_change_label_again -# assert: +# ansible.builtin.assert: # that: # - nm_change_label_again is not changed # - nm_change_label_again.current.displayName == 'ansible_test2' @@ -266,18 +266,18 @@ # QUERY ALL LABELS - name: Query all labels (check_mode) - mso_label: &label_query + cisco.mso.mso_label: &label_query <<: *mso_info state: query check_mode: true register: cm_query_all_labels - name: Query all labels (normal mode) - mso_label: *label_query + cisco.mso.mso_label: *label_query register: nm_query_all_labels - name: Verify query_all_labels - assert: + ansible.builtin.assert: that: - cm_query_all_labels is not changed - nm_query_all_labels is not changed @@ -288,20 +288,20 @@ # QUERY A LABEL - name: Query our label (check mode) - mso_label: + cisco.mso.mso_label: <<: *label_query label: ansible_test check_mode: true register: cm_query_label - name: Query our label (normal mode) - mso_label: + cisco.mso.mso_label: <<: *label_query label: ansible_test register: nm_query_label - name: Verify query_label - assert: + ansible.builtin.assert: that: - cm_query_label is not changed - cm_query_label.current.displayName == 'ansible_test' @@ -316,43 +316,43 @@ # REMOVE LABEL - name: Remove label (check_mode) - mso_label: *label_absent + cisco.mso.mso_label: *label_absent check_mode: true register: cm_remove_label - name: Verify cm_remove_label - assert: + ansible.builtin.assert: that: - cm_remove_label is changed - cm_remove_label.current == {} - name: Remove label (normal mode) - mso_label: *label_absent + cisco.mso.mso_label: *label_absent register: nm_remove_label - name: Verify nm_remove_label - assert: + ansible.builtin.assert: that: - nm_remove_label is changed - nm_remove_label.current == {} - name: Remove label again (check_mode) - mso_label: *label_absent + cisco.mso.mso_label: *label_absent check_mode: true register: cm_remove_label_again - name: Verify cm_remove_label_again - assert: + ansible.builtin.assert: that: - cm_remove_label_again is not changed - cm_remove_label_again.current == {} - name: Remove label again (normal mode) - mso_label: *label_absent + cisco.mso.mso_label: *label_absent register: nm_remove_label_again - name: Verify nm_remove_label_again - assert: + ansible.builtin.assert: that: - nm_remove_label_again is not changed - nm_remove_label_again.current == {} @@ -360,21 +360,21 @@ # QUERY NON-EXISTING LABEL - name: Query non-existing label (check_mode) - mso_label: + cisco.mso.mso_label: <<: *label_query label: ansible_test check_mode: true register: cm_query_non_label - name: Query non-existing label (normal mode) - mso_label: + cisco.mso.mso_label: <<: *label_query label: ansible_test register: nm_query_non_label # TODO: Implement more tests - name: Verify query_non_label - assert: + ansible.builtin.assert: that: - cm_query_non_label is not changed - nm_query_non_label is not changed @@ -382,7 +382,7 @@ # add label with login domain - name: Add label local domain(normal mode) - mso_label: &domain_label_present + cisco.mso.mso_label: &domain_label_present <<: *mso_info state: present label: ansible_test3 @@ -390,21 +390,21 @@ register: label_local_domain - name: Verify label_local_domain - assert: + ansible.builtin.assert: that: - label_local_domain is changed - label_local_domain.current.displayName == 'ansible_test3' - label_local_domain.current.type == 'site' - name: Add label test domain(normal mode) - mso_label: + cisco.mso.mso_label: <<: *domain_label_present label: ansible_test4 login_domain: '{{ mso_login_domain | default("test") }}' register: label_test_domain - name: Verify label_test_domain - assert: + ansible.builtin.assert: that: - label_test_domain is changed - label_test_domain.current.displayName == 'ansible_test4' diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_remote_location/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_remote_location/tasks/main.yml index aa543f959..d5d00010d 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_remote_location/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_remote_location/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -25,7 +25,6 @@ cisco.mso.mso_backup: <<: *mso_info state: query - delegate_to: localhost register: backups - name: Ensure all backups with link to remote location ansible_test are removed @@ -38,14 +37,12 @@ - item.location.locationType is defined - item.location.locationType == "remote" loop: "{{ backups.current | sort(attribute='name', reverse=True) }}" - delegate_to: localhost - name: Ensure remote location ansible_test is removed cisco.mso.mso_remote_location: <<: *mso_info remote_location: ansible_test state: absent - delegate_to: localhost - name: Configure remote location scp (check mode) cisco.mso.mso_remote_location: &remote_location @@ -59,17 +56,15 @@ remote_password: '{{ mso_remote_location_password | default(mso_password) }}' state: present check_mode: true - delegate_to: localhost register: cm_config_remote - name: Configure remote location scp cisco.mso.mso_remote_location: <<: *remote_location - delegate_to: localhost register: nm_config_remote - name: Verify configuration - assert: + ansible.builtin.assert: that: - cm_config_remote is changed - cm_config_remote.current.name == "ansible_test" @@ -92,11 +87,10 @@ - name: Configure remote location again cisco.mso.mso_remote_location: <<: *remote_location - delegate_to: localhost register: nm_config_remote_again - name: Verify configuration after again - assert: + ansible.builtin.assert: that: - nm_config_remote_again is not changed @@ -105,18 +99,16 @@ <<: *remote_location description: changed_description check_mode: true - delegate_to: localhost register: cm_change_config_remote_description - name: Change remote location description cisco.mso.mso_remote_location: <<: *remote_location description: changed_description - delegate_to: localhost register: nm_change_config_remote_description - name: Verify configuration change - assert: + ansible.builtin.assert: that: - cm_change_config_remote_description is changed - cm_change_config_remote_description.current.description == "changed_description" @@ -127,14 +119,12 @@ cisco.mso.mso_remote_location: <<: *remote_location state: query - delegate_to: localhost register: nm_query_remote - name: Query all remote locations cisco.mso.mso_remote_location: <<: *mso_info state: query - delegate_to: localhost register: nm_query_all_remotes - name: Query non existing remote location @@ -143,11 +133,10 @@ remote_location: non_existing state: query ignore_errors: true - delegate_to: localhost register: nm_query_non_existing - name: Verify queries - assert: + ansible.builtin.assert: that: - nm_query_remote is not changed - nm_query_remote.current | type_debug == "dict" @@ -161,18 +150,16 @@ <<: *remote_location state: absent check_mode: true - delegate_to: localhost register: cm_delete_config_remote - name: Remove remote location cisco.mso.mso_remote_location: <<: *remote_location state: absent - delegate_to: localhost register: nm_delete_config_remote - name: Verify delete - assert: + ansible.builtin.assert: that: - cm_delete_config_remote is changed - cm_delete_config_remote.current == {} @@ -190,18 +177,16 @@ <<: *remote_location remote_path: '{{ mso_remote_location_alternate_path | default("/home/"~mso_username) }}' check_mode: true - delegate_to: localhost register: cm_config_remote_different_path - name: Configure remote location different path cisco.mso.mso_remote_location: <<: *remote_location remote_path: '{{ mso_remote_location_alternate_path | default("/home/"~mso_username) }}' - delegate_to: localhost register: nm_config_remote_different_path - name: Verify configuration different path - assert: + ansible.builtin.assert: that: - cm_config_remote_different_path is changed - cm_config_remote_different_path.current.credential.remotePath == '{{ mso_remote_location_alternate_path | default("/home/"~mso_username) }}' @@ -212,25 +197,22 @@ cisco.mso.mso_remote_location: <<: *remote_location state: absent - delegate_to: localhost - name: Configure remote location sftp (check mode) cisco.mso.mso_remote_location: <<: *remote_location remote_protocol: sftp check_mode: true - delegate_to: localhost register: cm_config_remote_sftp - name: Configure remote location sftp cisco.mso.mso_remote_location: <<: *remote_location remote_protocol: sftp - delegate_to: localhost register: nm_config_remote_sftp - name: Verify configuration sftp - assert: + ansible.builtin.assert: that: - cm_config_remote_sftp is changed - cm_config_remote_sftp.current.credential.protocolType == "sftp" @@ -241,7 +223,6 @@ cisco.mso.mso_remote_location: <<: *remote_location state: absent - delegate_to: localhost - name: Configure remote location ssh (check mode) cisco.mso.mso_remote_location: &remote_location_ssh @@ -249,17 +230,15 @@ authentication_type: ssh remote_ssh_key: "{{ lookup('file', 'pki/rsa') }}" check_mode: true - delegate_to: localhost register: cm_config_remote_ssh - name: Configure remote location ssh cisco.mso.mso_remote_location: <<: *remote_location_ssh - delegate_to: localhost register: nm_config_remote_ssh - name: Verify configuration ssh - assert: + ansible.builtin.assert: that: - cm_config_remote_ssh is changed - cm_config_remote_ssh.current.credential.authType == "sshKey" @@ -270,7 +249,6 @@ cisco.mso.mso_remote_location: <<: *remote_location_ssh state: absent - delegate_to: localhost - name: Configure remote location ssh with passphrase (check mode) cisco.mso.mso_remote_location: &remote_location_ssh_pass @@ -279,17 +257,15 @@ remote_ssh_key: "{{ lookup('file', 'pki/rsa-passphrase') }}" remote_ssh_passphrase: '{{ mso_output_level | default("ansible") }}' check_mode: true - delegate_to: localhost register: cm_config_remote_ssh_pass - name: Configure remote location ssh with passphrase cisco.mso.mso_remote_location: <<: *remote_location_ssh_pass - delegate_to: localhost register: nm_config_remote_ssh_pass - name: Verify configuration ssh - assert: + ansible.builtin.assert: that: - cm_config_remote_ssh_pass is changed - cm_config_remote_ssh_pass.current.credential.authType == "sshKey" @@ -300,4 +276,3 @@ cisco.mso.mso_remote_location: <<: *remote_location_ssh_pass state: absent - delegate_to: localhost
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/error_handling.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/error_handling.yml index 63a241918..456220eac 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/error_handling.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/error_handling.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # SET VARs - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +23,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -45,7 +45,7 @@ register: error_on_missing_required_param - name: Verify error_on_missing_required_param - assert: + ansible.builtin.assert: that: - error_on_missing_required_param is failed - 'error_on_missing_required_param.msg == "missing required arguments: path"' @@ -73,19 +73,19 @@ register: error_on_name_resolution - name: Verify error_on_name_resolution - assert: + ansible.builtin.assert: that: - error_on_name_resolution is failed - name: Verify error_on_name_resolution - assert: + ansible.builtin.assert: that: - error_on_name_resolution.msg is search("Name or service not known") when: - version.current.version is version('3.7', '>=') - name: Error on invalid path - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/tenant method: post @@ -100,14 +100,14 @@ register: error_on_invalid_path - name: Verify error_on_invalid_path - assert: + ansible.builtin.assert: that: - error_on_invalid_path is failed - error_on_invalid_path.status == 404 when: version.current.version is version('3.0.0a', '<') or version.current.version is version('3.2', '>=') - name: Verify error_on_invalid_path - assert: + ansible.builtin.assert: that: - error_on_invalid_path is failed - error_on_invalid_path.status == 405 @@ -126,7 +126,7 @@ register: error_on_missing_attributes - name: Verify error_on_missing_attributes - assert: + ansible.builtin.assert: that: - error_on_missing_attributes is failed - error_on_missing_attributes.status == 400 @@ -147,7 +147,7 @@ register: error_on_input_validation - name: Verify error_on_input_validation - assert: + ansible.builtin.assert: that: - error_on_input_validation is failed - error_on_input_validation.status == 400 diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_inline.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_inline.yml index 252733c29..9eff34f24 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_inline.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_inline.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,13 +23,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -43,7 +43,7 @@ - EXT_EPG_2 - name: Remove EXT_EPGs Providers from DHCP Relay Policy - mso_dhcp_relay_policy_provider: + cisco.mso.mso_dhcp_relay_policy_provider: <<: *mso_info dhcp_relay_policy: ansible_dhcp_relay_1 tenant: ansible_test @@ -58,7 +58,7 @@ - EPG_2 - name: Stop consuming DHCP Policy - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -69,7 +69,7 @@ ignore_errors: true - name: Remove DHCP Relay Policies - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' state: absent @@ -79,7 +79,7 @@ - ansible_dhcp_relay_2 - name: Remove DHCP Option Policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' state: absent @@ -101,7 +101,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test state: absent @@ -109,20 +109,20 @@ # QUERY SCHEMAS - name: Query schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: get register: query_all_schema - name: Verify query_all_schema in json_inline - assert: + ansible.builtin.assert: that: - query_all_schema is not changed # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *mso_info state: query user: '{{ mso_username }}' @@ -130,14 +130,14 @@ register: query_user_id - name: Verify query_user_id - assert: + ansible.builtin.assert: that: - query_user_id is not changed - query_user_id.current.username == '{{ mso_username }}' # ADD tenant - name: Add tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/tenants method: post @@ -155,14 +155,14 @@ register: add_tenant - name: Verify add_tenant in json_inline - assert: + ansible.builtin.assert: that: - add_tenant is changed - add_tenant.jsondata.displayName == 'ansible_test' # ADD schema - name: Add schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: post @@ -190,14 +190,14 @@ register: add_schema - name: Verify add_schema in json_inline - assert: + ansible.builtin.assert: that: - add_schema is changed - add_schema.jsondata.displayName == 'ansible_test' # PUT schema - name: Put schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info port: 443 path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" @@ -226,14 +226,14 @@ register: put_schema - name: Verify put_schema in json_inline - assert: + ansible.builtin.assert: that: - put_schema is changed - put_schema.jsondata.displayName == 'ansible_test_2' # PATCH schema - name: Patch schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: patch @@ -249,12 +249,12 @@ register: patch_schema - name: Verify patch_schema in json_inline - assert: + ansible.builtin.assert: that: - patch_schema is changed - name: Verify patch_schema in json_inline - assert: + ansible.builtin.assert: that: - patch_schema.jsondata.templates[0].anps[0].displayName == 'AP2' # MSO 3.3 PATCH does not return anything anymore. @@ -262,28 +262,28 @@ # DELETE the schema - name: Delete the schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: delete register: delete_schema - name: Verify delete_schema in json_inline - assert: + ansible.builtin.assert: that: - delete_schema is changed - delete_schema.jsondata == None # DELETE TENANT - name: Delete the tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/tenants/{{ add_tenant.jsondata.id }}" method: delete register: delete_tenant - name: Verify delete_tenant in json_inline - assert: + ansible.builtin.assert: that: - delete_tenant is changed - delete_tenant.jsondata == None
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_string.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_string.yml index 9a9df1ea7..821e3e701 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_string.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_string.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +23,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -38,27 +38,27 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test state: absent # QUERY SCHEMAS - name: Query schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: get register: query_all_schema - name: Verify query_all_schema - assert: + ansible.builtin.assert: that: - query_all_schema is not changed # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *mso_info state: query user: '{{ mso_username }}' @@ -66,14 +66,14 @@ register: query_user_id - name: Verify query_user_id - assert: + ansible.builtin.assert: that: - query_user_id is not changed - query_user_id.current.username == '{{ mso_username }}' # ADD tenant - name: Add tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/tenants method: post @@ -91,14 +91,14 @@ register: add_tenant - name: Verify add_tenant in json_string - assert: + ansible.builtin.assert: that: - add_tenant is changed - add_tenant.jsondata.displayName == 'ansible_test' # ADD schema - name: Add schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: post @@ -126,14 +126,14 @@ register: add_schema - name: Verify add_schema in json_string - assert: + ansible.builtin.assert: that: - add_schema is changed - add_schema.jsondata.displayName == 'ansible_test' # PUT schema - name: Put schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: put @@ -161,14 +161,14 @@ register: put_schema - name: Verify put_schema in json_string - assert: + ansible.builtin.assert: that: - put_schema is changed - put_schema.jsondata.displayName == 'ansible_test_2' # PATCH schema - name: Patch schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: patch @@ -184,12 +184,12 @@ register: patch_schema - name: Verify patch_schema in json_string - assert: + ansible.builtin.assert: that: - patch_schema is changed - name: Verify patch_schema in json_string - assert: + ansible.builtin.assert: that: - patch_schema.jsondata.templates[0].anps[0].displayName == 'AP2' # MSO 3.3 PATCH does not return anything anymore. @@ -197,28 +197,28 @@ # DELETE the schema - name: Delete the schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: delete register: delete_schema - name: Verify delete_schema in json_string - assert: + ansible.builtin.assert: that: - delete_schema is changed - delete_schema.jsondata == None # DELETE TENANT - name: Delete the tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/tenants/{{ add_tenant.jsondata.id }}" method: delete register: delete_tenant - name: Verify delete_tenant in json_string - assert: + ansible.builtin.assert: that: - delete_tenant is changed - delete_tenant.jsondata == None
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_template.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_template.yml index 622b3d21d..ab04225ea 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_template.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/json_template.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -32,14 +32,14 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test state: absent # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *mso_info state: query user: '{{ mso_username }}' @@ -47,13 +47,13 @@ register: query_user_id - name: Verify query_user_id - assert: + ansible.builtin.assert: that: - query_user_id is not changed - query_user_id.current.username == '{{ mso_username }}' - name: Add a tenant from a templated payload file from templates - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /api/v1/tenants method: post @@ -61,7 +61,7 @@ register: add_tenant - name: Verify add_tenant in json_string - assert: + ansible.builtin.assert: that: - add_tenant is changed - add_tenant.jsondata.displayName == 'ansible_test'
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/main.yml index 22851bf72..97ef2840b 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/main.yml @@ -5,24 +5,24 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined -- include_tasks: json_inline.yml +- ansible.builtin.include_tasks: json_inline.yml tags: json_inline -- include_tasks: json_string.yml +- ansible.builtin.include_tasks: json_string.yml tags: json_string -- include_tasks: json_template.yml +- ansible.builtin.include_tasks: json_template.yml tags: json_template -- include_tasks: yaml_inline.yml +- ansible.builtin.include_tasks: yaml_inline.yml tags: yaml_inline -- include_tasks: yaml_string.yml +- ansible.builtin.include_tasks: yaml_string.yml tags: yaml_string -- include_tasks: error_handling.yml +- ansible.builtin.include_tasks: error_handling.yml tags: error_handling diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_inline.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_inline.yml index 1fe44f283..f038d9c81 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_inline.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_inline.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +23,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -38,27 +38,27 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test state: absent # QUERY SCHEMAS - name: Query schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: get register: query_all_schema - name: Verify query_all_schema - assert: + ansible.builtin.assert: that: - query_all_schema is not changed # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *mso_info state: query user: '{{ mso_username }}' @@ -66,14 +66,14 @@ register: query_user_id - name: Verify query_user_id - assert: + ansible.builtin.assert: that: - query_user_id is not changed - query_user_id.current.username == '{{ mso_username }}' # ADD tenant - name: Add tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/tenants method: post @@ -88,14 +88,14 @@ register: add_tenant - name: Verify add_tenant in yaml_inline - assert: + ansible.builtin.assert: that: - add_tenant is changed - add_tenant.jsondata.displayName == 'ansible_test' # ADD schema - name: Add schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: post @@ -120,14 +120,14 @@ register: add_schema - name: Verify add_schema in yaml_inline - assert: + ansible.builtin.assert: that: - add_schema is changed - add_schema.jsondata.displayName == 'ansible_test' # PUT schema - name: Put schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: put @@ -152,14 +152,14 @@ register: put_schema - name: Verify put_schema in yaml_inline - assert: + ansible.builtin.assert: that: - put_schema is changed - put_schema.jsondata.displayName == 'ansible_test_2' # PATCH schema - name: Patch schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: patch @@ -174,12 +174,12 @@ register: patch_schema - name: Verify patch_schema in yaml_inline - assert: + ansible.builtin.assert: that: - patch_schema is changed - name: Verify patch_schema in yaml_inline - assert: + ansible.builtin.assert: that: - patch_schema.jsondata.templates[0].anps[0].displayName == 'AP2' # MSO 3.3 PATCH does not return anything anymore. @@ -187,28 +187,28 @@ # DELETE the schema - name: Delete the schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: delete register: delete_schema - name: Verify delete_schema in yaml_inline - assert: + ansible.builtin.assert: that: - delete_schema is changed - delete_schema.jsondata == None # DELETE TENANT - name: Delete the tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/tenants/{{ add_tenant.jsondata.id }}" method: delete register: delete_tenant - name: Verify delete_tenant in yaml_inline - assert: + ansible.builtin.assert: that: - delete_tenant is changed - delete_tenant.jsondata == None
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_string.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_string.yml index 5d9cfb05e..1824d2210 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_string.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_rest/tasks/yaml_string.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +23,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -38,27 +38,27 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test state: absent # QUERY SCHEMAS - name: Query schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: get register: query_all_schema - name: Verify query_all_schema - assert: + ansible.builtin.assert: that: - query_all_schema is not changed # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *mso_info state: query user: '{{ mso_username }}' @@ -66,14 +66,14 @@ register: query_user_id - name: Verify query_user_id - assert: + ansible.builtin.assert: that: - query_user_id is not changed - query_user_id.current.username == '{{ mso_username }}' # ADD tenant - name: Add tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/tenants method: post @@ -88,14 +88,14 @@ register: add_tenant - name: Verify add_tenant in yaml_string - assert: + ansible.builtin.assert: that: - add_tenant is changed - add_tenant.jsondata.displayName == 'ansible_test' # ADD schema - name: Add schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: /mso/api/v1/schemas method: post @@ -120,14 +120,14 @@ register: add_schema - name: Verify add_schema in yaml_string - assert: + ansible.builtin.assert: that: - add_schema is changed - add_schema.jsondata.displayName == 'ansible_test' # PUT schema - name: Put schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: put @@ -152,14 +152,14 @@ register: put_schema - name: Verify put_schema in yaml_string - assert: + ansible.builtin.assert: that: - put_schema is changed - put_schema.jsondata.displayName == 'ansible_test_2' # PATCH schema - name: Patch schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: patch @@ -174,12 +174,12 @@ register: patch_schema - name: Verify patch_schema in yaml_string - assert: + ansible.builtin.assert: that: - patch_schema is changed - name: Verify patch_schema in yaml_string - assert: + ansible.builtin.assert: that: - patch_schema.jsondata.templates[0].anps[0].displayName == 'AP2' # MSO 3.3 PATCH does not return anything anymore. @@ -187,28 +187,28 @@ # DELETE the schema - name: Delete the schema - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/schemas/{{ add_schema.jsondata.id }}" method: delete register: delete_schema - name: Verify delete_schema in yaml_string - assert: + ansible.builtin.assert: that: - delete_schema is changed - delete_schema.jsondata == None # DELETE TENANT - name: Delete the tenant - mso_rest: + cisco.mso.mso_rest: <<: *mso_info path: "/mso/api/v1/tenants/{{ add_tenant.jsondata.id }}" method: delete register: delete_tenant - name: Verify delete_tenant in yaml_string - assert: + ansible.builtin.assert: that: - delete_tenant is changed - delete_tenant.jsondata == None
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/main.yml index a27a0e166..e081f3fcf 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,23 +22,23 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Set version vars - set_fact: - mso_rw: true + ansible.builtin.set_fact: + cisco.mso.mso_rw: true when: - version.current.version is version('2.2.4', '<') - name: Import tasks if RW of role in this MSO version - import_tasks: role-rw.yml + ansible.builtin.import_tasks: role-rw.yml when: mso_rw is defined - name: Import tasks if RO of role in this MSO version - import_tasks: role-ro.yml + ansible.builtin.import_tasks: role-ro.yml when: - mso_rw is not defined - version.current.version is version('3.2', '<')
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-ro.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-ro.yml index 730202a9d..00cd5a955 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-ro.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-ro.yml @@ -7,7 +7,7 @@ # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,18 +20,18 @@ # QUERY ALL ROLES - name: Query all roles (check_mode) - mso_role: &role_query + cisco.mso.mso_role: &role_query <<: *mso_info state: query check_mode: true register: cm_query_all_roles - name: Query all roles (normal mode) - mso_role: *role_query + cisco.mso.mso_role: *role_query register: nm_query_all_roles - name: Verify query_all_roles - assert: + ansible.builtin.assert: that: - cm_query_all_roles is not changed - nm_query_all_roles is not changed @@ -41,20 +41,20 @@ # QUERY A ROLE - name: Query our role - mso_role: + cisco.mso.mso_role: <<: *role_query role: powerUser check_mode: true register: cm_query_role - name: Query our role - mso_role: + cisco.mso.mso_role: <<: *role_query role: powerUser register: nm_query_role - name: Verify query_role - assert: + ansible.builtin.assert: that: - cm_query_role is not changed - cm_query_role.current.description == 'Elevates this user to \"admin\"' @@ -67,21 +67,21 @@ # QUERY NON-EXISTING ROLE - name: Query non-existing role (check_mode) - mso_role: + cisco.mso.mso_role: <<: *role_query role: non-existing-role check_mode: true register: cm_query_non_role - name: Query non-existing role (normal mode) - mso_role: + cisco.mso.mso_role: <<: *role_query role: non-existing-role register: nm_query_non_role # TODO: Implement more tests - name: Verify query_non_role - assert: + ansible.builtin.assert: that: - cm_query_non_role is not changed - nm_query_non_role is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-rw.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-rw.yml index 82db67640..398a9579c 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-rw.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_role/tasks/role-rw.yml @@ -7,7 +7,7 @@ # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -18,13 +18,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Remove role ansible_test - mso_role: &role_absent + cisco.mso.mso_role: &role_absent <<: *mso_info role: ansible_test state: absent - name: Remove role ansible_test2 - mso_role: + cisco.mso.mso_role: <<: *role_absent role: ansible_test2 register: cm_remove_role @@ -32,7 +32,7 @@ # ADD ROLE - name: Add role (check_mode) - mso_role: &role_present + cisco.mso.mso_role: &role_present <<: *mso_info role: ansible_test description: Ansible test role @@ -43,7 +43,7 @@ register: cm_add_role - name: Verify cm_add_role - assert: + ansible.builtin.assert: that: - cm_add_role is changed - cm_add_role.previous == {} @@ -52,11 +52,11 @@ - cm_add_role.current.id is not defined - name: Add role (normal mode) - mso_role: *role_present + cisco.mso.mso_role: *role_present register: nm_add_role - name: Verify nm_add_role - assert: + ansible.builtin.assert: that: - nm_add_role is changed - nm_add_role.previous == {} @@ -65,12 +65,12 @@ - nm_add_role.current.id is defined - name: Add role again (check_mode) - mso_role: *role_present + cisco.mso.mso_role: *role_present check_mode: true register: cm_add_role_again - name: Verify cm_add_role_again - assert: + ansible.builtin.assert: that: - cm_add_role_again is not changed - cm_add_role_again.previous.description == 'Ansible test role' @@ -80,11 +80,11 @@ - cm_add_role_again.current.id == nm_add_role.current.id - name: Add role again (normal mode) - mso_role: *role_present + cisco.mso.mso_role: *role_present register: nm_add_role_again - name: Verify nm_add_role_again - assert: + ansible.builtin.assert: that: - nm_add_role_again is not changed - nm_add_role_again.previous.description == 'Ansible test role' @@ -96,7 +96,7 @@ # CHANGE ROLE - name: Change role (check_mode) - mso_role: + cisco.mso.mso_role: <<: *role_present role: ansible_test description: Ansible test role 2 @@ -104,7 +104,7 @@ register: cm_change_role - name: Verify cm_change_role - assert: + ansible.builtin.assert: that: - cm_change_role is changed - cm_change_role.current.description == 'Ansible test role 2' @@ -112,7 +112,7 @@ - cm_change_role.current.id == nm_add_role.current.id - name: Change role (normal mode) - mso_role: + cisco.mso.mso_role: <<: *role_present role: ansible_test description: Ansible test role 2 @@ -120,7 +120,7 @@ register: nm_change_role - name: Verify nm_change_role - assert: + ansible.builtin.assert: that: - nm_change_role is changed - nm_change_role.current.description == 'Ansible test role 2' @@ -128,7 +128,7 @@ - nm_change_role.current.id == nm_add_role.current.id - name: Change role again (check_mode) - mso_role: + cisco.mso.mso_role: <<: *role_present role: ansible_test description: Ansible test role 2 @@ -136,7 +136,7 @@ register: cm_change_role_again - name: Verify cm_change_role_again - assert: + ansible.builtin.assert: that: - cm_change_role_again is not changed - cm_change_role_again.current.description == 'Ansible test role 2' @@ -144,14 +144,14 @@ - cm_change_role_again.current.id == nm_add_role.current.id - name: Change role again (normal mode) - mso_role: + cisco.mso.mso_role: <<: *role_present role: ansible_test description: Ansible test role 2 register: nm_change_role_again - name: Verify nm_change_role_again - assert: + ansible.builtin.assert: that: - nm_change_role_again is not changed - nm_change_role_again.current.description == 'Ansible test role 2' @@ -161,18 +161,18 @@ # QUERY ALL ROLES - name: Query all roles (check_mode) - mso_role: &role_query + cisco.mso.mso_role: &role_query <<: *mso_info state: query check_mode: true register: cm_query_all_roles - name: Query all roles (normal mode) - mso_role: *role_query + cisco.mso.mso_role: *role_query register: nm_query_all_roles - name: Verify query_all_roles - assert: + ansible.builtin.assert: that: - cm_query_all_roles is not changed - nm_query_all_roles is not changed @@ -182,20 +182,20 @@ # QUERY A ROLE - name: Query our role - mso_role: + cisco.mso.mso_role: <<: *role_query role: ansible_test check_mode: true register: cm_query_role - name: Query our role - mso_role: + cisco.mso.mso_role: <<: *role_query role: ansible_test register: nm_query_role - name: Verify query_role - assert: + ansible.builtin.assert: that: - cm_query_role is not changed - cm_query_role.current.description == 'Ansible test role 2' @@ -210,43 +210,43 @@ # REMOVE ROLE - name: Remove role (check_mode) - mso_role: *role_absent + cisco.mso.mso_role: *role_absent check_mode: true register: cm_remove_role - name: Verify cm_remove_role - assert: + ansible.builtin.assert: that: - cm_remove_role is changed - cm_remove_role.current == {} - name: Remove role (normal mode) - mso_role: *role_absent + cisco.mso.mso_role: *role_absent register: nm_remove_role - name: Verify nm_remove_role - assert: + ansible.builtin.assert: that: - nm_remove_role is changed - nm_remove_role.current == {} - name: Remove role again (check_mode) - mso_role: *role_absent + cisco.mso.mso_role: *role_absent check_mode: true register: cm_remove_role_again - name: Verify cm_remove_role_again - assert: + ansible.builtin.assert: that: - cm_remove_role_again is not changed - cm_remove_role_again.current == {} - name: Remove role again (normal mode) - mso_role: *role_absent + cisco.mso.mso_role: *role_absent register: nm_remove_role_again - name: Verify nm_remove_role_again - assert: + ansible.builtin.assert: that: - nm_remove_role_again is not changed - nm_remove_role_again.current == {} @@ -254,21 +254,21 @@ # QUERY NON-EXISTING ROLE - name: Query non-existing role (check_mode) - mso_role: + cisco.mso.mso_role: <<: *role_query role: non-existing-role check_mode: true register: cm_query_non_role - name: Query non-existing role (normal mode) - mso_role: + cisco.mso.mso_role: <<: *role_query role: non-existing-role register: nm_query_non_role # TODO: Implement more tests - name: Verify query_non_role - assert: + ansible.builtin.assert: that: - cm_query_non_role is not changed - nm_query_non_role is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema/tasks/main.yml index 84613d63a..d7c586b61 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema/tasks/main.yml @@ -1,16 +1,17 @@ # Test code for the MSO modules # Copyright: (c) 2020, Cindy Zhao (@cizhao) <cizhao@cisco.com> +# Copyright: (c) 2023, Akini Ross (@akinross) <akinross@cisco.com> # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,6 +21,12 @@ use_proxy: '{{ mso_use_proxy | default(true) }}' output_level: '{{ mso_output_level | default("info") }}' +- name: Query MSO version + cisco.mso.mso_version: + <<: *mso_info + state: query + register: version + - name: Remove schemas cisco.mso.mso_schema: <<: *mso_info @@ -71,7 +78,7 @@ register: query_one - name: Verify query_all and query_one - assert: + ansible.builtin.assert: that: - query_all is not changed - query_one is not changed @@ -94,7 +101,7 @@ register: nm_rm_schema - name: Verify rm_schema - assert: + ansible.builtin.assert: that: - cm_rm_schema is changed - cm_rm_schema.previous.displayName == "ansible_test" @@ -111,7 +118,135 @@ register: query_non_existing - name: Verify query_non_existing - assert: + ansible.builtin.assert: that: - query_non_existing is not changed - query_non_existing.current == {} + +# TEST BLOCK FOR MSO VERSION >= 4.1 WHICH ALLOW FOR SCHEMA WITHOUT TEMPLATES +- name: Execute tasks only for MSO version >= 4.1 + when: version.current.version is version('4.1', '>=') + block: + + - name: Ensure schema without templatess are not present + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ item }}' + state: absent + loop: + - "ansible_test" + - "ansible_test_2" + + - name: Create a schema without templates (check_mode) + cisco.mso.mso_schema: &ansible_test + <<: *mso_info + schema: ansible_test + description: ansible_test_descr + state: present + check_mode: true + register: cm_create_ansible_test + + - name: Create a schema without templates + cisco.mso.mso_schema: + <<: *ansible_test + register: nm_create_ansible_test + + - name: Create a schema without templates again + cisco.mso.mso_schema: + <<: *ansible_test + register: nm_create_ansible_test_again + + - name: Verify schema without templates creation + ansible.builtin.assert: + that: + - cm_create_ansible_test is changed + - cm_create_ansible_test.current.displayName == 'ansible_test' + - cm_create_ansible_test.current.description == 'ansible_test_descr' + - cm_create_ansible_test.proposed.displayName == 'ansible_test' + - cm_create_ansible_test.proposed.description == 'ansible_test_descr' + - cm_create_ansible_test.previous == {} + - nm_create_ansible_test is changed + - nm_create_ansible_test.current.displayName == 'ansible_test' + - nm_create_ansible_test.current.description == 'ansible_test_descr' + - nm_create_ansible_test.proposed.displayName == 'ansible_test' + - nm_create_ansible_test.proposed.description == 'ansible_test_descr' + # Commented due to description bug in schema where description is set on id specific but not schemas endpoint + # - nm_create_ansible_test_again is not changed + - nm_create_ansible_test_again.current.displayName == 'ansible_test' + - nm_create_ansible_test_again.current.description == 'ansible_test_descr' + - nm_create_ansible_test_again.previous.displayName == 'ansible_test' + # - nm_create_ansible_test_again.previous.description == 'ansible_test_descr' + + - name: Change a schema without templates display name (check_mode) + cisco.mso.mso_schema: &ansible_test_2 + <<: *mso_info + schema: ansible_test_2 + id: "{{ nm_create_ansible_test_again.current.id }}" + description: ansible_test_descr_changed + state: present + check_mode: true + register: cm_change_ansible_test + + - name: Change a schema without templates display name + cisco.mso.mso_schema: + <<: *ansible_test_2 + register: nm_change_ansible_test + + - name: Change a schema without templates display name again + cisco.mso.mso_schema: + <<: *ansible_test_2 + register: nm_change_ansible_test_again + + - name: Verify schema without templates change + ansible.builtin.assert: + that: + - cm_change_ansible_test is changed + - cm_change_ansible_test.current.displayName == 'ansible_test_2' + - cm_change_ansible_test.current.description == 'ansible_test_descr_changed' + - cm_change_ansible_test.proposed.displayName == 'ansible_test_2' + - cm_change_ansible_test.proposed.description == 'ansible_test_descr_changed' + - cm_change_ansible_test.previous.displayName == 'ansible_test' + # - cm_change_ansible_test.previous.description == 'ansible_test_descr' + - nm_change_ansible_test is changed + - nm_change_ansible_test.current.displayName == 'ansible_test_2' + - nm_change_ansible_test.current.description == 'ansible_test_descr_changed' + - nm_change_ansible_test.previous.displayName == 'ansible_test' + # - nm_change_ansible_test.previous.description == 'ansible_test_descr' + - nm_change_ansible_test_again is not changed + - nm_change_ansible_test_again.current.displayName == 'ansible_test_2' + - nm_change_ansible_test_again.current.description == 'ansible_test_descr_changed' + - nm_change_ansible_test_again.previous.displayName == 'ansible_test_2' + # - nm_change_ansible_test_again.previous.description == 'ansible_test_descr_changed' + + - name: Remove a schema without templates (check_mode) + cisco.mso.mso_schema: &ansible_test_remove + <<: *mso_info + schema: ansible_test_2 + state: absent + check_mode: true + register: cm_remove_ansible_test + + - name: Remove a schema without templates + cisco.mso.mso_schema: + <<: *ansible_test_remove + register: nm_remove_ansible_test + + - name: Remove a schema without templates again + cisco.mso.mso_schema: + <<: *ansible_test_remove + register: nm_remove_ansible_test_again + + - name: Verify schema without templates removal + ansible.builtin.assert: + that: + - cm_remove_ansible_test is changed + - cm_remove_ansible_test.current == {} + - cm_remove_ansible_test.previous.displayName == 'ansible_test_2' + # - cm_remove_ansible_test.previous.description == 'ansible_test_descr_changed' + - nm_remove_ansible_test is changed + - nm_remove_ansible_test.current == {} + - nm_remove_ansible_test.previous.displayName == 'ansible_test_2' + # - nm_remove_ansible_test.previous.description == 'ansible_test_descr_changed' + - nm_remove_ansible_test_again is not changed + - nm_remove_ansible_test_again.current == {} + - nm_remove_ansible_test_again.previous == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_clone/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_clone/tasks/main.yml index e26bf45d5..fd6a35e14 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_clone/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_clone/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -31,7 +31,7 @@ - Source_Schema - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -42,7 +42,7 @@ state: present - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -64,7 +64,7 @@ - { template: Template 3} - name: Ensure VRF exist - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present <<: *mso_info schema: Source_Schema template: Template1 @@ -72,7 +72,7 @@ state: present - name: Add bd in Source schema - mso_schema_template_bd: &bd_present + cisco.mso.mso_schema_template_bd: &bd_present <<: *mso_info schema: Source_Schema template: Template1 @@ -90,7 +90,7 @@ register: add_schema - name: Verify add_schema - assert: + ansible.builtin.assert: that: - add_schema is changed - add_schema.previous == {} @@ -106,7 +106,7 @@ register: add_same_schema - name: Verify add_same_schema - assert: + ansible.builtin.assert: that: - add_same_schema is not changed - add_same_schema.current == {} @@ -122,7 +122,7 @@ register: add_existing_schema - name: Verify add_existing_schema - assert: + ansible.builtin.assert: that: - add_existing_schema is not changed - add_existing_schema.msg == "Schema with the name 'Destination_Schema' already exists. Please use another name." @@ -137,7 +137,7 @@ register: add_existing_schema - name: Verify add_existing_schema - assert: + ansible.builtin.assert: that: - add_existing_schema is not changed - add_existing_schema.msg == "Provided schema 'Source_Schema_1' does not exist." @@ -153,6 +153,6 @@ - Source_Schema - name: Verify rm_schema - assert: + ansible.builtin.assert: that: - rm_schema is changed
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site/tasks/main.yml index 6eede75ae..5e356a0fd 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,7 +21,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -33,7 +33,7 @@ ignore_errors: true - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -42,7 +42,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -53,7 +53,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -63,7 +63,7 @@ state: present - name: Ensure schema 1 with Template 1 and Template 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -74,7 +74,7 @@ - { template: Template 2} - name: Add a new site to a schema with Template 1 in check mode - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -84,13 +84,13 @@ register: add_site_cm - name: Verify add_site_cm - assert: + ansible.builtin.assert: that: - add_site_cm.current.siteId is match ("[0-9a-zA-Z]*") - add_site_cm.current.templateName == "Template1" - name: Add a new site to a schema with Template 1 in normal mode - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -99,13 +99,13 @@ register: add_site_nm - name: Verify add_site_nm - assert: + ansible.builtin.assert: that: - add_site_nm.current.siteId is match ("[0-9a-zA-Z]*") - add_site_nm.current.templateName == "Template1" - name: Add a new site to a schema in normal mode again - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -114,13 +114,13 @@ register: add_site_nm_again - name: Verify add_site_nm_again - assert: + ansible.builtin.assert: that: - add_site_nm_again is not changed - add_site_nm_again.current.siteId is match ("[0-9a-zA-Z]*") - name: Add a new site to a schema with Template 2 in normal mode - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -130,7 +130,7 @@ register: add_site_temp2_nm - name: Verify add_site_temp2_nm - assert: + ansible.builtin.assert: that: - add_site_temp2_nm.current.siteId is match ("[0-9a-zA-Z]*") - add_site_temp2_nm.current.templateName == "Template2" @@ -144,7 +144,7 @@ - add_site_temp2_nm.sent.templateName == "Template2" - name: Query a schema site - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -153,21 +153,21 @@ register: query_site - name: Query all schema sites - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query register: query_all_sites - name: Verify query_site and query_all_sites - assert: + ansible.builtin.assert: that: - query_site is not changed - query_all_sites is not changed - query_all_sites.current | length == 2 - name: Remove a site from a schema with Template1 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -176,7 +176,7 @@ register: rm_site_temp1 - name: Remove a site from a schema with Template2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -185,7 +185,7 @@ register: rm_site_temp2 - name: Verify rm_site_temp1 and rm_site_temp2 - assert: + ansible.builtin.assert: that: - rm_site_temp1 is changed - rm_site_temp1.current == {} @@ -193,7 +193,7 @@ - rm_site_temp2.current == {} - name: Remove a site from a schema with Template2 again - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -202,13 +202,13 @@ register: rm_site_again - name: Verify rm_site_again - assert: + ansible.builtin.assert: that: - rm_site_again is not changed # USE NON-EXISTING STATE - name: non_existing_state state - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -218,14 +218,14 @@ register: non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - non_existing_state is not changed - non_existing_state.msg == "value of state must be one of{{':'}} absent, present, query, got{{':'}} non_existing_state" # USE A NON_EXISTING_SCHEMA - name: non_existing_schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -235,14 +235,14 @@ register: non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - non_existing_schema is not changed - non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." # USE A NON_EXISTING_TEMPLATE - name: non_existing_template - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -252,13 +252,13 @@ register: non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - non_existing_template is not changed - non_existing_template.msg == "Template 'non_existing_template' not found" - name: Template attribute absent in task - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -267,7 +267,7 @@ register: absent_template - name: Verify absent_template - assert: + ansible.builtin.assert: that: - absent_template is not changed - absent_template.current == []
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp/tasks/main.yml index 9faffb376..03909d8cf 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp/tasks/main.yml @@ -3,13 +3,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,13 +20,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -35,7 +35,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure physical site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -46,7 +46,7 @@ state: present - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -57,7 +57,7 @@ state: present - name: Ensure azure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -68,7 +68,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -79,7 +79,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -87,14 +87,14 @@ state: present - name: Associate non-cloud site with ansible_test again in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' state: present - name: Associate aws site with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -106,7 +106,7 @@ register: aaws_nm - name: Associate azure site with access_type not present, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -115,7 +115,7 @@ register: aazure_shared_nm - name: Ensure schema 1 with Template 1, and Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -127,7 +127,7 @@ - { template: Template 3} - name: Ensure schema 2 with Template 4 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -135,7 +135,7 @@ state: present - name: Add cloud site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{item.site}}' @@ -146,7 +146,7 @@ - { site: 'aws_{{ mso_site | default("ansible_test") }}', template: 'Template 2' } - name: Add physical site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -154,7 +154,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -162,7 +162,7 @@ state: present - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -172,7 +172,7 @@ state: present - name: Ensure ANPs exist at template level - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{item.schema}}' template: '{{ item.template }}' @@ -187,7 +187,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}_2', template: 'Template 4', anp: 'ANP_4' } - name: Ensure EPGs exist at template level - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -204,7 +204,7 @@ state: present - name: Add ANP to site azure (check_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -215,7 +215,7 @@ register: cm_add_anp - name: Add ANP to site azure (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -225,20 +225,20 @@ register: nm_add_anp - name: Verify add_anp values - assert: + ansible.builtin.assert: that: - cm_add_anp.current.anpRef.anpName == 'ANP' - nm_add_anp.current.anpRef.anpName == 'ANP' - name: Verify add_anp change - assert: + ansible.builtin.assert: that: - cm_add_anp is changed - nm_add_anp is changed when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add ANP to site aws - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -248,18 +248,18 @@ register: add_anp - name: Verify add_anp value - assert: + ansible.builtin.assert: that: - add_anp.current.anpRef.anpName == 'ANP_2' - name: Verify add_anp change - assert: + ansible.builtin.assert: that: - add_anp is changed when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add ANPs to site - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: '{{ item.site }}' schema: '{{ item.schema }}' @@ -272,7 +272,7 @@ - { site: '{{ mso_site | default("ansible_test") }}', schema: '{{ mso_schema | default("ansible_test") }}', template: 'Template 3', anp: 'ANP_3_2' } - name: Add a new site EPG for idempotency check - mso_schema_site_anp_epg: &idempotency_vmm + cisco.mso.mso_schema_site_anp_epg: &idempotency_vmm <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: 'Template 3' @@ -284,7 +284,7 @@ # Test due to inconsistency in attributes REQUEST/RESPONSE API # MSO Error 400: Bad Request: (0)(0)(0)(0)/deploymentImmediacy error.path.missing - name: Add new site domain to site EPG for idempotency check - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *idempotency_vmm domain_association_type: vmmDomain domain_profile: 'VMware-VMM' @@ -293,7 +293,7 @@ state: present - name: Add ANPs to site again - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -303,14 +303,14 @@ register: add_anp_again - name: Verify add_anp_again - assert: + ansible.builtin.assert: that: - add_anp_again is not changed - add_anp_again.current.anpRef.anpName == 'ANP_3' # QUERY ANPs - name: Query specific ANP (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -320,12 +320,12 @@ register: query_anp - name: Verify query_anp - assert: + ansible.builtin.assert: that: - query_anp is not changed - name: Query all ANPs (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -334,14 +334,14 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all | length >= 3 # DELETE the ANP - name: Delete ANP3 (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -351,13 +351,13 @@ register: delete_anp - name: Verify delete_anp - assert: + ansible.builtin.assert: that: - delete_anp is changed - delete_anp.current == {} - name: Delete ANP1 again - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -367,14 +367,14 @@ register: delete_anp_again - name: Verify delete_anp_again - assert: + ansible.builtin.assert: that: - delete_anp_again is not changed - delete_anp_again.current == {} # QUERY NON-EXISTING ANP - name: Query non-existing ANP (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -385,14 +385,14 @@ register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - nm_query_non_anp is not changed - nm_query_non_anp.msg == "ANP 'non_existing_anp' not found" # USE A NON-EXISTING STATE - name: Non-existing state (normal_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -403,14 +403,14 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - nm_non_existing_state is not changed - nm_non_existing_state.msg == "value of state must be one of{{':'}} absent, present, query, got{{':'}} non-existing-state" # USE A NON-EXISTING SCHEMA - name: Non-existing schema (normal_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: non-existing-schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -421,14 +421,14 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - nm_non_existing_schema is not changed - nm_non_existing_schema.msg == "Provided schema 'non-existing-schema' does not exist." # USE A NON-EXISTING SITE - name: Non-existing site (normal_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non-existing-site @@ -439,14 +439,14 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - nm_non_existing_site is not changed - nm_non_existing_site.msg == "Site 'non-existing-site' is not a valid site name." # USE A TEMPLATE WITHOUT ANY SITE - name: Add ANP to Template without any site associated (normal mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -457,14 +457,14 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - nm_no_site_associated is not changed - nm_no_site_associated.msg == "No site associated with template 'Template4'. Associate the site with the template using mso_schema_site." # USE A NON-EXISTING SITE-TEMPLATE - name: Non-existing site-template (normal_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -475,7 +475,7 @@ register: nm_non_existing_site_template - name: Verify non_existing_site_template - assert: + ansible.builtin.assert: that: - nm_non_existing_site_template is not changed - nm_non_existing_site_template.msg is match("Provided site/siteId/template 'ansible_test/[0-9a-zA-Z]*/Template2' does not exist. Existing siteIds/templates{{':'}} [0-9a-zA-Z]*/Template1, [0-9a-zA-Z]*/Template2, [0-9a-zA-Z]*/Template3")
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml index 8373a629f..28e836a55 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml @@ -3,13 +3,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,13 +20,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -35,7 +35,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -47,7 +47,7 @@ ignore_errors: true - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -55,7 +55,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -66,14 +66,14 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Associate non-cloud site with ansible_test again in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' state: present - name: Associate aws site with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -85,7 +85,7 @@ register: aaws_nm - name: Associate azure site with access_type not present, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -94,7 +94,7 @@ register: aazure_shared_nm - name: Ensure schema 1 with Template 1, and Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -106,7 +106,7 @@ - { template: Template 3} - name: Ensure schema 2 with Template 4 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -114,7 +114,7 @@ state: present - name: Add cloud site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{item.site}}' @@ -126,7 +126,7 @@ when: version.current.version is version('3', '<') or version.current.version is version('3.2', '>=') - name: Add physical site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -137,7 +137,7 @@ - { template: 'Template 1' } - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: '{{ item.template }}' @@ -148,7 +148,7 @@ - { template: 'Template 3' } - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: '{{ item.template }}' @@ -161,7 +161,7 @@ - { template: 'Template 3' } - name: Ensure ANPs exist at template level - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{item.schema}}' template: '{{ item.template }}' @@ -173,7 +173,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}_2', template: 'Template 4', anp: 'ANP_4' } - name: Ensure ANP exist at template level - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -181,7 +181,7 @@ state: present - name: Ensure EPGs exist at template level - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -202,7 +202,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}_2', template: 'Template 4', anp: 'ANP_4', epg: 'ansible_test_4' } - name: Ensure EPGs exist at template level - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -219,7 +219,7 @@ state: present - name: Add ANP to site - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -229,7 +229,7 @@ # ADD ANP EPGs to SITE - name: Add new EPG to site after adding ANP to site (check_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -241,7 +241,7 @@ register: cm_add_epg - name: Add new EPG to site after adding ANP to site (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -252,7 +252,7 @@ register: nm_add_epg - name: Verify add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg is changed - nm_add_epg is changed @@ -263,7 +263,7 @@ when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add new EPG to site after adding ANP to site again - mso_schema_site_anp_epg: &idempotency_vmm + cisco.mso.mso_schema_site_anp_epg: &idempotency_vmm <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -274,7 +274,7 @@ register: add_epg_again - name: Verify add_epg_again - assert: + ansible.builtin.assert: that: - add_epg_again is not changed - add_epg_again.current.epgRef.anpName == 'ANP_3' @@ -283,7 +283,7 @@ # Test due to inconsistency in attributes REQUEST/RESPONSE API # MSO Error 400: Bad Request: (0)(0)(0)(0)/deploymentImmediacy error.path.missing - name: Add new site domain to site EPG for idempotency check - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *idempotency_vmm domain_association_type: vmmDomain domain_profile: 'VMware-VMM' @@ -292,19 +292,19 @@ state: present - name: Add new EPG to site after adding ANP to site again - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *idempotency_vmm register: add_epg_again_with_vmm - name: Verify add_epg_again with vmm - assert: + ansible.builtin.assert: that: - add_epg_again is not changed - add_epg_again.current.epgRef.anpName == 'ANP_3' - add_epg_again.current.epgRef.epgName == 'ansible_test_3' - name: Add new EPG to site without adding ANPs to site - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -315,7 +315,7 @@ register: add_epg_no_anp - name: Verify add_epg_no_anp - assert: + ansible.builtin.assert: that: - add_epg_no_anp is changed - add_epg_no_anp.current.epgs.0.epgRef.anpName == 'ANP' @@ -323,7 +323,7 @@ when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add new EPG to site without adding ANPs to site again (ANP already exists from previous run) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -334,7 +334,7 @@ register: add_epg_no_anp_again - name: Verify add_epg_no_anp_again - assert: + ansible.builtin.assert: that: - add_epg_no_anp_again is not changed - add_epg_no_anp_again.current.epgRef.anpName == 'ANP' @@ -342,7 +342,7 @@ # QUERY EPGs - name: Query all EPGs with ANP (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -352,12 +352,12 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - name: Query specific EPG1 (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -368,13 +368,13 @@ register: query_epg - name: Verify query_epg - assert: + ansible.builtin.assert: that: - query_epg is not changed # DELETE the EPG - name: Delete EPG1 (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -385,14 +385,14 @@ register: delete_epg - name: Verify delete_epg - assert: + ansible.builtin.assert: that: - delete_epg is changed - delete_epg.current == {} when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Delete EPG1 again - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -403,14 +403,14 @@ register: delete_epg_again - name: Verify delete_epg_again - assert: + ansible.builtin.assert: that: - delete_epg_again is not changed - delete_epg_again.current == {} # QUERY NON-EXISTING EPG - name: Query non-existing EPG in template (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -422,14 +422,14 @@ register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - nm_query_non_epg is not changed - nm_query_non_epg.msg == "Provided EPG 'non_existing_epg' does not exist. Existing EPGs{{':'}} ansible_test_3" # QUERY NON-EXISTING EPG - name: Query non-existing EPG in site level - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -441,14 +441,14 @@ register: query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - query_non_epg is not changed - query_non_epg.msg == "EPG 'ansible_test_1' not found" when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Delete anp - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -458,7 +458,7 @@ # QUERY NON-EXISTING ANP - name: Query non-existing ANP in template(normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -470,14 +470,14 @@ register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - nm_query_non_anp is not changed - nm_query_non_anp.msg == "Provided anp 'non_existing_anp' does not exist. Existing anps{{':'}} ANP_3" # QUERY NON-EXISTING ANP - name: Query non-existing ANP at site level(normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 3 @@ -488,7 +488,7 @@ register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - nm_query_non_anp is not changed - nm_query_non_anp.msg == "Provided anp 'ANP_3' does not exist at site level." @@ -496,7 +496,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state (normal_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -508,14 +508,14 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - nm_non_existing_state is not changed - nm_non_existing_state.msg == "value of state must be one of{{':'}} absent, present, query, got{{':'}} non-existing-state" # # USE A NON-EXISTING TEMPLATE - name: Non-existing template (normal_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -527,14 +527,14 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - nm_non_existing_template is not changed - nm_non_existing_template.msg == "Provided template 'non-existing-template' does not exist. Existing templates{{':'}} Template1, Template2, Template3" # USE A NON-EXISTING SCHEMA - name: Non-existing schema (normal_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: non-existing-schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -546,14 +546,14 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - nm_non_existing_schema is not changed - nm_non_existing_schema.msg == "Provided schema 'non-existing-schema' does not exist." # USE A NON-EXISTING SITE - name: Non-existing site (normal_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non-existing-site @@ -565,14 +565,14 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - nm_non_existing_site is not changed - nm_non_existing_site.msg == "Site 'non-existing-site' is not a valid site name." # USE A NON-EXISTING SITE-TEMPLATE - name: Non-existing site-template (normal_mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -584,14 +584,14 @@ register: nm_non_existing_site_template - name: Verify non_existing_site_template - assert: + ansible.builtin.assert: that: - nm_non_existing_site_template is not changed - nm_non_existing_site_template.msg is match("Provided site/siteId/template 'ansible_test/[0-9a-zA-Z]*/Template2' does not exist. Existing siteIds/templates{{':'}} [0-9a-zA-Z]*/Template1, [0-9a-zA-Z]*/Template2, [0-9a-zA-Z]*/Template3, [0-9a-zA-Z]*/Template1") when: version.current.version is version('3', '<') or version.current.version is version('3.2', '>=') - name: Verify non_existing_site_template - assert: + ansible.builtin.assert: that: - nm_non_existing_site_template is not changed - nm_non_existing_site_template.msg is match("Provided site/siteId/template 'ansible_test/[0-9a-zA-Z]*/Template2' does not exist. Existing siteIds/templates{{':'}} [0-9a-zA-Z]*/Template3, [0-9a-zA-Z]*/Template1") @@ -599,7 +599,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add EPG to Template without any site associated (normal mode) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -611,7 +611,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - nm_no_site_associated is not changed - nm_no_site_associated.msg == "No site associated with template 'Template4'. Associate the site with the template using mso_schema_site." @@ -622,7 +622,7 @@ when: version.current.version is version('3.3', '>=') block: - name: Remove physical site from schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -630,7 +630,7 @@ state: absent - name: Ensure region for VRF1 at site level exists - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -641,7 +641,7 @@ state: present - name: Ensure Private Link Label in Azure VRF subnet exist (MSO >3.3) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -654,7 +654,7 @@ zone: null - name: Ensure another Private Link Label in Azure VRF subnet exist (MSO >3.3) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -666,7 +666,7 @@ private_link_label: 'PLL' - name: Add new EPG service type parameters (for version greater than 3.3) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -683,7 +683,7 @@ state: present - name: Add private link label to the EPG (for version greater than 3.3) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -694,7 +694,7 @@ state: present - name: Change private link label in the EPG (for version greater than 3.3) - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml index 0fc8943fd..2940874aa 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,7 +21,7 @@ output_level: '{{ mso_output_level | default("debug") }}' - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -30,7 +30,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -41,7 +41,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -52,7 +52,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -62,7 +62,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -73,7 +73,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -81,7 +81,7 @@ state: present - name: Add a new site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -89,7 +89,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -97,7 +97,7 @@ state: present - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -107,7 +107,7 @@ state: present - name: Ensure Template 1 with AP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -115,7 +115,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -128,7 +128,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG3 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -141,7 +141,7 @@ state: present - name: Ensure Template 1 with AP2 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -149,7 +149,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG2 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -162,7 +162,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG4 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -175,7 +175,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG6 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -189,7 +189,7 @@ # ADD STATIC PORTS - name: Add static port 1 to site EPG1 of AP1 (check mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -216,7 +216,7 @@ register: cm_add_stat1e1 - name: Verify cm_add_stat1e1 - assert: + ansible.builtin.assert: that: - cm_add_stat1e1 is changed - cm_add_stat1e1.previous == [] @@ -235,7 +235,7 @@ - cm_add_stat1e1.current|length == 3 - name: Add static port 1 to site EPG1 of AP1 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: &add_static_port_1 + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: &add_static_port_1 <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -261,7 +261,7 @@ register: nm_add_stat1e1 - name: Verify nm_add_stat1e1 - assert: + ansible.builtin.assert: that: - nm_add_stat1e1 is changed - nm_add_stat1e1.previous == [] @@ -280,7 +280,7 @@ - nm_add_stat1e1.current|length ==3 - name: Add static port 3 (vpc) to site EPG1 of AP1 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port_1 static_ports: - path: eth1/2 @@ -298,7 +298,7 @@ register: nm_add_stat3e1 - name: Verify nm_add_stat3e1 - assert: + ansible.builtin.assert: that: - nm_add_stat3e1 is changed - nm_add_stat3e1.previous != [] @@ -310,7 +310,7 @@ - nm_add_stat3e1.current|length > nm_add_stat1e1.current|length # verifying length of current task (nm_add_stat3e1) is greater than the previous task (nm_add_stat1e1) - name: Add static port 2 (dpc) to EPG6 of AP2 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -334,7 +334,7 @@ register: nm_add_stat2e6 - name: Verify nm_add_stat2e6 - assert: + ansible.builtin.assert: that: - nm_add_stat2e6 is changed - nm_add_stat2e6.previous == [] @@ -346,7 +346,7 @@ - nm_add_stat2e6.current[0].type == 'dpc' - name: Add static port 2 to site EPG2 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: &static_port_2 + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: &static_port_2 <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -368,7 +368,7 @@ register: nm_add_stat2e2 - name: Verify nm_add_stat2e2 - assert: + ansible.builtin.assert: that: - nm_add_stat2e2 is changed - nm_add_stat2e2.previous == [] @@ -380,19 +380,19 @@ # ADD EXISTING STATIC PORT - name: Add static port 1 to site EPG1 again (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *static_port_2 state: present register: nm_add_stat1e1_2 - name: Verify nm_add_stat1e1_2 - assert: + ansible.builtin.assert: that: - nm_add_stat1e1_2 is not changed # ADD STATIC FEX PORT - name: Add static fex port to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *static_port_2 static_ports: - path: eth1/2 @@ -407,7 +407,7 @@ register: nm_add_statfex - name: Verify nm_add_statfex - assert: + ansible.builtin.assert: that: - nm_add_statfex is changed - nm_add_statfex.previous != [] @@ -419,7 +419,7 @@ # QUERY STATIC PORTS - name: Query STATIC PORTS of site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -430,37 +430,37 @@ register: nm_query_statse1 - name: Verify nm_query_statse1 - assert: + ansible.builtin.assert: that: - nm_query_statse1 is not changed #REMOVE STATIC PORT - name: Remove all static ports from EPG2 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *static_port_2 state: absent register: nm_remove_stat2e2 - name: Verify nm_remove_stat2e2 - assert: + ansible.builtin.assert: that: - nm_remove_stat2e2 is changed - name: Remove all static ports from EPG2 again(normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *static_port_2 state: absent ignore_errors: true register: nm_remove_again_stat2e2 - name: Verify nm_remove_again_stat2e2 - assert: + ansible.builtin.assert: that: - nm_remove_again_stat2e2 is not changed # VERIFY NON EXISTENT 'DEPLOYMENT IMMEDIACY', 'TYPE' AND 'MODE' - name: Add static port 1 to site EPG4 with AP2 with no deployment immediacy, type and mode (normal mode) - mso_schema_site_anp_epg_bulk_staticport: &add_static_port + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: &add_static_port <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -478,7 +478,7 @@ register: nm_add_stat_no_di_type_mode - name: Verify nm_add_stat_no_di_type_mode - assert: + ansible.builtin.assert: that: - nm_add_stat_no_di_type_mode.current[0].deploymentImmediacy == 'lazy' - nm_add_stat_no_di_type_mode.current[0].mode == 'untagged' @@ -486,7 +486,7 @@ # VERIFY NON EXISTENT parent values. - name: Add static port 1 to site EPG4 with AP2 with no parent values (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -502,7 +502,7 @@ register: nm_add_stat_no_parent - name: Verify nm_add_stat_no_parent - assert: + ansible.builtin.assert: that: - nm_add_stat_no_parent.current[0].deploymentImmediacy == 'lazy' - nm_add_stat_no_parent.current[0].mode == 'untagged' @@ -510,7 +510,7 @@ # VERIFY NON EXISTENT required values. - name: Add static port 1 to site EPG4 with AP2 with missing required values (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -524,14 +524,14 @@ register: nm_add_stat_no_req - name: Verify nm_add_stat_no_req - assert: + ansible.builtin.assert: that: - nm_add_stat_no_req is not changed - nm_add_stat_no_req.msg == "state is present but all of the following are missing{{':'}} pod, leaf, path, vlan." # VERIFY path in each leaf within a pod is unique (pod->leaf->path) - name: Add static port 1 to site EPG4 with AP2 with missing required values (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -552,14 +552,14 @@ register: nm_add_unique_path - name: Verify nm_add_unique_path - assert: + ansible.builtin.assert: that: - nm_add_unique_path is not changed - nm_add_unique_path.msg == "Each leaf in a pod of a static port should have an unique path." # USE NON-EXISTING EPG and ANP AT TEMPLATE LEVEL - name: Add static port 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port anp: AP5 epg: EPG5 @@ -568,13 +568,13 @@ register: nm_add_stat1e5 - name: Verify nm_add_stat1e5 - assert: + ansible.builtin.assert: that: - nm_add_stat1e5 is not changed # USE NON-EXISTING EPG AT TEMPLATE LEVEL - name: Add static port 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port anp: AP1 epg: EPG6 @@ -583,55 +583,55 @@ register: nm_add_stat1e6 - name: Verify nm_add_stat1e6 - assert: + ansible.builtin.assert: that: - nm_add_stat1e6 is not changed # USE A NON-EXISTING SCHEMA - name: Non-existing schema for static port - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port schema: non_existing_schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - nm_non_existing_schema is not changed - nm_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." # USE A NON-EXISTING TEMPLATE - name: Non-existing template for static port (normal_mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port template: non_existing_template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - nm_non_existing_template is not changed - nm_non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{':'}} Template1, Template2" # USE A NON-EXISTING SITE - name: Non-existing site for static port (normal_mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port site: 'non_existing_site' ignore_errors: true register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - nm_non_existing_site is not changed - nm_non_existing_site.msg == "Site 'non_existing_site' is not a valid site name." # USE A TEMPLATE WITHOUT ANY SITE - name: Add site EPG static port association to Template 3 without any site associated (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *add_static_port schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -640,14 +640,14 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - nm_no_site_associated is not changed - nm_no_site_associated.msg == "No sites associated with schema 'ansible_test_2'. Associate the site with the schema using (M) mso_schema_site." # Add static port 3 after adding ANP and EPG to site - name: Add a new site to a schema 2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -655,7 +655,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -663,7 +663,7 @@ state: present - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -673,7 +673,7 @@ state: present - name: Ensure Template 3 with AP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -681,7 +681,7 @@ state: present - name: Ensure Template 3 and AP1 with EPG1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -694,7 +694,7 @@ state: present - name: Add new ANP to site - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -704,7 +704,7 @@ register: cm_add_epg - name: Add new EPG to site after adding ANP to site - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -715,7 +715,7 @@ register: cm_add_epg - name: Add static port to site EPG1 in schema 2 (normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -738,7 +738,7 @@ register: nm_add_stat3 - name: Verify nm_add_stat3 - assert: + ansible.builtin.assert: that: - nm_add_stat3 is changed - nm_add_stat3.previous == [] @@ -749,7 +749,7 @@ - nm_add_stat3.current[0].type == 'port' - name: Add static port to site EPG1 in schema 2 again without static_ports(normal mode) - mso_schema_site_anp_epg_bulk_staticport: + cisco.mso.mso_schema_site_anp_epg_bulk_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -768,7 +768,7 @@ register: nm_add_no_static_port - name: Verify nm_add_no_static_port - assert: + ansible.builtin.assert: that: - nm_add_no_static_port is not changed - nm_add_no_static_port.msg == "state is present but all of the following are missing{{':'}} static_ports" diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml index 24b953a0f..969f9c449 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml @@ -2,17 +2,18 @@ # Copyright: (c) 2020, Lionel Hercot (@lhercot) <lhercot@cisco.com> # Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> (based on mso_site test case) # Copyright: (c) 2020, Shreyas Srish (@shrsr) <ssrish@cisco.com> +# Copyright: (c) 2024, Akini Ross (@akinross) <akinross@cisco.com> # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +24,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -32,7 +33,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -43,7 +44,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -55,7 +56,7 @@ ignore_errors: true - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -65,7 +66,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -76,7 +77,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -84,7 +85,7 @@ state: present - name: Add a new site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -92,7 +93,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -100,7 +101,7 @@ state: present - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -110,7 +111,7 @@ state: present - name: Ensure Template 1 with AP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -118,7 +119,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -131,7 +132,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG3 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -144,7 +145,7 @@ state: present - name: Ensure Template 1 with AP2 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -152,7 +153,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG2 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -165,7 +166,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG4 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -179,7 +180,7 @@ # ADD DOMAINS - name: Add domain 1 to site EPG1 with AP1 (check mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -195,7 +196,7 @@ register: cm_add_dom1e1 - name: Verify cm_add_dom1e1 - assert: + ansible.builtin.assert: that: - cm_add_dom1e1 is changed - cm_add_dom1e1.previous == {} @@ -205,7 +206,7 @@ - cm_add_dom1e1.current.resolutionImmediacy == 'pre-provision' - name: Add domain 1 to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -220,7 +221,7 @@ register: nm_add_dom1e1 - name: Verify nm_add_dom1e1 - assert: + ansible.builtin.assert: that: - nm_add_dom1e1 is changed - nm_add_dom1e1.previous == {} @@ -230,7 +231,7 @@ - nm_add_dom1e1.current.resolutionImmediacy == 'pre-provision' - name: Add domain 2 to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -245,7 +246,7 @@ register: nm_add_dom2e1 - name: Verify nm_add_dom2e1 - assert: + ansible.builtin.assert: that: - nm_add_dom2e1 is changed - nm_add_dom2e1.previous == {} @@ -255,7 +256,7 @@ - nm_add_dom2e1.current.resolutionImmediacy == 'pre-provision' - name: Add domain 3 to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -270,7 +271,7 @@ register: nm_add_dom3e1 - name: Verify nm_add_dom3e1 - assert: + ansible.builtin.assert: that: - nm_add_dom3e1 is changed - nm_add_dom3e1.previous != {} @@ -280,7 +281,7 @@ - nm_add_dom3e1.current.resolutionImmediacy == 'lazy' - name: Add domain1 to site EPG3 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -295,7 +296,7 @@ register: nm_add_dom1e3 - name: Verify nm_add_dom1e2 - assert: + ansible.builtin.assert: that: - nm_add_dom1e3 is changed - nm_add_dom1e3.previous == {} @@ -305,7 +306,7 @@ - nm_add_dom1e3.current.resolutionImmediacy == 'lazy' - name: Add domain 2 to EPG2 (check mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -321,7 +322,7 @@ register: cm_add_dom2e2 - name: Verify cm_add_dom2e2 - assert: + ansible.builtin.assert: that: - cm_add_dom2e2 is changed - cm_add_dom2e2.previous == {} @@ -332,7 +333,7 @@ # QUERY DOMAINS - name: Query domains of site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -343,13 +344,13 @@ register: nm_query_domse1 - name: Verify nm_query_domse1 - assert: + ansible.builtin.assert: that: - nm_query_domse1 is not changed # QUERY A DOMAIN - name: Query domain3 of site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -364,13 +365,13 @@ register: nm_query_dom3e1 - name: Verify nm_query_dom3e1 - assert: + ansible.builtin.assert: that: - nm_query_dom3e1 is not changed # QUERY REMOVED DOMAIN - name: Add domain 2 to site EPG2 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -385,7 +386,7 @@ register: nm_add_dom2e2 - name: Verify nm_add_dom2e2 - assert: + ansible.builtin.assert: that: - nm_add_dom2e2 is changed - nm_add_dom2e2.previous == {} @@ -395,7 +396,7 @@ - nm_add_dom2e2.current.resolutionImmediacy == 'pre-provision' - name: Remove domain2 from EPG2 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -410,12 +411,12 @@ register: nm_remove_dom2e2 - name: Verify nm_remove_dom2e2 - assert: + ansible.builtin.assert: that: - nm_remove_dom2e2 is changed - name: Query removed domain2 from EPG2 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -431,13 +432,13 @@ register: nm_non_existent_dom2e2 - name: Verify non_existing_domain - assert: + ansible.builtin.assert: that: - nm_non_existent_dom2e2 is not changed - nm_non_existent_dom2e2.msg == "Domain association 'physicalDomain/phys' not found" - name: Remove domain2 from EPG2 again(normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -453,13 +454,13 @@ register: nm_remove_again_dom2e2 - name: Verify nm_remove_again_dom2e2 - assert: + ansible.builtin.assert: that: - nm_remove_again_dom2e2 is not changed # ADD EXISTING DOMAIN - name: Add domain 1 to site EPG1 again (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -474,13 +475,13 @@ register: nm_add_dom1e1_2 - name: Verify nm_add_dom1e1_2 - assert: + ansible.builtin.assert: that: - nm_add_dom1e1_2 is not changed # ADD DOMAIN WITH NO STATE - name: Add domain 1 to site EPG1 again with no state (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -495,13 +496,13 @@ register: nm_add_stateless_dom1e1_2 - name: Verify nm_add_stateless_dom1e1_2 - assert: + ansible.builtin.assert: that: - nm_add_stateless_dom1e1_2 is not changed # ADD OTHER DOMAIN OPTIONS - name: Add domain l3ExtDomain to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -516,7 +517,7 @@ register: nm_add_doml3 - name: Verify nm_add_doml3 - assert: + ansible.builtin.assert: that: - nm_add_doml3 is changed - nm_add_doml3.previous == {} @@ -526,7 +527,7 @@ - nm_add_doml3.current.resolutionImmediacy == 'lazy' - name: Add domain l2ExtDomain to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -542,7 +543,7 @@ register: nm_add_doml2 - name: Verify nm_add_doml2 - assert: + ansible.builtin.assert: that: - nm_add_doml2 is changed - nm_add_doml2.previous == {} @@ -552,7 +553,7 @@ - nm_add_doml2.current.resolutionImmediacy == 'lazy' - name: Add domain fibreChannel to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -567,7 +568,7 @@ register: nm_add_domfc - name: Verify nm_add_domfc - assert: + ansible.builtin.assert: that: - nm_add_domfc is changed - nm_add_domfc.previous == {} @@ -578,7 +579,7 @@ # USE OTHER ATTRIBUTES OF VMM DOMAIN - name: Add domain vmm to site EPG2 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: &domain_ap1_epg2 + cisco.mso.mso_schema_site_anp_epg_domain: &domain_ap1_epg2 <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -588,7 +589,7 @@ domain_association_type: vmmDomain domain_profile: 'VMware-VMM' deployment_immediacy: immediate - resolution_immediacy: lazy + resolution_immediacy: immediate micro_seg_vlan_type: 'vlan' micro_seg_vlan: 100 port_encap_vlan_type: 'vlan' @@ -599,17 +600,26 @@ switching_mode: native enhanced_lagpolicy_name: 'ansible_check_name' enhanced_lagpolicy_dn: 'ansible_check' + delimiter: '|' + binding_type: static + num_ports: 2 + port_allocation: elastic + netflow_pref: enabled + allow_promiscuous: accept + forged_transmits: accept + mac_changes: accept + custom_epg_name: ansible_custom_epg state: present register: nm_add_domvmprop - name: Query domain vmms attached to site EPG2 with AP2 - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *domain_ap1_epg2 state: query register: nm_query_domvmprop - name: Verify domain vmm to site EPG2 with AP2 - assert: + ansible.builtin.assert: that: - nm_add_domvmprop is changed - nm_add_domvmprop.previous == {} @@ -623,10 +633,19 @@ - nm_add_domvmprop.current.microSegVlan.vlanType == "vlan" - nm_add_domvmprop.current.portEncapVlan.vlan == 100 - nm_add_domvmprop.current.portEncapVlan.vlanType == "vlan" - - nm_add_domvmprop.current.resolutionImmediacy == "lazy" + - nm_add_domvmprop.current.resolutionImmediacy == "immediate" - nm_add_domvmprop.current.switchType == "default" - nm_add_domvmprop.current.switchingMode == "native" - nm_add_domvmprop.current.vlanEncapMode == "static" + - nm_add_domvmprop.current.delimiter == "|" + - nm_add_domvmprop.current.bindingType == "static" + - nm_add_domvmprop.current.numPorts == 2 + - nm_add_domvmprop.current.portAllocation == "elastic" + - nm_add_domvmprop.current.netflowPref == "enabled" + - nm_add_domvmprop.current.allowPromiscuous == "accept" + - nm_add_domvmprop.current.forgedTransmits == "accept" + - nm_add_domvmprop.current.macChanges == "accept" + - nm_add_domvmprop.current.customEpgName == "ansible_custom_epg" - nm_add_domvmprop.current.vmmDomainProperties.allowMicroSegmentation == true - nm_add_domvmprop.current.vmmDomainProperties.epgLagPol.enhancedLagPol.dn == "ansible_check" - nm_add_domvmprop.current.vmmDomainProperties.epgLagPol.enhancedLagPol.name == "ansible_check_name" @@ -637,6 +656,15 @@ - nm_add_domvmprop.current.vmmDomainProperties.switchType == "default" - nm_add_domvmprop.current.vmmDomainProperties.switchingMode == "native" - nm_add_domvmprop.current.vmmDomainProperties.vlanEncapMode == "static" + - nm_add_domvmprop.current.vmmDomainProperties.delimiter == "|" + - nm_add_domvmprop.current.vmmDomainProperties.bindingType == "static" + - nm_add_domvmprop.current.vmmDomainProperties.numPorts == 2 + - nm_add_domvmprop.current.vmmDomainProperties.portAllocation == "elastic" + - nm_add_domvmprop.current.vmmDomainProperties.netflowPref == "enabled" + - nm_add_domvmprop.current.vmmDomainProperties.allowPromiscuous == "accept" + - nm_add_domvmprop.current.vmmDomainProperties.forgedTransmits == "accept" + - nm_add_domvmprop.current.vmmDomainProperties.macChanges == "accept" + - nm_add_domvmprop.current.vmmDomainProperties.customEpgName == "ansible_custom_epg" - nm_query_domvmprop.current.allowMicroSegmentation == true - nm_query_domvmprop.current.deployImmediacy == "immediate" - nm_query_domvmprop.current.dn == "uni/vmmp-VMware/dom-VMware-VMM" @@ -646,20 +674,29 @@ - nm_query_domvmprop.current.microSegVlan.vlanType == "vlan" - nm_query_domvmprop.current.portEncapVlan.vlan == 100 - nm_query_domvmprop.current.portEncapVlan.vlanType == "vlan" - - nm_query_domvmprop.current.resolutionImmediacy == "lazy" + - nm_query_domvmprop.current.resolutionImmediacy == "immediate" - nm_query_domvmprop.current.switchType == "default" - nm_query_domvmprop.current.switchingMode == "native" - nm_query_domvmprop.current.vlanEncapMode == "static" + - nm_query_domvmprop.current.delimiter == "|" + - nm_query_domvmprop.current.bindingType == "static" + - nm_query_domvmprop.current.numPorts == 2 + - nm_query_domvmprop.current.portAllocation == "elastic" + - nm_query_domvmprop.current.netflowPref == "enabled" + - nm_query_domvmprop.current.allowPromiscuous == "accept" + - nm_query_domvmprop.current.forgedTransmits == "accept" + - nm_query_domvmprop.current.macChanges == "accept" + - nm_query_domvmprop.current.customEpgName == "ansible_custom_epg" - name: Add another domain vmm to site EPG2 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *domain_ap1_epg2 domain_profile: 'TEST' state: present register: nm_add_another_domvmprop - name: Query all domains vmms attached to site EPG2 with AP2 - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -670,14 +707,14 @@ register: nm_query_another_domvmprop - name: Verify domain vmm to site EPG2 with AP2 - assert: + ansible.builtin.assert: that: - nm_add_another_domvmprop is changed - nm_query_another_domvmprop is not changed - nm_query_another_domvmprop.current | length == 2 -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error binding type static and port_allocation not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -688,28 +725,36 @@ domain_profile: 'VMware-VMM' deployment_immediacy: lazy resolution_immediacy: lazy - micro_seg_vlan: 100 - port_encap_vlan_type: 'vlan' - port_encap_vlan: 100 - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native - enhanced_lagpolicy_name: 'ansible_check' - enhanced_lagpolicy_dn: 'ansible_check' + binding_type: static state: present ignore_errors: true - register: nm_add_domvmprop1 + register: err_binding_type_static -- name: Verify nm_add_domvmprop1 - assert: +- name: Verify binding type static error + ansible.builtin.assert: that: - - nm_add_domvmprop1 is not changed - - nm_add_domvmprop1.previous == {} - - nm_add_domvmprop1.msg == "micro_seg_vlan_type is required when micro_seg_vlan is provided." + - err_binding_type_static is not changed + - err_binding_type_static.msg == "binding_type is static but all of the following are missing{{":"}} port_allocation" + +- name: Error micro_seg_vlan and micro_seg_vlan_type not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + template: Template 1 + anp: AP2 + epg: EPG4 + domain_association_type: vmmDomain + domain_profile: 'VMware-VMM' + deployment_immediacy: lazy + resolution_immediacy: lazy + micro_seg_vlan: 100 + state: present + ignore_errors: true + register: err_no_micro_seg_vlan_type -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error micro_seg_vlan_type and micro_seg_vlan not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -721,26 +766,20 @@ deployment_immediacy: lazy resolution_immediacy: lazy micro_seg_vlan_type: 'vlan' - port_encap_vlan_type: 'vlan' - port_encap_vlan: 100 - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native - enhanced_lagpolicy_name: 'ansible_check' - enhanced_lagpolicy_dn: 'ansible_check' state: present ignore_errors: true - register: nm_add_domvmprop2 + register: err_no_micro_seg_vlan -- name: Verify nm_add_domvmprop2 - assert: +- name: Verify micro segmentation vlan error + ansible.builtin.assert: that: - - nm_add_domvmprop2 is not changed - - nm_add_domvmprop2.msg == "micro_seg_vlan is required when micro_seg_vlan_type is provided." + - err_no_micro_seg_vlan_type is not changed + - err_no_micro_seg_vlan_type.msg == "parameters are required together{{":"}} micro_seg_vlan_type, micro_seg_vlan" + - err_no_micro_seg_vlan is not changed + - err_no_micro_seg_vlan.msg == "parameters are required together{{":"}} micro_seg_vlan_type, micro_seg_vlan" -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error port_encap_vlan and port_encap_vlan_type not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -751,27 +790,13 @@ domain_profile: 'VMware-VMM' deployment_immediacy: lazy resolution_immediacy: lazy - micro_seg_vlan_type: 'vlan' - micro_seg_vlan: 100 port_encap_vlan: 100 - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native - enhanced_lagpolicy_name: 'ansible_check' - enhanced_lagpolicy_dn: '' state: present ignore_errors: true - register: nm_add_domvmprop3 + register: err_no_port_encap_vlan_type -- name: Verify nm_add_domvmprop3 - assert: - that: - - nm_add_domvmprop3 is not changed - - nm_add_domvmprop3.msg == "port_encap_vlan_type is required when port_encap_vlan is provided." - -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error port_encap_vlan_type and port_encap_vlan not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -782,27 +807,21 @@ domain_profile: 'VMware-VMM' deployment_immediacy: lazy resolution_immediacy: lazy - micro_seg_vlan_type: 'vlan' - micro_seg_vlan: 100 port_encap_vlan_type: 'vlan' - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native - enhanced_lagpolicy_name: 'ansible_check' - enhanced_lagpolicy_dn: 'ansible_check' state: present ignore_errors: true - register: nm_add_domvmprop4 + register: err_no_port_encap_vlan -- name: Verify nm_add_domvmprop4 - assert: +- name: Verify port encap vlan error + ansible.builtin.assert: that: - - nm_add_domvmprop4 is not changed - - nm_add_domvmprop4.msg == "port_encap_vlan is required when port_encap_vlan_type is provided." + - err_no_port_encap_vlan_type is not changed + - err_no_port_encap_vlan_type.msg == "parameters are required together{{":"}} port_encap_vlan_type, port_encap_vlan" + - err_no_port_encap_vlan is not changed + - err_no_port_encap_vlan.msg == "parameters are required together{{":"}} port_encap_vlan_type, port_encap_vlan" -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error enhanced_lagpolicy_dn and enhanced_lagpolicy_name not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -813,27 +832,13 @@ domain_profile: 'VMware-VMM' deployment_immediacy: lazy resolution_immediacy: lazy - micro_seg_vlan_type: 'vlan' - micro_seg_vlan: 100 - port_encap_vlan_type: 'vlan' - port_encap_vlan: 100 - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native enhanced_lagpolicy_dn: 'ansible_check' state: present ignore_errors: true - register: nm_add_domvmprop5 - -- name: Verify nm_add_domvmprop5 - assert: - that: - - nm_add_domvmprop5 is not changed - - nm_add_domvmprop5.msg == "enhanced_lagpolicy_name is required when enhanced_lagpolicy_dn is provided." + register: err_no_enhanced_lagpolicy_name -- name: Add domain vmm to site EPG4 with AP2 (normal mode) - mso_schema_site_anp_epg_domain: +- name: Error enhanced_lagpolicy_name and enhanced_lagpolicy_dn not provided (error mode) + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -844,28 +849,22 @@ domain_profile: 'VMware-VMM' deployment_immediacy: lazy resolution_immediacy: lazy - micro_seg_vlan_type: 'vlan' - micro_seg_vlan: 100 - port_encap_vlan_type: 'vlan' - port_encap_vlan: 100 - vlan_encap_mode: static - allow_micro_segmentation: true - switch_type: 'default' - switching_mode: native enhanced_lagpolicy_name: 'ansible_check' state: present ignore_errors: true - register: nm_add_domvmprop6 + register: err_no_enhanced_lagpolicy_dn - name: Verify nm_add_domvmprop6 - assert: + ansible.builtin.assert: that: - - nm_add_domvmprop6 is not changed - - nm_add_domvmprop6.msg == "enhanced_lagpolicy_dn is required when enhanced_lagpolicy_name is provided." + - err_no_enhanced_lagpolicy_name is not changed + - err_no_enhanced_lagpolicy_name.msg == "parameters are required together{{":"}} enhanced_lagpolicy_name, enhanced_lagpolicy_dn" + - err_no_enhanced_lagpolicy_dn is not changed + - err_no_enhanced_lagpolicy_dn.msg == "parameters are required together{{":"}} enhanced_lagpolicy_name, enhanced_lagpolicy_dn" # USE NON-EXISTING EPG and ANP AT TEMPLATE LEVEL - name: Add domain 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -881,13 +880,13 @@ register: nm_add_dom1e5 - name: Verify nm_add_dom1e5 - assert: + ansible.builtin.assert: that: - nm_add_dom1e5 is not changed # USE NON-EXISTING EPG AT TEMPLATE LEVEL - name: Add domain 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -903,13 +902,13 @@ register: nm_add_dom1e6 - name: Verify nm_add_dom1e6 - assert: + ansible.builtin.assert: that: - nm_add_dom1e6 is not changed # USE A NON-EXISTING SCHEMA - name: Non-existing schema for domain (check_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -925,7 +924,7 @@ register: cm_non_existing_schema - name: Non-existing schema for domain (normal_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -940,7 +939,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -949,7 +948,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for domain (check_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -965,7 +964,7 @@ register: cm_non_existing_template - name: Non-existing template for domain (normal_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -980,7 +979,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -989,7 +988,7 @@ # USE A NON-EXISTING SITE - name: Non-existing site for domain (check_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -1005,7 +1004,7 @@ register: cm_non_existing_site - name: Non-existing site for domain (normal_mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -1020,7 +1019,7 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -1030,7 +1029,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site EPG domain association to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -1046,7 +1045,7 @@ register: cm_no_site_associated - name: Add site EPG domain association to Template 3 without any site associated (normal mode) - mso_schema_site_anp_epg_domain: + cisco.mso.mso_schema_site_anp_epg_domain: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -1061,7 +1060,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_selector/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_selector/tasks/main.yml index ec69a7c47..1660e8e4c 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_selector/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_selector/tasks/main.yml @@ -6,13 +6,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,13 +23,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -38,7 +38,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure azure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -49,7 +49,7 @@ state: present - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -60,7 +60,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -71,7 +71,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -81,7 +81,7 @@ state: present - name: Associate aws site with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -93,7 +93,7 @@ register: aaws_nm - name: Associate azure site with access_type not present, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -102,7 +102,7 @@ register: aazure_shared_nm - name: Ensure schema 1 with Template 1, and Template 2, Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -114,7 +114,7 @@ - { template: Template 3} - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -122,7 +122,7 @@ state: present - name: Add aws site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -134,7 +134,7 @@ when: version.current.version is version('3', '<') - name: Add azure site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -146,7 +146,7 @@ when: version.current.version is version('3', '<') - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -154,7 +154,7 @@ state: present - name: Ensure ANP exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -165,7 +165,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}', template: 'Template 2' } - name: Add a new CIDR in VRF1 at site level - mso_schema_site_vrf_region_cidr: &mso_present + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -181,7 +181,7 @@ # ADD EPGs - name: Ensure EPGs exist - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -197,7 +197,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}', template: 'Template 1', epg: 'ansible_test_2' } - name: Add Selector to EPG (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -208,7 +208,7 @@ register: nm_add_selector_1 - name: Verify nm_add_selector_1 - assert: + ansible.builtin.assert: that: - nm_add_selector_1 is changed - nm_add_selector_1.previous == {} @@ -216,7 +216,7 @@ - nm_add_selector_1.current.expressions == [] - name: Add Selector 2 to EPG (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -231,7 +231,7 @@ register: nm_add_selector_2 - name: Verify nm_add_selector_2 - assert: + ansible.builtin.assert: that: - nm_add_selector_2 is changed - nm_add_selector_2.previous == {} @@ -242,7 +242,7 @@ # ADD SELECTORS to site EPG - name: Add selector site_selector_1 to site EPG ansible_test_1 with ANP (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -255,7 +255,7 @@ register: cm_add_site_selector_1 - name: Verify cm_add_site_selector_1 - assert: + ansible.builtin.assert: that: - cm_add_site_selector_1.current.name == "site_selector_1" - cm_add_site_selector_1.current.expressions == [] @@ -263,7 +263,7 @@ - cm_add_site_selector_1.previous == {} - name: Add selector site_selector_1 to site EPG ansible_test_1 with ANP (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -275,7 +275,7 @@ register: nm_add_site_selector_1 - name: Verify nm_add_site_selector_1 - assert: + ansible.builtin.assert: that: - nm_add_site_selector_1.current.name == "site_selector_1" - nm_add_site_selector_1.current.expressions == [] @@ -284,7 +284,7 @@ # Add selector 1 again - name: Add selector site_selector_1 to site EPG ansible_test_1 with ANP again (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -296,14 +296,14 @@ register: nm_add_site_selector_1_again - name: Verify nm_add_site_selector_1_again - assert: + ansible.builtin.assert: that: - nm_add_site_selector_1_again is not changed - nm_add_site_selector_1_again.current.name == "site_selector_1" == nm_add_site_selector_1_again.previous.name - nm_add_site_selector_1_again.current.expressions == [] == nm_add_site_selector_1_again.previous.expressions - name: Add Selector 1 to site EPG with space in selector name (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -316,13 +316,13 @@ register: nm_add_selector1_with_space_in_name - name: Verify nm_add_selector1_with_space_in_name - assert: + ansible.builtin.assert: that: - nm_add_selector1_with_space_in_name is not changed - nm_add_selector1_with_space_in_name.msg == "There should not be any space in selector name." - name: Add Selector 2 to site EPG with space in expression type (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -339,13 +339,13 @@ register: nm_add_selector2_with_space_in_expression_type - name: Verify nm_add_selector2_with_space_in_expression_type - assert: + ansible.builtin.assert: that: - nm_add_selector2_with_space_in_expression_type is not changed - nm_add_selector2_with_space_in_expression_type.msg == "There should not be any space in 'type' attribute of expression 'expression 2'" - name: Add Selector 2 to site EPG (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -362,7 +362,7 @@ register: cm_add_site_selector_2 - name: Verify cm_add_selector_2 - assert: + ansible.builtin.assert: that: - cm_add_site_selector_2 is changed - cm_add_site_selector_2.previous == {} @@ -372,7 +372,7 @@ - cm_add_site_selector_2.current.expressions[0].value == "test" - name: Add Selector_2 to site EPG (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -388,7 +388,7 @@ register: nm_add_site_selector_2 - name: Verify nm_add_site_selector_2 - assert: + ansible.builtin.assert: that: - nm_add_site_selector_2 is changed - nm_add_site_selector_2.previous == {} @@ -398,7 +398,7 @@ - nm_add_site_selector_2.current.expressions[0].value == "test" - name: Change Selector 2 - keyExist(normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -415,13 +415,13 @@ register: nm_change_site_selector_2_key_exist - name: Verify nm_change_site_selector_2_key_exist - assert: + ansible.builtin.assert: that: - nm_change_site_selector_2_key_exist is not changed - nm_change_site_selector_2_key_exist.msg == "Attribute 'value' is not supported for operator 'has_key' in expression 'expression_5'" - name: Change Selector 2 - keyNotExist (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -438,13 +438,13 @@ register: nm_change_site_selector_2_key_not_exist - name: Verify nm_change_site_selector_2_key_not_exist - assert: + ansible.builtin.assert: that: - nm_change_site_selector_2_key_not_exist is not changed - nm_change_site_selector_2_key_not_exist.msg == "Attribute 'value' is not supported for operator 'does_not_have_key' in expression 'expression_6'" - name: Change Selector 2 - equals (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -460,14 +460,14 @@ register: nm_change_site_selector_2_equals - name: Verify nm_change_site_selector_2_equals - assert: + ansible.builtin.assert: that: - nm_change_site_selector_2_equals is not changed - nm_change_site_selector_2_equals.msg == "Attribute 'value' needed for operator 'equals' in expression 'expression_6'" # Remove site ANP - name: Remove site ANP (normal_mode) - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -476,7 +476,7 @@ state: absent - name: Query site ANP - mso_schema_site_anp: + cisco.mso.mso_schema_site_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -487,14 +487,14 @@ register: query_site_ANP - name: Verify query_site_ANP - assert: + ansible.builtin.assert: that: - query_site_ANP.msg == "ANP 'ANP' not found" when: version.current.version is version('4.0', '<') # no error msg is returned in NDO4.0 because site will be present when template is defined # Query without site ANP - name: Query site_selectors without site ANP - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -506,7 +506,7 @@ register: query_without_site_ANP - name: Verify query_without_site_ANP - assert: + ansible.builtin.assert: that: - query_without_site_ANP is not changed - query_without_site_ANP.msg == "Anp 'ANP' does not exist in site level." @@ -514,7 +514,7 @@ # - name: Add selector without ANP exist in site level - name: Add site selector 3 without site ANP exist (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -530,7 +530,7 @@ register: nm_add_site_selector_3_without_anp - name: Verify nm_add_site_selector_3_without_anp - assert: + ansible.builtin.assert: that: - nm_add_site_selector_3_without_anp is changed - nm_add_site_selector_3_without_anp.previous == {} @@ -541,7 +541,7 @@ # Remove site level EPG - name: Remove site EPG - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -552,7 +552,7 @@ # Query without site level EPG - name: Query site_selectors without site EPG - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -564,14 +564,14 @@ register: query_without_site_EPG - name: Verify query_without_site_EPG - assert: + ansible.builtin.assert: that: - query_without_site_EPG is not changed - query_without_site_EPG.msg == "Epg 'ansible_test_1' does not exist in site level." when: version.current.version is version('4.0', '<') # no error msg is returned in NDO4.0 because site will be present when template is defined - name: Add site selector 1 without site EPG exist (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -583,7 +583,7 @@ register: nm_add_site_selector_1_without_epg - name: Verify nm_add_site_selector_1_without_epg - assert: + ansible.builtin.assert: that: - nm_add_site_selector_1_without_epg is changed - nm_add_site_selector_1_without_epg.previous == {} @@ -591,7 +591,7 @@ - nm_add_site_selector_1_without_epg.current.expressions == [] - name: Add site_selector_1 site_selector_2 site_selector_3 again - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -611,13 +611,13 @@ register: nm_add_site_selectors_again - name: Verify nm_add_site_selectors_again - assert: + ansible.builtin.assert: that: - nm_add_site_selectors_again is changed # Query all selectors - name: Query selectors to site EPG - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -628,7 +628,7 @@ register: query_all_site_selectors - name: Verify query_all_site_selectors - assert: + ansible.builtin.assert: that: - query_all_site_selectors is not changed - query_all_site_selectors.current | length == 3 @@ -647,7 +647,7 @@ # Query sepecific seletor to site EPG - name: Query selector to site EPG - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -659,7 +659,7 @@ register: query_site_selector_1 - name: Verify query_site_selector_1 - assert: + ansible.builtin.assert: that: - query_site_selector_1 is not changed - query_site_selector_1.current.name == "site_selector_1" @@ -668,7 +668,7 @@ - query_site_selector_1.current.expressions[0].value == "test" - name: Remove site selector 3 (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -680,13 +680,13 @@ register: nm_remove_site_selector_3 - name: Verify nm_remove_site_selector_3 - assert: + ansible.builtin.assert: that: - nm_remove_site_selector_3 is changed - nm_remove_site_selector_3.current == {} - name: Remove site selector 3 again (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -698,14 +698,14 @@ register: nm_remove_site_selector_3_again - name: Verify nm_remove_site_selector_3_again - assert: + ansible.builtin.assert: that: - nm_remove_site_selector_3_again is not changed - nm_remove_site_selector_3_again.current == {} # QUERY NON-EXISTING Selector to EPG - name: Query non-existing selector (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -719,7 +719,7 @@ register: cm_query_non_selector - name: Query non-existing selector (normal mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -732,7 +732,7 @@ register: nm_query_non_selector - name: Verify cm_query_non_selector and nm_query_non_selector - assert: + ansible.builtin.assert: that: - cm_query_non_selector is not changed - nm_query_non_selector is not changed @@ -742,7 +742,7 @@ # QUERY NON-EXISTING EPG - name: Query non-existing EPG (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -756,7 +756,7 @@ register: cm_query_non_epg - name: Query non-existing EPG (normal mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -769,7 +769,7 @@ register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - cm_query_non_epg is not changed - nm_query_non_epg is not changed @@ -778,7 +778,7 @@ # QUERY NON-EXISTING ANP - name: Query non-existing ANP (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -792,7 +792,7 @@ register: cm_query_non_anp - name: Query non-existing ANP (normal mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -805,7 +805,7 @@ register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - cm_query_non_anp is not changed - nm_query_non_anp is not changed @@ -814,7 +814,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -828,7 +828,7 @@ register: cm_non_existing_state - name: Non-existing state (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -841,7 +841,7 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -850,7 +850,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -864,7 +864,7 @@ register: cm_non_existing_template - name: Non-existing template (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -877,7 +877,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -886,7 +886,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: non-existing-schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -900,7 +900,7 @@ register: cm_non_existing_schema - name: Non-existing schema (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: non-existing-schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -913,7 +913,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -922,7 +922,7 @@ # USE A NON-EXISTING SITE - name: Non-existing site (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non-existing-site @@ -936,7 +936,7 @@ register: cm_non_existing_site - name: Non-existing site (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non-existing-site @@ -949,7 +949,7 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -958,7 +958,7 @@ # USE A NON-EXISTING SITE-TEMPLATE - name: Non-existing site-template (check_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -972,7 +972,7 @@ register: cm_non_existing_site_template - name: Non-existing site-template (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -985,7 +985,7 @@ register: nm_non_existing_site_template - name: Verify non_existing_site_template - assert: + ansible.builtin.assert: that: - cm_non_existing_site_template is not changed - nm_non_existing_site_template is not changed @@ -993,7 +993,7 @@ - cm_non_existing_site_template.msg == nm_non_existing_site_template.msg == "Provided site-template association 'aws_{{ mso_site | default("ansible_test") }}-Template3' does not exist." - name: Add Selector_4 to site EPG (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -1009,13 +1009,13 @@ register: nm_add_site_selector_4 - name: Verify nm_add_site_selector_4 - assert: + ansible.builtin.assert: that: - nm_add_site_selector_4 is not changed - nm_add_site_selector_4.msg == "Operator 'has_key' is not supported when expression type is 'ip_address'" - name: Add Selector_4 to site EPG again (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -1031,13 +1031,13 @@ register: nm_add_site_selector_4_again - name: Verify nm_add_site_selector_4 - assert: + ansible.builtin.assert: that: - nm_add_site_selector_4_again is changed - nm_add_site_selector_4_again.current.name == "site_selector_4" - name: Add azure site_selector_1 to site EPG (normal_mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -1054,14 +1054,14 @@ register: nm_add_azure_site_selector_1 - name: Verify nm_add_azure_site_selector_1 - assert: + ansible.builtin.assert: that: - nm_add_azure_site_selector_1 is not changed - nm_add_azure_site_selector_1.msg == "Type 'zone' is only supported for aws" # USE A TEMPLATE WITHOUT ANY SITE - name: Add site EPG selector to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -1079,7 +1079,7 @@ register: cm_no_site_associated - name: Add site EPG selector to Template 3 without any site associated (normal mode) - mso_schema_site_anp_epg_selector: + cisco.mso.mso_schema_site_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -1096,7 +1096,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml index cb50a64e6..054ec970e 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml @@ -1,4 +1,5 @@ # Test code for the MSO modules +# Copyright: (c) 2024, Akini Ross (@akinross) <akinross@cisco.com> # Copyright: (c) 2020, Lionel Hercot (@lhercot) <lhercot@cisco.com> # Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> (based on mso_site test case) # Copyright: (c) 2020, Shreyas Srish (@shrsr) <ssrish@cisco.com> @@ -6,13 +7,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +24,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -32,7 +33,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -43,7 +44,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -54,7 +55,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -64,7 +65,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -75,7 +76,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -83,7 +84,7 @@ state: present - name: Add a new site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -91,7 +92,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -99,7 +100,7 @@ state: present - name: Add BD1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -109,7 +110,7 @@ state: present - name: Ensure Template 1 with AP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -117,7 +118,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -130,7 +131,7 @@ state: present - name: Ensure Template 1 and AP1 with EPG3 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -143,7 +144,7 @@ state: present - name: Ensure Template 1 with AP2 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -151,7 +152,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG2 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -164,7 +165,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG4 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -177,7 +178,7 @@ state: present - name: Ensure Template 1 and AP2 with EPG6 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -191,7 +192,7 @@ # ADD STATIC PORTS - name: Add static port 1 to site EPG1 of AP1 (check mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -210,7 +211,7 @@ register: cm_add_stat1e1 - name: Verify cm_add_stat1e1 - assert: + ansible.builtin.assert: that: - cm_add_stat1e1 is changed - cm_add_stat1e1.previous == {} @@ -221,7 +222,7 @@ - cm_add_stat1e1.current.type == 'port' - name: Add static port 1 to site EPG1 of AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -238,7 +239,7 @@ register: nm_add_stat1e1 - name: Verify nm_add_stat1e1 - assert: + ansible.builtin.assert: that: - nm_add_stat1e1 is changed - nm_add_stat1e1.previous == {} @@ -249,7 +250,7 @@ - nm_add_stat1e1.current.type == 'port' - name: Add static port 2 to site EPG1 of AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -268,7 +269,7 @@ register: nm_add_stat2e1 - name: Verify nm_add_stat2e1 - assert: + ansible.builtin.assert: that: - nm_add_stat2e1 is changed - nm_add_stat2e1.previous == {} @@ -280,7 +281,7 @@ - name: Add static port 3 (vpc) to site EPG1 of AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -298,7 +299,7 @@ register: nm_add_stat3e1 - name: Verify nm_add_stat3e1 - assert: + ansible.builtin.assert: that: - nm_add_stat3e1 is changed - nm_add_stat3e1.previous == {} @@ -309,7 +310,7 @@ - nm_add_stat3e1.current.type == 'vpc' - name: Add static port 1 to site EPG3 of AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -327,7 +328,7 @@ register: nm_add_stat1e3 - name: Verify nm_add_stat1e3 - assert: + ansible.builtin.assert: that: - nm_add_stat1e3 is changed - nm_add_stat1e3.previous == {} @@ -338,7 +339,7 @@ - nm_add_stat1e3.current.type == 'port' - name: Add static port 2 (dpc) to EPG6 of AP2 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -357,7 +358,7 @@ register: nm_add_stat2e6 - name: Verify nm_add_stat2e6 - assert: + ansible.builtin.assert: that: - nm_add_stat2e6 is changed - nm_add_stat2e6.previous == {} @@ -370,7 +371,7 @@ # QUERY STATIC PORTS - name: Query STATIC PORTS of site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -381,13 +382,13 @@ register: nm_query_statse1 - name: Verify nm_query_statse1 - assert: + ansible.builtin.assert: that: - nm_query_statse1 is not changed # QUERY A STATIC PORT - name: Query static port 3 (vpc) of site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -405,13 +406,13 @@ register: nm_query_stat3e1 - name: Verify nm_query_stat3e1 - assert: + ansible.builtin.assert: that: - nm_query_stat3e1 is not changed # QUERY REMOVED STATIC PORT - name: Add static port 2 to site EPG2 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -429,7 +430,7 @@ register: nm_add_stat2e2 - name: Verify nm_add_stat2e2 - assert: + ansible.builtin.assert: that: - nm_add_stat2e2 is changed - nm_add_stat2e2.previous == {} @@ -440,7 +441,7 @@ - nm_add_stat2e2.current.type == 'port' - name: Remove static port 2 from EPG2 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -458,12 +459,12 @@ register: nm_remove_stat2e2 - name: Verify nm_remove_stat2e2 - assert: + ansible.builtin.assert: that: - nm_remove_stat2e2 is changed - name: Query removed static port 2 from EPG2 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -482,13 +483,13 @@ register: nm_non_existent_dom2e2 - name: Verify non_existing_domain - assert: + ansible.builtin.assert: that: - nm_non_existent_dom2e2 is not changed - - nm_non_existent_dom2e2.msg == "Static port 'topology/pod-2/paths-102/pathep-[eth1/2]' not found" + - nm_non_existent_dom2e2.msg == "Provided Static Port Path 'topology/pod-2/paths-102/pathep-[eth1/2]' not found" - name: Remove static port 2 from EPG2 again(normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -507,13 +508,13 @@ register: nm_remove_again_stat2e2 - name: Verify nm_remove_again_stat2e2 - assert: + ansible.builtin.assert: that: - nm_remove_again_stat2e2 is not changed # ADD EXISTING STATIC PORT - name: Add static port 1 to site EPG1 again (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -531,13 +532,13 @@ register: nm_add_stat1e1_2 - name: Verify nm_add_stat1e1_2 - assert: + ansible.builtin.assert: that: - nm_add_stat1e1_2 is not changed # ADD STATIC PORT WITH NO STATE - name: Add static port 1 to site EPG1 again with no state (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -555,13 +556,13 @@ register: nm_add_stateless_stat1e1_2 - name: Verify nm_add_stateless_stat1e1_2 - assert: + ansible.builtin.assert: that: - nm_add_stateless_stat1e1_2 is not changed # ADD STATIC FEX PORT - name: Add static fex port to site EPG1 with AP1 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -580,7 +581,7 @@ register: nm_add_statfex - name: Verify nm_add_statfex - assert: + ansible.builtin.assert: that: - nm_add_statfex is changed - nm_add_statfex.previous == {} @@ -592,7 +593,7 @@ # VERIFY NON EXISTENT DEPLOYMENT IMMEDIACY - name: Add static port 1 to site EPG4 with AP2 with no deployment immediacy (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -609,13 +610,13 @@ register: nm_add_stat_di - name: Verify nm_add_stat_di - assert: + ansible.builtin.assert: that: - nm_add_stat_di.current.deploymentImmediacy == 'lazy' # VERIFY NON EXISTENT MODE - name: Add static port 1 to site EPG4 with AP2 with no mode (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -632,13 +633,13 @@ register: nm_add_stat_mode - name: Verify nm_add_stat_mode - assert: + ansible.builtin.assert: that: - nm_add_stat_mode.current.mode == 'untagged' # USE NON-EXISTING EPG and ANP AT TEMPLATE LEVEL - name: Add static port 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -657,13 +658,13 @@ register: nm_add_stat1e5 - name: Verify nm_add_stat1e5 - assert: + ansible.builtin.assert: that: - nm_add_stat1e5 is not changed # USE NON-EXISTING EPG AT TEMPLATE LEVEL - name: Add static port 1 to non-existent site EPG5 (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -681,13 +682,13 @@ register: nm_add_stat1e6 - name: Verify nm_add_stat1e6 - assert: + ansible.builtin.assert: that: - nm_add_stat1e6 is not changed # USE A NON-EXISTING SCHEMA - name: Non-existing schema for static port (check_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -706,7 +707,7 @@ register: cm_non_existing_schema - name: Non-existing schema for static port (normal_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -724,7 +725,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -733,7 +734,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for static port (check_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -752,7 +753,7 @@ register: cm_non_existing_template - name: Non-existing template for static port (normal_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -770,16 +771,16 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed - cm_non_existing_template == nm_non_existing_template - - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1, Template2" + - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{":"}} Template1, Template2" # USE A NON-EXISTING SITE - name: Non-existing site for static port (check_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -798,7 +799,7 @@ register: cm_non_existing_site - name: Non-existing site for static port (normal_mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -816,17 +817,17 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed - cm_non_existing_site == nm_non_existing_site - - cm_non_existing_site.msg is match("Provided site/siteId/template 'ansible_test/[0-9a-zA-Z]*/Template2' does not exist. Existing siteIds/templates{{':'}} [0-9a-zA-Z]*/Template1") - - nm_non_existing_site.msg is match("Provided site/siteId/template 'ansible_test/[0-9a-zA-Z]*/Template2' does not exist. Existing siteIds/templates{{':'}} [0-9a-zA-Z]*/Template1") + - cm_non_existing_site.msg == "Provided site 'ansible_test' not associated with template 'Template2'. Site is currently associated with template(s){{':'}} Template1" + - nm_non_existing_site.msg == "Provided site 'ansible_test' not associated with template 'Template2'. Site is currently associated with template(s){{':'}} Template1" # USE A TEMPLATE WITHOUT ANY SITE - name: Add site EPG static port association to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -845,7 +846,7 @@ register: cm_no_site_associated - name: Add site EPG static port association to Template 3 without any site associated (normal mode) - mso_schema_site_anp_epg_staticport: + cisco.mso.mso_schema_site_anp_epg_staticport: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -863,8 +864,557 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed - - cm_no_site_associated.msg == nm_no_site_associated.msg == "No site associated with template 'Template3'. Associate the site with the template using mso_schema_site."
\ No newline at end of file + - cm_no_site_associated.msg == nm_no_site_associated.msg == "No sites associated with schema 'ansible_test_2'. Associate the site with the schema using (M) mso_schema_site." + +# TESTS IN BULK + +# SETUP TEST ENVIRONMENT FOR BULK + +- name: Remove Schemas for bulk + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ item }}' + state: absent + loop: + - '{{ mso_schema | default("ansible_test") }}_2' + - '{{ mso_schema | default("ansible_test") }}' + +- name: Create schema ansible_test with template_bulk + cisco.mso.mso_schema_template: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + tenant: ansible_test + template: template_bulk + +- name: Create vrf_bulk in template_bulk + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + vrf: vrf_bulk + +- name: Create bd_bulk in template_bulk + cisco.mso.mso_schema_template_bd: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + bd: bd_bulk + vrf: + name: vrf_bulk + +- name: Create anp_bulk in template_bulk + cisco.mso.mso_schema_template_anp: &anp_bulk + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + anp: anp_bulk + +- name: Create EPG in template_bulk + cisco.mso.mso_schema_template_anp_epg: + <<: *anp_bulk + epg: epg_bulk + bd: + name: bd_bulk + vrf: + name: vrf_bulk + +- name: Add site to template_bulk + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + template: template_bulk + +- name: Set facts for static_ports + ansible.builtin.set_fact: + static_ports_present: [] + static_ports_present_2: [] + static_ports_absent: [] + static_ports_absent_2: [] + +- name: Create static_ports list for appending + ansible.builtin.set_fact: + static_ports_present: "{{ static_ports_present + [{'pod': 'pod-1', 'leaf': '101', 'path': 'eth1/%s' | format(item), 'vlan': '110%s' | format(item)}] }}" + static_ports_present_2: "{{ static_ports_present_2 + [{'pod': 'pod-1', 'leaf': '101', 'path': 'eth2/%s' | format(item), 'vlan': '120%s' | format(item)}] }}" + loop: "{{ range(0, 10, 1) | list }}" + +- name: Create static_ports list for removing + ansible.builtin.set_fact: + static_ports_absent: "{{ static_ports_absent + [{'pod': 'pod-1', 'leaf': '101', 'path': 'eth1/%s' | format(item), 'vlan': '110%s' | format(item)}] }}" + static_ports_absent_2: "{{ static_ports_absent_2 + [{'pod': 'pod-1', 'leaf': '101', 'path': 'eth2/%s' | format(item), 'vlan': '120%s' | format(item)}] }}" + loop: "{{ range(0, 10, 2) | list }}" + +# CREATE AND UPDATE TESTS FOR BULK + +- name: Append static ports (check_mode) + cisco.mso.mso_schema_site_anp_epg_staticport: &static_ports_append + <<: *anp_bulk + epg: epg_bulk + site: '{{ mso_site | default("ansible_test") }}' + static_ports: "{{ static_ports_present }}" + register: cm_append_static_ports + check_mode: true + +- name: Append static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + register: nm_append_static_ports + +- name: Append static ports again + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + register: nm_append_static_ports_again + +- name: Append additional static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + static_ports: "{{ static_ports_present_2 }}" + register: nm_append_static_ports_2 + +- name: Verify appending static ports + ansible.builtin.assert: + that: + - cm_append_static_ports is changed + - cm_append_static_ports.previous == [] + - cm_append_static_ports.current | length == 10 + - cm_append_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - cm_append_static_ports.current.0.portEncapVlan == 1100 + - cm_append_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - cm_append_static_ports.current.3.portEncapVlan == 1103 + - cm_append_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - cm_append_static_ports.current.9.portEncapVlan == 1109 + - nm_append_static_ports is changed + - nm_append_static_ports.previous == [] + - nm_append_static_ports.current | length == 10 + - nm_append_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_append_static_ports.current.0.portEncapVlan == 1100 + - nm_append_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_append_static_ports.current.3.portEncapVlan == 1103 + - nm_append_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_append_static_ports.current.9.portEncapVlan == 1109 + - nm_append_static_ports_again is not changed + - nm_append_static_ports_again.previous | length == 10 + - nm_append_static_ports_again.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_append_static_ports_again.previous.0.portEncapVlan == 1100 + - nm_append_static_ports_again.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_append_static_ports_again.previous.3.portEncapVlan == 1103 + - nm_append_static_ports_again.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_append_static_ports_again.previous.9.portEncapVlan == 1109 + - nm_append_static_ports_again.current | length == 10 + - nm_append_static_ports_again.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_append_static_ports_again.current.0.portEncapVlan == 1100 + - nm_append_static_ports_again.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_append_static_ports_again.current.3.portEncapVlan == 1103 + - nm_append_static_ports_again.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_append_static_ports_again.current.9.portEncapVlan == 1109 + - nm_append_static_ports_2 is changed + - nm_append_static_ports_2.previous | length == 10 + - nm_append_static_ports_2.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_append_static_ports_2.previous.0.portEncapVlan == 1100 + - nm_append_static_ports_2.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_append_static_ports_2.previous.3.portEncapVlan == 1103 + - nm_append_static_ports_2.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_append_static_ports_2.previous.9.portEncapVlan == 1109 + - nm_append_static_ports_2.current | length == 20 + - nm_append_static_ports_2.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_append_static_ports_2.current.0.portEncapVlan == 1100 + - nm_append_static_ports_2.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_append_static_ports_2.current.3.portEncapVlan == 1103 + - nm_append_static_ports_2.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_append_static_ports_2.current.9.portEncapVlan == 1109 + - nm_append_static_ports_2.current.10.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_append_static_ports_2.current.10.portEncapVlan == 1200 + - nm_append_static_ports_2.current.13.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_append_static_ports_2.current.13.portEncapVlan == 1203 + - nm_append_static_ports_2.current.19.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_append_static_ports_2.current.19.portEncapVlan == 1209 + +# REMOVE AND UPDATE TESTS FOR BULK + +- name: Remove static ports (check_mode) + cisco.mso.mso_schema_site_anp_epg_staticport: &static_ports_remove + <<: *static_ports_append + static_ports: "{{ static_ports_absent }}" + state: absent + register: cm_remove_static_ports + check_mode: true + +- name: Remove static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_remove + register: nm_remove_static_ports + +- name: Remove static ports again + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_remove + register: nm_remove_static_ports_again + +- name: Remove additional static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_remove + static_ports: "{{ static_ports_absent_2 }}" + register: nm_remove_static_ports_2 + +- name: Verify removing static ports + ansible.builtin.assert: + that: + - cm_remove_static_ports is changed + - cm_remove_static_ports.previous | length == 20 + - cm_remove_static_ports.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - cm_remove_static_ports.previous.0.portEncapVlan == 1100 + - cm_remove_static_ports.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - cm_remove_static_ports.previous.3.portEncapVlan == 1103 + - cm_remove_static_ports.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - cm_remove_static_ports.previous.9.portEncapVlan == 1109 + - cm_remove_static_ports.previous.10.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - cm_remove_static_ports.previous.10.portEncapVlan == 1200 + - cm_remove_static_ports.previous.13.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - cm_remove_static_ports.previous.13.portEncapVlan == 1203 + - cm_remove_static_ports.previous.19.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - cm_remove_static_ports.previous.19.portEncapVlan == 1209 + - cm_remove_static_ports.current | length == 15 + - cm_remove_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - cm_remove_static_ports.current.0.portEncapVlan == 1101 + - cm_remove_static_ports.current.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - cm_remove_static_ports.current.2.portEncapVlan == 1105 + - cm_remove_static_ports.current.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - cm_remove_static_ports.current.4.portEncapVlan == 1109 + - cm_remove_static_ports.current.5.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - cm_remove_static_ports.current.5.portEncapVlan == 1200 + - cm_remove_static_ports.current.8.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - cm_remove_static_ports.current.8.portEncapVlan == 1203 + - cm_remove_static_ports.current.14.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - cm_remove_static_ports.current.14.portEncapVlan == 1209 + - nm_remove_static_ports is changed + - nm_remove_static_ports.previous | length == 20 + - nm_remove_static_ports.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_remove_static_ports.previous.0.portEncapVlan == 1100 + - nm_remove_static_ports.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_remove_static_ports.previous.3.portEncapVlan == 1103 + - nm_remove_static_ports.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports.previous.9.portEncapVlan == 1109 + - nm_remove_static_ports.previous.10.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_remove_static_ports.previous.10.portEncapVlan == 1200 + - nm_remove_static_ports.previous.13.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_remove_static_ports.previous.13.portEncapVlan == 1203 + - nm_remove_static_ports.previous.19.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports.previous.19.portEncapVlan == 1209 + - nm_remove_static_ports.current | length == 15 + - nm_remove_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_remove_static_ports.current.0.portEncapVlan == 1101 + - nm_remove_static_ports.current.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_remove_static_ports.current.2.portEncapVlan == 1105 + - nm_remove_static_ports.current.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports.current.4.portEncapVlan == 1109 + - nm_remove_static_ports.current.5.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_remove_static_ports.current.5.portEncapVlan == 1200 + - nm_remove_static_ports.current.8.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_remove_static_ports.current.8.portEncapVlan == 1203 + - nm_remove_static_ports.current.14.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports.current.14.portEncapVlan == 1209 + - nm_remove_static_ports_again is not changed + - nm_remove_static_ports_again.previous | length == 15 + - nm_remove_static_ports_again.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_remove_static_ports_again.previous.0.portEncapVlan == 1101 + - nm_remove_static_ports_again.previous.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_remove_static_ports_again.previous.2.portEncapVlan == 1105 + - nm_remove_static_ports_again.previous.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports_again.previous.4.portEncapVlan == 1109 + - nm_remove_static_ports_again.previous.5.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_remove_static_ports_again.previous.5.portEncapVlan == 1200 + - nm_remove_static_ports_again.previous.8.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_remove_static_ports_again.previous.8.portEncapVlan == 1203 + - nm_remove_static_ports_again.previous.14.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports_again.previous.14.portEncapVlan == 1209 + - nm_remove_static_ports_again.current | length == 15 + - nm_remove_static_ports_again.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_remove_static_ports_again.current.0.portEncapVlan == 1101 + - nm_remove_static_ports_again.current.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_remove_static_ports_again.current.2.portEncapVlan == 1105 + - nm_remove_static_ports_again.current.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports_again.current.4.portEncapVlan == 1109 + - nm_remove_static_ports_again.current.5.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_remove_static_ports_again.current.5.portEncapVlan == 1200 + - nm_remove_static_ports_again.current.8.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_remove_static_ports_again.current.8.portEncapVlan == 1203 + - nm_remove_static_ports_again.current.14.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports_again.current.14.portEncapVlan == 1209 + - nm_remove_static_ports_2 is changed + - nm_remove_static_ports_2.previous | length == 15 + - nm_remove_static_ports_2.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_remove_static_ports_2.previous.0.portEncapVlan == 1101 + - nm_remove_static_ports_2.previous.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_remove_static_ports_2.previous.2.portEncapVlan == 1105 + - nm_remove_static_ports_2.previous.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports_2.previous.4.portEncapVlan == 1109 + - nm_remove_static_ports_2.previous.5.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_remove_static_ports_2.previous.5.portEncapVlan == 1200 + - nm_remove_static_ports_2.previous.8.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_remove_static_ports_2.previous.8.portEncapVlan == 1203 + - nm_remove_static_ports_2.previous.14.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports_2.previous.14.portEncapVlan == 1209 + - nm_remove_static_ports_2.current | length == 10 + - nm_remove_static_ports_2.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_remove_static_ports_2.current.0.portEncapVlan == 1101 + - nm_remove_static_ports_2.current.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_remove_static_ports_2.current.2.portEncapVlan == 1105 + - nm_remove_static_ports_2.current.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_remove_static_ports_2.current.4.portEncapVlan == 1109 + - nm_remove_static_ports_2.current.5.path == "topology/pod-1/paths-101/pathep-[eth2/1]" + - nm_remove_static_ports_2.current.5.portEncapVlan == 1201 + - nm_remove_static_ports_2.current.7.path == "topology/pod-1/paths-101/pathep-[eth2/5]" + - nm_remove_static_ports_2.current.7.portEncapVlan == 1205 + - nm_remove_static_ports_2.current.9.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_remove_static_ports_2.current.9.portEncapVlan == 1209 + +# FORCE REPLACE TESTS + +- name: Force replace static ports with static ports (check_mode) + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + force_replace: true + register: cm_force_replace_provider_static_ports + check_mode: true + +- name: Force replace static ports with static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + force_replace: true + register: nm_force_replace_provider_static_ports + +- name: Force replace static ports with static ports again + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + force_replace: true + register: nm_force_replace_provider_static_ports_again + +- name: Force replace static ports with new static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + static_ports: "{{ static_ports_present_2 }}" + force_replace: true + register: nm_force_replace_new_static_ports + +- name: Verify force replacing static ports + ansible.builtin.assert: + that: + - cm_force_replace_provider_static_ports is changed + - cm_force_replace_provider_static_ports.previous | length == 10 + - cm_force_replace_provider_static_ports.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - cm_force_replace_provider_static_ports.previous.0.portEncapVlan == 1101 + - cm_force_replace_provider_static_ports.previous.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - cm_force_replace_provider_static_ports.previous.2.portEncapVlan == 1105 + - cm_force_replace_provider_static_ports.previous.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - cm_force_replace_provider_static_ports.previous.4.portEncapVlan == 1109 + - cm_force_replace_provider_static_ports.previous.5.path == "topology/pod-1/paths-101/pathep-[eth2/1]" + - cm_force_replace_provider_static_ports.previous.5.portEncapVlan == 1201 + - cm_force_replace_provider_static_ports.previous.7.path == "topology/pod-1/paths-101/pathep-[eth2/5]" + - cm_force_replace_provider_static_ports.previous.7.portEncapVlan == 1205 + - cm_force_replace_provider_static_ports.previous.9.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - cm_force_replace_provider_static_ports.previous.9.portEncapVlan == 1209 + - cm_force_replace_provider_static_ports.current | length == 10 + - cm_force_replace_provider_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - cm_force_replace_provider_static_ports.current.0.portEncapVlan == 1100 + - cm_force_replace_provider_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - cm_force_replace_provider_static_ports.current.3.portEncapVlan == 1103 + - cm_force_replace_provider_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - cm_force_replace_provider_static_ports.current.9.portEncapVlan == 1109 + - cm_force_replace_provider_static_ports.current | length == 10 + - nm_force_replace_provider_static_ports is changed + - nm_force_replace_provider_static_ports.previous | length == 10 + - nm_force_replace_provider_static_ports.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/1]" + - nm_force_replace_provider_static_ports.previous.0.portEncapVlan == 1101 + - nm_force_replace_provider_static_ports.previous.2.path == "topology/pod-1/paths-101/pathep-[eth1/5]" + - nm_force_replace_provider_static_ports.previous.2.portEncapVlan == 1105 + - nm_force_replace_provider_static_ports.previous.4.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_force_replace_provider_static_ports.previous.4.portEncapVlan == 1109 + - nm_force_replace_provider_static_ports.previous.5.path == "topology/pod-1/paths-101/pathep-[eth2/1]" + - nm_force_replace_provider_static_ports.previous.5.portEncapVlan == 1201 + - nm_force_replace_provider_static_ports.previous.7.path == "topology/pod-1/paths-101/pathep-[eth2/5]" + - nm_force_replace_provider_static_ports.previous.7.portEncapVlan == 1205 + - nm_force_replace_provider_static_ports.previous.9.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_force_replace_provider_static_ports.previous.9.portEncapVlan == 1209 + - nm_force_replace_provider_static_ports.current | length == 10 + - nm_force_replace_provider_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_force_replace_provider_static_ports.current.0.portEncapVlan == 1100 + - nm_force_replace_provider_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_force_replace_provider_static_ports.current.3.portEncapVlan == 1103 + - nm_force_replace_provider_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_force_replace_provider_static_ports.current.9.portEncapVlan == 1109 + - nm_force_replace_provider_static_ports_again is not changed + - nm_force_replace_provider_static_ports_again.previous | length == 10 + - nm_force_replace_provider_static_ports_again.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_force_replace_provider_static_ports_again.previous.0.portEncapVlan == 1100 + - nm_force_replace_provider_static_ports_again.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_force_replace_provider_static_ports_again.previous.3.portEncapVlan == 1103 + - nm_force_replace_provider_static_ports_again.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_force_replace_provider_static_ports_again.previous.9.portEncapVlan == 1109 + - nm_force_replace_provider_static_ports_again.current | length == 10 + - nm_force_replace_provider_static_ports_again.current.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_force_replace_provider_static_ports_again.current.0.portEncapVlan == 1100 + - nm_force_replace_provider_static_ports_again.current.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_force_replace_provider_static_ports_again.current.3.portEncapVlan == 1103 + - nm_force_replace_provider_static_ports_again.current.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_force_replace_provider_static_ports_again.current.9.portEncapVlan == 1109 + - nm_force_replace_new_static_ports.previous | length == 10 + - nm_force_replace_new_static_ports.previous.0.path == "topology/pod-1/paths-101/pathep-[eth1/0]" + - nm_force_replace_new_static_ports.previous.0.portEncapVlan == 1100 + - nm_force_replace_new_static_ports.previous.3.path == "topology/pod-1/paths-101/pathep-[eth1/3]" + - nm_force_replace_new_static_ports.previous.3.portEncapVlan == 1103 + - nm_force_replace_new_static_ports.previous.9.path == "topology/pod-1/paths-101/pathep-[eth1/9]" + - nm_force_replace_new_static_ports.previous.9.portEncapVlan == 1109 + - nm_force_replace_new_static_ports.current | length == 10 + - nm_force_replace_new_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_force_replace_new_static_ports.current.0.portEncapVlan == 1200 + - nm_force_replace_new_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_force_replace_new_static_ports.current.3.portEncapVlan == 1203 + - nm_force_replace_new_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_force_replace_new_static_ports.current.9.portEncapVlan == 1209 + +# QUERY TESTS FOR BULK + +- name: Query static ports + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + static_ports: "{{ static_ports_present_2 }}" + state: query + register: nm_query_static_ports + +- name: Create static ports without input (error) + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *anp_bulk + epg: epg_bulk + site: '{{ mso_site | default("ansible_test") }}' + state: present + register: err_present_static_ports + ignore_errors: true + +- name: Query static ports with non existing static ports (error) + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *static_ports_append + static_ports: + - leaf: 101 + pod: pod-1 + path: eth1/40 + type: port + vlan: 1100 + - leaf: 201 + pod: pod-1 + path: eth1/41 + type: port + vlan: 1101 + state: query + register: err_query_static_ports + ignore_errors: true + +- name: Verify queries for bulk + ansible.builtin.assert: + that: + - err_present_static_ports is failed + - err_present_static_ports.msg == "state is present or absent but all of the following are missing{{":"}} pod, leaf, path, vlan." + - nm_query_static_ports is not changed + - nm_query_static_ports.current | length == 10 + - nm_query_static_ports.current.0.path == "topology/pod-1/paths-101/pathep-[eth2/0]" + - nm_query_static_ports.current.0.portEncapVlan == 1200 + - nm_query_static_ports.current.3.path == "topology/pod-1/paths-101/pathep-[eth2/3]" + - nm_query_static_ports.current.3.portEncapVlan == 1203 + - nm_query_static_ports.current.9.path == "topology/pod-1/paths-101/pathep-[eth2/9]" + - nm_query_static_ports.current.9.portEncapVlan == 1209 + - err_query_static_ports is failed + - err_query_static_ports.msg.0 == "Provided Static Port Path 'topology/pod-1/paths-101/pathep-[eth2/0]' not found" + - err_query_static_ports.msg.1 == "Provided Static Port Path 'topology/pod-1/paths-101/pathep-[eth2/1]' not found" + +# FORCE REMOVE ALL CONTRACTS + +- name: Force remove all static ports + cisco.mso.mso_schema_site_anp_epg_staticport: &force_remove_all + <<: *anp_bulk + epg: epg_bulk + site: '{{ mso_site | default("ansible_test") }}' + force_replace: true + state: absent + register: force_remove_all_static_ports + +- name: Create new static ports without existing contracts + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *force_remove_all + static_ports: + - leaf: 101 + pod: pod-1 + path: eth1/40 + type: port + vlan: 1100 + state: present + register: force_remove_all_new_static + +- name: Force remove all static ports again + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *force_remove_all + +- name: Verify force remove all static ports + ansible.builtin.assert: + that: + - force_remove_all_static_ports is changed + - force_remove_all_static_ports.previous | length == 10 + - force_remove_all_static_ports.current == [] + - force_remove_all_new_static is changed + - force_remove_all_new_static.previous == [] + - force_remove_all_new_static.current | length == 1 + +# OVERWRITE ARGUMENTS + +- name: Overwrite static port arguments (error) + cisco.mso.mso_schema_site_anp_epg_staticport: &overwrite_static_ports + <<: *anp_bulk + epg: epg_bulk + site: '{{ mso_site | default("ansible_test") }}' + leaf: 201 + pod: pod-1 + static_ports: + - type: port + register: err_overwrite_static_ports + ignore_errors: true + +- name: Overwrite static other port arguments (error) + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *anp_bulk + epg: epg_bulk + site: '{{ mso_site | default("ansible_test") }}' + path: eth1/41 + vlan: 1101 + static_ports: + - type: port + register: err_overwrite_static_ports_other + ignore_errors: true + +- name: Overwrite static port arguments + cisco.mso.mso_schema_site_anp_epg_staticport: + <<: *overwrite_static_ports + path: eth1/41 + vlan: 1101 + register: overwrite_static_ports + ignore_errors: true + +- name: Verify overwrite static port arguments + ansible.builtin.assert: + that: + - err_overwrite_static_ports is failed + - err_overwrite_static_ports.msg == "state is present but all of the following are missing{{":"}} path, vlan." + - err_overwrite_static_ports_other is failed + - err_overwrite_static_ports_other.msg == "state is present but all of the following are missing{{":"}} pod, leaf." + - overwrite_static_ports is changed + - overwrite_static_ports.current.0.path == "topology/pod-1/paths-201/pathep-[eth1/41]" + - overwrite_static_ports.current.0.portEncapVlan == 1101 + - overwrite_static_ports.current.0.type == "port" + +# CLEAN UP TEST ENVIRONMENT + +- name: Remove schemas + cisco.mso.mso_schema: + <<: *mso_info + schema: ansible_test + state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_useg_attribute/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_useg_attribute/tasks/main.yml index 9ba4c846a..889d7e83d 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_useg_attribute/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_anp_epg_useg_attribute/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: "Please define the following variables: mso_hostname, mso_username and mso_password." when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: "{{ mso_hostname }}" username: "{{ mso_username }}" @@ -23,13 +23,13 @@ # Setup Part - name: Remove schemas - mso_schema: &ansible_test_schema_absent + cisco.mso.mso_schema: &ansible_test_schema_absent <<: *mso_info schema: ansible_test state: absent - name: Ensure ansible_test tenant absent - mso_tenant: &ansible_test_tenant_absent + cisco.mso.mso_tenant: &ansible_test_tenant_absent <<: *mso_info tenant: ansible_test users: @@ -37,12 +37,12 @@ state: absent - name: Ensure ansible_test tenant present - mso_tenant: &ansible_test_tenant_present + cisco.mso.mso_tenant: &ansible_test_tenant_present <<: *ansible_test_tenant_absent state: present - name: Ensure ansible_test schema with ans_test_template exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: ansible_test tenant: ansible_test @@ -50,7 +50,7 @@ state: present - name: Ensure ans_test_anp exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: ansible_test template: ans_test_template @@ -76,7 +76,7 @@ state: present - name: Ensure ans_test_epg exist - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: ansible_test template: ans_test_template @@ -90,7 +90,7 @@ state: present - name: Ensure ans_test_epg_2 exist without useg_epg - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: ansible_test template: ans_test_template @@ -103,14 +103,14 @@ state: present - name: Associate a ansible_test site with a ansible_test tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: ansible_test state: present - name: Ensure ansible_test site associated with ansible_test schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: ansible_test site: ansible_test @@ -118,7 +118,7 @@ state: present - name: Add ans_test_epg to the ansible_test site - mso_schema_site_anp_epg: + cisco.mso.mso_schema_site_anp_epg: <<: *mso_info site: ansible_test schema: ansible_test @@ -137,7 +137,7 @@ # Test Part # Note: Ignore the below task, which is used to reference the attributes to other tasks - name: Invalid test - check for missing required attributes error message - mso_schema_site_anp_epg_useg_attribute: &useg_attribute_present + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &useg_attribute_present <<: *mso_info schema: ansible_test template: ans_test_template @@ -150,7 +150,7 @@ register: ans_test_uSeg_1_nt - name: ans_test_uSeg_1 present - attribute_type - ip, useg_subnet - true, without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *mso_info site: ansible_test schema: ansible_test @@ -163,7 +163,7 @@ register: ans_test_uSeg_1 - name: Invalid test - ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_2 attribute_type: ip @@ -171,70 +171,83 @@ ignore_errors: true register: ans_test_uSeg_2_nt +- name: Invalid test - ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - true, with value + cisco.mso.mso_schema_site_anp_epg_useg_attribute: + <<: *useg_attribute_present + name: ans_test_uSeg_2 + attribute_type: ip + useg_subnet: true + value: 1.2.3.4 + ignore_errors: true + register: ans_test_uSeg_2_nt1 + - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - check mode - mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_2_cm_present + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_2_cm_present <<: *useg_attribute_present name: ans_test_uSeg_2 attribute_type: ip useg_subnet: false - value: 11.22.33.44/24 + value: 11.22.33.44 check_mode: true register: ans_test_uSeg_2_cm_present - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - normal mode - mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_2_nm_present + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_2_nm_present <<: *ans_test_uSeg_2_cm_present + output_level: debug register: ans_test_uSeg_2_nm_present - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - normal mode again - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *ans_test_uSeg_2_nm_present + output_level: debug register: ans_test_uSeg_2_nm_present_again - name: Assertions check for add ans_test_uSeg_1 and ans_test_uSeg_2 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_1 is changed - ans_test_uSeg_1.current != {} - ans_test_uSeg_1.current.name == "ans_test_uSeg_1" - ans_test_uSeg_1.current.type == "ip" - ans_test_uSeg_1.current.value == "0.0.0.0" - - ans_test_uSeg_1.current.fvSubnet == false + - ans_test_uSeg_1.current.fvSubnet == true - ans_test_uSeg_1.current.description == "ans_test_uSeg_1" - ans_test_uSeg_2_nt is not changed - ans_test_uSeg_2_nt.msg == "useg_subnet is False but all of the following are missing{{':'}} value" + - ans_test_uSeg_2_nt1 is not changed + - ans_test_uSeg_2_nt1.msg == "The value of uSeg subnet IP should be an empty string or 0.0.0.0, when the useg_subnet is set to true." - ans_test_uSeg_2_cm_present is changed - ans_test_uSeg_2_cm_present.current != {} - ans_test_uSeg_2_cm_present.previous == {} - ans_test_uSeg_2_cm_present.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_cm_present.current.type == "ip" - - ans_test_uSeg_2_cm_present.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_cm_present.current.fvSubnet == true + - ans_test_uSeg_2_cm_present.current.value == "11.22.33.44" + - ans_test_uSeg_2_cm_present.current.fvSubnet == false - ans_test_uSeg_2_cm_present.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present is changed - ans_test_uSeg_2_nm_present.current != {} - ans_test_uSeg_2_nm_present.previous == {} - ans_test_uSeg_2_nm_present.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present.current.type == "ip" - - ans_test_uSeg_2_nm_present.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present.current.fvSubnet == true + - ans_test_uSeg_2_nm_present.current.value == "11.22.33.44" + - ans_test_uSeg_2_nm_present.sent.fvSubnet == false - ans_test_uSeg_2_nm_present.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present_again is not changed - ans_test_uSeg_2_nm_present_again.current != {} - ans_test_uSeg_2_nm_present_again.previous != {} - ans_test_uSeg_2_nm_present_again.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present_again.current.type == "ip" - - ans_test_uSeg_2_nm_present_again.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present_again.current.fvSubnet == true + - ans_test_uSeg_2_nm_present_again.current.value == "11.22.33.44" + - ans_test_uSeg_2_nm_present_again.sent.fvSubnet == false - ans_test_uSeg_2_nm_present_again.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present_again.previous.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present_again.previous.type == "ip" - - ans_test_uSeg_2_nm_present_again.previous.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present_again.previous.fvSubnet == true + - ans_test_uSeg_2_nm_present_again.previous.value == "11.22.33.44" - ans_test_uSeg_2_nm_present_again.previous.description == "uSeg Attr object created using Ansible" - name: Invalid test - ans_test_uSeg_3 present - attribute_type - mac and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_3 attribute_type: mac @@ -242,7 +255,7 @@ register: ans_test_uSeg_3_nt - name: ans_test_uSeg_3 present - attribute_type - mac and with value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_3 attribute_type: mac @@ -250,7 +263,7 @@ register: ans_test_uSeg_3 - name: Assertions check for add ans_test_uSeg_3 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_3_nt is not changed - ans_test_uSeg_3_nt.msg == "Failed due to invalid 'value' and the attribute_type is{{':'}} mac." @@ -263,7 +276,7 @@ - ans_test_uSeg_3.current.value == "aa:bb:cc:dd:ee:ff" - name: Invalid test - ans_test_uSeg_4 present - attribute_type - dns and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_4 attribute_type: dns @@ -271,7 +284,7 @@ register: ans_test_uSeg_4_nt - name: ans_test_uSeg_4 present - attribute_type - dns and with value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_4 attribute_type: dns @@ -279,7 +292,7 @@ register: ans_test_uSeg_4 - name: Assertions check for add ans_test_uSeg_4 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_4_nt is not changed - ans_test_uSeg_4_nt.msg == "Failed due to invalid 'value' and the attribute_type is{{':'}} dns." @@ -292,7 +305,7 @@ - ans_test_uSeg_4.current.value == "test_dns_value" - name: Invalid test - ans_test_uSeg_6 present - attribute_type - vm_datacenter and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -301,7 +314,7 @@ register: ans_test_uSeg_6_nt - name: Invalid test - ans_test_uSeg_6 present - attribute_type - vm_datacenter, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -310,7 +323,7 @@ register: ans_test_uSeg_6_nt1 - name: ans_test_uSeg_6 present - attribute_type - vm_datacenter, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -319,7 +332,7 @@ register: ans_test_uSeg_6 - name: Assertions check for add ans_test_uSeg_6 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_6_nt is not changed - ans_test_uSeg_6_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_datacenter." @@ -334,7 +347,7 @@ - ans_test_uSeg_6.current.value == "test_vm_datacenter_value" - name: Invalid test - ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -343,7 +356,7 @@ register: ans_test_uSeg_7_nt - name: Invalid test - ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -352,7 +365,7 @@ register: ans_test_uSeg_7_nt1 - name: ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -361,7 +374,7 @@ register: ans_test_uSeg_7 - name: Assertions check for add ans_test_uSeg_7 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_7_nt is not changed - ans_test_uSeg_7_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_hypervisor_identifier." @@ -376,7 +389,7 @@ - ans_test_uSeg_7.current.value == "test_vm_hypervisor_identifier_value" - name: Invalid test - ans_test_uSeg_8 present - attribute_type - vm_operating_system and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -385,7 +398,7 @@ register: ans_test_uSeg_8_nt - name: Invalid test - ans_test_uSeg_8 present - attribute_type - vm_operating_system, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -394,7 +407,7 @@ register: ans_test_uSeg_8_nt1 - name: ans_test_uSeg_8 present - attribute_type - vm_operating_system, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -403,7 +416,7 @@ register: ans_test_uSeg_8 - name: Assertions check for add ans_test_uSeg_8 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_8_nt is not changed - ans_test_uSeg_8_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_operating_system." @@ -418,7 +431,7 @@ - ans_test_uSeg_8.current.value == "test_vm_operating_system_value" - name: Invalid test - ans_test_uSeg_9 present - attribute_type - vm_tag and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -427,7 +440,7 @@ register: ans_test_uSeg_9_nt - name: Invalid test - ans_test_uSeg_9 present - attribute_type - vm_tag, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -436,7 +449,7 @@ register: ans_test_uSeg_9_nt1 - name: ans_test_uSeg_9 present - attribute_type - vm_tag, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -445,7 +458,7 @@ register: ans_test_uSeg_9 - name: Assertions check for add ans_test_uSeg_9 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_9_nt is not changed - ans_test_uSeg_9_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_tag." @@ -460,7 +473,7 @@ - ans_test_uSeg_9.current.value == "test_vm_tag_value" - name: Invalid test - ans_test_uSeg_10 present - attribute_type - vm_identifier and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -469,7 +482,7 @@ register: ans_test_uSeg_10_nt - name: Invalid test - ans_test_uSeg_10 present - attribute_type - vm_identifier, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -478,7 +491,7 @@ register: ans_test_uSeg_10_nt1 - name: ans_test_uSeg_10 present - attribute_type - vm_identifier, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -487,7 +500,7 @@ register: ans_test_uSeg_10 - name: Assertions check for add ans_test_uSeg_10 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_10_nt is not changed - ans_test_uSeg_10_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_identifier." @@ -502,7 +515,7 @@ - ans_test_uSeg_10.current.value == "test_vm_identifier_value" - name: Invalid test - ans_test_uSeg_11 present - attribute_type - vmm_domain and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -511,7 +524,7 @@ register: ans_test_uSeg_11_nt - name: Invalid test - ans_test_uSeg_11 present - attribute_type - vmm_domain, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -520,7 +533,7 @@ register: ans_test_uSeg_11_nt1 - name: ans_test_uSeg_11 present - attribute_type - vmm_domain, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -529,7 +542,7 @@ register: ans_test_uSeg_11 - name: Assertions check for add ans_test_uSeg_11 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_11_nt is not changed - ans_test_uSeg_11_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vmm_domain." @@ -544,7 +557,7 @@ - ans_test_uSeg_11.current.value == "test_vmm_domain_value" - name: Invalid test - ans_test_uSeg_12 present - attribute_type - vm_name and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -553,7 +566,7 @@ register: ans_test_uSeg_12_nt - name: Invalid test - ans_test_uSeg_12 present - attribute_type - vm_name, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -562,7 +575,7 @@ register: ans_test_uSeg_12_nt1 - name: ans_test_uSeg_12 present - attribute_type - vm_name, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -571,7 +584,7 @@ register: ans_test_uSeg_12 - name: Assertions check for add ans_test_uSeg_12 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_12_nt is not changed - ans_test_uSeg_12_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_name." @@ -586,7 +599,7 @@ - ans_test_uSeg_12.current.value == "test_vm_value" - name: Invalid test - ans_test_uSeg_13 present - attribute_type - vnic_dn and without operator - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -595,7 +608,7 @@ register: ans_test_uSeg_13_nt - name: Invalid test - ans_test_uSeg_13 present - attribute_type - vnic_dn, operator - equals and without value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -604,7 +617,7 @@ register: ans_test_uSeg_13_nt1 - name: ans_test_uSeg_13 present - attribute_type - vnic_dn, operator - equals and value - mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_13_present + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_13_present <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -613,7 +626,7 @@ register: ans_test_uSeg_13 - name: Assertions check for add ans_test_uSeg_12 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_13_nt is not changed - ans_test_uSeg_13_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vnic_dn." @@ -629,7 +642,7 @@ # Query Part - name: Invalid test - Query an uSeg Attr with name - invalid_useg_attr - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: invalid_useg_attr state: query @@ -637,20 +650,20 @@ ignore_errors: true - name: Query an uSeg Attr with name - ans_test_uSeg_1 - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 state: query register: query_a_useg_6 - name: Query all uSeg Attrs - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present state: query register: query_all_useg_objects - name: Assertions check for query uSeg Attr objects - assert: + ansible.builtin.assert: that: - invalid_useg_attr is not changed - invalid_useg_attr.msg == "The uSeg Attribute{{':'}} invalid_useg_attr not found." @@ -664,21 +677,21 @@ # Update Part - name: Update ans_test_uSeg_13 object description and value - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *ans_test_uSeg_13_present description: "ans_test_uSeg_13 updated!" value: test_vnic_dn_value_updated register: ans_test_uSeg_13_update - name: Query an uSeg Attr with name - ans_test_uSeg_13 to check the updated changes - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 state: query register: query_a_useg_object_with_name - name: Assertions check for update ans_test_uSeg_13 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_13_update is changed - ans_test_uSeg_13_update.current != {} @@ -700,7 +713,7 @@ # Cleanup Part - name: ans_test_uSeg_1 absent with check mode - mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_1_cm_absent + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_1_cm_absent <<: *useg_attribute_present name: ans_test_uSeg_1 state: absent @@ -708,17 +721,17 @@ register: ans_test_uSeg_1_cm_absent - name: ans_test_uSeg_1 absent with normal mode - mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_1_nm_absent + cisco.mso.mso_schema_site_anp_epg_useg_attribute: &ans_test_uSeg_1_nm_absent <<: *ans_test_uSeg_1_cm_absent register: ans_test_uSeg_1_nm_absent - name: ans_test_uSeg_1 absent with normal mode again - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *ans_test_uSeg_1_nm_absent register: ans_test_uSeg_1_nm_absent_again - name: Assertions check for ans_test_uSeg_1 absent - assert: + ansible.builtin.assert: that: - ans_test_uSeg_1_cm_absent is changed - ans_test_uSeg_1_cm_absent.current == {} @@ -731,7 +744,7 @@ - ans_test_uSeg_1_nm_absent_again.previous == {} - name: Query all uSeg Attrs - invalid template name - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present template: ans_test_template_123 state: query @@ -739,7 +752,7 @@ register: query_invalid_template - name: Query all uSeg Attrs - invalid Application Profile name - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present anp: ans_test_anp_123 state: query @@ -747,7 +760,7 @@ register: query_invalid_ap - name: Query all uSeg Attrs - invalid EPG name - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present epg: ans_test_epg_123 state: query @@ -755,7 +768,7 @@ register: query_invalid_epg - name: Invalid test - ans_test_anp_123 present under ans_test_epg_2 - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present epg: ans_test_epg_2 name: ans_test_anp_123 @@ -765,7 +778,7 @@ register: ans_test_epg_2_nt - name: Assertions check for invalid inputs - assert: + ansible.builtin.assert: that: - query_invalid_template is not changed - query_invalid_template.msg is match("Provided template 'ans_test_template_123' not matching existing template.+") @@ -786,27 +799,25 @@ state: undeploy - name: Remove ansible_test schema to delete all uSeg Attr objects - mso_schema: + cisco.mso.mso_schema: <<: *ansible_test_schema_absent schema: ansible_test state: absent # To check all uSeg Attrs removed from the machine - name: Query all uSeg Attrs - Cleanup Part - mso_schema_site_anp_epg_useg_attribute: + cisco.mso.mso_schema_site_anp_epg_useg_attribute: <<: *useg_attribute_present state: query ignore_errors: true register: query_useg_absent_check - name: Assertions check for query all uSeg Attrs - Cleanup Part - assert: + ansible.builtin.assert: that: - query_useg_absent_check is not changed - query_useg_absent_check.current == {} - name: Remove ansible_test tenant - mso_tenant: - <<: *ansible_test_tenant_present - state: absent - <<: *mso_info + cisco.mso.mso_tenant: + <<: *ansible_test_tenant_absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd/tasks/main.yml index a7de528ea..c7770dfb6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd/tasks/main.yml @@ -7,13 +7,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,13 +24,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -42,7 +42,7 @@ ignore_errors: true - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -51,7 +51,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -62,7 +62,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -72,7 +72,7 @@ state: present - name: Ensure schema 1 with Template 1, and Template 2, Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -84,7 +84,7 @@ - { template: Template 3} - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -92,7 +92,7 @@ state: present - name: Add physical site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -103,7 +103,7 @@ - { template: Template 2} - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -112,7 +112,7 @@ state: present - name: Ensure ansible_test_1 BD does not exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -122,7 +122,7 @@ state: absent - name: Add template BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -133,7 +133,7 @@ register: nm_add_bd - name: Verify nm_add_bd - assert: + ansible.builtin.assert: that: - nm_add_bd is changed - nm_add_bd.previous == {} @@ -142,7 +142,7 @@ - nm_add_bd.current.vrfRef.vrfName == "VRF1" - name: Add template BD 2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -154,7 +154,7 @@ register: nm_add_bd_2 - name: Verify nm_add_bd_2 - assert: + ansible.builtin.assert: that: - nm_add_bd_2 is changed - nm_add_bd_2.previous == {} @@ -163,7 +163,7 @@ - nm_add_bd_2.current.vrfRef.vrfName == "VRF1" - name: Add template BD 3 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -175,7 +175,7 @@ register: nm_add_bd_3 - name: Verify nm_add_bd_3 - assert: + ansible.builtin.assert: that: - nm_add_bd_3 is changed - nm_add_bd_3.previous == {} @@ -184,7 +184,7 @@ - nm_add_bd_3.current.vrfRef.vrfName == "VRF1" - name: Add template BD 4 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -196,7 +196,7 @@ register: nm_add_bd_4 - name: Verify nm_add_bd_4 - assert: + ansible.builtin.assert: that: - nm_add_bd_4 is changed - nm_add_bd_4.previous == {} @@ -205,7 +205,7 @@ - nm_add_bd_4.current.vrfRef.vrfName == "VRF1" - name: Add site BD (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -216,21 +216,21 @@ register: cm_add_site_bd - name: Verify cm_add_site_bd - assert: + ansible.builtin.assert: that: - cm_add_site_bd.current.bdRef.bdName == "ansible_test_1" - cm_add_site_bd.current.bdRef.templateName == "Template1" - cm_add_site_bd.current.hostBasedRouting == false - name: Verify cm_add_site_bd - assert: + ansible.builtin.assert: that: - cm_add_site_bd is changed - cm_add_site_bd.previous == {} when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add site BD (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -240,7 +240,7 @@ register: nm_add_site_bd - name: Verify nm_add_site_bd - assert: + ansible.builtin.assert: that: - nm_add_site_bd.current.bdRef.bdName == "ansible_test_1" - nm_add_site_bd.current.bdRef.templateName == "Template1" @@ -248,14 +248,14 @@ - cm_add_site_bd.current.bdRef.schemaId == nm_add_site_bd.current.bdRef.schemaId - name: Verify nm_add_site_bd - assert: + ansible.builtin.assert: that: - nm_add_site_bd is changed - nm_add_site_bd.previous == {} when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add site BD again (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -266,7 +266,7 @@ register: cm_add_site_bd_again - name: Add site BD again (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -276,14 +276,14 @@ register: nm_add_site_bd_again - name: Verify cm_add_site_bd_again and nm_add_site_bd_again - assert: + ansible.builtin.assert: that: - cm_add_site_bd_again is not changed - nm_add_site_bd_again is not changed - cm_add_site_bd_again.previous.bdRef.bdName == nm_add_site_bd_again.previous.bdRef.bdName == cm_add_site_bd_again.current.bdRef.bdName == nm_add_site_bd_again.current.bdRef.bdName == "ansible_test_1" - name: Change site BD (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -295,7 +295,7 @@ register: cm_change_site_bd - name: Change site BD (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -306,7 +306,7 @@ register: nm_change_site_bd - name: Verify cm_change_site_bd and nm_change_site_bd - assert: + ansible.builtin.assert: that: - cm_change_site_bd is changed - nm_change_site_bd is changed @@ -318,7 +318,7 @@ - nm_change_site_bd.current.hostBasedRouting == true - name: Add site BD with host_route (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -330,7 +330,7 @@ register: cm_add_site_bd_with_host_route - name: Add site BD with host_route (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -341,7 +341,7 @@ register: nm_add_site_bd_with_host_route - name: Verify cm_add_site_bd_with_host_route and nm_add_site_bd_with_host_route - assert: + ansible.builtin.assert: that: - cm_add_site_bd_with_host_route is changed - nm_add_site_bd_with_host_route is changed @@ -349,14 +349,14 @@ - nm_add_site_bd_with_host_route.current.hostBasedRouting == true - name: Verify cm_add_site_bd_with_host_route and nm_add_site_bd_with_host_route - assert: + ansible.builtin.assert: that: - cm_add_site_bd_with_host_route.previous == {} - nm_add_site_bd_with_host_route.previous == {} when: version.current.version is version('4.0', '<') # already present when template is defined, thus previous exists - name: Add site BD 3 (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -367,7 +367,7 @@ register: nm_add_site_bd_3 - name: Verify nm_add_site_bd_3 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_3 is changed - nm_add_site_bd_3.current.hostBasedRouting == true @@ -375,13 +375,13 @@ - nm_add_site_bd_3.current.bdRef.templateName == "Template1" - name: Verify nm_add_site_bd_3 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_3.previous == {} when: version.current.version is version('4.0', '<') # already be present when template is defined, thus previous exists - name: Add site BD 4 (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -392,7 +392,7 @@ register: nm_add_site_bd_4 - name: Verify nm_add_site_bd_4 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_4 is changed - nm_add_site_bd_4.current.mac == "00:22:23:F1:21:F9" @@ -400,13 +400,13 @@ - nm_add_site_bd_4.current.bdRef.templateName == "Template1" - name: Verify nm_add_site_bd_4 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_4.previous == {} when: version.current.version is version('4.0', '<') # already be present when template is defined, thus previous exists - name: Query a specific BD (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -417,7 +417,7 @@ register: cm_query_bd_2 - name: Query a specific BD (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -427,7 +427,7 @@ register: nm_query_bd_2 - name: Verify cm_query_bd_2 and nm_query_bd_2 - assert: + ansible.builtin.assert: that: - cm_query_bd_2 is not changed - nm_query_bd_2 is not changed @@ -437,7 +437,7 @@ - cm_query_bd_2.current.hostBasedRouting == nm_query_bd_2.current.hostBasedRouting == true - name: Query all BDs (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -447,7 +447,7 @@ register: cm_query_all_bd - name: Query all BDs (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -456,7 +456,7 @@ register: nm_query_all_bd - name: Verify cm_query_all_bd and cm_query_all_bd - assert: + ansible.builtin.assert: that: - cm_query_all_bd is not changed - nm_query_all_bd is not changed @@ -468,7 +468,7 @@ - cm_query_all_bd.current[1].bdRef.templateName == nm_query_all_bd.current[1].bdRef.templateName == "Template1" - name: Remove BD 2 (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -479,7 +479,7 @@ register: cm_remove_site_bd_2 - name: Remove BD 2 (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -489,7 +489,7 @@ register: nm_remove_site_bd_2 - name: Verify cm_remove_site_bd_2 and nm_remove_site_bd_2 - assert: + ansible.builtin.assert: that: - cm_remove_site_bd_2 is changed - nm_remove_site_bd_2 is changed @@ -499,7 +499,7 @@ - cm_remove_site_bd_2.current == nm_remove_site_bd_2.current == {} - name: Remove BD 2 again(normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -509,14 +509,14 @@ register: nm_remove_site_bd_2_again - name: Verify nm_remove_site_bd_2_again - assert: + ansible.builtin.assert: that: - nm_remove_site_bd_2_again is not changed - nm_remove_site_bd_2_again.previous == nm_remove_site_bd_2_again.current == {} when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Query site without BD (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -525,7 +525,7 @@ register: nm_query_without_bd - name: Verify nm_query_without_bd - assert: + ansible.builtin.assert: that: - nm_query_without_bd is not changed - nm_query_without_bd.current == [] @@ -534,7 +534,7 @@ # QUERY NON-EXISTING BD - name: Query non-existing BD (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -546,7 +546,7 @@ register: cm_query_non_bd - name: Query non-existing BD (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -557,7 +557,7 @@ register: nm_query_non_bd - name: Verify cm_query_non_bd and nm_query_non_bd - assert: + ansible.builtin.assert: that: - cm_query_non_bd is not changed - nm_query_non_bd is not changed @@ -565,7 +565,7 @@ # USE NON-EXISTING STATE - name: non_existing_state state (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -576,7 +576,7 @@ register: cm_non_existing_state - name: non_existing_state state (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -587,7 +587,7 @@ register: nm_non_existing_state - name: Verify cm_non_existing_state and nm_non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -595,7 +595,7 @@ # USE A NON_EXISTING_TEMPLATE - name: non_existing_template (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -607,7 +607,7 @@ register: cm_non_existing_template - name: non_existing_template (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -618,7 +618,7 @@ register: nm_non_existing_template - name: Verify cm_non_existing_template and nm_non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -626,7 +626,7 @@ # USE A NON_EXISTING_SCHEMA - name: non_existing_schema (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -638,7 +638,7 @@ register: cm_non_existing_schema - name: non_existing_schema (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -649,7 +649,7 @@ register: nm_non_existing_schema - name: Verify cm_non_existing_schema and nm_non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -657,7 +657,7 @@ # USE A NON_EXISTING_SITE - name: non_existing_site (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non_existing_site @@ -669,7 +669,7 @@ register: cm_non_existing_site - name: non_existing_site (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non_existing_site @@ -680,7 +680,7 @@ register: nm_non_existing_site - name: Verify cm_non_existing_site and nm_non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -688,7 +688,7 @@ # USE A NON_EXISTING_SITE_TEMPLATE - name: non_existing_site_template (check_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -700,7 +700,7 @@ register: cm_non_existing_site_template - name: non_existing_site_template (normal_mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -711,7 +711,7 @@ register: nm_non_existing_site_template - name: Verify cm_non_existing_site_template and nm_non_existing_site_template - assert: + ansible.builtin.assert: that: - cm_non_existing_site_template is not changed - nm_non_existing_site_template is not changed @@ -719,7 +719,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site BD to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -731,7 +731,7 @@ register: cm_no_site_associated - name: Add site BD to Template 3 without any site associated (normal mode) - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -742,7 +742,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml index 1e1914522..aaaf61b2f 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -38,7 +38,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -49,7 +49,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -60,7 +60,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -70,7 +70,7 @@ state: present - name: Ensure schema with Template1 and Template2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -81,7 +81,7 @@ - { template: Template2} - name: Ensure schema 2 with Template3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -89,7 +89,7 @@ state: present - name: Add physical site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -97,7 +97,7 @@ state: present - name: Add physical site to a schema2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -105,7 +105,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -113,7 +113,7 @@ state: present - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -121,7 +121,7 @@ state: present - name: Ensure VRF3 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -129,7 +129,7 @@ state: present - name: Add template BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -140,7 +140,7 @@ register: nm_add_bd - name: Verify nm_add_bd - assert: + ansible.builtin.assert: that: - nm_add_bd is changed - nm_add_bd.previous == {} @@ -149,7 +149,7 @@ - nm_add_bd.current.vrfRef.vrfName == "VRF1" - name: Add a new L3out - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -160,7 +160,7 @@ register: nm_add_l3out - name: Add a new L3out2 in different template - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -171,7 +171,7 @@ register: nm_add_l3out - name: Add a new L3out3 in different schema - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -182,13 +182,13 @@ register: nm_add_l3out - name: Verify nm_add_l3out - assert: + ansible.builtin.assert: that: - nm_add_l3out is changed - nm_add_l3out.previous == {} - name: Add BD to site - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -198,21 +198,21 @@ register: nm_add_site_bd - name: Verify nm_add_site_bd - assert: + ansible.builtin.assert: that: - nm_add_site_bd.current.bdRef.bdName == "ansible_test_1" - nm_add_site_bd.current.bdRef.templateName == "Template1" - nm_add_site_bd.current.hostBasedRouting == false - name: Verify nm_add_site_bd - assert: + ansible.builtin.assert: that: - nm_add_site_bd is changed - nm_add_site_bd.previous == {} when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined - name: Add l3out to BD Site - mso_schema_site_bd_l3out: &site_bd_l3out_again + cisco.mso.mso_schema_site_bd_l3out: &site_bd_l3out_again <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -224,12 +224,12 @@ register: nm_bd_site_l3out - name: Add l3out to BD Site again - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *site_bd_l3out_again register: nm_bd_site_l3out_again - name: Verify nm_bd_site_l3out - assert: + ansible.builtin.assert: that: - nm_bd_site_l3out is changed - nm_bd_site_l3out.previous == {} @@ -237,7 +237,7 @@ - nm_bd_site_l3out_again is not changed - name: Query a specific BD site l3out - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -249,13 +249,13 @@ register: query_result - name: Verify query_result - assert: + ansible.builtin.assert: that: - query_result is not changed - nm_bd_site_l3out.current.l3outName == "L3out1" - name: Add l3out2 from different template to BD Site - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -268,7 +268,7 @@ register: nm_bd_site_l3out2 - name: Add l3out3 from different schema to BD Site - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -282,7 +282,7 @@ register: nm_bd_site_l3out3 - name: Verify nm_bd_site_l3out2 and nm_bd_site_l3out3 - assert: + ansible.builtin.assert: that: - nm_bd_site_l3out2 is changed - nm_bd_site_l3out2.previous == {} @@ -292,7 +292,7 @@ - nm_bd_site_l3out3.current.l3outName == "L3out3" - name: Query all BD site l3outs - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -302,7 +302,7 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all.current.0.l3outName == "L3out1" @@ -311,7 +311,7 @@ # Checking error conditions - name: Use non_existing template - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -324,7 +324,7 @@ register: non_existing_template - name: Use non_existing BD - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -335,7 +335,7 @@ register: non_existing_bd - name: Query non_existing BD site L3out - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -348,7 +348,7 @@ register: non_existing_l3out - name: Verify error query - assert: + ansible.builtin.assert: that: - non_existing_template is not changed - non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{':'}} Template1, Template2" @@ -359,7 +359,7 @@ # Check addition of l3out to Site BD without adding BD to site - name: Remove l3out from BD Site - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -371,14 +371,14 @@ register: remove_bd_site_l3out - name: Verify remove_bd_site_l3out - assert: + ansible.builtin.assert: that: - remove_bd_site_l3out is changed - remove_bd_site_l3out.previous.l3outName == "L3out1" - remove_bd_site_l3out.current == {} - name: Remove BD from site - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -388,7 +388,7 @@ register: nm_remove_site_bd - name: Verify nm_remove_site_bd - assert: + ansible.builtin.assert: that: - nm_remove_site_bd is changed - nm_remove_site_bd.previous.bdRef.bdName == "ansible_test_1" @@ -396,7 +396,7 @@ - nm_remove_site_bd.current == {} - name: Remove template BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -405,13 +405,13 @@ register: nm_remove_bd - name: Verify nm_remove_bd - assert: + ansible.builtin.assert: that: - nm_remove_bd is changed - nm_remove_bd.current == {} - name: Add new template BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -422,13 +422,13 @@ register: nm_add_bd_template - name: Verify nm_add_bd_template - assert: + ansible.builtin.assert: that: - nm_add_bd_template is changed - nm_add_bd_template.previous == {} - name: Add a new l3 out to BD (BD not associated to Site) - mso_schema_site_bd_l3out: + cisco.mso.mso_schema_site_bd_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -440,7 +440,7 @@ register: add_bd_site_l3out - name: Verify add_bd_site_l3out - assert: + ansible.builtin.assert: that: - add_bd_site_l3out is changed - add_bd_site_l3out.previous == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml index 1f6f94c02..9da901308 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,13 +21,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -36,7 +36,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -47,7 +47,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -58,7 +58,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -68,7 +68,7 @@ state: present - name: Ensure schema 1 with Template1, Template2, Template4 and Template5 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -81,7 +81,7 @@ - Template5 - name: Ensure schema 2 with Template3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -89,7 +89,7 @@ state: present - name: Add physical site to templates - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -101,7 +101,7 @@ - Template5 - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -110,7 +110,7 @@ state: present - name: Add template BD to Template1 for create in site subnet - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -123,7 +123,7 @@ state: present - name: Add template BD to Template3 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -136,7 +136,7 @@ register: nm_add_bd_template_3 - name: Add template BD to Template2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -149,7 +149,7 @@ register: nm_add_bd_template_2 - name: Add template BD to Template4 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template4 @@ -162,7 +162,7 @@ register: nm_add_bd_template_4 - name: Add template BD to Template1 without disabling layer2_stretch - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -173,7 +173,7 @@ register: nm_add_bd - name: Add site BD - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -183,7 +183,7 @@ register: nm_add_site_bd - name: Add site BD subnet with layer2_stretch enabled - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -195,12 +195,12 @@ register: add_site_bd_subnet_with_l2Stretch_enabled - name: Verify add_site_bd_subnet_with_l2Stretch_enabled - assert: + ansible.builtin.assert: that: - add_site_bd_subnet_with_l2Stretch_enabled.msg == "The l2Stretch of template bd should be false in order to create a site bd subnet. Set l2Stretch as false using mso_schema_template_bd" - name: Disable layer2_stretch in template BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -212,7 +212,7 @@ register: nm_add_bd - name: Add site BD subnet with layer2_stretch disabled (check_mode) - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -224,7 +224,7 @@ register: cm_add_site_bd_subnet - name: Verify cm_add_site_bd_subnet - assert: + ansible.builtin.assert: that: - cm_add_site_bd_subnet is changed - cm_add_site_bd_subnet.previous == {} @@ -236,7 +236,7 @@ - cm_add_site_bd_subnet.current.querier == False - name: Add site BD subnet with layer2_stretch disabled (normal_mode) - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -247,7 +247,7 @@ register: nm_add_site_bd_subnet - name: Verify nm_add_site_bd_subnet - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet is changed - nm_add_site_bd_subnet.previous == {} @@ -259,7 +259,7 @@ - nm_add_site_bd_subnet.current.querier == False - name: Add site BD subnet again - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -270,12 +270,12 @@ register: nm_add_site_bd_subnet_again - name: Verify nm_add_site_bd_subnet_again - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet_again is not changed - name: Add another site BD subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -291,7 +291,7 @@ register: nm_add_another_site_bd_subnet - name: Verify nm_add_another_site_bd_subnet - assert: + ansible.builtin.assert: that: - nm_add_another_site_bd_subnet is changed - nm_add_another_site_bd_subnet.previous == {} @@ -302,7 +302,7 @@ - nm_add_another_site_bd_subnet.current.querier == true - name: Add BD ansible_test_5 to Schema1, template5 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template5 @@ -315,7 +315,7 @@ state: present - name: Add site BD5 - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -324,7 +324,7 @@ state: present - name: Add site BD5 subnet with layer2_stretch disabled (normal_mode) - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -341,7 +341,7 @@ register: nm_add_site_bd_subnet5 - name: Verify nm_add_site_bd_subnet5 for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet5 is changed - nm_add_site_bd_subnet5.previous == {} @@ -354,7 +354,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_add_site_bd_subnet5 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet5 is changed - nm_add_site_bd_subnet5.previous == {} @@ -368,13 +368,13 @@ when: version.current.version is version('3.1.1g', '>=') - name: Verify nm_add_site_bd_subnet5 for a version that's >= 3.1.1h - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet5.current.primary == True when: version.current.version is version('3.1.1h', '>=') - name: Add site BD subnet with non existing site bd (normal_mode) - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -385,7 +385,7 @@ register: nm_add_site_bd_subnet_and_site_bd - name: Verify nm_add_site_bd_subnet_and_site_bd - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet_and_site_bd is changed - nm_add_site_bd_subnet_and_site_bd.previous == {} @@ -397,7 +397,7 @@ - nm_add_site_bd_subnet_and_site_bd.current.querier == False - name: Query site bd - mso_schema_site_bd: + cisco.mso.mso_schema_site_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -407,12 +407,12 @@ register: query_site_bd - name: Verify query_site_bd - assert: + ansible.builtin.assert: that: - query_site_bd.current.bdRef.bdName == "ansible_test_site_bd_from_subnet" - name: Add site BD subnet with now existing site bd again (normal_mode) - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -423,12 +423,12 @@ register: nm_add_site_bd_subnet_and_site_bd_again - name: Verify nm_add_site_bd_subnet_and_site_bd_again - assert: + ansible.builtin.assert: that: - nm_add_site_bd_subnet_and_site_bd_again is not changed - name: Query all subnets - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -438,7 +438,7 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all.current | length == 2 @@ -446,7 +446,7 @@ - query_all.current.1.ip == "10.10.10.1/16" - name: Query a specific site BD subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -457,13 +457,13 @@ register: query_subnet - name: Verify query_subnet - assert: + ansible.builtin.assert: that: - query_subnet is not changed - query_subnet.current.ip == "10.1.0.1/16" - name: Query a specific site BD5 subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -474,14 +474,14 @@ register: query_subnet5 - name: Verify query_subnet5 for version before 3.1 - assert: + ansible.builtin.assert: that: - query_subnet5 is not changed - query_subnet5.current.ip == "10.1.0.5/16" when: version.current.version is version('3.1.1g', '<') - name: Verify query_subnet5 for 3.1 version and later - assert: + ansible.builtin.assert: that: - query_subnet5 is not changed - query_subnet5.current.ip == "10.1.0.5/16" @@ -489,13 +489,13 @@ when: version.current.version is version('3.1.1g', '>=') - name: Verify query_subnet5 for 3.1.1h version and later - assert: + ansible.builtin.assert: that: - query_subnet5.current.primary == true when: version.current.version is version('3.1.1h', '>=') - name: Remove a site BD subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -506,14 +506,14 @@ register: rm_subnet - name: Verify rm_subnet - assert: + ansible.builtin.assert: that: - rm_subnet is changed - rm_subnet.current == {} - rm_subnet.previous.ip == "10.1.0.1/16" - name: Remove the site BD subnet again - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -524,13 +524,13 @@ register: rm_subnet_again - name: Verify rm_subnet_again - assert: + ansible.builtin.assert: that: - rm_subnet_again is not changed - rm_subnet_again.previous == rm_subnet_again.current == {} - name: Remove a site BD 5 subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -541,7 +541,7 @@ register: rm_subnet5 - name: Verify rm_subnet5 - assert: + ansible.builtin.assert: that: - rm_subnet5 is changed - rm_subnet5.current == {} @@ -549,7 +549,7 @@ # Use non_existing_schema - name: Query subnet by non_existing_schema - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -561,13 +561,13 @@ register: non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." # Use non_existing_template - name: Query subnet by non_existing_template - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -579,13 +579,13 @@ register: non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{':'}} Template1, Template2, Template4, Template5" # Use non_existing_template_bd - name: Query subnet by non_existing_template_bd - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -597,13 +597,13 @@ register: non_existing_template_bd - name: Verify non_existing_template_bd - assert: + ansible.builtin.assert: that: - non_existing_template_bd.msg == "Provided BD 'non_existing_template_bd' not matching existing bd(s){{':'}} ansible_test_site_bd_from_subnet, ansible_test_1" # Use template without site associated - name: Query with no site associated to template - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -615,13 +615,13 @@ register: template_without_sites - name: Verify template_without_sites - assert: + ansible.builtin.assert: that: - template_without_sites.msg == "No sites associated with schema 'ansible_test_2'. Associate the site with the schema using (M) mso_schema_site." # Use non_existing_subnet - name: Query with non_existing_subnet - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -633,13 +633,13 @@ register: non_existing_subnet - name: Verify non_existing_subnet - assert: + ansible.builtin.assert: that: - non_existing_subnet.msg.startswith("Provided subnet 'non_existing_subnet' not matching existing site bd subnet(s){{':'}}") # Use non_existing_site_template_association - name: Query with non_existing_site_template_association - mso_schema_site_bd_subnet: + cisco.mso.mso_schema_site_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -651,12 +651,12 @@ register: non_existing_site_template_association - name: Verify non_existing_site_template_association - assert: + ansible.builtin.assert: that: - non_existing_site_template_association.msg == "Provided site 'ansible_test' not associated with template 'Template4'. Site is currently associated with template(s){{':'}} Template1, Template2, Template5" - name: Remove schemas for next ci test case - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/aliases b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/aliases new file mode 100644 index 000000000..5042c9c09 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/aliases @@ -0,0 +1,2 @@ +# No ACI MultiSite infrastructure, so not enabled +# unsupported diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml new file mode 100644 index 000000000..e7bacfa91 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml @@ -0,0 +1,312 @@ +# Test code for the MSO modules +# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> + +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) + +- name: Test that we have an ACI MultiSite host, username and password + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." + when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined + +# CLEAN ENVIRONMENT +- name: Set vars + ansible.builtin.set_fact: + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" + output_level: '{{ mso_output_level | default("info") }}' + +- name: Query system information + cisco.aci.aci_system: + <<: *aci_info + id: 1 + state: query + register: aci_version + +- name: Remove an existing tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Add a tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: '{{ mso_tenant | default("ansible_test") }}' + +# Site type checking for L4-L7 Device configuration +# QUERY OBJECTS +- name: Query cloud provider object + cisco.aci.aci_cloud_provider: + <<: *aci_info + state: query + register: query_cloud + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '>=') + +- name: Set vars + ansible.builtin.set_fact: + query_cloud: + current: [] + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '<') + +- name: Verify query_cloud for all sites + ansible.builtin.assert: + that: + - query_cloud is not changed + +- name: Verify query_cloud for Cloud Sites + ansible.builtin.assert: + that: + - query_cloud is not changed + - query_cloud.current.0.cloudProvP.attributes.environment == "public-cloud" + - '"vendor" in query_cloud.current.0.cloudProvP.attributes' + when: + - query_cloud.current | length > 0 # This condition will execute only cloud sites + +# Cloud Site block +- name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Add azure_vrf to the {{ mso_tenant | default("ansible_test") }} + cisco.aci.aci_vrf: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + vrf: azure_vrf + + - name: Add azure_ctxprof to the {{ mso_tenant | default("ansible_test") }} + cisco.aci.aci_cloud_ctx_profile: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + cloud: azure + name: azure_ctxprof + vrf: azure_vrf + region: westus2 + primary_cidr: "1.1.1.2/32" + state: present + + - name: Add the subnet to the azure_ctxprof + cisco.aci.aci_rest: + <<: *aci_info + path: api/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32].json + method: post + content: + cloudSubnet: + attributes: + ip: 1.1.1.2/32 + name: azure_ctxprof_cidr + children: + - cloudRsZoneAttach: + attributes: + tDn: "uni/clouddomp/provp-azure/region-westus2/zone-default" + + - name: Add the {{ mso_tenant | default("ansible_test") }}_adc device - ThirdParty_LB + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/cld-{{ mso_tenant | default("ansible_test") }}_adc.json + method: post + content: + cloudLDev: + attributes: + targetMode: unspecified + name: '{{ mso_tenant | default("ansible_test") }}_adc' + svcType: ADC + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-{{ mso_tenant | default("ansible_test") }}/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_LB_Inf + children: + - cloudEPSelector: + attributes: + name: TP_LB_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_firewall1 device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/cld-{{ mso_tenant | default("ansible_test") }}_firewall1.json + method: post + content: + cloudLDev: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_firewall1' + svcType: FW + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-{{ mso_tenant | default("ansible_test") }}/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_FW_Inf1 + children: + - cloudEPSelector: + attributes: + name: TP_FW_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_firewall2 device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/cld-{{ mso_tenant | default("ansible_test") }}_firewall2.json + method: post + content: + cloudLDev: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_firewall2' + svcType: FW + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-{{ mso_tenant | default("ansible_test") }}/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_FW_Inf2 + children: + - cloudEPSelector: + attributes: + name: TP_FW_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_other device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_other.json + method: post + content: + cloudLB: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_other' + type: network + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: 'uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_app_lb device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_app_lb.json + method: post + content: + cloudLB: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_app_lb' + type: application + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: 'uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]' + +- name: Execute tasks only for non-cloud sites + when: query_cloud.current | length == 0 # Non-Cloud Site block + block: + - name: Remove the redirect_policy2 from the common tenant - setup part + cisco.aci.aci_rest: + <<: *aci_info + path: "/api/node/mo/uni/tn-common/svcCont.json" + method: post + content: + vnsSvcRedirectPol: + attributes: + name: redirect_policy2 + status: deleted + + - name: Remove ansible_tenant from the APIC - setup part + cisco.aci.aci_tenant: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent + + - name: Add ansible_tenant to the APIC + cisco.aci.aci_tenant: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: present + + - name: Add devices and cluster interfaces to the ansible_tenant + cisco.aci.aci_rest: + <<: *aci_info + path: "/api/node/mo/uni/tn-{{ item.tenant }}.json" + method: post + content: + vnsLDevVip: + attributes: + svcType: "{{ item.type }}" + managed: "false" + name: "{{ item.name }}" + children: + - vnsCDev: + attributes: + name: "{{ item.name }}" + children: + - vnsCIf: + attributes: + name: "{{ item.concrete_interface }}" + children: + - vnsRsCIfPathAtt: + attributes: + tDn: "topology/pod-1/paths-101/pathep-[eth1/1]" + - vnsLIf: + attributes: + name: "{{ item.cluster_interface }}" + children: + - vnsRsCIfAttN: + attributes: + tDn: "uni/tn-{{ item.tenant }}/lDevVip-{{ item.name }}/cDev-{{ item.name }}/cIf-[{{ item.concrete_interface }}]" + - vnsLIf: + attributes: + name: "{{ item.cluster_interface }}_2" + children: + - vnsRsCIfAttN: + attributes: + tDn: "uni/tn-{{ item.tenant }}/lDevVip-{{ item.name }}/cDev-{{ item.name }}/cIf-[{{ item.concrete_interface }}]" + + loop: + - { + tenant: '{{ mso_tenant | default("ansible_test") }}', + type: FW, + name: ansible_tenant_firewall1, + cluster_interface: clu_if1, + concrete_interface: cn_if1, + } + - { + tenant: '{{ mso_tenant | default("ansible_test") }}', + type: ADC, + name: ansible_tenant_adc, + cluster_interface: clu_if3, + concrete_interface: cn_if3, + } + - { + tenant: '{{ mso_tenant | default("ansible_test") }}', + type: OTHERS, + name: ansible_tenant_other, + cluster_interface: clu_if4, + concrete_interface: cn_if4, + } + + - name: Add redirect policies to the common and ansible_tenant tenants + cisco.aci.aci_rest: + <<: *aci_info + path: "/api/node/mo/uni/tn-{{ item.tenant }}/svcCont.json" + method: post + content: + vnsSvcRedirectPol: + attributes: + name: "{{ item.name }}" + loop: + - { + tenant: '{{ mso_tenant | default("ansible_test") }}', + name: redirect_policy1, + } + - { tenant: common, name: redirect_policy2 } diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml new file mode 100644 index 000000000..ebee2fb2a --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml @@ -0,0 +1,935 @@ +# Test code for the MSO modules +# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> + +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) + +- name: Test that we have an ACI MultiSite host, username and password + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." + when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined + +# CLEAN ENVIRONMENT +- name: Set vars + ansible.builtin.set_fact: + mso_info: &mso_info + host: "{{ mso_hostname }}" + username: "{{ mso_username }}" + password: "{{ mso_password }}" + validate_certs: "{{ mso_validate_certs | default(false) }}" + use_ssl: "{{ mso_use_ssl | default(true) }}" + use_proxy: "{{ mso_use_proxy | default(false) }}" + output_level: '{{ mso_output_level | default("info") }}' + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" + output_level: '{{ mso_output_level | default("info") }}' + +# Setup part begins +- name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + +- name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + +- name: Include tasks for L4-L7 devices + ansible.builtin.include_tasks: l4_l7_devices.yml + +- name: Set ansible_network_os to cisco.nd.nd and ansible_connection to ansible.netcommon.httpapi + ansible.builtin.set_fact: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: cisco.nd.nd + +- name: Reset the ansible_connection to access the MSO/NDO + ansible.builtin.meta: reset_connection + +- name: Remove ansible_schema to start the test - setup part + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + state: absent + +- name: Remove {{ mso_tenant | default("ansible_test") }} tenant to start the test - setup part + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Add {{ mso_tenant | default("ansible_test") }} tenant + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + users: ["{{ mso_username }}"] + state: present + +- name: Associate Azure site with '{{ mso_tenant | default("ansible_test") }}' + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + site: ansible_test + state: present + when: + - query_cloud.current | length == 0 + +- name: Associate Azure site with '{{ mso_tenant | default("ansible_test") }}' # Azure Task + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + site: azure_ansible_test_2 + cloud_account: "uni/tn-{{ mso_tenant | default('ansible_test') }}/act-[{{ azure_cloud_account | default(123) }}]-vendor-azure" + state: present + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + +- name: Ensure ansible_schema with ansible_template1 and ansible_template2 exist + cisco.mso.mso_schema_template: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + template: "{{ item }}" + state: present + loop: + - "ansible_template1" + - "ansible_template2" + +- name: Create ansible_service_graph schema template service graph + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + service_graph: "ansible_service_graph" + display_name: "ansible_service_graph" + service_nodes: + - type: firewall + - type: load-balancer + - type: other + filter_after_first_node: allow_all + state: present + +- name: Bind ansible_test site with ansible_template1 and ansible_template2 + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "{{ item }}" + site: '{{ mso_site | default("ansible_test") }}' + state: present + loop: + - "ansible_template1" + - "ansible_template2" + +- name: Configure the site service graph ansible_service_graph + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + service_graph: "ansible_service_graph" + site: '{{ mso_site | default("ansible_test") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + devices: + - name: '{{ mso_tenant | default("ansible_test") }}_firewall1' + - name: '{{ mso_tenant | default("ansible_test") }}_adc' + - name: '{{ mso_tenant | default("ansible_test") }}_other' + state: present + +- name: Add Filter1 to ansible_template1 + cisco.mso.mso_schema_template_filter_entry: &filter_present + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + filter: Filter1 + entry: Filter1Entry + state: present + +- name: Add Filter2 to ansible_template1 + cisco.mso.mso_schema_template_filter_entry: + <<: *filter_present + filter: Filter2 + entry: Filter2Entry + state: present + +- name: Add Contracts to the ansible_template1 + cisco.mso.mso_schema_template_contract_filter: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + contract: "{{ item }}" + filter: Filter1 + state: present + loop: + - Contract1 + - Contract2 + - Contract3 + +- name: Add a VRF1 to ansible_template1 + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + vrf: VRF1 + state: present + +- name: Add a VRF2 to ansible_template1 + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + vrf: VRF2 + state: present + +- name: Add BD1 to ansible_template1 + cisco.mso.mso_schema_template_bd: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + bd: BD1 + vrf: + name: VRF1 + state: present + +- name: Add BD2 to ansible_template1 + cisco.mso.mso_schema_template_bd: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + bd: BD2 + vrf: + name: VRF2 + state: present + +- name: Add AP1 to ansible_template1 + cisco.mso.mso_schema_template_anp: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + state: present + +- name: Add EPG1 to AP1 in ansible_template1 + cisco.mso.mso_schema_template_anp_epg: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + bd: + name: BD1 + vrf: + name: VRF1 + state: present + +- name: Bind Contract1 and 2 with EPG1 provider + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + contract: + name: "{{ item }}" + type: provider + state: present + loop: + - Contract1 + - Contract2 + +- name: Bind Contract1 with EPG1 consumer + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + contract: + name: "{{ item }}" + type: consumer + state: present + loop: + - Contract1 + - Contract2 + +- name: Bind Contract1 and 2 with template service graph - ansible_service_graph + cisco.mso.mso_schema_template_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + contract: "{{ item }}" + service_graph: ansible_service_graph + service_nodes: + - provider: BD1 + consumer: BD2 + - provider: BD1 + consumer: BD2 + - provider: BD1 + consumer: BD2 + state: present + loop: + - Contract1 + - Contract2 + +# Test part +# Azure tests part +- name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Add Service Graph 1 at site level for the Azure site service graph test # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + service_graph: ansible_service_graph + site: '{{ mso_site | default("ansible_test") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + devices: + - name: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_type: source_nat + provider_interface: TP_FW_Inf1 + consumer_connector_type: redirect + consumer_interface: TP_FW_Inf1 + - name: '{{ mso_tenant | default("ansible_test") }}_app_lb' + - name: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_type: destination_nat + consumer_connector_type: redirect + state: present + output_level: debug + register: az_sg1_cm_present + + - name: Bind the Contract1 with site service graph - ansible_service_graph - check_mode # Azure Task + cisco.mso.mso_schema_site_contract_service_graph: &az_add_site_con_sg_cm + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + state: present + output_level: debug + check_mode: true + register: az_add_site_con_sg_cm + + - name: Bind the Contract1 with site service graph - ansible_service_graph - normal_mode # Azure Task + cisco.mso.mso_schema_site_contract_service_graph: + <<: *az_add_site_con_sg_cm + register: az_add_site_con_sg_nm + + - name: Bind the Contract1 with site service graph - ansible_service_graph - normal_mode again # Azure Task + cisco.mso.mso_schema_site_contract_service_graph: + <<: *az_add_site_con_sg_cm + register: az_add_site_con_sg_nm_again + + - name: Assertions check for the bind site contract service graph + ansible.builtin.assert: + that: + - az_add_site_con_sg_cm is changed + - az_add_site_con_sg_cm.current != {} + - az_add_site_con_sg_cm.previous == {} + - az_add_site_con_sg_cm.current.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_cm.current.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_cm.current.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - az_add_site_con_sg_cm.proposed.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_cm.proposed.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_cm.proposed.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - az_add_site_con_sg_nm is changed + - az_add_site_con_sg_nm.current != {} + - az_add_site_con_sg_nm.previous == {} + - az_add_site_con_sg_nm.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - az_add_site_con_sg_nm.current.serviceGraphRef.templateName == "ansible_template1" + - az_add_site_con_sg_nm.current.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_nm.current.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_nm.current.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - az_add_site_con_sg_nm.proposed.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_nm.proposed.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_nm.proposed.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - az_add_site_con_sg_nm_again is not changed + - az_add_site_con_sg_nm_again.current != {} + - az_add_site_con_sg_nm_again.previous != {} + - az_add_site_con_sg_nm_again.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - az_add_site_con_sg_nm_again.current.serviceGraphRef.templateName == "ansible_template1" + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.0.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.1.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node2") + - az_add_site_con_sg_nm_again.previous.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + +# Non-Cloud sites part +- name: Execute tasks only for non-cloud sites + when: + - query_cloud.current | length == 0 + block: + - name: Bind the Contract1 with site service graph - ansible_service_graph - check_mode + cisco.mso.mso_schema_site_contract_service_graph: &add_site_con_sg_cm + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.4/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if4 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if4 + consumer_connector_redirect_policy: redirect_policy1 + state: present + output_level: debug + check_mode: true + register: add_sg_cm + + - name: Bind the Contract1 with site service graph - ansible_service_graph - normal_mode + cisco.mso.mso_schema_site_contract_service_graph: + <<: *add_site_con_sg_cm + contract: Contract1 + register: add_sg_nm + + - name: Bind the Contract2 with site service graph - ansible_service_graph - normal_mode + cisco.mso.mso_schema_site_contract_service_graph: + <<: *add_site_con_sg_cm + contract: Contract2 + register: add_sg_nm_c2 + + - name: Bind the Contract1 with site service graph - ansible_service_graph - normal_mode - again + cisco.mso.mso_schema_site_contract_service_graph: + <<: *add_site_con_sg_cm + contract: Contract1 + register: add_sg_nm_again + + - name: Assertions check for the bind site contract service graph + ansible.builtin.assert: + that: + - add_sg_cm is changed + - add_sg_cm.current != {} + - add_sg_cm.previous == {} + - add_sg_cm.current.serviceNodesRelationship.0.serviceNodeRef.serviceGraphName == "ansible_service_graph" + - add_sg_cm.current.serviceNodesRelationship.0.serviceNodeRef.serviceNodeName == "node1" + - add_sg_cm.current.serviceNodesRelationship.0.serviceNodeRef.templateName == "ansible_template1" + - add_sg_cm.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - add_sg_cm.current.serviceGraphRef.templateName == "ansible_template1" + - add_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - add_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - add_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - add_sg_cm.current.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_cm.current.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_cm.current.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_cm.current.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_cm.proposed.serviceNodesRelationship.0.serviceNodeRef.serviceGraphName == "ansible_service_graph" + - add_sg_cm.proposed.serviceNodesRelationship.0.serviceNodeRef.serviceNodeName == "node1" + - add_sg_cm.proposed.serviceNodesRelationship.0.serviceNodeRef.templateName == "ansible_template1" + - add_sg_cm.proposed.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - add_sg_cm.proposed.serviceGraphRef.templateName == "ansible_template1" + - add_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - add_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - add_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - add_sg_cm.proposed.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_cm.proposed.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_cm.proposed.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_cm.proposed.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_nm is changed + - add_sg_nm.current != {} + - add_sg_nm.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - add_sg_nm.current.serviceGraphRef.templateName == "ansible_template1" + - add_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - add_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - add_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - add_sg_nm.current.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_nm.current.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_nm.current.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - add_sg_nm.current.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - add_sg_nm.previous == {} + - add_sg_nm_again is not changed + - add_sg_nm_again.current != {} + - add_sg_nm_again.previous != {} + - add_sg_nm_again.previous.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - add_sg_nm_again.previous.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - add_sg_nm_again.previous.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - add_sg_nm_again.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - add_sg_nm_again.current.serviceGraphRef.templateName == "ansible_template1" + - add_sg_nm_again.current.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + + - name: Update the Contract1 - site service graph - ansible_service_graph - node properties - check_mode + cisco.mso.mso_schema_site_contract_service_graph: &update_site_con_sg_cm + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.3/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if4 + provider_connector_redirect_policy_tenant: common + provider_connector_redirect_policy: redirect_policy2 + consumer_connector_cluster_interface: clu_if4 + consumer_connector_redirect_policy_tenant: common + consumer_connector_redirect_policy: redirect_policy2 + state: present + output_level: debug + check_mode: true + register: update_sg_cm + + - name: Update the Contract1 - site service graph - ansible_service_graph - node properties - normal_mode + cisco.mso.mso_schema_site_contract_service_graph: + <<: *update_site_con_sg_cm + register: update_sg_nm + + - name: Update the Contract1 - site service graph - ansible_service_graph - node properties - normal_mode again + cisco.mso.mso_schema_site_contract_service_graph: + <<: *update_site_con_sg_cm + register: update_sg_nm_again + + - name: Assertions check for the update site contract service graph + ansible.builtin.assert: + that: + - update_sg_cm is changed + - update_sg_cm.current != {} + - update_sg_cm.previous != {} + - update_sg_cm.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - update_sg_cm.current.serviceGraphRef.templateName == "ansible_template1" + - update_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - update_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - update_sg_cm.current.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.3/24" + - update_sg_cm.previous.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - update_sg_cm.previous.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - update_sg_cm.previous.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - update_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - update_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - update_sg_cm.proposed.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.3/24" + - update_sg_cm.current.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.current.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_cm.current.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.current.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_cm.proposed.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.proposed.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_cm.proposed.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.proposed.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_cm.previous.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.previous.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - update_sg_cm.previous.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_cm.previous.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - update_sg_nm is changed + - update_sg_nm.current != {} + - update_sg_nm.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - update_sg_nm.current.serviceGraphRef.templateName == "ansible_template1" + - update_sg_nm.current.serviceNodesRelationship.0.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_firewall1/lIf-clu_if1" + - update_sg_nm.current.serviceNodesRelationship.0.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - update_sg_nm.current.serviceNodesRelationship.0.consumerConnector.subnets | length == 0 + - update_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - update_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - update_sg_nm.current.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.3/24" + - update_sg_nm.previous.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - update_sg_nm.previous.serviceNodesRelationship.1.consumerConnector.subnets.0.ip == "1.1.1.1/24" + - update_sg_nm.previous.serviceNodesRelationship.1.consumerConnector.subnets.1.ip == "4.4.4.4/24" + - update_sg_nm.current.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_nm.current.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_nm.current.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_nm.current.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - update_sg_nm.previous.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_nm.previous.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - update_sg_nm.previous.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - update_sg_nm.previous.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - update_sg_nm_again is not changed + - update_sg_nm_again.current != {} + - update_sg_nm_again.current.serviceGraphRef.serviceGraphName == "ansible_service_graph" + - update_sg_nm_again.current.serviceGraphRef.templateName == "ansible_template1" + + - name: Negative test - Add site contract service graph with invalid service_graph + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + tenant: '{{ mso_tenant | default("ansible_test") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph_invalid + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.4/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy_tenant: common + provider_connector_redirect_policy: redirect_policy2 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy_tenant: common + consumer_connector_redirect_policy: redirect_policy2 + state: present + ignore_errors: true + register: nt_add_sg_with_invalid_sg + + - name: Negative test - use invalid service graph schema to check the failure + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}_temp' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.4/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy_tenant: common + provider_connector_redirect_policy: redirect_policy2 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy_tenant: common + consumer_connector_redirect_policy: redirect_policy2 + state: present + ignore_errors: true + register: nt_with_invalid_sg_schema + + - name: Negative test - Add site contract service graph without node_relationship and tenant + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph: ansible_service_graph + state: present + ignore_errors: true + register: nt_add_sg_without_node_relationship_and_tenant + + - name: Negative test - Add site contract service graph without node_relationship + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph: ansible_service_graph + state: present + ignore_errors: true + register: nt_add_sg_without_node_relationship + + - name: Negative test - Add site contract service graph without tenant + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.4/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy_tenant: common + provider_connector_redirect_policy: redirect_policy2 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy_tenant: common + consumer_connector_redirect_policy: redirect_policy2 + state: present + ignore_errors: true + register: nt_add_sg_without_tenant + + - name: Negative test - Add site contract service graph without tenant + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_template: ansible_template1 + service_graph: ansible_service_graph_invalid + node_relationship: + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + provider_connector_cluster_interface: clu_if1 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if1 + consumer_connector_redirect_policy: redirect_policy1 + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_adc' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy: redirect_policy1 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy: redirect_policy1 + consumer_subnet_ips: ["1.1.1.1/24", "4.4.4.4/24"] + - cluster_interface_device: '{{ mso_tenant | default("ansible_test") }}_other' + provider_connector_cluster_interface: clu_if3 + provider_connector_redirect_policy_tenant: common + provider_connector_redirect_policy: redirect_policy2 + consumer_connector_cluster_interface: clu_if3 + consumer_connector_redirect_policy_tenant: common + consumer_connector_redirect_policy: redirect_policy2 + state: present + ignore_errors: true + register: nt_add_sg_without_tenant + + - name: Assertions check for the negative site contract tests + ansible.builtin.assert: + that: + - nt_with_invalid_sg_schema is not changed + - nt_with_invalid_sg_schema.current == {} + - nt_with_invalid_sg_schema.msg == "Provided service_graph_schema{{':'}} 'ansible_schema_temp' does not exist." + - nt_add_sg_without_node_relationship_and_tenant is not changed + - nt_add_sg_without_node_relationship_and_tenant.current == {} + - nt_add_sg_without_node_relationship_and_tenant.msg == "The node_relationship and tenant attributes are required when state is present and site type is on-premise." + - nt_add_sg_without_node_relationship is not changed + - nt_add_sg_without_node_relationship.current == {} + - nt_add_sg_without_node_relationship.msg == "The node_relationship attribute is required when state is present and site type is on-premise." + - nt_add_sg_without_tenant is not changed + - nt_add_sg_without_tenant.current == {} + - nt_add_sg_without_tenant.msg == "The tenant attribute is required when state is present and site type is on-premise." + - nt_add_sg_with_invalid_sg is not changed + - nt_add_sg_with_invalid_sg.msg == "The service graph{{':'}} ansible_service_graph_invalid does not associated with the site contract{{':'}} Contract1." + + - name: Query a empty site contract without passing the service graph name + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract3 + state: query + register: query_empty_contract_without_sg_name + + - name: Query a invalid site contract without passing the service graph value + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract4 + state: query + ignore_errors: true + register: query_invalid_contract_sg + + - name: Query all site contract service graphs with an empty template + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template2 + site: '{{ mso_site | default("ansible_test") }}' + service_graph: ansible_service_graph + state: query + register: query_all_sg_with_empty_template + + - name: Query a site contract - Contract1 service graph without passing service graph name + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + contract: Contract1 + site: '{{ mso_site | default("ansible_test") }}' + state: query + register: query_sg_without_name + + - name: Query all site contract service graphs without passing the service_graph and contract name + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + state: query + register: query_all_sg_without_contract_sg + + - name: Assertions check for the query results + ansible.builtin.assert: + that: + - query_empty_contract_without_sg_name is not changed + - query_empty_contract_without_sg_name.current == {} + - query_invalid_contract_sg is not changed + - query_invalid_contract_sg.current == {} + - query_invalid_contract_sg.msg == "The site contract{{':'}} Contract4 does not exist." + - query_all_sg_with_empty_template is not changed + - query_all_sg_with_empty_template.current == {} + - query_sg_without_name is not changed + - query_sg_without_name.current != {} + - query_sg_without_name.current.serviceGraphRef is match(".+/templates/ansible_template1/serviceGraphs/ansible_service_graph") + - query_sg_without_name.current.serviceNodesRelationship | length == 3 + - query_sg_without_name.current.serviceNodesRelationship.0.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_firewall1/lIf-clu_if1" + - query_sg_without_name.current.serviceNodesRelationship.0.consumerConnector.redirectPolicy.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/svcCont/svcRedirectPol-redirect_policy1" + - query_sg_without_name.current.serviceNodesRelationship.0.consumerConnector.subnets | length == 0 + - query_sg_without_name.current.serviceNodesRelationship.0.providerConnector.subnets | length == 0 + - query_sg_without_name.current.serviceNodesRelationship.0.serviceNodeRef is match(".+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node1") + - query_all_sg_without_contract_sg is not changed + - query_all_sg_without_contract_sg.current | length == 2 + - query_all_sg_without_contract_sg.current.0.serviceGraphRef is match(".+/templates/ansible_template1/serviceGraphs/ansible_service_graph") + - query_all_sg_without_contract_sg.current.1.serviceGraphRef is match(".+/templates/ansible_template1/serviceGraphs/ansible_service_graph") + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.1.providerConnector.subnets | length == 0 + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.2.consumerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.2.consumerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.2.providerConnector.redirectPolicy.dn == "uni/tn-common/svcCont/svcRedirectPol-redirect_policy2" + - query_all_sg_without_contract_sg.current.0.serviceNodesRelationship.2.providerConnector.clusterInterface.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/lDevVip-{{ mso_tenant | default("ansible_test") }}_other/lIf-clu_if4" + + - name: Remove the site contract Contract1 - service graph from the ansible_template1 - check_mode + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + state: absent + output_level: debug + check_mode: true + register: site_con_sg_absent_cm + + - name: Remove the site contract Contract1 - service graph from the ansible_template1 - normal_mode + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + state: absent + register: site_con_sg_absent_nm + + - name: Remove the site contract Contract1 - service graph from the ansible_template1 - normal_mode again + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + state: absent + ignore_errors: true + register: site_con_sg_absent_nm_again + + - name: Assertions check for remove the site contract Contract1 - service graph from the ansible_template1 + ansible.builtin.assert: + that: + - site_con_sg_absent_cm is changed + - site_con_sg_absent_cm.current == {} + - site_con_sg_absent_cm.previous != {} + - site_con_sg_absent_cm.previous.serviceGraphRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph") + - site_con_sg_absent_cm.previous.serviceNodesRelationship | length == 3 + - site_con_sg_absent_cm.previous.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - site_con_sg_absent_cm.previous.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - site_con_sg_absent_cm.proposed == {} + - site_con_sg_absent_cm.sent == {} + - site_con_sg_absent_nm is changed + - site_con_sg_absent_nm.current == {} + - site_con_sg_absent_nm.previous != {} + - site_con_sg_absent_nm.previous.serviceGraphRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph") + - site_con_sg_absent_nm.previous.serviceNodesRelationship | length == 3 + - site_con_sg_absent_nm.previous.serviceNodesRelationship.1.consumerConnector.subnets | length == 2 + - site_con_sg_absent_nm.previous.serviceNodesRelationship.2.serviceNodeRef is match("/schemas/.+/templates/ansible_template1/serviceGraphs/ansible_service_graph/serviceNodes/node3") + - site_con_sg_absent_nm_again is not changed + - site_con_sg_absent_nm_again.current == {} + - site_con_sg_absent_nm_again.previous == {} + - site_con_sg_absent_nm_again.msg is match("MSO Error 400{{':'}} error in remove for path{{':'}} '/sites/0/contracts/0/serviceGraphRelationship'{{':'}} unable to remove nonexistent key{{':'}} serviceGraphRelationship{{':'}} missing value") + +# Cleanup part + +- name: Remove the site association for the ansible_schema templates + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "{{ item }}" + site: '{{ mso_site | default("ansible_test") }}' + state: present + loop: + - "ansible_template1" + - "ansible_template2" + +- name: Remove the ansible_schema schema + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + state: absent + +- name: Remove the {{ mso_tenant | default("ansible_test") }} tenant + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + +- name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + +- name: Remove the common tenant redirect policy + cisco.aci.aci_rest: + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: no + path: "/api/node/mo/uni/tn-common/svcCont.json" + method: post + content: + vnsSvcRedirectPol: + attributes: + name: redirect_policy2 + status: deleted + +- name: Remove the {{ mso_tenant | default("ansible_test") }} from the APIC + cisco.aci.aci_tenant: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases new file mode 100644 index 000000000..5042c9c09 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases @@ -0,0 +1,2 @@ +# No ACI MultiSite infrastructure, so not enabled +# unsupported diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/l4_l7_devices.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/l4_l7_devices.yml new file mode 100644 index 000000000..5c325ba44 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/l4_l7_devices.yml @@ -0,0 +1,222 @@ +# Test code for the MSO modules +# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> + +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) + +- name: Test that we have an ACI MultiSite host, username and password + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." + when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined + +# CLEAN ENVIRONMENT +- name: Set vars + ansible.builtin.set_fact: + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" + output_level: '{{ mso_output_level | default("info") }}' + +- name: Query system information + cisco.aci.aci_system: + <<: *aci_info + id: 1 + state: query + register: aci_version + +- name: Remove an existing tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Add a tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: '{{ mso_tenant | default("ansible_test") }}' + +# Site type checking for L4-L7 Device configuration +# QUERY OBJECTS +- name: Query cloud provider object + cisco.aci.aci_cloud_provider: + <<: *aci_info + state: query + register: query_cloud + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '>=') + +- name: Set vars + ansible.builtin.set_fact: + query_cloud: + current: [] + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '<') + +- name: Verify query_cloud for all sites + ansible.builtin.assert: + that: + - query_cloud is not changed + +- name: Verify query_cloud for Cloud Sites + ansible.builtin.assert: + that: + - query_cloud is not changed + - query_cloud.current.0.cloudProvP.attributes.environment == "public-cloud" + - '"vendor" in query_cloud.current.0.cloudProvP.attributes' + when: + - query_cloud.current | length > 0 # This condition will execute only cloud sites + +# Cloud Site block +- name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Add azure_vrf to the {{ mso_tenant | default("ansible_test") }} + cisco.aci.aci_vrf: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + vrf: azure_vrf + + - name: Add azure_ctxprof to the {{ mso_tenant | default("ansible_test") }} + cisco.aci.aci_cloud_ctx_profile: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + cloud: azure + name: azure_ctxprof + vrf: azure_vrf + region: westus2 + primary_cidr: "1.1.1.2/32" + state: present + + - name: Add the subnet to the azure_ctxprof + cisco.aci.aci_rest: + <<: *aci_info + path: api/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32].json + method: post + content: + cloudSubnet: + attributes: + ip: 1.1.1.2/32 + name: azure_ctxprof_cidr + children: + - cloudRsZoneAttach: + attributes: + tDn: "uni/clouddomp/provp-azure/region-westus2/zone-default" + + - name: Add the {{ mso_tenant | default("ansible_test") }}_tplb device - ThirdParty_LB + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/cld-{{ mso_tenant | default("ansible_test") }}_tplb.json + method: post + content: + cloudLDev: + attributes: + targetMode: unspecified + name: '{{ mso_tenant | default("ansible_test") }}_tplb' + svcType: ADC + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-{{ mso_tenant | default("ansible_test") }}/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_LB_Inf + children: + - cloudEPSelector: + attributes: + name: TP_LB_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_firewall1 device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/cld-{{ mso_tenant | default("ansible_test") }}_firewall1.json + method: post + content: + cloudLDev: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_firewall1' + svcType: FW + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-{{ mso_tenant | default("ansible_test") }}/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_FW_Inf1 + children: + - cloudEPSelector: + attributes: + name: TP_FW_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the {{ mso_tenant | default("ansible_test") }}_nlb device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb.json + method: post + content: + cloudLB: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_nlb' + type: network + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: 'uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]' + - cloudVip: + attributes: + name: 10.10.10.10 + + - name: Add the {{ mso_tenant | default("ansible_test") }}_aplb device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_aplb.json + method: post + content: + cloudLB: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_aplb' + type: application + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: 'uni/tn-{{ mso_tenant | default("ansible_test") }}/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]' + + - name: Add certificate store to the {{ mso_tenant | default("ansible_test") }} tenant + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/certstore.json + method: post + content: + cloudCertStore: + attributes: + name: default + + - name: Add certificate authority to the {{ mso_tenant | default("ansible_test") }} tenant + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/certstore/tp-{{ mso_tenant | default("ansible_test") }}_ca.json + method: post + content: + pkiTP: + attributes: + certChain: '{{ lookup("file", "pki/admin.crt") }}' + name: '{{ mso_tenant | default("ansible_test") }}_ca' + + - name: Add key ring to the {{ mso_tenant | default("ansible_test") }} tenant + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-{{ mso_tenant | default("ansible_test") }}/certstore/keyring-{{ mso_tenant | default("ansible_test") }}_keyring.json + method: post + content: + pkiKeyRing: + attributes: + name: '{{ mso_tenant | default("ansible_test") }}_keyring' + tp: '{{ mso_tenant | default("ansible_test") }}_ca' + modulus: mod2048 + adminState: started diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/main.yml new file mode 100644 index 000000000..7552c563d --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/main.yml @@ -0,0 +1,1604 @@ +# Test code for the MSO modules +# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> + +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) + +- name: Test that we have an ACI MultiSite host, username and password + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." + when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined + +# CLEAN ENVIRONMENT +- name: Set vars + ansible.builtin.set_fact: + mso_info: &mso_info + host: "{{ mso_hostname }}" + username: "{{ mso_username }}" + password: "{{ mso_password }}" + validate_certs: "{{ mso_validate_certs | default(false) }}" + use_ssl: "{{ mso_use_ssl | default(true) }}" + use_proxy: "{{ mso_use_proxy | default(false) }}" + output_level: '{{ mso_output_level | default("info") }}' + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" + output_level: '{{ mso_output_level | default("info") }}' + +# Setup part begins +- name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + +- name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + +- name: Include tasks for L4-L7 devices + ansible.builtin.include_tasks: l4_l7_devices.yml + +- name: Set ansible_network_os to cisco.nd.nd and ansible_connection to ansible.netcommon.httpapi + ansible.builtin.set_fact: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: cisco.nd.nd + +- name: Reset the ansible_connection to access the MSO/NDO + ansible.builtin.meta: reset_connection + +- name: Remove ansible_schema to start the test - setup part + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + state: absent + +- name: Remove {{ mso_tenant | default("ansible_test") }} tenant to start the test - setup part + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Add {{ mso_tenant | default("ansible_test") }} tenant + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + users: ["{{ mso_username }}"] + state: present + +- name: Associate Azure site with '{{ mso_tenant | default("ansible_test") }}' + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + site: azure_ansible_test_2 + cloud_account: "uni/tn-{{ mso_tenant | default('ansible_test') }}/act-[{{ azure_cloud_account | default(123) }}]-vendor-azure" + state: present + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + +- name: Ensure ansible_schema with ansible_template1 and ansible_template2 exist + cisco.mso.mso_schema_template: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + template: "{{ item }}" + state: present + loop: + - "ansible_template1" + - "ansible_template2" + +- name: Create ansible_service_graph schema template service graph + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + service_graph: "ansible_service_graph" + display_name: "ansible_service_graph" + service_nodes: + - type: firewall + - type: load-balancer + filter_after_first_node: allow_all + state: present + +- name: Create ansible_service_graph2 schema template service graph + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + service_graph: "ansible_service_graph2" + display_name: "ansible_service_graph2" + service_nodes: + - type: load-balancer + - type: load-balancer + filter_after_first_node: allow_all + state: present + +- name: Bind ansible_test site with ansible_template1 and ansible_template2 + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "{{ item }}" + site: '{{ mso_site | default("ansible_test") }}' + state: present + loop: + - "ansible_template1" + +- name: Add Filter1 to ansible_template1 + cisco.mso.mso_schema_template_filter_entry: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + filter: Filter1 + entry: Filter1Entry + state: present + +- name: Add Contracts to the ansible_template1 + cisco.mso.mso_schema_template_contract_filter: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + contract: "{{ item }}" + filter: Filter1 + state: present + loop: + - Contract1 + - Contract2 + - Contract3 + +- name: Add a VRF1 to ansible_template1 + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + vrf: VRF1 + state: present + +- name: Add BD1 to ansible_template1 + cisco.mso.mso_schema_template_bd: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + bd: BD1 + vrf: + name: VRF1 + state: present + +- name: Add AP1 to ansible_template1 + cisco.mso.mso_schema_template_anp: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + state: present + +- name: Add EPG1 to AP1 in ansible_template1 + cisco.mso.mso_schema_template_anp_epg: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + bd: + name: BD1 + vrf: + name: VRF1 + state: present + +- name: Bind Contract1 and 2 with EPG1 provider + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + contract: + name: "{{ item }}" + type: provider + state: present + loop: + - Contract1 + - Contract2 + +- name: Bind Contract1 with EPG1 consumer + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + anp: AP1 + epg: EPG1 + contract: + name: "{{ item }}" + type: consumer + state: present + loop: + - Contract1 + - Contract2 + - Contract3 + +- name: Bind Contract1 with template service graph - ansible_service_graph + cisco.mso.mso_schema_template_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + contract: Contract1 + service_graph: ansible_service_graph + service_nodes: + - provider: BD1 + consumer: BD1 + - provider: BD1 + consumer: BD1 + state: present + +- name: Bind Contract2 with template service graph - ansible_service_graph2 + cisco.mso.mso_schema_template_contract_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "ansible_template1" + contract: Contract2 + service_graph: ansible_service_graph2 + service_nodes: + - provider: BD1 + consumer: BD1 + - provider: BD1 + consumer: BD1 + state: present + +- name: Add site VRF region CIDR to the VRF1 + cisco.mso.mso_schema_site_vrf_region_cidr: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + vrf: VRF1 + region: westus2 + cidr: 14.14.14.1/24 + state: present + +- name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Add Service Graph 1 at site level for the Azure site service graph test + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + service_graph: ansible_service_graph + site: '{{ mso_site | default("ansible_test") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + devices: + - name: '{{ mso_tenant | default("ansible_test") }}_firewall1' # Third-Party Firewall - Listener not supported + - name: '{{ mso_tenant | default("ansible_test") }}_tplb' # Third-Party Load Balancer - Listener not supported + state: present + register: az_sg1_cm_present + + - name: Add Service Graph 2 at site level for the Azure site service graph test + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + service_graph: ansible_service_graph2 + site: '{{ mso_site | default("ansible_test") }}' + tenant: '{{ mso_tenant | default("ansible_test") }}' + devices: + - name: '{{ mso_tenant | default("ansible_test") }}_nlb' # Network Load Balancer - Listener supported + - name: '{{ mso_tenant | default("ansible_test") }}_aplb' # Application Load Balancer - Listener supported + state: present + register: az_sg1_cm_present + + - name: Bind the Contract1 with site service graph - ansible_service_graph + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract1 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph + state: present + register: az_add_site_con_sg_cm + + - name: Bind the Contract2 with site service graph - ansible_service_graph2 + cisco.mso.mso_schema_site_contract_service_graph: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_schema") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + contract: Contract2 + service_graph_schema: '{{ mso_schema | default("ansible_schema") }}' + service_graph_template: ansible_template1 + service_graph: ansible_service_graph2 + state: present + register: az_add_site_con_sg_cm + +# Test part +- name: Negative test - add listener - nlb_li_tcp without device when the parent is not present + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + ignore_errors: true + register: nt_add_listener_without_device + +- name: Add listener - nlb_li_tcp - check_mode + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + output_level: debug + check_mode: true + register: add_nlb_li_tcp_cm + +- name: Add listener - nlb_li_tcp - normal_mode + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + register: add_nlb_li_tcp_nm + +- name: Add listener - nlb_li_tcp normal_mode again + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + register: add_nlb_li_tcp_nm_again + +- name: Add listener - nlb_li_udp without device when the parent is present + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_udp + listener_port: 80 + listener_protocol: udp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + security_policy: default + rules: + - name: rule2 + priority: 2 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + ignore_errors: true + register: add_nlb_li_udp + +- name: Add listener - ans_li_common - udp + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: ans_li_common + listener_port: 80 + listener_protocol: udp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: common3 + priority: 3 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: http + path: health_check_path + interval: 5 + unhealthy_threshold: 2 + success_code: 200-399 + register: add_ans_li_common_udp + +- name: Add listener - aplb_li_https + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true # "yes" - host should be empty in the rule + success_code: "200" + target_ip_type: unspecified + register: add_aplb_li_https + +- name: Add listener - aplb_li_http + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener: aplb_li_http + listener_port: 80 + listener_protocol: http + security_policy: default + rules: + - name: rule2 + priority: 2 + action_type: forward + port: 443 + protocol: https + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 443 + protocol: https + path: "/" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + host: use_host_from_rule + use_host_from_rule: false # "no"(unchecked) - host should be specified in the rule + success_code: "200" + target_ip_type: unspecified + register: add_aplb_li_http + +- name: Add listener - ans_li_common - http + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener: ans_li_common + listener_port: 80 + listener_protocol: http + security_policy: default + rules: + - name: rule3 + priority: 3 + action_type: forward + port: 443 + protocol: https + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 443 + protocol: https + path: "/" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + host: use_host_from_rule + use_host_from_rule: false + success_code: "200" + target_ip_type: unspecified + register: add_ans_li_common_http + +- name: Assertions check for the add listeners test + ansible.builtin.assert: + that: + - nt_add_listener_without_device is not changed + - nt_add_listener_without_device.current == {} + - nt_add_listener_without_device.msg == "The 'device' name is required to initialize the parent object." + - add_nlb_li_tcp_cm is changed + - add_nlb_li_tcp_cm.current != {} + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.name == "nlb_li_tcp" + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.name == "10.10.10.10" + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb/vip-10.10.10.10" + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.protocol == "tcp" + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.index == 1 + - add_nlb_li_tcp_cm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.name == "rule1" + - add_nlb_li_tcp_cm.proposed != {} + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.name == "nlb_li_tcp" + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.name == "10.10.10.10" + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb/vip-10.10.10.10" + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.protocol == "tcp" + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.index == 1 + - add_nlb_li_tcp_cm.proposed.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.name == "rule1" + - add_nlb_li_tcp_nm is changed + - add_nlb_li_tcp_nm.current != {} + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.name == "nlb_li_tcp" + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.name == "10.10.10.10" + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.nlbDevIp.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb/vip-10.10.10.10" + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.protocol == "tcp" + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.index == 1 + - add_nlb_li_tcp_nm.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.name == "rule1" + - add_nlb_li_tcp_nm.previous == {} + - add_nlb_li_tcp_nm_again is not changed + - add_nlb_li_tcp_nm_again.current.name == "nlb_li_tcp" + - add_nlb_li_tcp_nm_again.current.nlbDevIp.name == "10.10.10.10" + - add_nlb_li_tcp_nm_again.current.nlbDevIp.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb/vip-10.10.10.10" + - add_nlb_li_tcp_nm_again.current.protocol == "tcp" + - add_nlb_li_tcp_nm_again.current.rules.0.index == 1 + - add_nlb_li_tcp_nm_again.current.rules.0.name == "rule1" + - add_nlb_li_udp is not changed + - add_nlb_li_udp.msg == "When the 'frontend_ip' is '10.10.10.10', the ['device'] attributes must be set and the object name{{':'}} nlb_li_udp" + - add_ans_li_common_udp is changed + - add_ans_li_common_udp.current.name == "ans_li_common" + - add_ans_li_common_udp.current.protocol == "udp" + - add_ans_li_common_udp.current.nlbDevIp.name == "10.10.10.10" + - add_ans_li_common_udp.current.nlbDevIp.dn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/clb-{{ mso_tenant | default("ansible_test") }}_nlb/vip-10.10.10.10" + - add_aplb_li_https is changed + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.name == "aplb_li_https" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.protocol == "https" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.port == 443 + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.certificates.0.default == true + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.certificates.0.name == "ans_li_tenant_keyring" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.certificates.0.store == "default" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.certificates.0.tDn == "uni/tn-{{ mso_tenant | default("ansible_test") }}/certstore" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.index == 1 + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.name == "rule1" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.protocol == "http" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.actionType == "forward" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.healthCheck.protocol == "http" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.healthCheck.path == "health_check_path" + - add_aplb_li_https.current.deviceConfiguration.cloudLoadBalancer.listeners.0.rules.0.providerEpgRef is match("/schemas/.+/templates/ansible_template1/anps/AP1/epgs/EPG1") + - add_aplb_li_http is changed + - add_aplb_li_http.current.name == "aplb_li_http" + - add_aplb_li_http.current.protocol == "http" + - add_aplb_li_http.current.rules.0.healthCheck.host == "use_host_from_rule" + - add_aplb_li_http.current.rules.0.healthCheck.useHostFromRule == "no" + - add_aplb_li_http.current.rules.0.healthCheck.protocol == "https" + - add_ans_li_common_http is changed + - add_ans_li_common_http.current.name == "ans_li_common" + - add_ans_li_common_http.current.protocol == "http" + - add_ans_li_common_http.current.rules.0.healthCheck.protocol == "https" + - add_ans_li_common_http.current.rules.0.healthCheck.host == "use_host_from_rule" + - add_ans_li_common_http.current.rules.0.healthCheck.useHostFromRule == "no" + - add_ans_li_common_http.current.rules.0.actionType == "forward" + - add_ans_li_common_http.current.rules.0.protocol == "https" + - add_ans_li_common_http.current.rules.0.name == "rule3" + - add_ans_li_common_http.current.rules.0.providerEpgRef is match("/schemas/.+/templates/ansible_template1/anps/AP1/epgs/EPG1") + +- name: Update listener - ans_li_common rule health_check property - timeout value 30 to 60 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener: ans_li_common + listener_port: 80 + listener_protocol: http + security_policy: default + rules: + - name: rule3 + priority: 3 + action_type: forward + port: 443 + protocol: https + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 443 + protocol: https + path: "/" + interval: 30 + timeout: 60 + unhealthy_threshold: 3 + host: use_host_from_rule + use_host_from_rule: false + success_code: "200" + target_ip_type: unspecified + register: update_ans_li_common + +- name: Update listener - ans_li_common with invalid service_node_index 5 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 5 + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener: ans_li_common + listener_port: 80 + listener_protocol: http + security_policy: default + rules: + - name: rule3 + priority: 3 + action_type: forward + port: 443 + protocol: https + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 443 + protocol: https + path: "/" + interval: 30 + timeout: 60 + unhealthy_threshold: 3 + host: use_host_from_rule + use_host_from_rule: false + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_update_ans_li_common + +- name: Assertions check for the update listeners test + ansible.builtin.assert: + that: + - update_ans_li_common is changed + - update_ans_li_common.current.name == "ans_li_common" + - update_ans_li_common.current.protocol == "http" + - update_ans_li_common.current.rules.0.actionType == "forward" + - update_ans_li_common.current.rules.0.providerEpgRef is match( "/schemas/.+/templates/ansible_template1/anps/AP1/epgs/EPG1") + - update_ans_li_common.current.rules.0.protocol == "https" + - update_ans_li_common.current.rules.0.healthCheck.protocol == "https" + - nt_update_ans_li_common is not changed + - nt_update_ans_li_common.msg == "The service_node_index{{':'}} 5 is out of range." + +- name: Query all listeners + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + state: query + register: query_all_listeners + +- name: Query all listeners with service_node_index 0 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + state: query + register: node1_query_all_listeners + +- name: Query all listeners with name ans_li_common without service_node_index + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: ans_li_common + state: query + register: query_all_ans_li_common + +- name: Query a listener with name ans_li_common and service_node_index 0 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: ans_li_common + service_node_index: 0 + state: query + register: query_a_ans_li_common + +- name: Query an invalid listener with name invalid_ans_li_common - under Contract2 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: invalid_ans_li_common + state: query + register: nt_query_c1_listeners + +- name: Query an invalid listener with name invalid_ans_li_common - under Contract2 with service_node_index 1 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: invalid_ans_li_common + service_node_index: 1 + state: query + register: nt_query_invalid_listener_node1 + +- name: Assertions check for the query listeners test + ansible.builtin.assert: + that: + - query_all_listeners is not changed + - query_all_listeners.current | length >= 5 + - node1_query_all_listeners is not changed + - node1_query_all_listeners.current | length == 2 + - query_all_ans_li_common is not changed + - query_all_ans_li_common.current | length == 2 + - query_all_ans_li_common.current.0.name == "ans_li_common" + - query_all_ans_li_common.current.1.name == "ans_li_common" + - query_a_ans_li_common is not changed + - query_a_ans_li_common.current != {} + - query_a_ans_li_common.current.name == "ans_li_common" + - nt_query_c1_listeners is not changed + - nt_query_c1_listeners.current == {} + - nt_query_invalid_listener_node1 is not changed + - nt_query_invalid_listener_node1.current == {} + +- name: Query all listeners under Contract1 - Negative test + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract1" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: invalid_ans_li_common + state: query + register: nt_query_all_c1_listeners + +- name: Query all listeners under Contract1 with service_node_index 1 - Negative test + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract1" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + listener: invalid_ans_li_common + service_node_index: 1 + state: query + register: nt_query_c1_listeners + +- name: Assertions check for the query listeners negative test + ansible.builtin.assert: + that: + - nt_query_all_c1_listeners is not changed + - nt_query_all_c1_listeners.current == {} + - nt_query_c1_listeners is not changed + - nt_query_c1_listeners.current == {} + +- name: Negative test - query all listeners with the non-cloud site + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract1" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: "ansible_test" + service_node_index: 0 + state: query + ignore_errors: true + register: nt_non_cloud_site + +- name: Negative test - add listener - nt_aplb_li_https - ssl cert missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_lp_https_ssl_cert_missing + +- name: Negative test - add listener - nt_aplb_li_https - Contract3 SG Ref missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract3" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_invalid_contract3 + +- name: Negative test - add listener - nt_aplb_li_https - with invalid device + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract3" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb_invalid' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_invalid_device + +- name: Negative test - add listener - nt_fw_li_https to the Third-Party Firewall + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract1" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nt_fw_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_firewall1' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_tp_fw_listener + +- name: Negative test - add listener - nt_tplb_li_https to the Third-Party load-balancer + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract1" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_tplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_tplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_tp_lb_listener + +- name: Negative test - add listener - nt_aplb_li_https - with same listener and rule protocol - https + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: https + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_lp_and_rp_https + +- name: Negative test - add listener - nt_aplb_li_https - with same listener and rule protocol - http + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: http + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_lp_and_rp_http + +- name: Negative test - add listener - nt_aplb_li_https - rule action_type is redirect + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: redirect + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_action_type_redirect + +- name: Negative test - add listener - nt_aplb_li_https - rule action_type is forward + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + target_ip_type: unspecified + ignore_errors: true + register: nt_action_type_forward + +- name: Negative test - add listener - nt_aplb_li_https - rule url_type is custom + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 1 + listener: nt_aplb_li_https + tenant: '{{ mso_tenant | default("ansible_test") }}' + device: '{{ mso_tenant | default("ansible_test") }}_aplb' + listener_port: 443 + listener_protocol: https + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: http + provider_epg_ref: + anp_name: AP1 + epg_name: EPG1 + url_type: custom + health_check: + port: 80 + protocol: http + path: "health_check_path" + interval: 30 + timeout: 30 + unhealthy_threshold: 3 + use_host_from_rule: true + success_code: "200" + target_ip_type: unspecified + ignore_errors: true + register: nt_url_type_custom + +- name: Negative test - add listener - nlb_li_tcp - listener protocol is tcp/udp - health_check missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + ignore_errors: true + register: nt_lp_tcp_udp_hp_missing + +- name: Negative test - add listener - nlb_li_tcp - listener protocol is tcp/udp - health_check protocol tcp - unhealthy_threshold missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: tcp + interval: 5 + success_code: 200-399 + ignore_errors: true + register: nt_lp_tcp_udp_hp_tcp_ut_missing + +- name: Negative test - add listener - nlb_li_tcp - listener protocol is tcp/udp - health_check protocol http/https - unhealthy_threshold missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_tcp + listener_port: 80 + listener_protocol: tcp + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: http + interval: 5 + success_code: 200-399 + ignore_errors: true + register: nt_lp_tcp_udp_hp_http_https_ut_missing + +- name: Negative test - add listener - nlb_li_http - listener protocol is http - health_check protocol https - unhealthy_threshold missing + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_http + listener_port: 80 + listener_protocol: http + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: https + interval: 5 + success_code: 200-399 + ignore_errors: true + register: nt_lp_http_hp_https_ut_missing + +- name: Negative test - add listener - nlb_li_http - listener protocol is http - health_check protocol http + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_http + listener_port: 80 + listener_protocol: http + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: http + interval: 5 + success_code: 200-399 + ignore_errors: true + register: nt_lp_http_hp_http + +- name: Negative test - add listener - nlb_li_https - listener protocol is https - health_check protocol https + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: nlb_li_https + listener_port: 80 + listener_protocol: https + tenant: '{{ mso_tenant | default("ansible_test") }}' + frontend_ip: "10.10.10.10" + device: '{{ mso_tenant | default("ansible_test") }}_nlb' + security_policy: default + ssl_certificates: + - name: '{{ mso_tenant | default("ansible_test") }}_keyring' + certificate_store: default + rules: + - name: rule1 + priority: 1 + action_type: forward + port: 80 + protocol: tcp + health_check: + port: 80 + protocol: https + interval: 5 + success_code: 200-399 + ignore_errors: true + register: nt_lp_https_hp_https + +- name: Negative test - remove a listener - ans_li_common - with invalid service_node_index is -1 + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: -1 + listener: ans_li_common + state: absent + ignore_errors: true + register: rm_ans_li_common_nm_again + +- name: Assertions check for the listeners negative test + ansible.builtin.assert: + that: + - nt_non_cloud_site is not changed + - nt_non_cloud_site.msg == "The Site Contract Service Graph Listener is not supported for the site{{':'}} ansible_test." + - nt_lp_https_ssl_cert_missing is not changed + - nt_lp_https_ssl_cert_missing.msg == "When the 'listener_protocol' is 'https', the ['security_policy', 'ssl_certificates'] attributes must be set and the object name{{':'}} nt_aplb_li_https" + - nt_invalid_contract3 is not changed + - nt_invalid_contract3.msg == "The site contract{{':'}} Contract3 is not associated with a service graph." + - nt_invalid_device is not changed + - nt_invalid_device.msg == "The site contract{{':'}} Contract3 is not associated with a service graph." + - nt_tp_fw_listener is not changed + - nt_tp_fw_listener.msg == "Listener is not supported for the 'service_node_index'{{':'}} 0 is associated with the Third-Party Firewall device." + - nt_tp_lb_listener is not changed + - nt_tp_lb_listener.msg == "Listener is not supported for the 'service_node_index'{{':'}} 1 is associated with the Third-Party Load Balancer device." + - nt_lp_and_rp_https is not changed + - nt_lp_and_rp_https.msg == "When the 'listener_protocol' is 'https', the rule 'protocol' must be 'https'" + - nt_lp_and_rp_http is not changed + - nt_lp_and_rp_http.msg == "When the 'listener_protocol' is 'http', the rule 'protocol' must be 'http'" + - nt_action_type_redirect is not changed + - nt_action_type_redirect.msg == "When the 'action_type' is 'redirect', the ['redirect_protocol', 'redirect_port', 'url_type', 'redirect_code'] attributes must be set at the object position{{':'}} 0 and the object name{{':'}} rule1" + - nt_action_type_forward is not changed + - nt_action_type_forward.msg == "When the 'action_type' is 'forward', the ['health_check'] attributes must be set at the object position{{':'}} 0 and the object name{{':'}} rule1" + - nt_url_type_custom is not changed + - nt_url_type_custom.msg == "When the 'url_type' is 'custom', the ['redirect_host_name', 'redirect_path', 'redirect_query', 'response_code'] attributes must be set at the object position{{':'}} 0 and the object name{{':'}} rule1" + - nt_lp_tcp_udp_hp_missing is not changed + - nt_lp_tcp_udp_hp_missing.msg == "When the 'action_type' is 'forward', the ['health_check'] attributes must be set at the object position{{':'}} 0 and the object name{{':'}} rule1" + - nt_lp_tcp_udp_hp_tcp_ut_missing is not changed + - nt_lp_tcp_udp_hp_tcp_ut_missing.msg == "When the 'health_check - 'protocol'' is 'tcp', the ['unhealthy_threshold'] attributes must be set" + - nt_lp_tcp_udp_hp_http_https_ut_missing is not changed + - nt_lp_tcp_udp_hp_http_https_ut_missing.msg == "When the 'health_check - 'protocol'' is 'http/https', the ['path', 'unhealthy_threshold'] attributes must be set" + - nt_lp_http_hp_https_ut_missing is not changed + - nt_lp_http_hp_https_ut_missing.msg == "When the 'health_check - 'protocol'' is 'http/https', the ['path', 'unhealthy_threshold', 'timeout'] attributes must be set" + - nt_lp_http_hp_http is not changed + - nt_lp_http_hp_http.msg == "The 'listener_protocol'{{':'}} http and the health_check protocol{{':'}} http is not a valid configuration at the object position{{':'}} 0 and the object name{{':'}} rule1" + - nt_lp_https_hp_https is not changed + - nt_lp_https_hp_https.msg == "The 'listener_protocol'{{':'}} https and the health_check protocol{{':'}} https is not a valid configuration at the object position{{':'}} 0 and the object name{{':'}} rule1" + - rm_ans_li_common_nm_again is not changed + - rm_ans_li_common_nm_again.msg == "The service_node_index{{':'}} -1 is not valid." + +- name: Remove an existing listener - ans_li_common - check_mode + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: ans_li_common + state: absent + output_level: debug + check_mode: true + register: rm_ans_li_common_cm + +- name: Remove an existing listener - ans_li_common - normal_mode + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: ans_li_common + state: absent + register: rm_ans_li_common_nm + +- name: Remove an existing listener - ans_li_common - normal_mode again + cisco.mso.mso_schema_site_contract_service_graph_listener: + <<: *mso_info + contract: "Contract2" + schema: '{{ mso_schema | default("ansible_test") }}' + template: ansible_template1 + site: '{{ mso_site | default("ansible_test") }}' + service_node_index: 0 + listener: ans_li_common + state: absent + register: rm_ans_li_common_nm_again + +- name: Assertions check for remove listeners + ansible.builtin.assert: + that: + - rm_ans_li_common_cm is changed + - rm_ans_li_common_cm.current == {} + - rm_ans_li_common_cm.previous != {} + - rm_ans_li_common_cm.previous.name == "ans_li_common" + - rm_ans_li_common_cm.previous.protocol == "udp" + - rm_ans_li_common_cm.proposed == {} + - rm_ans_li_common_nm is changed + - rm_ans_li_common_nm.current == {} + - rm_ans_li_common_nm.previous != {} + - rm_ans_li_common_nm.previous.name == "ans_li_common" + - rm_ans_li_common_nm.previous.protocol == "udp" + - rm_ans_li_common_nm_again is not changed + - rm_ans_li_common_nm_again.current == {} + - rm_ans_li_common_nm_again.previous == {} + +# Cleanup part +- name: Remove the site association for the ansible_schema templates + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + template: "{{ item }}" + site: '{{ mso_site | default("ansible_test") }}' + state: present + loop: + - "ansible_template1" + - "ansible_template2" + +- name: Remove the ansible_schema schema + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_schema") }}' + state: absent + +- name: Remove the {{ mso_tenant | default("ansible_test") }} tenant + cisco.mso.mso_tenant: + <<: *mso_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent + +- name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + +- name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + +- name: Remove the common tenant redirect policy + cisco.aci.aci_rest: + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: no + path: "/api/node/mo/uni/tn-common/svcCont.json" + method: post + content: + vnsSvcRedirectPol: + attributes: + name: redirect_policy2 + status: deleted + +- name: Remove the {{ mso_tenant | default("ansible_test") }} from the APIC + cisco.aci.aci_tenant: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/pki/admin.crt b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/pki/admin.crt new file mode 100644 index 000000000..1f797a4c2 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_contract_service_graph_listener/tasks/pki/admin.crt @@ -0,0 +1,14 @@ +-----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-----
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml index 5b8c799db..8dc05d9fb 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -37,7 +37,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -48,7 +48,7 @@ state: present - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -59,7 +59,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -70,7 +70,7 @@ ignore_errors: true - name: Associate non-cloud site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -78,12 +78,12 @@ register: add_ncs - name: Verify add_ncs - assert: + ansible.builtin.assert: that: - add_ncs is not changed - name: Remove a site from a schema with Template1 and Template2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -91,11 +91,13 @@ state: absent ignore_errors: true loop: + - Template4 + - Template3 - Template2 - Template1 - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -105,7 +107,7 @@ # Ensure pre requisites exist - name: Ensure schema 1 with Template1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -115,9 +117,10 @@ - Template1 - Template2 - Template3 + - Template4 - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -125,15 +128,23 @@ state: present - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 vrf: VRF2 state: present +- name: Ensure VRF3 exists + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + vrf: VRF3 + state: present + - name: Ensure L3Out1 Exists - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -143,7 +154,7 @@ state: present - name: Ensure L3Out2 Exists - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -152,9 +163,19 @@ l3out: L3out2 state: present +- name: Ensure L3Out3 Exists + cisco.mso.mso_schema_template_l3out: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + vrf: + name: VRF3 + l3out: L3out3 + state: present + # ADD external EPG to template - name: Add external EPG at template level(check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -172,7 +193,7 @@ register: cm_add_epg - name: Verify cm_add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg is changed - cm_add_epg.previous == {} @@ -181,7 +202,7 @@ - cm_add_epg.current.vrfRef.vrfName == "VRF1" - name: Add external EPG at template level(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -198,7 +219,7 @@ register: nm_add_epg - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg is changed - nm_add_epg.previous == {} @@ -213,7 +234,7 @@ block: # Associate site to schema/template after creating External EPG - name: Add non-cloud site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -222,13 +243,13 @@ register: add_site - name: Verify add_site - assert: + ansible.builtin.assert: that: - add_site.current.siteId is match ("[0-9a-zA-Z]*") - add_site.current.templateName == "Template1" - name: Add site L3Out (normal_mode) - mso_schema_site_l3out: + cisco.mso.mso_schema_site_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -244,7 +265,7 @@ # ADD External EPGs to site - name: ADD External EPG1 to site (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -256,20 +277,20 @@ register: cm_add_epg - name: Verify cm_add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg.current.externalEpgRef.externalEpgName == "ansible_test_1" - cm_add_epg.current.externalEpgRef.templateName == "Template1" - name: Verify cm_add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg is changed - cm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined + when: version.current.version is version('4.0', '<') - name: Add external EPG to site (normal mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -280,21 +301,21 @@ register: nm_add_epg - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg.current.externalEpgRef.externalEpgName == "ansible_test_1" - nm_add_epg.current.externalEpgRef.templateName == "Template1" - cm_add_epg.current.externalEpgRef.schemaId == nm_add_epg.current.externalEpgRef.schemaId - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg is changed - nm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined + when: version.current.version is version('4.0', '<') - name: ADD External EPG1 to site again - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -305,7 +326,7 @@ register: add_epg_again - name: Verify add_epg_again - assert: + ansible.builtin.assert: that: - add_epg_again is not changed - add_epg_again.current.externalEpgRef.externalEpgName == "ansible_test_1" @@ -313,7 +334,7 @@ # QUERY ALL EPG - name: Query all external EPGs in site (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -323,7 +344,7 @@ register: cm_query_all_epgs - name: Query all EPG (normal mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -332,14 +353,14 @@ register: nm_query_all_epgs - name: Verify query_all_epgs - assert: + ansible.builtin.assert: that: - cm_query_all_epgs is not changed - nm_query_all_epgs is not changed # QUERY AN EPG - name: Query epg 1(check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -351,7 +372,7 @@ register: cm_query_epg_1 - name: Query epg 1(normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -362,13 +383,13 @@ register: nm_query_epg_1 - name: Verify cm_query_epg_1 and nm_query_epg_1 - assert: + ansible.builtin.assert: that: - cm_query_epg_1 is not changed - nm_query_epg_1 is not changed - name: Query epg 1 without l3Out - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -378,13 +399,13 @@ register: nm_query_epg_l3out - name: Verify nm_query_epg_l3out - assert: + ansible.builtin.assert: that: - nm_query_epg_l3out is not changed # REMOVE EPG - name: Remove EPG (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -396,13 +417,13 @@ register: cm_remove_epg - name: Verify cm_remove_epg - assert: + ansible.builtin.assert: that: - cm_remove_epg is changed - cm_remove_epg.current == {} - name: Remove EPG (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -413,7 +434,7 @@ register: nm_remove_epg - name: Add site external EPG without L3Out when template external EPG type is on-premise (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -424,13 +445,13 @@ register: nm_add_epg_no_l3out - name: Verify nm_add_epg_no_l3out - assert: + ansible.builtin.assert: that: - nm_add_epg_no_l3out is not changed - nm_add_epg_no_l3out.msg == "L3Out cannot be empty when template external EPG type is 'on-premise'." - name: Remove external EPG at template level - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -439,14 +460,14 @@ register: nm_remove_epg - name: Verify nm_remove_epg - assert: + ansible.builtin.assert: that: - nm_remove_epg is changed - nm_remove_epg.current == {} # Associate site to schema/template before creating External EPG - name: Add non-cloud site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -456,14 +477,30 @@ register: add_site - name: Verify add_site - assert: + ansible.builtin.assert: that: - add_site.current.siteId is match ("[0-9a-zA-Z]*") - add_site.current.templateName == "Template2" + - name: Add non-cloud site to a schema + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + template: Template3 + state: present + when: version.current.version is version('3.3', '>=') + register: add_site + + - name: Verify add_site + assert: + that: + - add_site.current.siteId is match ("[0-9a-zA-Z]*") + - add_site.current.templateName == "Template3" + # Create template External EPG after site association - name: Add external EPG (at template level) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -480,7 +517,7 @@ register: nm_add_ex_epg - name: Verify nm_add_ex_epg - assert: + ansible.builtin.assert: that: - nm_add_ex_epg is changed - nm_add_ex_epg.previous == {} @@ -488,7 +525,7 @@ - nm_add_ex_epg.current.vrfRef.vrfName == "VRF2" - name: Add external EPG to site (normal mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' schema: '{{ mso_schema | default("ansible_test") }}' @@ -499,21 +536,177 @@ register: nm_add_epg - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg.current.externalEpgRef.externalEpgName == "ansible_test_2" - nm_add_epg.current.externalEpgRef.templateName == "Template2" - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg is changed - nm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined + when: version.current.version is version('4.0', '<') + + # Verify L3Out association at site level External EPG + + # 1. Verifying External EPG association with VRFs of different templates in same schema + - name: Execute tasks only for MSO version < 4.0 + when: version.current.version is version('4.0', '<') + block: + # 1.1. Verifying External EPG association with VRF in the same template of the same schema + - name: Add external EPG 1 at Template1 and associate it with the VRF1 in the Template1 + cisco.mso.mso_schema_template_external_epg: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_1 + vrf: + name: VRF1 + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + state: present + register: add_epg1 + + - name: Verify add External EPG 1 + assert: + that: + - add_epg1 is changed + - add_epg1.previous == {} + - add_epg1.current.name == "ansible_test_1" + - add_epg1.current.vrfRef.templateName == "Template1" + - add_epg1.current.vrfRef.vrfName == "VRF1" + - add_epg1.current.vrfRef.schemaId == add_epg1.current.vrfRef.schemaId + + - name: Add external EPG to site and associate it with the L3Out1 in Template1 + cisco.mso.mso_schema_site_external_epg: + <<: *mso_info + site: '{{ mso_site | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_1 + l3out: L3out1 + l3out_template: Template1 + l3out_schema: '{{ mso_schema | default("ansible_test") }}' + state: present + register: add_epg_site_1 + + - name: Verify add_epg_site_1 + assert: + that: + - add_epg_site_1.current.externalEpgRef.externalEpgName == "ansible_test_1" + - add_epg_site_1.current.externalEpgRef.templateName == "Template1" + + - name: Verify add_epg_site_1 + assert: + that: + - add_epg_site_1 is changed + - add_epg_site_1.previous == {} + + - name: Add external EPG to site and associate it with the L3Out3 in Template3 (VRF in same template) + cisco.mso.mso_schema_site_external_epg: + <<: *mso_info + site: '{{ mso_site | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_1 + l3out: L3out3 + l3out_template: Template3 + l3out_schema: '{{ mso_schema | default("ansible_test") }}' + state: present + register: add_epg_site1_l3out3 + + - name: Verify add_epg_site1_l3out3 + assert: + that: + - add_epg_site1_l3out3.current.externalEpgRef.externalEpgName == "ansible_test_1" + - add_epg_site1_l3out3.current.externalEpgRef.templateName == "Template1" + + - name: Verify add_epg_site1_l3out3 + assert: + that: + - add_epg_site1_l3out3 is changed + - add_epg_site1_l3out3.previous.l3outDn == "uni/tn-ansible_test/out-L3out1" + + # 1.2. Verifying External EPG association with VRF in the different template of the same schema + - name: Add external EPG 1 at Template1 and associate it with the VRF3 in Template3 + cisco.mso.mso_schema_template_external_epg: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_3 + vrf: + name: VRF3 + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + state: present + register: add_epg3 + + - name: Verify add External EPG 3 + assert: + that: + - add_epg3 is changed + - add_epg3.previous == {} + - add_epg3.current.name == "ansible_test_3" + - add_epg3.current.vrfRef.templateName == "Template3" + - add_epg3.current.vrfRef.vrfName == "VRF3" + - add_epg3.current.vrfRef.schemaId == add_epg3.current.vrfRef.schemaId + + # ExternalEpg and its L3Out are associated with different VRF in a template + - name: Add external EPG to site and associate it with the L3Out1 in Template1 + cisco.mso.mso_schema_site_external_epg: + <<: *mso_info + site: '{{ mso_site | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_3 + l3out: L3out1 + l3out_template: Template1 + l3out_schema: '{{ mso_schema | default("ansible_test") }}' + state: present + register: add_epg_site_3 + + - name: Verify add_epg_site_3 + assert: + that: + - add_epg_site_3.current.externalEpgRef.externalEpgName == "ansible_test_3" + - add_epg_site_3.current.externalEpgRef.templateName == "Template1" + - add_epg_site_3.current.l3outRef is match('/schemas/[0-9a-zA-Z]*/templates/Template1/l3outs/L3out1') + + - name: Verify add_epg_site_3 + assert: + that: + - add_epg_site_3 is changed + - add_epg_site_3.previous == {} + + - name: Add external EPG to site and associate it with the L3Out3 in Template3 + cisco.mso.mso_schema_site_external_epg: + <<: *mso_info + site: '{{ mso_site | default("ansible_test") }}' + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + external_epg: ansible_test_3 + l3out: L3out3 + l3out_template: Template3 + l3out_schema: '{{ mso_schema | default("ansible_test") }}' + state: present + register: add_epg_site_3_l3out3 + + - name: Verify add_epg_site_3_l3out3 + assert: + that: + - add_epg_site_3_l3out3.current.externalEpgRef.externalEpgName == "ansible_test_1" + - add_epg_site_3_l3out3.current.externalEpgRef.templateName == "Template1" + + - name: Verify add_epg_site_3_l3out3 + assert: + that: + - add_epg_site_3_l3out3 is changed + - add_epg_site_3_l3out3.previous == {} # QUERY NON-EXISTING external EPG - name: Query non-existing External EPG (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -526,7 +719,7 @@ register: cm_query_non_external_epg - name: Query non-existing External EPG (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -538,7 +731,7 @@ register: nm_query_non_external_epg - name: Verify cm_query_non_external_epg and nm_query_non_external_epg - assert: + ansible.builtin.assert: that: - cm_query_non_external_epg is not changed - nm_query_non_external_epg is not changed @@ -546,7 +739,7 @@ # USE NON-EXISTING STATE - name: non_existing_state state (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -558,7 +751,7 @@ register: cm_non_existing_state - name: non_existing_state state (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -570,7 +763,7 @@ register: nm_non_existing_state - name: Verify cm_non_existing_state and nm_non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -578,7 +771,7 @@ # USE A NON_EXISTING_TEMPLATE - name: non_existing_template (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -591,7 +784,7 @@ register: cm_non_existing_template - name: non_existing_template site association(normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -603,15 +796,15 @@ register: nm_non_existing_template - name: Verify cm_non_existing_template and nm_non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed - - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{':'}} Template1, Template2, Template3" + - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non_existing_template' not matching existing template(s){{':'}} Template1, Template2, Template3, Template4" # USE A NON_EXISTING_SCHEMA - name: non_existing_schema (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -624,7 +817,7 @@ register: cm_non_existing_schema - name: non_existing_schema (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: non_existing_schema site: '{{ mso_site | default("ansible_test") }}' @@ -636,7 +829,7 @@ register: nm_non_existing_schema - name: Verify cm_non_existing_schema and nm_non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -644,7 +837,7 @@ # USE A NON_EXISTING_SITE - name: non_existing_site (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non_existing_site @@ -657,7 +850,7 @@ register: cm_non_existing_site - name: non_existing_site (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: non_existing_site @@ -669,7 +862,7 @@ register: nm_non_existing_site - name: Verify cm_non_existing_site and nm_non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -677,11 +870,11 @@ # USE A NON_EXISTING_SITE_TEMPLATE - name: non_existing_site_template (check_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' - template: Template3 + template: Template4 external_epg: ansible_test_2 l3out: L3out1 state: query @@ -690,11 +883,11 @@ register: cm_non_existing_site_template - name: non_existing_site_template (normal_mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' - template: Template3 + template: Template4 external_epg: ansible_test_2 l3out: L3out1 state: query @@ -702,32 +895,32 @@ register: nm_non_existing_site_template - name: Verify cm_non_existing_site_template and nm_non_existing_site_template - assert: + ansible.builtin.assert: that: - cm_non_existing_site_template is not changed - nm_non_existing_site_template is not changed - - cm_non_existing_site_template.msg == nm_non_existing_site_template.msg == "Provided site 'ansible_test' not associated with template 'Template3'. Site is currently associated with template(s){{':'}} Template1, Template2" + - cm_non_existing_site_template.msg == nm_non_existing_site_template.msg == "Provided site 'ansible_test' not associated with template 'Template4'. Site is currently associated with template(s){{':'}} Template1, Template2, Template3" # USE A TEMPLATE WITHOUT ANY SITE - - name: Add site L3Out to Schema Template2 without any site associated (check mode) - mso_schema_site_external_epg: + - name: Add site External EPG to Schema Template4 without any site associated (check mode) + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' - template: Template3 - external_epg: ansible_test_2 + template: Template4 + external_epg: ansible_test_4 l3out: L3out1 state: present check_mode: true ignore_errors: true register: cm_no_site_associated - - name: Add site L3Out to Template2 without any site associated (normal mode) - mso_schema_site_external_epg: + - name: Add site External EPG to Template4 without any site associated (normal mode) + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' - template: Template3 + template: Template4 external_epg: ansible_test_2 l3out: L3out1 state: present @@ -735,99 +928,99 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed - - cm_no_site_associated.msg == nm_no_site_associated.msg == "Provided site 'ansible_test' not associated with template 'Template3'. Site is currently associated with template(s){{':'}} Template1, Template2" + - cm_no_site_associated.msg == nm_no_site_associated.msg == "Provided site 'ansible_test' not associated with template 'Template4'. Site is currently associated with template(s){{':'}} Template1, Template2, Template3" # Verify route_reachability argument when template_external_epg is associated with Azure site and # template_external_epg type argument is set to cloud - name: Ensure ANP exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' - template: Template2 - anp: ANP2 + template: Template4 + anp: ANP4 state: present -- name: Ensure VRF3 exists - mso_schema_template_vrf: +- name: Ensure VRF4 exists + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' - template: Template3 - vrf: VRF3 + template: Template4 + vrf: VRF4 state: present -- name: Ensure L3Out3 Exists - mso_schema_template_l3out: +- name: Ensure L3Out4 Exists + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' - template: Template3 + template: Template4 vrf: - name: VRF3 - l3out: L3out3 + name: VRF4 + l3out: L3out4 state: present -- name: Add external EPG3 at template3 level type cloud (normal mode) - mso_schema_template_external_epg: +- name: Add external EPG4 at template4 level type cloud (normal mode) + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' - template: Template3 - external_epg: ext_epg_3 + template: Template4 + external_epg: ext_epg_4 type: cloud vrf: - name: VRF3 + name: VRF4 schema: '{{ mso_schema | default("ansible_test") }}' - template: Template3 + template: Template4 anp: - name: ANP3 + name: ANP4 schema: '{{ mso_schema | default("ansible_test") }}' - template: Template3 + template: Template4 state: present - register: nm_add_ext_epg_3 + register: nm_add_ext_epg_4 -- name: Add azure site to a schema Template3 - mso_schema_site: +- name: Add azure site to a schema Template4 + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template3 + template: Template4 state: present when: version.current.version is version('3.3', '>=') register: add_cloud_site - name: Add external EPG to site (normal mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template3 - external_epg: ext_epg_3 + template: Template4 + external_epg: ext_epg_4 route_reachability: site-ext state: present register: nm_add_ext_epg_site - name: Verify nm_add_ext_epg_site - assert: + ansible.builtin.assert: that: - - nm_add_ext_epg_site.current.externalEpgRef.externalEpgName == "ext_epg_3" + - nm_add_ext_epg_site.current.externalEpgRef.externalEpgName == "ext_epg_4" - nm_add_ext_epg_site.current.routeReachabilityInternetType == "site-ext" - name: Add external EPG to site again(normal mode) - mso_schema_site_external_epg: + cisco.mso.mso_schema_site_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template3 - external_epg: ext_epg_3 + template: Template4 + external_epg: ext_epg_4 route_reachability: site-ext state: present register: nm_add_ext_epg_site_again - name: Verify nm_add_ext_epg_site_again - assert: + ansible.builtin.assert: that: - nm_add_ext_epg_site_again is not changed - - nm_add_ext_epg_site_again.current.externalEpgRef.externalEpgName == "ext_epg_3" + - nm_add_ext_epg_site_again.current.externalEpgRef.externalEpgName == "ext_epg_4" - nm_add_ext_epg_site_again.current.routeReachabilityInternetType == "site-ext"
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg_selector/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg_selector/tasks/main.yml index 3701ba781..49e821980 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg_selector/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_external_epg_selector/tasks/main.yml @@ -6,13 +6,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,13 +23,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure azure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -40,7 +40,7 @@ state: present - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -51,7 +51,7 @@ state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -60,7 +60,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -71,7 +71,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -81,7 +81,7 @@ state: present - name: Associate aws site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -92,7 +92,7 @@ state: present - name: Associate azure site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -100,7 +100,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -111,7 +111,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -119,7 +119,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -127,7 +127,7 @@ state: present - name: Ensure Template 1 with AP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -135,7 +135,7 @@ state: present - name: Ensure L3Out Exists - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -145,7 +145,7 @@ state: present - name: Ensure External EPG1 exists - mso_schema_template_externalepg: + cisco.mso.mso_schema_template_externalepg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -165,7 +165,7 @@ state: present - name: Ensure External EPG2 exists - mso_schema_template_externalepg: + cisco.mso.mso_schema_template_externalepg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -185,7 +185,7 @@ state: present - name: Add Azure site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -194,7 +194,7 @@ when: version.current.version is version('3', '<') - name: Add AWS site to a schema - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -203,7 +203,7 @@ when: version.current.version is version('3', '<') - name: Add a new CIDR in VRF1 at site level - mso_schema_site_vrf_region_cidr: &mso_present + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -219,7 +219,7 @@ # ADD SELECTORS - name: Add a selector to Azure in check mode - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -235,7 +235,7 @@ register: cm_azure_e1 - name: Verify cm_azure_e1 - assert: + ansible.builtin.assert: that: - cm_azure_e1 is changed - cm_azure_e1.previous == {} @@ -244,7 +244,7 @@ - name: Add a selector to Azure in normal mode - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -259,7 +259,7 @@ register: nm_azure_e1 - name: Verify nm_azure_e1 - assert: + ansible.builtin.assert: that: - nm_azure_e1 is changed - nm_azure_e1.previous == {} @@ -267,7 +267,7 @@ - nm_azure_e1.current.subnets[0].name == 'e1' - name: Add a selector to AWS in normal mode - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -282,7 +282,7 @@ register: nm_aws_e2 - name: Verify nm_aws_e2 - assert: + ansible.builtin.assert: that: - nm_aws_e2 is changed - nm_aws_e2.previous == {} @@ -290,7 +290,7 @@ - nm_aws_e2.current.subnets[0].name == 'e2' - name: Add a selector to AWS in normal mode again - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -305,12 +305,12 @@ register: nm_aws_e1_again - name: Verify nm_aws_e1_again - assert: + ansible.builtin.assert: that: - nm_aws_e1_again is not changed - name: Add a selector to AWS in normal mode again with no expressions - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -322,14 +322,14 @@ register: nm_aws_e1_again_noexp - name: Verify nm_aws_e1_again_noexp - assert: + ansible.builtin.assert: that: - nm_aws_e1_again_noexp is not changed - nm_aws_e1_again_noexp.msg == "Missing expressions in selector" # QUERY A SELECTOR - name: Query a selector of Azure - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -340,13 +340,13 @@ register: query_azure_e1 - name: Verify query_azure_e1 - assert: + ansible.builtin.assert: that: - query_azure_e1 is not changed # QUERY ALL - name: Query all selectors of Azure - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -356,13 +356,13 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed # REMOVE A SELECTOR - name: Remove a selector of Azure - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -373,12 +373,12 @@ register: remove_azure_e1 - name: Verify remove_azure_e1 - assert: + ansible.builtin.assert: that: - remove_azure_e1 is changed - name: Remove a selector of Azure again - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -390,13 +390,13 @@ register: remove_azure_e1_again - name: Verify remove_azure_e1_again - assert: + ansible.builtin.assert: that: - remove_azure_e1_again is not changed # QUERY REMOVED SELECTOR - name: Query a removed selector of Azure - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -408,13 +408,13 @@ register: query_removed_azure_e1 - name: Verify query_removed_azure_e1 - assert: + ansible.builtin.assert: that: - query_removed_azure_e1 is not changed # USE A NON-EXISTING SCHEMA - name: Non-existing schema for selector (check_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: non_existing_schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -425,7 +425,7 @@ register: cm_non_existing_schema - name: Non-existing schema for selector (normal_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: non_existing_schema site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -435,7 +435,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -444,7 +444,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for selector (check_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -455,7 +455,7 @@ register: cm_non_existing_template - name: Non-existing template for selector (normal_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -465,7 +465,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -474,7 +474,7 @@ # USE A NON-EXISTING SITE - name: Non-existing site for static port (check_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -485,7 +485,7 @@ register: cm_non_existing_site - name: Non-existing site for static port (normal_mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -495,7 +495,7 @@ register: nm_non_existing_site - name: Verify non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -505,7 +505,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site external EPG selector to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -516,7 +516,7 @@ register: cm_no_site_associated - name: Add site external EPG selector to Template 3 without any site associated (normal mode) - mso_schema_site_external_epg_selector: + cisco.mso.mso_schema_site_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -526,7 +526,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml new file mode 100644 index 000000000..1d5585200 --- /dev/null +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml @@ -0,0 +1,237 @@ +# Test code for the MSO modules +# Copyright: (c) 2024, Sabari Jaganathan (@sajagana) <sajagana@cisco.com> + +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) + +- name: Test that we have an ACI MultiSite host, username and password + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." + when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined + +# CLEAN ENVIRONMENT +- name: Set vars + ansible.builtin.set_fact: + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" + output_level: '{{ mso_output_level | default("info") }}' + +- name: Query system information + cisco.aci.aci_system: + <<: *aci_info + id: 1 + state: query + register: aci_version + +- name: Remove an existing tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: ansible_test + state: absent + +- name: Add a tenant on APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: ansible_test + +# Site type checking for L4-L7 Device configuration +# QUERY OBJECTS +- name: Query cloud provider object + cisco.aci.aci_cloud_provider: + <<: *aci_info + state: query + register: query_cloud + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '>=') + +- name: Set vars + ansible.builtin.set_fact: + query_cloud: + current: [] + when: aci_version.current.0.topSystem.attributes.version is version('4.1', '<') + +- name: Verify query_cloud for all sites + ansible.builtin.assert: + that: + - query_cloud is not changed + +- name: Verify query_cloud for Cloud Sites + ansible.builtin.assert: + that: + - query_cloud is not changed + - query_cloud.current.0.cloudProvP.attributes.environment == "public-cloud" + - '"vendor" in query_cloud.current.0.cloudProvP.attributes' + when: + - query_cloud.current | length > 0 # This condition will execute only cloud sites + +# Cloud Site block +- name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Add azure_vrf to the ansible_test + cisco.aci.aci_vrf: + <<: *aci_info + tenant: ansible_test + vrf: azure_vrf + + - name: Add azure_ctxprof to the ansible_test + cisco.aci.aci_cloud_ctx_profile: + <<: *aci_info + tenant: ansible_test + cloud: azure + name: azure_ctxprof + vrf: azure_vrf + region: westus2 + primary_cidr: "1.1.1.2/32" + state: present + + - name: Add the subnet to the azure_ctxprof + cisco.aci.aci_rest: + <<: *aci_info + path: api/mo/uni/tn-ansible_test/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32].json + method: post + content: + cloudSubnet: + attributes: + ip: 1.1.1.2/32 + name: azure_ctxprof_cidr + children: + - cloudRsZoneAttach: + attributes: + tDn: "uni/clouddomp/provp-azure/region-westus2/zone-default" + + - name: Add the ansible_test_adc device - ThirdParty_LB + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test/cld-ansible_test_adc.json + method: post + content: + cloudLDev: + attributes: + targetMode: unspecified + name: ansible_test_adc + svcType: ADC + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-ansible_test/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_LB_Inf + children: + - cloudEPSelector: + attributes: + name: TP_LB_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the ansible_test_firewall1 device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test/cld-ansible_test_firewall1.json + method: post + content: + cloudLDev: + attributes: + name: ansible_test_firewall1 + svcType: FW + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-ansible_test/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_FW_Inf1 + children: + - cloudEPSelector: + attributes: + name: TP_FW_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the ansible_test_firewall2 device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test/cld-ansible_test_firewall2.json + method: post + content: + cloudLDev: + attributes: + name: ansible_test_firewall2 + svcType: FW + children: + - cloudRsLDevToCtx: + attributes: + tDn: uni/tn-ansible_test/ctx-azure_vrf + - cloudLIf: + attributes: + allowAll: "yes" + name: TP_FW_Inf2 + children: + - cloudEPSelector: + attributes: + name: TP_FW_Inf_Selector + matchExpression: IP=='1.1.1.1' + + - name: Add the ansible_test_other device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test/clb-ansible_test_other.json + method: post + content: + cloudLB: + attributes: + name: ansible_test_other + type: network + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: "uni/tn-ansible_test/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]" + + - name: Add the ansible_test_app_lb device + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test/clb-ansible_test_app_lb.json + method: post + content: + cloudLB: + attributes: + name: ansible_test_app_lb + type: application + children: + - cloudRsLDevToCloudSubnet: + attributes: + tDn: "uni/tn-ansible_test/ctxprofile-azure_ctxprof/cidr-[1.1.1.2/32]/subnet-[1.1.1.2/32]" + +- name: Execute tasks only for non-cloud sites + when: query_cloud.current | length == 0 # Non-Cloud Site block + block: + - name: Add devices to APIC + cisco.aci.aci_rest: + <<: *aci_info + path: /api/node/mo/uni/tn-ansible_test.json + method: post + content: + vnsLDevVip: + attributes: + svcType: "{{ item.type }}" + managed: "false" + name: "{{ item.name }}" + children: + - vnsCDev: + attributes: + name: "{{ item.name }}" + loop: + - type: FW + name: ansible_test_firewall1 + - type: FW + name: ansible_test_firewall2 + - type: ADC + name: ansible_test_adc + - type: OTHERS + name: ansible_test_other diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml index a9b60bab6..369fde0b7 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml @@ -4,25 +4,32 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: - msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined - # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info - host: '{{ mso_hostname }}' - username: '{{ mso_username }}' - password: '{{ mso_password }}' - validate_certs: '{{ mso_validate_certs | default(false) }}' - use_ssl: '{{ mso_use_ssl | default(true) }}' - use_proxy: '{{ mso_use_proxy | default(false) }}' + host: "{{ mso_hostname }}" + username: "{{ mso_username }}" + password: "{{ mso_password }}" + validate_certs: "{{ mso_validate_certs | default(false) }}" + use_ssl: "{{ mso_use_ssl | default(true) }}" + use_proxy: "{{ mso_use_proxy | default(false) }}" + output_level: '{{ mso_output_level | default("info") }}' + aci_info: &aci_info + host: "{{ apic_hostname }}" + username: "{{ apic_username }}" + password: "{{ apic_password }}" + validate_certs: "{{ apic_validate_certs | default(false) }}" + use_ssl: "{{ apic_use_ssl | default(true) }}" + use_proxy: "{{ apic_use_proxy | default(true) }}" output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -32,764 +39,1161 @@ - name: Execute tasks only for MSO version >= 3.3 when: version.current.version is version('3.3', '>=') block: - - name: Ensure site exists - cisco.mso.mso_site: - <<: *mso_info - site: '{{ mso_site | default("ansible_test") }}' - apic_username: '{{ apic_username }}' - apic_password: '{{ apic_password }}' - apic_site_id: '{{ apic_site_id | default(101) }}' - urls: - - https://{{ apic_hostname }} - state: present - ignore_errors: true - - - name: Remove schemas - cisco.mso.mso_schema: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - state: absent - - - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: '{{ item }}' - state: absent - loop: - - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' - - - name: Ensure tenant ansible_test exist - cisco.mso.mso_tenant: - <<: *mso_info - tenant: ansible_test - users: - - '{{ mso_username }}' - state: present - - - name: Associate site with ansible_test - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: '{{ mso_site | default("ansible_test") }}' - state: present - - - name: Add a tenant on APIC - cisco.aci.aci_tenant: - host: '{{ apic_hostname }}' - username: '{{ apic_username }}' - password: '{{ apic_password }}' - validate_certs: no - name: "ansible_test" - - - name: Add devices to APIC - cisco.aci.aci_rest: - host: '{{ apic_hostname }}' - username: '{{ apic_username }}' - password: '{{ apic_password }}' - validate_certs: no - path: /api/node/mo/uni/tn-ansible_test.json - method: post - content: - vnsLDevVip: - attributes: - svcType: '{{ item.type }}' - managed: 'false' - name: '{{ item.name }}' - children: - - vnsCDev: - attributes: - name: '{{ item.name }}' - loop: - - { type: FW, name: ansible_test_firewall1 } - - { type: FW, name: ansible_test_firewall2 } - - { type: ADC, name: ansible_test_adc } - - { type: OTHERS, name: ansible_test_other } - - - name: Ensure schema 1 with Template1 and 2 exist - cisco.mso.mso_schema_template: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - tenant: ansible_test - template: '{{ item }}' - state: present - loop: - - 'Template1' - - 'Template2' - - - name: Ensure schema 2 with Template1 exists - cisco.mso.mso_schema_template: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}_2' - tenant: ansible_test - template: Template1 - state: present - - - name: Add Node1 - cisco.mso.mso_service_node_type: - <<: *mso_info - name: ansible_test_other1 - display_name: ansible_test_other1 - state: present - - - name: Add Node2 - cisco.mso.mso_service_node_type: - <<: *mso_info - name: ansible_test_other2 - display_name: ansible_test_other2 - state: present - - - name: Create a service graph 1 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - display_name: sg1 - service_nodes: - - type: firewall - filter_after_first_node: allow_all - state: present - - - name: Create service graph 2 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG2 - display_name: sg2 - service_nodes: - - type: firewall - - type: load-balancer - filter_after_first_node: allow_all - state: present - register: sg1_again - - - name: Create service graph 3 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG3 - display_name: sg3 - service_nodes: - - type: firewall - - type: load-balancer - - type: other - filter_after_first_node: allow_all - state: present - register: sg1_again - - - name: Create a service graph 4 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - display_name: sg4 - service_nodes: - - type: other - - type: load-balancer - - type: firewall - filter_after_first_node: filters_from_contract - state: present - - - name: Create a service graph 5 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG5 - display_name: sg5 - service_nodes: - - type: other - - type: firewall - - type: firewall - filter_after_first_node: filters_from_contract - state: present - - - name: Create a service graph 6 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG6 - display_name: sg6 - service_nodes: - - type: other - - type: other - - type: other - filter_after_first_node: filters_from_contract - state: present - - - name: Create a service graph 7 at Template level - cisco.mso.mso_schema_template_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG7 - display_name: sg7 - service_nodes: - - type: load-balancer - - type: load-balancer - filter_after_first_node: filters_from_contract - state: present - - - name: Add physical site to a schema - cisco.mso.mso_schema_site: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: '{{ mso_site | default("ansible_test") }}' - template: Template1 - state: present - - - name: Add a new Graph at site level (check mode) - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - state: present - register: cm_sg1 - check_mode: true - - - name: Verify cm_sg1 - assert: - that: - - cm_sg1 is changed - - cm_sg1.current.serviceGraphRef.serviceGraphName == "SG1" - - cm_sg1.current.serviceGraphRef.templateName == "Template1" - - cm_sg1.current.serviceNodes | length == 1 - - cm_sg1.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - - name: Add a new Graph SG1 at site level (normal mode) - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - state: present - register: nm_sg1 - - - name: Verify change_sg1 - assert: - that: - - nm_sg1 is changed - - nm_sg1.current.serviceGraphRef.serviceGraphName == "SG1" - - nm_sg1.current.serviceGraphRef.templateName == "Template1" - - nm_sg1.current.serviceNodes | length == 1 - - nm_sg1.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - - name: Add Graph SG1 at site level again - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - state: present - register: nm_sg1_again - - - name: Verify change_sg1 - assert: - that: - - nm_sg1_again is not changed - - nm_sg1_again.current.serviceGraphRef.serviceGraphName == "SG1" - - nm_sg1_again.current.serviceGraphRef.templateName == "Template1" - - nm_sg1_again.current.serviceNodes | length == 1 - - nm_sg1_again.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - - name: Change service graph SG1 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall2 - state: present - register: change_sg1 - - - name: Verify change_sg1 - assert: - that: - - change_sg1 is changed - - change_sg1.current.serviceGraphRef.serviceGraphName == "SG1" - - change_sg1.current.serviceGraphRef.templateName == "Template1" - - change_sg1.current.serviceNodes | length == 1 - - change_sg1.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall2" - - - name: Add a new Graph SG2 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG2 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - - name: ansible_test_adc - state: present - register: sg2 - - - name: Verify sg2 - assert: - that: - - sg2 is changed - - sg2.current.serviceGraphRef.serviceGraphName == "SG2" - - sg2.current.serviceGraphRef.templateName == "Template1" - - sg2.current.serviceNodes | length == 2 - - sg2.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - sg2.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - - name: Add a new Graph SG3 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG3 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - - name: ansible_test_adc - - name: ansible_test_other - state: present - register: sg3 - - - name: Verify sg3 - assert: - that: - - sg3 is changed - - sg3.current.serviceGraphRef.serviceGraphName == "SG3" - - sg3.current.serviceGraphRef.templateName == "Template1" - - sg3.current.serviceNodes | length == 3 - - sg3.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - sg3.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - sg3.current.serviceNodes.2.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - - name: Add a new Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_adc - - name: ansible_test_firewall1 - state: present - register: sg4 - - - name: Verify sg4 - assert: - that: - - sg4 is changed - - sg4.current.serviceGraphRef.serviceGraphName == "SG4" - - sg4.current.serviceGraphRef.templateName == "Template1" - - sg4.current.serviceNodes | length == 3 - - sg4.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - sg4.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - sg4.current.serviceNodes.2.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_adc - - name: ansible_test_firewall2 - state: present - register: change1_sg4 - - - name: Verify change1_sg4 - assert: - that: - - change1_sg4 is changed - - change1_sg4.current.serviceGraphRef.serviceGraphName == "SG4" - - change1_sg4.current.serviceGraphRef.templateName == "Template1" - - change1_sg4.current.serviceNodes | length == 3 - - change1_sg4.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - change1_sg4.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - change1_sg4.current.serviceNodes.2.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall2" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - state: present - ignore_errors: true - register: change2_sg4 - - - name: Verify change2_sg4 - assert: - that: - - change2_sg4 is not changed - - change2_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_adc - state: present - ignore_errors: true - register: change3_sg4 - - - name: Verify change3_sg4 - assert: - that: - - change3_sg4 is not changed - - change3_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_firewall1 - state: present - ignore_errors: true - register: change4_sg4 - - - name: Verify change4_sg4 - assert: - that: - - change4_sg4 is not changed - - change4_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_adc - state: present - ignore_errors: true - register: change5_sg4 - - - name: Verify change5_sg4 - assert: - that: - - change5_sg4 is not changed - - change5_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '2' service node(s) were given for the service graph" - - - name: Change Graph SG4 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG4 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_other - - name: ansible_test_adc - state: present - ignore_errors: true - register: change6_sg4 - - - name: Verify change6_sg4 - assert: - that: - - change6_sg4 is not changed - - change6_sg4.msg == "Provided device 'ansible_test_other' of type 'ADC' does not exist." - - - name: Add Graph SG5 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG5 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_firewall1 - - name: ansible_test_firewall1 - state: present - register: sg5 - - - name: Verify sg5 - assert: - that: - - sg5 is changed - - sg5.current.serviceGraphRef.serviceGraphName == "SG5" - - sg5.current.serviceGraphRef.templateName == "Template1" - - sg5.current.serviceNodes | length == 3 - - sg5.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - sg5.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - sg5.current.serviceNodes.2.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_firewall1" - - - name: Add Graph SG6 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG6 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_other - - name: ansible_test_other - - name: ansible_test_other - state: present - register: sg6 - - - name: Verify sg6 - assert: - that: - - sg6 is changed - - sg6.current.serviceGraphRef.serviceGraphName == "SG6" - - sg6.current.serviceGraphRef.templateName == "Template1" - - sg6.current.serviceNodes | length == 3 - - sg6.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - sg6.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - sg6.current.serviceNodes.2.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_other" - - - name: Add Graph SG7 at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG7 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - devices: - - name: ansible_test_adc - - name: ansible_test_adc - state: present - register: sg7 - - - name: Verify sg7 - assert: - that: - - sg7 is changed - - sg7.current.serviceGraphRef.serviceGraphName == "SG7" - - sg7.current.serviceGraphRef.templateName == "Template1" - - sg7.current.serviceNodes | length == 2 - - sg7.current.serviceNodes.0.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - sg7.current.serviceNodes.1.device.dn == "uni/tn-ansible_test/lDevVip-ansible_test_adc" - - - name: Query service graph SG at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - state: query - register: query_sg - - - name: Verify query_sg - assert: - that: - - query_sg is not changed - - query_sg.current.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") - - - name: Query all service graphs at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - state: query - register: query_all - - - name: Verify query_all - assert: - that: - - query_all is not changed - - query_all.current | length == 7 - - - name: Query non_existing service graph at site level - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - site: '{{ mso_site | default("ansible_test") }}' - service_graph: non_existent - tenant: ansible_test - state: query - ignore_errors: true - register: query_non_existing_sg - - - name: Verify query_non_existing_sg - assert: - that: - - query_non_existing_sg.msg == "Service Graph 'non_existent' not found" - - - name: Use non_existing schema - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: non_existing_schema - template: Template1 - service_graph: SG - tenant: ansible_test - site: '{{ mso_site | default("ansible_test") }}' - state: query - ignore_errors: true - register: query_non_existing_schema - - - name: Verify non_existing_schema - assert: - that: - - query_non_existing_schema is not changed - - query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." - - - name: Use non_existing template - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: non_existing_template - service_graph: SG - tenant: ansible_test - site: '{{ mso_site | default("ansible_test") }}' - state: query - ignore_errors: true - register: query_non_existing_template - - - name: Verify query_non_existing_template - assert: - that: - - query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1, Template2" - - - name: Use non_existing_site_template - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: '{{ mso_site | default("ansible_test") }}' - service_graph: SG - template: Template2 - tenant: ansible_test - state: query - ignore_errors: true - register: nm_non_existing_site_template - - - name: Verify cm_non_existing_site_template and nm_non_existing_site_template - assert: - that: - - nm_non_existing_site_template is not changed - - nm_non_existing_site_template.msg == "Provided site-template association 'ansible_test-Template2' does not exist." - - - name: Add site Service Graph to Template2 without any site association - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}_2' - site: '{{ mso_site | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - tenant: ansible_test - devices: - - name: ansible_test_firewall2 - state: present - ignore_errors: true - register: nm_no_site_associated - - - name: Verify nm_no_site_associated - assert: - that: - - nm_no_site_associated is not changed - - nm_no_site_associated.msg == "No site associated with template 'Template1'. Associate the site with the template using mso_schema_site." - - - name: Remove service graph from site level(check mode) - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - site: '{{ mso_site | default("ansible_test") }}' - tenant: ansible_test - state: absent - register: rm_sg_cm - check_mode: true - - - name: Verify rm_sg_cm - assert: - that: - - rm_sg_cm is changed - - rm_sg_cm.current == {} - - rm_sg_cm.previous.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") - - - name: Remove service graph from site level (normal mode) - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - tenant: ansible_test - site: '{{ mso_site | default("ansible_test") }}' - state: absent - register: rm_sg - - - name: Verify rm_sg - assert: - that: - - rm_sg is changed - - rm_sg.current == {} - - rm_sg.previous.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") - - - name: Remove service graph again - cisco.mso.mso_schema_site_service_graph: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - service_graph: SG1 - tenant: ansible_test - site: '{{ mso_site | default("ansible_test") }}' - state: absent - register: rm_sg_again - - - name: Verify rm_sg_again - assert: - that: - - rm_sg_again is not changed - - rm_sg_again.current == {} - - rm_sg_again.previous == {} - when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined + - name: Ensure site exists + cisco.mso.mso_site: + <<: *mso_info + site: '{{ mso_site | default("ansible_test") }}' + apic_username: "{{ apic_username }}" + apic_password: "{{ apic_password }}" + apic_site_id: "{{ apic_site_id | default(101) }}" + urls: + - https://{{ apic_hostname }} + state: present + ignore_errors: true + + - name: Remove schemas + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + state: absent + + - name: Ensure sites removed from tenant ansible_test + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: ansible_test + site: "{{ item }}" + state: absent + loop: + - '{{ mso_site | default("ansible_test") }}' + - 'aws_{{ mso_site | default("ansible_test") }}' + - 'azure_{{ mso_site | default("ansible_test") }}' + - '{{ mso_site | default("azure_ansible_test_2") }}' + ignore_errors: true + + - name: Ensure tenant ansible_test exist + cisco.mso.mso_tenant: + <<: *mso_info + tenant: ansible_test + users: + - "{{ mso_username }}" + state: present + + - name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + + - name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + + - name: Include tasks for L4-L7 devices + ansible.builtin.include_tasks: l4_l7_devices.yml + + - name: Set ansible_network_os to cisco.nd.nd and ansible_connection to ansible.netcommon.httpapi + ansible.builtin.set_fact: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: cisco.nd.nd + + - name: Reset the ansible_connection to access the MSO/NDO + ansible.builtin.meta: reset_connection + + - name: Associate site with ansible_test + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: ansible_test + site: '{{ mso_site | default("ansible_test") }}' + state: present + when: + - query_cloud.current | length == 0 + + - name: Associate Azure site with ansible_test # Azure Task + cisco.mso.mso_tenant_site: + <<: *mso_info + tenant: ansible_test + site: azure_ansible_test_2 + cloud_account: "uni/tn-{{ mso_tenant | default('ansible_test') }}/act-[{{ azure_cloud_account | default(123) }}]-vendor-azure" + state: present + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + + - name: Ensure schema 1 with Template1, 2 and 3 exist + cisco.mso.mso_schema_template: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + tenant: ansible_test + template: "{{ item }}" + state: present + loop: + - "Template1" + - "Template2" + - "Template3" # Azure Task + + - name: Ensure schema 2 with Template1 exists + cisco.mso.mso_schema_template: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}_2' + tenant: ansible_test + template: Template1 + state: present + + - name: Add Node1 + cisco.mso.mso_service_node_type: + <<: *mso_info + name: ansible_test_other1 + display_name: ansible_test_other1 + state: present + + - name: Add Node2 + cisco.mso.mso_service_node_type: + <<: *mso_info + name: ansible_test_other2 + display_name: ansible_test_other2 + state: present + + - name: Create a service graph 1 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + display_name: sg1 + service_nodes: + - type: firewall + filter_after_first_node: allow_all + state: present + + - name: Create service graph 2 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG2 + display_name: sg2 + service_nodes: + - type: firewall + - type: load-balancer + filter_after_first_node: allow_all + state: present + register: sg1_again + + - name: Create service graph 3 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG3 + display_name: sg3 + service_nodes: + - type: firewall + - type: load-balancer + - type: other + filter_after_first_node: allow_all + state: present + register: sg1_again + + - name: Create a service graph 4 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + display_name: sg4 + service_nodes: + - type: other + - type: load-balancer + - type: firewall + filter_after_first_node: filters_from_contract + state: present + + - name: Create a service graph 5 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG5 + display_name: sg5 + service_nodes: + - type: other + - type: firewall + - type: firewall + filter_after_first_node: filters_from_contract + state: present + + - name: Create a service graph 6 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG6 + display_name: sg6 + service_nodes: + - type: other + - type: other + - type: other + filter_after_first_node: filters_from_contract + state: present + + - name: Create a service graph 7 at Template level + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG7 + display_name: sg7 + service_nodes: + - type: load-balancer + - type: load-balancer + filter_after_first_node: filters_from_contract + state: present + + - name: Add physical site to a schema + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + template: Template1 + state: present + + - name: Add a new Graph at site level (check mode) + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + state: present + register: cm_sg1 + check_mode: true + + - name: Verify cm_sg1 + ansible.builtin.assert: + that: + - cm_sg1 is changed + - cm_sg1.current.serviceGraphRef.serviceGraphName == "SG1" + - cm_sg1.current.serviceGraphRef.templateName == "Template1" + - cm_sg1.current.serviceNodes | length == 1 + - cm_sg1.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + + - name: Add a new Graph SG1 at site level (normal mode) + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + state: present + register: nm_sg1 + + - name: Verify change_sg1 + ansible.builtin.assert: + that: + - nm_sg1 is changed + - nm_sg1.current.serviceGraphRef.serviceGraphName == "SG1" + - nm_sg1.current.serviceGraphRef.templateName == "Template1" + - nm_sg1.current.serviceNodes | length == 1 + - nm_sg1.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + + - name: Add Graph SG1 at site level again + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + state: present + register: nm_sg1_again + + - name: Verify change_sg1 + ansible.builtin.assert: + that: + - nm_sg1_again is not changed + - nm_sg1_again.current.serviceGraphRef.serviceGraphName == "SG1" + - nm_sg1_again.current.serviceGraphRef.templateName == "Template1" + - nm_sg1_again.current.serviceNodes | length == 1 + - nm_sg1_again.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + + - name: Change service graph SG1 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall2 + state: present + register: change_sg1 + + - name: Verify change_sg1 + ansible.builtin.assert: + that: + - change_sg1 is changed + - change_sg1.current.serviceGraphRef.serviceGraphName == "SG1" + - change_sg1.current.serviceGraphRef.templateName == "Template1" + - change_sg1.current.serviceNodes | length == 1 + - change_sg1.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall2") + + - name: Add a new Graph SG2 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG2 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + - name: ansible_test_adc + state: present + register: sg2 + + - name: Verify sg2 + ansible.builtin.assert: + that: + - sg2 is changed + - sg2.current.serviceGraphRef.serviceGraphName == "SG2" + - sg2.current.serviceGraphRef.templateName == "Template1" + - sg2.current.serviceNodes | length == 2 + - sg2.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - sg2.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + + - name: Add a new Graph SG3 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG3 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + - name: ansible_test_adc + - name: ansible_test_other + state: present + register: sg3 + + - name: Verify sg3 + ansible.builtin.assert: + that: + - sg3 is changed + - sg3.current.serviceGraphRef.serviceGraphName == "SG3" + - sg3.current.serviceGraphRef.templateName == "Template1" + - sg3.current.serviceNodes | length == 3 + - sg3.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - sg3.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - sg3.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + + - name: Add a new Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + - name: ansible_test_adc + - name: ansible_test_firewall1 + state: present + register: sg4 + + - name: Verify sg4 + ansible.builtin.assert: + that: + - sg4 is changed + - sg4.current.serviceGraphRef.serviceGraphName == "SG4" + - sg4.current.serviceGraphRef.templateName == "Template1" + - sg4.current.serviceNodes | length == 3 + - sg4.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - sg4.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - sg4.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + + - name: Change Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + - name: ansible_test_adc + - name: ansible_test_firewall2 + state: present + register: change1_sg4 + + - name: Verify change1_sg4 + ansible.builtin.assert: + that: + - change1_sg4 is changed + - change1_sg4.current.serviceGraphRef.serviceGraphName == "SG4" + - change1_sg4.current.serviceGraphRef.templateName == "Template1" + - change1_sg4.current.serviceNodes | length == 3 + - change1_sg4.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - change1_sg4.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - change1_sg4.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall2") + + - name: Change Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + state: present + ignore_errors: true + register: change2_sg4 + + - name: Verify change2_sg4 + ansible.builtin.assert: + that: + - change2_sg4 is not changed + - change2_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" + + - name: Change Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_adc + state: present + ignore_errors: true + register: change3_sg4 + + - name: Verify change3_sg4 + ansible.builtin.assert: + that: + - change3_sg4 is not changed + - change3_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" + + - name: Change Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + state: present + ignore_errors: true + register: change4_sg4 + + - name: Verify change4_sg4 + ansible.builtin.assert: + that: + - change4_sg4 is not changed + - change4_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '1' service node(s) were given for the service graph" + + - name: Change Graph SG4 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG4 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + - name: ansible_test_adc + state: present + ignore_errors: true + register: change5_sg4 + + - name: Verify change5_sg4 + ansible.builtin.assert: + that: + - change5_sg4 is not changed + - change5_sg4.msg == "Service Graph 'SG4' has '3' service node type(s) but '2' service node(s) were given for the service graph" + + - name: Add Graph SG5 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG5 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + - name: ansible_test_firewall1 + - name: ansible_test_firewall1 + state: present + register: sg5 + + - name: Verify sg5 + ansible.builtin.assert: + that: + - sg5 is changed + - sg5.current.serviceGraphRef.serviceGraphName == "SG5" + - sg5.current.serviceGraphRef.templateName == "Template1" + - sg5.current.serviceNodes | length == 3 + - sg5.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - sg5.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - sg5.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + + - name: Add Graph SG6 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG6 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_other + - name: ansible_test_other + - name: ansible_test_other + state: present + register: sg6 + + - name: Verify sg6 + ansible.builtin.assert: + that: + - sg6 is changed + - sg6.current.serviceGraphRef.serviceGraphName == "SG6" + - sg6.current.serviceGraphRef.templateName == "Template1" + - sg6.current.serviceNodes | length == 3 + - sg6.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - sg6.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - sg6.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + + - name: Add Graph SG7 at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG7 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_adc + - name: ansible_test_adc + state: present + register: sg7 + + - name: Verify sg7 + ansible.builtin.assert: + that: + - sg7 is changed + - sg7.current.serviceGraphRef.serviceGraphName == "SG7" + - sg7.current.serviceGraphRef.templateName == "Template1" + - sg7.current.serviceNodes | length == 2 + - sg7.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - sg7.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + + - name: Query service graph SG at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + state: query + register: query_sg + + - name: Verify query_sg + ansible.builtin.assert: + that: + - query_sg is not changed + - query_sg.current.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") + + - name: Query all service graphs at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + state: query + register: query_all + + - name: Verify query_all + ansible.builtin.assert: + that: + - query_all is not changed + - query_all.current | length == 7 + + # Azure tests part + - name: Execute tasks only for cloud sites + when: + - query_cloud.current | length > 0 + - query_cloud.current.0.cloudProvP.attributes.vendor == "azure" + block: + - name: Create a service graph 1 at Template3 for the Azure site service graph test # Azure Task + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + service_graph: SG1 + display_name: sg1 + service_nodes: + - type: firewall + - type: load-balancer + - type: other + filter_after_first_node: allow_all + state: present + + - name: Create a service graph 2 at Template3 for the Azure site service graph test # Azure Task + cisco.mso.mso_schema_template_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + service_graph: SG2 + display_name: sg2 + service_nodes: + - type: other + filter_after_first_node: allow_all + state: present + + - name: Add Azure site to a schema Template3 for the Azure site service graph test # Azure Task + cisco.mso.mso_schema_site: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + template: Template3 + state: present + + - name: Add Service Graph 1 at site level for the Azure site service graph test - check_mode # Azure Task + cisco.mso.mso_schema_site_service_graph: &az_sg1_cm_present + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + devices: + - name: ansible_test_firewall1 + provider_connector_type: source_nat + provider_interface: TP_FW_Inf1 + consumer_connector_type: redirect + consumer_interface: TP_FW_Inf1 + - name: ansible_test_app_lb + - name: ansible_test_other + provider_connector_type: destination_nat + consumer_connector_type: redirect + state: present + output_level: debug + register: az_sg1_cm_present + check_mode: true + + - name: Add Service Graph 1 at site level for the Azure site service graph test - normal_mode # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_sg1_cm_present + output_level: debug + register: az_sg1_nm_present + + - name: Add Service Graph 1 at site level for the Azure site service graph test - normal_mode again # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_sg1_cm_present + register: az_sg1_nm_present_again + + - name: Add Service Graph 2 at site level for the Azure site service graph test # Azure Task + cisco.mso.mso_schema_site_service_graph: &az_sg2_nm_present + <<: *az_sg1_cm_present + service_graph: SG2 + devices: + - name: ansible_test_firewall2 + provider_connector_type: destination_nat + provider_interface: TP_FW_Inf12 + consumer_connector_type: redirect + consumer_interface: TP_FW_Inf2 + state: present + register: az_sg2_nm_present + + - name: Assertions check for the add Azure site service graph + ansible.builtin.assert: + that: + - az_sg1_cm_present is changed + - az_sg1_cm_present.current.serviceGraphRef.serviceGraphName == "SG1" + - az_sg1_cm_present.current.serviceGraphRef.templateName == "Template3" + - az_sg1_cm_present.current.serviceNodes | length == 3 + - az_sg1_cm_present.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - az_sg1_cm_present.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_sg1_cm_present.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_sg1_cm_present.previous.serviceNodes is none + - az_sg1_cm_present.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1") + - az_sg1_cm_present.proposed.serviceGraphRef.serviceGraphName == "SG1" + - az_sg1_cm_present.proposed.serviceGraphRef.templateName == "Template3" + - az_sg1_cm_present.proposed.serviceNodes | length == 3 + - az_sg1_cm_present.proposed.serviceNodes.0.consumerConnectorType == "redir" + - az_sg1_cm_present.proposed.serviceNodes.0.consumerInterface == "TP_FW_Inf1" + - az_sg1_cm_present.proposed.serviceNodes.0.device.dn == "uni/tn-ansible_test/cld-ansible_test_firewall1" + - az_sg1_cm_present.proposed.serviceNodes.0.providerConnectorType == "snat" + - az_sg1_cm_present.proposed.serviceNodes.0.providerInterface == "TP_FW_Inf1" + - az_sg1_cm_present.proposed.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG1" + - az_sg1_cm_present.proposed.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_sg1_cm_present.proposed.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_sg1_cm_present.proposed.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_sg1_cm_present.proposed.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_sg1_nm_present is changed + - az_sg1_nm_present.current.serviceGraphRef.serviceGraphName == "SG1" + - az_sg1_nm_present.current.serviceGraphRef.templateName == "Template3" + - az_sg1_nm_present.current.serviceNodes | length == 3 + - az_sg1_nm_present.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - az_sg1_nm_present.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_sg1_nm_present.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_sg1_nm_present.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1") + - az_sg1_nm_present.previous.serviceNodes is none + - az_sg1_nm_present_again is not changed + - az_sg1_nm_present_again.current.serviceGraphRef.serviceGraphName == "SG1" + - az_sg1_nm_present_again.current.serviceGraphRef.templateName == "Template3" + - az_sg1_nm_present_again.current.serviceNodes | length == 3 + - az_sg1_nm_present_again.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - az_sg1_nm_present_again.current.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_sg1_nm_present_again.current.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_sg1_nm_present_again.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1") + - az_sg1_nm_present_again.previous.serviceNodes | length == 3 + - az_sg1_nm_present_again.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - az_sg1_nm_present_again.previous.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_sg1_nm_present_again.previous.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_sg2_nm_present is changed + - az_sg2_nm_present.current.serviceGraphRef.serviceGraphName == "SG2" + - az_sg2_nm_present.current.serviceGraphRef.templateName == "Template3" + - az_sg2_nm_present.current.serviceNodes | length == 1 + - az_sg2_nm_present.current.serviceNodes.0.consumerConnectorType == "redir" + - az_sg2_nm_present.current.serviceNodes.0.consumerInterface == "TP_FW_Inf2" + - az_sg2_nm_present.current.serviceNodes.0.providerConnectorType == "dnat" + - az_sg2_nm_present.current.serviceNodes.0.providerInterface == "TP_FW_Inf12" + - az_sg2_nm_present.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall2") + - az_sg2_nm_present.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_sg2_nm_present.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_sg2_nm_present.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_sg2_nm_present.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - az_sg2_nm_present.previous.serviceNodes is none + + - name: Update Service Graph 2 node with ansible_test_app_lb - check_mode # Azure Task + cisco.mso.mso_schema_site_service_graph: &az_update_sg2_cm + <<: *az_sg2_nm_present + service_graph: SG2 + devices: + - name: ansible_test_app_lb + state: present + output_level: debug + register: az_update_sg2_cm + check_mode: true + + - name: Update Service Graph 2 node with ansible_test_app_lb - normal_mode # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + output_level: debug + register: az_update_sg2_nm + + - name: Update Service Graph 2 node with ansible_test_app_lb - normal_mode again # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + register: az_update_sg2_nm_again + + - name: Update Service Graph 2 node with ansible_test_app_lb - Negative Test # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + devices: + - name: ansible_test_app_lb + provider_connector_type: destination_nat + consumer_connector_type: redirect + state: present + output_level: debug + register: nt_ansible_test_app_lb + ignore_errors: true + + - name: Update Service Graph 2 node with ansible_test_other # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + devices: + - name: ansible_test_other + provider_connector_type: source_and_destination_nat + consumer_connector_type: none + state: present + register: pt_ansible_test_other + + - name: Update Service Graph 2 node with ansible_test_other - Negative Test # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + devices: + - name: ansible_test_other + provider_connector_type: source_and_destination_nat + consumer_connector_type: none + consumer_interface: invalid_inf + state: present + output_level: debug + register: nt_ansible_test_other + ignore_errors: true + + - name: Update Service Graph 2 node with ansible_test_adc # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + devices: + - name: ansible_test_adc + provider_interface: TP_LB_Inf + consumer_interface: TP_LB_Inf + state: present + register: pt_ansible_test_adc + + - name: Assertions check for the update Azure site service graph + ansible.builtin.assert: + that: + - az_update_sg2_cm is changed + - az_update_sg2_cm.current.serviceGraphRef.serviceGraphName == "SG2" + - az_update_sg2_cm.current.serviceGraphRef.templateName == "Template3" + - az_update_sg2_cm.current.serviceNodes | length == 1 + - az_update_sg2_cm.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_update_sg2_cm.current.serviceNodes.0.device.funcType == "GoTo" + - az_update_sg2_cm.current.serviceNodes.0.consumerConnectorType is none + - az_update_sg2_cm.current.serviceNodes.0.consumerInterface is none + - az_update_sg2_cm.current.serviceNodes.0.providerConnectorType is none + - az_update_sg2_cm.current.serviceNodes.0.providerInterface is none + - az_update_sg2_cm.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_cm.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_cm.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_cm.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - az_update_sg2_cm.previous.serviceNodes | length == 1 + - az_update_sg2_cm.previous.serviceNodes.0.consumerConnectorType == "redir" + - az_update_sg2_cm.previous.serviceNodes.0.consumerInterface == "TP_FW_Inf2" + - az_update_sg2_cm.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall2") + - az_update_sg2_cm.previous.serviceNodes.0.device.funcType == "GoTo" + - az_update_sg2_cm.previous.serviceNodes.0.providerConnectorType == "dnat" + - az_update_sg2_cm.previous.serviceNodes.0.providerInterface == "TP_FW_Inf12" + - az_update_sg2_cm.previous.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_cm.previous.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_cm.previous.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_cm.proposed.serviceGraphRef.serviceGraphName == "SG2" + - az_update_sg2_cm.proposed.serviceGraphRef.templateName == "Template3" + - az_update_sg2_cm.proposed.serviceNodes | length == 1 + - az_update_sg2_cm.proposed.serviceNodes.0.consumerConnectorType is none + - az_update_sg2_cm.proposed.serviceNodes.0.consumerInterface is none + - az_update_sg2_cm.proposed.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_update_sg2_cm.proposed.serviceNodes.0.device.funcType == "GoTo" + - az_update_sg2_cm.proposed.serviceNodes.0.providerConnectorType is none + - az_update_sg2_cm.proposed.serviceNodes.0.providerInterface is none + - az_update_sg2_cm.proposed.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_cm.proposed.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_cm.proposed.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_nm is changed + - az_update_sg2_nm.current.serviceGraphRef.serviceGraphName == "SG2" + - az_update_sg2_nm.current.serviceGraphRef.templateName == "Template3" + - az_update_sg2_nm.current.serviceNodes | length == 1 + - az_update_sg2_nm.current.serviceNodes.0.consumerConnectorType is none + - az_update_sg2_nm.current.serviceNodes.0.consumerInterface is none + - az_update_sg2_nm.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_update_sg2_nm.current.serviceNodes.0.providerConnectorType is none + - az_update_sg2_nm.current.serviceNodes.0.providerInterface is none + - az_update_sg2_nm.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_nm.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_nm.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_nm.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - az_update_sg2_nm.previous.serviceNodes | length == 1 + - az_update_sg2_nm.previous.serviceNodes.0.consumerConnectorType == "redir" + - az_update_sg2_nm.previous.serviceNodes.0.consumerInterface == "TP_FW_Inf2" + - az_update_sg2_nm.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall2") + - az_update_sg2_nm.previous.serviceNodes.0.device.funcType == "GoTo" + - az_update_sg2_nm.previous.serviceNodes.0.providerConnectorType == "dnat" + - az_update_sg2_nm.previous.serviceNodes.0.providerInterface == "TP_FW_Inf12" + - az_update_sg2_nm.previous.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_nm.previous.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_nm.previous.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_nm_again is not changed + - az_update_sg2_nm_again.current.serviceGraphRef.serviceGraphName == "SG2" + - az_update_sg2_nm_again.current.serviceGraphRef.templateName == "Template3" + - az_update_sg2_nm_again.current.serviceNodes | length == 1 + - az_update_sg2_nm_again.current.serviceNodes.0.consumerConnectorType is none + - az_update_sg2_nm_again.current.serviceNodes.0.consumerInterface is none + - az_update_sg2_nm_again.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_update_sg2_nm_again.current.serviceNodes.0.providerConnectorType is none + - az_update_sg2_nm_again.current.serviceNodes.0.providerInterface is none + - az_update_sg2_nm_again.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_nm_again.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_nm_again.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - az_update_sg2_nm_again.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - az_update_sg2_nm_again.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_update_sg2_nm_again.previous.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - az_update_sg2_nm_again.previous.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - az_update_sg2_nm_again.previous.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - pt_ansible_test_adc is changed + - pt_ansible_test_adc.current.serviceGraphRef + - pt_ansible_test_adc.current.serviceGraphRef.serviceGraphName == "SG2" + - pt_ansible_test_adc.current.serviceGraphRef.templateName == "Template3" + - pt_ansible_test_adc.current.serviceNodes.0.consumerConnectorType is none + - pt_ansible_test_adc.current.serviceNodes.0.consumerInterface == "TP_LB_Inf" + - pt_ansible_test_adc.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - pt_ansible_test_adc.current.serviceNodes.0.providerConnectorType is none + - pt_ansible_test_adc.current.serviceNodes.0.providerInterface == "TP_LB_Inf" + - pt_ansible_test_adc.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - pt_ansible_test_adc.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - pt_ansible_test_adc.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - pt_ansible_test_adc.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - pt_ansible_test_adc.previous.serviceNodes.0.consumerConnectorType == "none" + - pt_ansible_test_adc.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - pt_ansible_test_adc.previous.serviceNodes.0.providerConnectorType == "snat_dnat" + - pt_ansible_test_adc.previous.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - pt_ansible_test_adc.previous.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - pt_ansible_test_adc.previous.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - pt_ansible_test_other is changed + - pt_ansible_test_other.current.serviceGraphRef.serviceGraphName == "SG2" + - pt_ansible_test_other.current.serviceGraphRef.templateName == "Template3" + - pt_ansible_test_other.current.serviceNodes.0.consumerConnectorType == "none" + - pt_ansible_test_other.current.serviceNodes.0.consumerInterface is none + - pt_ansible_test_other.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - pt_ansible_test_other.current.serviceNodes.0.providerConnectorType == "snat_dnat" + - pt_ansible_test_other.current.serviceNodes.0.providerInterface is none + - pt_ansible_test_other.current.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - pt_ansible_test_other.current.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - pt_ansible_test_other.current.serviceNodes.0.serviceNodeRef.templateName == "Template3" + - pt_ansible_test_other.previous.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - pt_ansible_test_other.previous.serviceNodes | length == 1 + - pt_ansible_test_other.previous.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - pt_ansible_test_other.previous.serviceNodes.0.serviceNodeRef.serviceGraphName == "SG2" + - pt_ansible_test_other.previous.serviceNodes.0.serviceNodeRef.serviceNodeName == "node1" + - pt_ansible_test_other.previous.serviceNodes.0.serviceNodeRef.templateName == "Template3" + + - name: Update Service Graph 2 node with ansible_test_adc - Negative Test # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_update_sg2_cm + devices: + - name: ansible_test_adc + provider_interface: TP_LB_Inf + consumer_interface: TP_LB_Inf + consumer_connector_type: none + state: present + output_level: debug + register: nt_ansible_test_adc + ignore_errors: true + + - name: Assertions check for the Azure site service graph negative tests + ansible.builtin.assert: + that: + - nt_ansible_test_adc is not changed + - nt_ansible_test_adc.msg is match("Unsupported attributes{{':'}} provider_connector_type and consumer_connector_type should be 'None' for the Third-Party Load Balancer.") + - nt_ansible_test_other is not changed + - nt_ansible_test_other.msg is match("Unsupported attributes{{':'}} provider_interface and consumer_interface should be 'None' for the Network Load Balancer device.") + - nt_ansible_test_app_lb is not changed + - nt_ansible_test_app_lb.msg is match("Unsupported attributes{{':'}} provider_connector_type, provider_interface, consumer_connector_type, consumer_interface should be 'None' for the Application Load Balancer device.") + + - name: Query all service graphs at Azure site level # Azure Task + cisco.mso.mso_schema_site_service_graph: &az_site_sg_query_all + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template3 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + state: query + register: az_site_sg_query_all + + - name: Query a service graph with name at Azure site level # Azure Task + cisco.mso.mso_schema_site_service_graph: + <<: *az_site_sg_query_all + service_graph: SG2 + state: query + register: az_site_sg_query_sg2 + + - name: Assertions check for the query Azure site service graph + ansible.builtin.assert: + that: + - az_site_sg_query_all is not changed + - az_site_sg_query_all.current | length == 2 + - az_site_sg_query_all.current.0.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1") + - az_site_sg_query_all.current.0.serviceNodes | length == 3 + - az_site_sg_query_all.current.0.serviceNodes.0.consumerConnectorType == "redir" + - az_site_sg_query_all.current.0.serviceNodes.0.consumerInterface == "TP_FW_Inf1" + - az_site_sg_query_all.current.0.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_firewall1") + - az_site_sg_query_all.current.0.serviceNodes.0.device.funcType == "GoTo" + - az_site_sg_query_all.current.0.serviceNodes.0.providerConnectorType == "snat" + - az_site_sg_query_all.current.0.serviceNodes.0.providerInterface == "TP_FW_Inf1" + - az_site_sg_query_all.current.0.serviceNodes.0.serviceNodeRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1/serviceNodes/node1") + - az_site_sg_query_all.current.0.serviceNodes.1.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_app_lb") + - az_site_sg_query_all.current.0.serviceNodes.1.serviceNodeRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1/serviceNodes/node2") + - az_site_sg_query_all.current.0.serviceNodes.2.consumerConnectorType == "redir" + - az_site_sg_query_all.current.0.serviceNodes.2.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_other") + - az_site_sg_query_all.current.0.serviceNodes.2.providerConnectorType == "dnat" + - az_site_sg_query_all.current.0.serviceNodes.2.serviceNodeRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG1/serviceNodes/node3") + - az_site_sg_query_sg2 is not changed + - az_site_sg_query_sg2.current.serviceGraphRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2") + - az_site_sg_query_sg2.current.serviceNodes | length == 1 + - az_site_sg_query_sg2.current.serviceNodes.0.consumerInterface == "TP_LB_Inf" + - az_site_sg_query_sg2.current.serviceNodes.0.device.dn is match("uni/tn-ansible_test/(lDevVip|clb|cld)-ansible_test_adc") + - az_site_sg_query_sg2.current.serviceNodes.0.device.funcType == "GoTo" + - az_site_sg_query_sg2.current.serviceNodes.0.providerInterface == "TP_LB_Inf" + - az_site_sg_query_sg2.current.serviceNodes.0.serviceNodeRef is match("/schemas/.+/templates/Template3/serviceGraphs/SG2/serviceNodes/node1") + # Azure tests ends + + - name: Query non_existing service graph at site level + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + site: '{{ mso_site | default("ansible_test") }}' + service_graph: non_existent + tenant: ansible_test + state: query + ignore_errors: true + register: query_non_existing_sg + + - name: Verify query_non_existing_sg + ansible.builtin.assert: + that: + - query_non_existing_sg.msg == "Service Graph 'non_existent' not found" + + - name: Use non_existing schema + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: non_existing_schema + template: Template1 + service_graph: SG + tenant: ansible_test + site: '{{ mso_site | default("ansible_test") }}' + state: query + ignore_errors: true + register: query_non_existing_schema + + - name: Verify non_existing_schema + ansible.builtin.assert: + that: + - query_non_existing_schema is not changed + - query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." + + - name: Use non_existing template + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: non_existing_template + service_graph: SG + tenant: ansible_test + site: '{{ mso_site | default("ansible_test") }}' + state: query + ignore_errors: true + register: query_non_existing_template + + - name: Verify query_non_existing_template + ansible.builtin.assert: + that: + - query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1, Template2, Template3" + + - name: Use non_existing_site_template + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + site: '{{ mso_site | default("ansible_test") }}' + service_graph: SG + template: Template2 + tenant: ansible_test + state: query + ignore_errors: true + register: nm_non_existing_site_template + + - name: Verify cm_non_existing_site_template and nm_non_existing_site_template + ansible.builtin.assert: + that: + - nm_non_existing_site_template is not changed + - nm_non_existing_site_template.msg is match("Provided site-template association '.+' does not exist.") + + - name: Add site Service Graph to Template2 without any site association + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}_2' + site: '{{ mso_site | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + tenant: ansible_test + devices: + - name: ansible_test_firewall2 + state: present + ignore_errors: true + register: nm_no_site_associated + + - name: Verify nm_no_site_associated + ansible.builtin.assert: + that: + - nm_no_site_associated is not changed + - nm_no_site_associated.msg == "No site associated with template 'Template1'. Associate the site with the template using mso_schema_site." + + - name: Remove service graph from site level(check mode) + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + site: '{{ mso_site | default("ansible_test") }}' + tenant: ansible_test + state: absent + register: rm_sg_cm + check_mode: true + + - name: Verify rm_sg_cm + ansible.builtin.assert: + that: + - rm_sg_cm is changed + - rm_sg_cm.current == {} + - rm_sg_cm.previous.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") + + - name: Remove service graph from site level (normal mode) + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + tenant: ansible_test + site: '{{ mso_site | default("ansible_test") }}' + state: absent + register: rm_sg + + - name: Verify rm_sg + ansible.builtin.assert: + that: + - rm_sg is changed + - rm_sg.current == {} + - rm_sg.previous.serviceGraphRef is match("/schemas/[0-9a-zA-Z]*/templates/Template1/serviceGraphs/SG1") + + - name: Remove service graph again + cisco.mso.mso_schema_site_service_graph: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template1 + service_graph: SG1 + tenant: ansible_test + site: '{{ mso_site | default("ansible_test") }}' + state: absent + register: rm_sg_again + + - name: Verify rm_sg_again + ansible.builtin.assert: + that: + - rm_sg_again is not changed + - rm_sg_again.current == {} + - rm_sg_again.previous == {} + when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined + + # To clear the ACI Config + - name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local + ansible.builtin.set_fact: + ansible_connection: local + ansible_network_os: cisco.aci.aci + + - name: Reset the ansible_connection to access the APIC + ansible.builtin.meta: reset_connection + + - name: Remove the ansible_test tenant from APIC + cisco.aci.aci_tenant: + <<: *aci_info + name: ansible_test + state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region/tasks/main.yml index c31a31eeb..315a4d94d 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region/tasks/main.yml @@ -5,7 +5,7 @@ # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -19,13 +19,13 @@ '{{ mso_site | default(\"ansible_test\") }}']" - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -36,7 +36,7 @@ state: present - name: Ensure azure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -47,7 +47,7 @@ state: present - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -56,7 +56,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -67,7 +67,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -75,7 +75,7 @@ state: present - name: Ensure AWS site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -85,7 +85,7 @@ state: present - name: Ensure Azure site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -93,7 +93,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -104,7 +104,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -112,7 +112,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -120,7 +120,7 @@ state: present - name: Add region and cidr in VRF1 at AWS site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -133,7 +133,7 @@ register: aws_add_region_cidr - name: Add region and cidr in VRF1 at Azure site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -146,7 +146,7 @@ register: azure_add_region_cidr - name: Add another region and cidr in VRF1 at AWS site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -159,7 +159,7 @@ register: aws_add_another_region_cidr - name: Add another region and cidr in VRF1 at Azure site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -176,7 +176,7 @@ when: version.current.version is version('3.3', '>=') block: - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -184,7 +184,7 @@ state: present - name: Add region and cidr in VRF2 at Azure site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -197,7 +197,7 @@ register: azure_add_another_region_cidr - name: Add region and cidr in VRF2 at AWS site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -210,7 +210,7 @@ register: azure_add_another_region_cidr - name: Add context underlay parameters in VRF1 at Azure site level - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -225,7 +225,7 @@ register: azure_add_context_underlay - name: Add context underlay parameters in VRF1 at AWS site level - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -240,7 +240,7 @@ register: aws_add_context_underlay - name: Verify add_context_underlay - assert: + ansible.builtin.assert: that: - azure_add_context_underlay is changed - azure_add_context_underlay.current.contextProfileType == "container-overlay" @@ -248,31 +248,31 @@ - aws_add_context_underlay.current.contextProfileType == "container-overlay" - name: Get Validation status - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query register: query_validate - name: Verify query_validate - assert: + ansible.builtin.assert: that: - query_validate is not changed - name: Verify query_validate result < 4.0 - assert: + ansible.builtin.assert: that: - query_validate.current.result == "true" when: version.current.version is version('4.0', '<') - name: Verify query_validate result => 4.0 - assert: + ansible.builtin.assert: that: - query_validate.current.result == true when: version.current.version is version('4.0', '>=') - name: Query all aws regions - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -282,7 +282,7 @@ register: aws_query_all - name: Query all azure regions - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -292,7 +292,7 @@ register: azure_query_all - name: Query specific aws region - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -303,7 +303,7 @@ register: aws_query_region - name: Query specific azure region - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -314,7 +314,7 @@ register: azure_query_region - name: Verify query - assert: + ansible.builtin.assert: that: - aws_query_all is not changed - azure_query_all is not changed @@ -332,7 +332,7 @@ - azure_query_region.current.cidrs.0.subnets == [] - name: Remove aws VRF region (check mode) - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -344,7 +344,7 @@ register: cm_rm_aws_region - name: Remove aws VRF region (normal mode) - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -355,7 +355,7 @@ register: nm_rm_aws_region - name: Remove azure VRF region (check mode) - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -367,7 +367,7 @@ register: cm_rm_azure_region - name: Remove azure VRF region (normal mode) - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -378,7 +378,7 @@ register: nm_rm_azure_region - name: Verify deletion - assert: + ansible.builtin.assert: that: - cm_rm_aws_region is changed - nm_rm_aws_region is changed @@ -418,7 +418,7 @@ register: add_vpn_gateway_router_azure - name: Verify adding VPN Gateway Router - assert: + ansible.builtin.assert: that: - add_vpn_gateway_router_aws.current.isVpnGatewayRouter == add_vpn_gateway_router_azure.current.isVpnGatewayRouter == true when: version.current.version is version('3.0.0a', '>=') @@ -478,7 +478,7 @@ register: nm_rm_vpn_gateway_router_azure - name: Verify removing VPN Gateway Router - assert: + ansible.builtin.assert: that: - cm_rm_vpn_gateway_router_aws is changed - nm_rm_vpn_gateway_router_aws is changed @@ -491,7 +491,7 @@ when: version.current.version is version('3.0.0a', '>=') - name: Use non_existing schema - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: non_existing template: Template 1 @@ -503,7 +503,7 @@ ignore_errors: true - name: Use non_existing site - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -515,7 +515,7 @@ ignore_errors: true - name: Use non_existing site/template association - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -527,7 +527,7 @@ ignore_errors: true - name: Use non_existing VRF - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -539,7 +539,7 @@ ignore_errors: true - name: Use non_existing region - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -551,7 +551,7 @@ ignore_errors: true - name: Verify non_existing - assert: + ansible.builtin.assert: that: - non_existing_schema.msg == "Provided schema 'non_existing' does not exist." - non_existing_site.msg == "Site 'non_existing' is not a valid site name." @@ -559,19 +559,19 @@ - non_existing_region.msg == "Region 'non_existing' not found" - name: Verify non_existing (version < 3.3) - assert: + ansible.builtin.assert: that: - non_existing_vrf.msg == "Provided vrf 'non_existing' does not exist. Existing vrfs{{':'}} VRF1" when: version.current.version is version('3.3', '<') - name: Verify non_existing (version >= 3.3) - assert: + ansible.builtin.assert: that: - non_existing_vrf.msg == "Provided vrf 'non_existing' does not exist. Existing vrfs{{':'}} VRF1, VRF2" when: version.current.version is version('3.3', '>=') - name: Delete non_existing region - mso_schema_site_vrf_region: + cisco.mso.mso_schema_site_vrf_region: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -582,7 +582,7 @@ register: rm_non_existing_region - name: Verify rm_non_existing_region - assert: + ansible.builtin.assert: that: - rm_non_existing_region is not changed - rm_non_existing_region.previous == rm_non_existing_region.current == {}
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr/tasks/main.yml index 64d08821c..c818b6e59 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr/tasks/main.yml @@ -7,13 +7,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -27,13 +27,13 @@ '{{ mso_site | default(\"ansible_test\") }}']" - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -44,7 +44,7 @@ state: present - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -55,7 +55,7 @@ state: present - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -66,7 +66,7 @@ state: present - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -75,7 +75,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -86,7 +86,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test sites: @@ -96,7 +96,7 @@ state: present - name: Ensure AWS site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -106,7 +106,7 @@ state: present - name: Ensure Azure site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -114,7 +114,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -125,7 +125,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -133,7 +133,7 @@ state: present - name: Add physical site to Template 1 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -141,7 +141,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -153,7 +153,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}_2', template: 'Template 3' } - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -162,7 +162,7 @@ when: version.current.version is version('3', '<') - name: Ensure VRF1 exists at Site level for the physical site - mso_schema_site_vrf: + cisco.mso.mso_schema_site_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -172,7 +172,7 @@ # ADD SUBNET - name: Add a new CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_present + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -186,7 +186,7 @@ register: cm_add_cidr - name: Verify cm_add_cidr - assert: + ansible.builtin.assert: that: - cm_add_cidr is changed - cm_add_cidr.previous == {} @@ -194,12 +194,12 @@ - cm_add_cidr.current.primary == true - name: Add a new CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present register: nm_add_cidr - name: Verify nm_add_cidr - assert: + ansible.builtin.assert: that: - nm_add_cidr is changed - nm_add_cidr.previous == {} @@ -207,31 +207,31 @@ - nm_add_cidr.current.primary == true - name: Add same CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present register: cm_add_cidr_again - name: Verify cm_add_cidr_again - assert: + ansible.builtin.assert: that: - cm_add_cidr_again is not changed - cm_add_cidr_again.current.ip == cm_add_cidr_again.previous.ip == '10.0.0.0/16' - cm_add_cidr_again.current.primary == cm_add_cidr_again.previous.primary == true - name: Add same CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present register: nm_add_cidr_again - name: Verify nm_add_cidr_again - assert: + ansible.builtin.assert: that: - nm_add_cidr_again is not changed - nm_add_cidr_again.current.ip == nm_add_cidr_again.previous.ip == '10.0.0.0/16' - nm_add_cidr_again.current.primary == nm_add_cidr_again.previous.primary == true - name: Add a CIDR in VRF1 at Azure site level (check mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -241,7 +241,7 @@ register: cm_add_cidr_2 - name: Verify cm_add_cidr_2 - assert: + ansible.builtin.assert: that: - cm_add_cidr_2 is changed - cm_add_cidr_2.previous == {} @@ -249,7 +249,7 @@ - cm_add_cidr_2.current.primary == true - name: Add a CIDR in VRF1 at Azure site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -258,7 +258,7 @@ register: nm_add_cidr_2 - name: Verify nm_add_cidr_2 - assert: + ansible.builtin.assert: that: - nm_add_cidr_2 is changed - nm_add_cidr_2.previous == {} @@ -266,7 +266,7 @@ - nm_add_cidr_2.current.primary == true - name: Add a second CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_present_2 + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_present_2 <<: *mso_present site: 'aws_{{ mso_site | default("ansible_test") }}' region: us-west-1 @@ -276,7 +276,7 @@ register: cm_add_cidr_3 - name: Verify cm_add_cidr_3 - assert: + ansible.builtin.assert: that: - cm_add_cidr_3 is changed - cm_add_cidr_3.previous == {} @@ -284,12 +284,12 @@ - cm_add_cidr_3.current.primary == false - name: Add a second CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present_2 register: nm_add_cidr_3 - name: Verify nm_add_cidr_3 - assert: + ansible.builtin.assert: that: - nm_add_cidr_3 is changed - nm_add_cidr_3.previous == {} @@ -297,7 +297,7 @@ - nm_add_cidr_3.current.primary == false - name: Add a second CIDR in VRF1 at Azure site level (check mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -307,7 +307,7 @@ register: cm_add_cidr_4 - name: Verify cm_add_cidr_4 - assert: + ansible.builtin.assert: that: - cm_add_cidr_4 is changed - cm_add_cidr_4.previous == {} @@ -315,7 +315,7 @@ - cm_add_cidr_4.current.primary == false - name: Add a second CIDR in VRF1 at Azure site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -324,7 +324,7 @@ register: nm_add_cidr_4 - name: Verify nm_add_cidr_4 - assert: + ansible.builtin.assert: that: - nm_add_cidr_4 is changed - nm_add_cidr_4.previous == {} @@ -333,7 +333,7 @@ # QUERY CIDR - name: Query CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_query + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -346,19 +346,19 @@ register: cm_query_cidr - name: Verify cm_query_cidr - assert: + ansible.builtin.assert: that: - cm_query_cidr is not changed - cm_query_cidr.current.ip == '10.0.0.0/16' - cm_query_cidr.current.primary == true - name: Query CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query register: nm_query_cidr - name: Query CIDR in VRF1 at Azure site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_query_2 + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_query_2 <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -371,19 +371,19 @@ register: cm_query_cidr_2 - name: Verify cm_query_cidr_2 - assert: + ansible.builtin.assert: that: - cm_query_cidr_2 is not changed - cm_query_cidr_2.current.ip == '10.1.0.0/16' - cm_query_cidr_2.current.primary == true - name: Query CIDR in VRF1 at Azure site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_2 register: nm_query_cidr_2 - name: Verify nm_query_cidr_2 - assert: + ansible.builtin.assert: that: - nm_query_cidr_2 is not changed - nm_query_cidr_2.current.ip == '10.1.0.0/16' @@ -391,7 +391,7 @@ # QUERY ALL CIDR - name: Query all CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_query_all + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_query_all <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -403,7 +403,7 @@ register: cm_query_cidr_all_aws - name: Query CIDR in VRF1 at Azure site level (check mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_all site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -412,7 +412,7 @@ register: cm_query_cidr_all_azure - name: Verify cm_query_cidr_all_aws and cm_query_cidr_all_azure - assert: + ansible.builtin.assert: that: - cm_query_cidr_all_aws is not changed - cm_query_cidr_all_aws.current[0].ip == '10.0.0.0/16' @@ -426,19 +426,19 @@ - cm_query_cidr_all_azure.current[1].primary == false - name: Query CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_all register: nm_query_cidr_all_aws - name: Query CIDR in VRF1 at Azure site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_all site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus register: nm_query_cidr_all_azure - name: Verify nm_query_cidr_all_aws and nm_query_cidr_all_azure - assert: + ansible.builtin.assert: that: - nm_query_cidr_all_aws is not changed - nm_query_cidr_all_aws.current[0].ip == '10.0.0.0/16' @@ -452,14 +452,14 @@ - nm_query_cidr_all_azure.current[1].primary == false - name: Query CIDR in VRF2 (not present a Site level) for AWS Site (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_all vrf: VRF2 ignore_errors: true register: nm_query_cidr_all_aws_2 - name: Query CIDR in VRF1 (with VRF present a Site level) for Physical Site (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query_all site: '{{ mso_site | default("ansible_test") }}' vrf: VRF1 @@ -467,7 +467,7 @@ register: nm_query_cidr_all_aws_3 - name: Verify nm_query_cidr_all_aws_2 and nm_query_cidr_all_aws_3 - assert: + ansible.builtin.assert: that: - nm_query_cidr_all_aws_2.msg == "Provided vrf 'VRF2' does not exist at site level." - nm_query_cidr_all_aws_3.msg == "Provided region 'us-west-1' does not exist. Existing regions{{':'}} " @@ -475,58 +475,58 @@ # REMOVE CIDR - name: Remove CIDR (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present_2 state: absent check_mode: true register: cm_remove_cidr - name: Verify cm_remove_cidr - assert: + ansible.builtin.assert: that: - cm_remove_cidr is changed - cm_remove_cidr.current == {} - name: Remove CIDR (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present_2 state: absent register: nm_remove_cidr - name: Verify nm_remove_cidr - assert: + ansible.builtin.assert: that: - nm_remove_cidr is changed - nm_remove_cidr.current == {} - name: Remove CIDR again (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present_2 state: absent check_mode: true register: cm_remove_cidr_again - name: Verify cm_remove_cidr_again - assert: + ansible.builtin.assert: that: - cm_remove_cidr_again is not changed - cm_remove_cidr_again.current == {} - name: Remove CIDR again (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present_2 state: absent register: nm_remove_cidr_again - name: Verify nm_remove_cidr_again - assert: + ansible.builtin.assert: that: - nm_remove_cidr_again is not changed - nm_remove_cidr_again.current == {} # QUERY NON-EXISTING CIDR - name: Query non-existing CIDR (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query cidr: non_existing_cidr check_mode: true @@ -534,14 +534,14 @@ register: cm_query_non_cidr - name: Query non-existing CIDR (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query cidr: non_existing_cidr ignore_errors: true register: nm_query_non_cidr - name: Verify query_non_cidr - assert: + ansible.builtin.assert: that: - cm_query_non_cidr is not changed - nm_query_non_cidr is not changed @@ -550,7 +550,7 @@ # QUERY NON-EXISTING region - name: Query non-existing region (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query region: non_existing_region check_mode: true @@ -558,14 +558,14 @@ register: cm_query_non_region - name: Query non-existing region (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query region: non_existing_region ignore_errors: true register: nm_query_non_region - name: Verify query_non_region - assert: + ansible.builtin.assert: that: - cm_query_non_region is not changed - nm_query_non_region is not changed @@ -574,7 +574,7 @@ # QUERY NON-EXISTING VRF - name: Query non-existing VRF (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query vrf: non_existing_vrf check_mode: true @@ -582,28 +582,28 @@ register: cm_query_non_vrf - name: Query non-existing VRF (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query vrf: non_existing_vrf ignore_errors: true register: nm_query_non_vrf - name: Verify query_non_vrf - assert: + ansible.builtin.assert: that: - cm_query_non_vrf is not changed - nm_query_non_vrf is not changed - cm_query_non_vrf == nm_query_non_vrf - name: Verify query_non_vrf (version < 3.0) - assert: + ansible.builtin.assert: that: - cm_query_non_vrf.msg == nm_query_non_vrf.msg == "Provided vrf 'non_existing_vrf' does not exist. Existing vrfs{{':'}} VRF1, VRF2" when: version.current.version is version('3', '<') # USE A NON-EXISTING STATE - name: Non-existing state for site cidr (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query state: non-existing-state check_mode: true @@ -611,14 +611,14 @@ register: cm_non_existing_state - name: Non-existing state for site cidr (normal_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -627,7 +627,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for site cidr (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query schema: non-existing-schema check_mode: true @@ -635,14 +635,14 @@ register: cm_non_existing_schema - name: Non-existing schema for site cidr (normal_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -651,7 +651,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for site cidr (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query template: non-existing-template check_mode: true @@ -659,14 +659,14 @@ register: cm_non_existing_template - name: Non-existing template for site cidr (normal_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -675,7 +675,7 @@ # USE A NON-ASSOCIATED TEMPLATE - name: Non-associated template for site cidr (check_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query template: Template 2 check_mode: true @@ -683,14 +683,14 @@ register: cm_non_associated_template - name: Non-associated template for site cidr (normal_mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_query template: Template 2 ignore_errors: true register: nm_non_associated_template - name: Verify non_associated_template - assert: + ansible.builtin.assert: that: - cm_non_associated_template is not changed - nm_non_associated_template is not changed @@ -700,7 +700,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site VRF region cidr to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -708,14 +708,14 @@ register: cm_no_site_associated - name: Add site VRF region cidr to Template 3 without any site associated (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is changed - nm_no_site_associated is changed
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/tasks/main.yml index e5e8d3ca7..0858d5cf3 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/tasks/main.yml @@ -8,13 +8,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -27,13 +27,13 @@ { 'site': 'azure_{{ mso_site | default(\"ansible_test\") }}', 'region': 'westus', 'cidr': '10.1.0.0/16'}]" - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -44,7 +44,7 @@ state: present - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -55,7 +55,7 @@ state: present - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -64,7 +64,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -75,7 +75,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -83,7 +83,7 @@ state: present - name: Ensure AWS site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -93,7 +93,7 @@ state: present - name: Ensure Azure site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -101,7 +101,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -112,7 +112,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -120,7 +120,7 @@ state: present - name: Add a new sites to a Template 1 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ item.site }}' @@ -130,7 +130,7 @@ when: version.current.version is version('3', '<') - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -138,7 +138,7 @@ state: present - name: Ensure region for VRF1 at site level exists - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -152,7 +152,7 @@ # ADD SUBNET - name: Add a new subnet to AWS CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: &mso_present + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: &mso_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -167,7 +167,7 @@ register: cm_add_subnet - name: Verify cm_add_subnet - assert: + ansible.builtin.assert: that: - cm_add_subnet is changed - cm_add_subnet.previous == {} @@ -175,12 +175,12 @@ - cm_add_subnet.current.zone == 'us-west-1a' - name: Add a new subnet to AWS CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present register: nm_add_subnet - name: Verify nm_add_subnet - assert: + ansible.builtin.assert: that: - nm_add_subnet is changed - nm_add_subnet.previous == {} @@ -188,31 +188,31 @@ - nm_add_subnet.current.zone == 'us-west-1a' - name: Add same subnet again to AWS CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present register: cm_add_subnet_again - name: Verify cm_add_subnet_again - assert: + ansible.builtin.assert: that: - cm_add_subnet_again is not changed - cm_add_subnet_again.current.ip == cm_add_subnet_again.previous.ip == '10.0.0.0/24' - cm_add_subnet_again.current.zone == cm_add_subnet_again.previous.zone == 'us-west-1a' - name: Add same subnet again to AWS CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present register: nm_add_subnet_again - name: Verify nm_add_subnet_again - assert: + ansible.builtin.assert: that: - nm_add_subnet_again is not changed - nm_add_subnet_again.current.ip == nm_add_subnet_again.previous.ip == '10.0.0.0/24' - nm_add_subnet_again.current.zone == nm_add_subnet_again.previous.zone == 'us-west-1a' - name: Add a new subnet to Azure CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -223,7 +223,7 @@ register: cm_add_subnet_2 - name: Verify cm_add_subnet_2 - assert: + ansible.builtin.assert: that: - cm_add_subnet_2 is changed - cm_add_subnet_2.previous == {} @@ -231,7 +231,7 @@ - cm_add_subnet_2.current.zone == '' - name: Add a new subnet to Azure CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -241,7 +241,7 @@ register: nm_add_subnet_2 - name: Verify nm_add_subnet_2 - assert: + ansible.builtin.assert: that: - nm_add_subnet_2 is changed - nm_add_subnet_2.previous == {} @@ -249,7 +249,7 @@ - nm_add_subnet_2.current.zone == '' - name: Add a second subnet to Azure CIDR in VRF1 at site level for VGW (check mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -261,7 +261,7 @@ register: cm_add_subnet_3 - name: Verify cm_add_subnet_3 - assert: + ansible.builtin.assert: that: - cm_add_subnet_3 is changed - cm_add_subnet_3.previous == {} @@ -271,7 +271,7 @@ # VGW - name: Add a second subnet to Azure CIDR in VRF1 at site level for VGW (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -282,7 +282,7 @@ register: nm_add_subnet_3 - name: Verify nm_add_subnet_3 - assert: + ansible.builtin.assert: that: - nm_add_subnet_3 is changed - nm_add_subnet_3.previous == {} @@ -292,7 +292,7 @@ # Private Link Label - name: Add a new subnet to Azure CIDR in VRF1 at site level for Private Link Label (MSO >3.3) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -304,7 +304,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_add_subnet_4 - assert: + ansible.builtin.assert: that: - nm_add_subnet_4 is changed - nm_add_subnet_4.current.ip == '10.1.0.0/24' @@ -313,7 +313,7 @@ # QUERY SUBNETS - name: Query subnet to AWS CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: &mso_query + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: &mso_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -327,25 +327,25 @@ register: cm_query_subnet - name: Verify cm_query_subnet - assert: + ansible.builtin.assert: that: - cm_query_subnet is not changed - cm_query_subnet.current.ip == '10.0.0.0/24' - cm_query_subnet.current.zone == 'us-west-1a' - name: Query subnet to AWS CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query register: nm_query_subnet - name: Verify nm_query_subnet - assert: + ansible.builtin.assert: that: - nm_query_subnet is not changed # QUERY ALL SUBNETS - name: Query all subnets to AWS CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: &mso_query_all + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: &mso_query_all <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -358,7 +358,7 @@ register: cm_query_subnet_all_aws - name: Query all subnets to Azure CIDR in VRF1 at site level (check mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query_all site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -368,7 +368,7 @@ register: cm_query_subnet_all_azure - name: Verify cm_query_subnet_all_aws and cm_query_subnet_all_azure - assert: + ansible.builtin.assert: that: - cm_query_subnet_all_aws is not changed - cm_query_subnet_all_aws.current[0].ip == '10.0.0.0/24' @@ -378,7 +378,7 @@ - cm_query_subnet_all_azure.current[1].ip == '10.1.1.0/24' - name: Verify cm_query_subnet_all_aws and cm_query_subnet_all_azure zone - assert: + ansible.builtin.assert: that: - cm_query_subnet_all_azure.current[0].zone == '' - cm_query_subnet_all_azure.current[1].zone == '' @@ -386,19 +386,19 @@ - name: Verify cm_query_subnet_all_aws and cm_query_subnet_all_azure zone - assert: + ansible.builtin.assert: that: - cm_query_subnet_all_azure.current[0].zone == 'default' - cm_query_subnet_all_azure.current[1].zone == 'default' when: version.current.version is version('4.0', '>=') - name: Query subnet to AWS CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query_all register: nm_query_subnet_all_aws - name: Query subnet to AWS CIDR in VRF1 at site level (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query_all site: 'azure_{{ mso_site | default("ansible_test") }}' region: westus @@ -407,7 +407,7 @@ register: nm_query_subnet_all_azure - name: Verify nm_query_subnet_all_aws and nm_query_subnet_all_azure - assert: + ansible.builtin.assert: that: - nm_query_subnet_all_aws is not changed - nm_query_subnet_all_aws.current[0].ip == '10.0.0.0/24' @@ -417,7 +417,7 @@ - nm_query_subnet_all_azure.current[1].ip == '10.1.1.0/24' - name: Verify cm_query_subnet_all_aws and cm_query_subnet_all_azure zone - assert: + ansible.builtin.assert: that: - nm_query_subnet_all_azure.current[0].zone == '' - nm_query_subnet_all_azure.current[1].zone == '' @@ -425,7 +425,7 @@ - name: Verify cm_query_subnet_all_aws and cm_query_subnet_all_azure zone - assert: + ansible.builtin.assert: that: - nm_query_subnet_all_azure.current[0].zone == 'default' - nm_query_subnet_all_azure.current[1].zone == 'default' @@ -436,7 +436,7 @@ when: version.current.version is version('3.3', '>=') block: - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -444,7 +444,7 @@ state: present - name: Add a secondary CIDR in VRF1 at AWS site level - mso_schema_site_vrf_region_cidr: &secondary_cidr + cisco.mso.mso_schema_site_vrf_region_cidr: &secondary_cidr <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -456,7 +456,7 @@ register: nm_add_cidr_3 - name: Verify nm_add_cidr_3 - assert: + ansible.builtin.assert: that: - nm_add_cidr_3 is changed - nm_add_cidr_3.previous == {} @@ -464,7 +464,7 @@ - nm_add_cidr_3.current.primary == false - name: Add a secondary CIDR in VRF1 at Azure site level - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *secondary_cidr schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -476,7 +476,7 @@ register: nm_add_cidr_4 - name: Verify nm_add_cidr_4 - assert: + ansible.builtin.assert: that: - nm_add_cidr_4 is changed - nm_add_cidr_4.previous == {} @@ -484,7 +484,7 @@ - nm_add_cidr_4.current.primary == false - name: Add hosted vrf parameters in VRF1 at Azure site level - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -500,7 +500,7 @@ register: azure_add_hosted_vrf - name: Verify azure_add_hosted_vrf - assert: + ansible.builtin.assert: that: - azure_add_hosted_vrf is changed - azure_add_hosted_vrf.previous == {} @@ -508,7 +508,7 @@ - azure_add_hosted_vrf.current.vrfRef.vrfName == 'VRF2' - name: Add hosted vrf parameters in VRF1 at AWS site level - mso_schema_site_vrf_region_cidr_subnet: &aws_cidr + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: &aws_cidr <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -524,7 +524,7 @@ register: aws_add_hosted_vrf - name: Verify aws_add_hosted_vrf - assert: + ansible.builtin.assert: that: - aws_add_hosted_vrf is changed - aws_add_hosted_vrf.previous == {} @@ -532,89 +532,89 @@ - aws_add_hosted_vrf.current.vrfRef.vrfName == 'VRF2' - name: Get Validation status - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query register: query_validate - name: Verify query_validate - assert: + ansible.builtin.assert: that: - query_validate is not changed - name: Verify query_validate result < 4.0 - assert: + ansible.builtin.assert: that: - query_validate.current.result == "true" when: version.current.version is version('4.0', '<') - name: Verify query_validate result => 4.0 - assert: + ansible.builtin.assert: that: - query_validate.current.result == true when: version.current.version is version('4.0', '>=') # REMOVE SUBNETS - name: Remove Subnet from CIDR (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present state: absent check_mode: true register: cm_remove_subnet - name: Verify cm_remove_subnet - assert: + ansible.builtin.assert: that: - cm_remove_subnet is changed - cm_remove_subnet.current == {} - name: Remove Subnet from CIDR (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present state: absent register: nm_remove_subnet - name: Verify nm_remove_subnet - assert: + ansible.builtin.assert: that: - nm_remove_subnet is changed - nm_remove_subnet.current == {} - name: Remove Subnet from CIDR again (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present state: absent check_mode: true register: cm_remove_subnet_again - name: Verify cm_remove_subnet_again - assert: + ansible.builtin.assert: that: - cm_remove_subnet_again is not changed - cm_remove_subnet_again.current == {} - name: Remove Subnet from CIDR again (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_present state: absent register: nm_remove_subnet_again - name: Verify nm_remove_subnet_again - assert: + ansible.builtin.assert: that: - nm_remove_subnet_again is not changed - nm_remove_subnet_again.current == {} - name: Remove Subnet from CIDR (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *aws_cidr state: absent register: remove_subnet when: version.current.version is version('3.3', '>=') - name: Verify nm_remove_subnet - assert: + ansible.builtin.assert: that: - remove_subnet is changed - remove_subnet.current == {} @@ -622,7 +622,7 @@ # QUERY NON-EXISTING subnet in CIDR - name: Query non-existing subnet (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query subnet: non_existing_subnet check_mode: true @@ -630,14 +630,14 @@ register: cm_query_non_subnet - name: Query non-existing subnet (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query subnet: non_existing_subnet ignore_errors: true register: nm_query_non_subnet - name: Verify query_non_subnet - assert: + ansible.builtin.assert: that: - cm_query_non_subnet is not changed - nm_query_non_subnet is not changed @@ -647,7 +647,7 @@ # QUERY NON-EXISTING CIDR - name: Query non-existing CIDR (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query cidr: non_existing_cidr check_mode: true @@ -655,34 +655,34 @@ register: cm_query_non_cidr - name: Query non-existing CIDR (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query cidr: non_existing_cidr ignore_errors: true register: nm_query_non_cidr - name: Verify query_non_cidr - assert: + ansible.builtin.assert: that: - cm_query_non_cidr is not changed - nm_query_non_cidr is not changed - cm_query_non_cidr == nm_query_non_cidr - name: Verify query_non_cidr value (version < 3.3) - assert: + ansible.builtin.assert: that: - cm_query_non_cidr.msg == nm_query_non_cidr.msg == "Provided CIDR IP 'non_existing_cidr' does not exist. Existing CIDR IPs{{':'}} 10.0.0.0/16. Use mso_schema_site_vrf_region_cidr to create it." when: version.current.version is version('3.3', '<') - name: Verify query_non_cidr value (version >= 3.3) - assert: + ansible.builtin.assert: that: - cm_query_non_cidr.msg == nm_query_non_cidr.msg == "Provided CIDR IP 'non_existing_cidr' does not exist. Existing CIDR IPs{{':'}} 10.0.0.0/16, 10.2.0.0/16. Use mso_schema_site_vrf_region_cidr to create it." when: version.current.version is version('3.3', '>=') # QUERY NON-EXISTING region - name: Query non-existing region (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query region: non_existing_region check_mode: true @@ -690,14 +690,14 @@ register: cm_query_non_region - name: Query non-existing region (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query region: non_existing_region ignore_errors: true register: nm_query_non_region - name: Verify query_non_region - assert: + ansible.builtin.assert: that: - cm_query_non_region is not changed - nm_query_non_region is not changed @@ -706,7 +706,7 @@ # QUERY NON-EXISTING VRF - name: Query non-existing VRF (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query vrf: non_existing_vrf check_mode: true @@ -714,14 +714,14 @@ register: cm_query_non_vrf - name: Query non-existing VRF (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query vrf: non_existing_vrf ignore_errors: true register: nm_query_non_vrf - name: Verify query_non_vrf - assert: + ansible.builtin.assert: that: - cm_query_non_vrf is not changed - nm_query_non_vrf is not changed @@ -730,7 +730,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for site cidr subnet (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query state: non-existing-state check_mode: true @@ -738,14 +738,14 @@ register: cm_non_existing_state - name: Non-existing state for site cidr subnet (normal_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -754,7 +754,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for site cidr subnet (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query schema: non-existing-schema check_mode: true @@ -762,14 +762,14 @@ register: cm_non_existing_schema - name: Non-existing schema for site cidr subnet (normal_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -778,7 +778,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for site cidr subnet (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query template: non-existing-template check_mode: true @@ -786,14 +786,14 @@ register: cm_non_existing_template - name: Non-existing template for site cidr subnet (normal_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -802,7 +802,7 @@ # USE A NON-ASSOCIATED TEMPLATE - name: Non-associated template for site cidr subnet (check_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query template: Template 2 check_mode: true @@ -810,14 +810,14 @@ register: cm_non_associated_template - name: Non-associated template for site cidr subnet (normal_mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query template: Template 2 ignore_errors: true register: nm_non_associated_template - name: Verify non_associated_template - assert: + ansible.builtin.assert: that: - cm_non_associated_template is not changed - nm_non_associated_template is not changed @@ -827,7 +827,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site cidr subnet to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -836,7 +836,7 @@ register: cm_no_site_associated - name: Add site cidr subnet to Template 3 without any site associated (normal mode) - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -844,7 +844,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed @@ -852,7 +852,7 @@ # Checking if issue when adding subnet to Hub Network (#126) - name: Add hub network in VRF1 region us-west-1 at AWS site level - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -865,7 +865,7 @@ state: present - name: Add a new subnet to AWS CIDR in VRF1 at site level - mso_schema_site_vrf_region_cidr_subnet: + cisco.mso.mso_schema_site_vrf_region_cidr_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -880,7 +880,7 @@ register: nm_add_subnet_hub_network - name: Verify nm_add_subnet_hub_network - assert: + ansible.builtin.assert: that: - nm_add_subnet_hub_network is changed - nm_add_subnet_hub_network.current.usage == 'gateway'
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/hub_network.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/hub_network.yml index 33fde6710..61936621a 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/hub_network.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/hub_network.yml @@ -6,7 +6,7 @@ # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,7 +20,7 @@ '{{ mso_site | default(\"ansible_test\") }}']" - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -31,7 +31,7 @@ state: present - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -42,7 +42,7 @@ state: present - name: Remove Schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -51,7 +51,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure sites removed from tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -62,7 +62,7 @@ - 'azure_{{ mso_site | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test # sites: @@ -72,7 +72,7 @@ state: present - name: Ensure AWS site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -82,7 +82,7 @@ state: present - name: Ensure Azure site is present under tenant ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -90,7 +90,7 @@ state: present - name: Ensure schema 1 with Template 1 and 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -101,7 +101,7 @@ - Template 2 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -109,7 +109,7 @@ state: present - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -117,7 +117,7 @@ state: present - name: Add a new CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &mso_present + cisco.mso.mso_schema_site_vrf_region_cidr: &mso_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -131,7 +131,7 @@ register: cm_add_cidr - name: Verify cm_add_cidr - assert: + ansible.builtin.assert: that: - cm_add_cidr is changed - cm_add_cidr.previous == {} @@ -139,12 +139,12 @@ - cm_add_cidr.current.primary == true - name: Add a new CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *mso_present register: nm_add_cidr - name: Verify nm_add_cidr - assert: + ansible.builtin.assert: that: - nm_add_cidr is changed - nm_add_cidr.previous == {} @@ -153,7 +153,7 @@ # ADD Hub Network - name: Add hub network in VRF1 region us-west-1 at AWS site level (check mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -168,7 +168,7 @@ register: cm_add_hub_network - name: Add hub network in VRF1 region us-west-1 at AWS site level (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -182,7 +182,7 @@ register: nm_add_hub_network - name: Verify cm_add_hub_network and nm_add_hub_network - assert: + ansible.builtin.assert: that: - cm_add_hub_network is changed - nm_add_hub_network is changed @@ -195,7 +195,7 @@ # Add hub network again - name: Add hub network again in VRF1 region us-west-1 at AWS site level (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -209,7 +209,7 @@ register: nm_add_hub_network_again - name: Verify nm_add_hub_network_again - assert: + ansible.builtin.assert: that: - nm_add_hub_network_again is not changed - nm_add_hub_network_again.previous.name == nm_add_hub_network_again.current.name == "hub-test" @@ -217,7 +217,7 @@ # Update hub network - name: Update hub network in VRF1 region us-west-1 at AWS site level (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -232,7 +232,7 @@ register: cm_update_hub_network - name: Update hub network in VRF1 region us-west-1 at AWS site level (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -246,7 +246,7 @@ register: nm_update_hub_network - name: Verify cm_update_hub_network and nm_update_hub_network - assert: + ansible.builtin.assert: that: - cm_update_hub_network is changed - nm_update_hub_network is changed @@ -261,7 +261,7 @@ # Query Hub Network - name: Query hub network in VRF1 region us-west-1 at AWS site level - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -273,7 +273,7 @@ register: cm_query_hub_network - name: Verify cm_query_hub_network - assert: + ansible.builtin.assert: that: - cm_query_hub_network is not changed - cm_query_hub_network.current.name == "hub-default" @@ -281,7 +281,7 @@ # Remove Hub Network - name: Remove hub network in VRF1 region us-west-1 at AWS site level (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -293,7 +293,7 @@ register: cm_remove_hub_network - name: Remove hub network in VRF1 region us-west-1 at AWS site level (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -304,7 +304,7 @@ register: nm_remove_hub_network - name: Verify cm_remove_hub_network and nm_remove_hub_network - assert: + ansible.builtin.assert: that: - cm_remove_hub_network is changed - cm_remove_hub_network.current == {} @@ -317,7 +317,7 @@ # Remove Hub Network again - name: Remove again hub network in VRF1 region us-west-1 at AWS site level (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -329,7 +329,7 @@ register: cm_remove_hub_network_again - name: Remove again hub network in VRF1 region us-west-1 at AWS site level (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -340,7 +340,7 @@ register: nm_remove_hub_network_again - name: Verify cm_remove_hub_network_again and nm_remove_hub_network_again - assert: + ansible.builtin.assert: that: - cm_remove_hub_network_again is not changed - nm_remove_hub_network_again is not changed @@ -349,7 +349,7 @@ # query when hub network does not exist - name: Query non_existing_hub_network - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -361,13 +361,13 @@ register: query_non_existing_hub_network - name: Verify query_non_existing_hub_network - assert: + ansible.builtin.assert: that: - query_non_existing_hub_network.msg == "Hub network not found" # Re-Add hub network - name: Re-Add hub network in VRF1 region us-west-1 at AWS site level (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -381,7 +381,7 @@ register: re_add_hub_network - name: Verify re_add_hub_network - assert: + ansible.builtin.assert: that: - re_add_hub_network is changed - re_add_hub_network.previous == {} @@ -390,7 +390,7 @@ # QUERY NON-EXISTING region - name: Query non-existing region (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -403,7 +403,7 @@ register: cm_query_non_region - name: Query non-existing region (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -415,7 +415,7 @@ register: nm_query_non_region - name: Verify query_non_region - assert: + ansible.builtin.assert: that: - cm_query_non_region is not changed - nm_query_non_region is not changed @@ -424,7 +424,7 @@ # QUERY NON-EXISTING VRF - name: Query non-existing VRF (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -437,7 +437,7 @@ register: cm_query_non_vrf - name: Query non-existing VRF (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -449,7 +449,7 @@ register: nm_query_non_vrf - name: Verify query_non_vrf - assert: + ansible.builtin.assert: that: - cm_query_non_vrf is not changed - nm_query_non_vrf is not changed @@ -458,7 +458,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for site hub network (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -471,7 +471,7 @@ register: cm_non_existing_state - name: Non-existing state for hub network (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -483,7 +483,7 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -492,7 +492,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for site hub network (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -505,7 +505,7 @@ register: cm_non_existing_schema - name: Non-existing schema for site hub network (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -517,7 +517,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -526,7 +526,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for site hub network (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -539,7 +539,7 @@ register: cm_non_existing_template - name: Non-existing template for site hub network (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -551,7 +551,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -560,7 +560,7 @@ # USE A NON_EXISTING_SITE_TEMPLATE - name: non_existing_site_template (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -573,7 +573,7 @@ register: cm_non_existing_site_template - name: non_existing_site_template (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -585,7 +585,7 @@ register: nm_non_existing_site_template - name: Verify cm_non_existing_site_template and nm_non_existing_site_template - assert: + ansible.builtin.assert: that: - cm_non_existing_site_template is not changed - nm_non_existing_site_template is not changed @@ -593,7 +593,7 @@ # USE A NON_EXISTING_SITE - name: non_existing_site (check_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -606,7 +606,7 @@ register: cm_non_existing_site - name: non_existing_site (normal_mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -618,7 +618,7 @@ register: nm_non_existing_site - name: Verify cm_non_existing_site and nm_non_existing_site - assert: + ansible.builtin.assert: that: - cm_non_existing_site is not changed - nm_non_existing_site is not changed @@ -626,7 +626,7 @@ # use mso_schema_site_vrf_region_cidr_subnet module to update region - name: Add a new CIDR in VRF1 at AWS site level (check mode) - mso_schema_site_vrf_region_cidr: &cidr_present + cisco.mso.mso_schema_site_vrf_region_cidr: &cidr_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -640,7 +640,7 @@ register: cm_add_cidr - name: Verify cm_add_cidr - assert: + ansible.builtin.assert: that: - cm_add_cidr is changed - cm_add_cidr.previous == {} @@ -648,12 +648,12 @@ - cm_add_cidr.current.primary == false - name: Add a new CIDR in VRF1 at AWS site level (normal mode) - mso_schema_site_vrf_region_cidr: + cisco.mso.mso_schema_site_vrf_region_cidr: <<: *cidr_present register: nm_add_cidr - name: Verify nm_add_cidr - assert: + ansible.builtin.assert: that: - nm_add_cidr is changed - nm_add_cidr.previous == {} @@ -662,7 +662,7 @@ # query hub network after using mso_schema_site_vrf_region_cidr_subnet module to update region - name: Query hub_network after region updated - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -673,7 +673,7 @@ register: query_after_region_update - name: Verify query_after_region_update - assert: + ansible.builtin.assert: that: - query_after_region_update is not changed - query_after_region_update.current.name == "hub-test" @@ -681,7 +681,7 @@ # USE A TEMPLATE WITHOUT ANY SITE - name: Add site VRF region hub network to Schema 2 Template 3 without any site associated (check mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -697,7 +697,7 @@ register: cm_no_site_associated - name: Add site VRF region hub network to Template 3 without any site associated (normal mode) - mso_schema_site_vrf_region_hub_network: + cisco.mso.mso_schema_site_vrf_region_hub_network: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -712,7 +712,7 @@ register: nm_no_site_associated - name: Verify cm_no_site_associated and nm_no_site_associated - assert: + ansible.builtin.assert: that: - cm_no_site_associated is not changed - nm_no_site_associated is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/main.yml index 6eb612ad0..a282da449 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_site_vrf_region_hub_network/tasks/main.yml @@ -5,13 +5,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template/tasks/main.yml index 9823bcfd4..c3da18453 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template/tasks/main.yml @@ -1,16 +1,17 @@ # Test code for the MSO modules # Copyright: (c) 2020, Shreyas Srish (@shrsr) <ssrish@cisco.com> +# Copyright: (c) 2023, Akini Ross (@akinross) <akinross@cisco.com> # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -39,7 +40,7 @@ ignore_errors: true - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -49,7 +50,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: '{{ item }}' users: @@ -62,7 +63,7 @@ - 'ansible_test_2' - name: Ensure schema 1 with Template 1 exists in check mode - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -72,7 +73,7 @@ register: add_template1_schema1_cm - name: Ensure schema 1 with Template 1 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -81,7 +82,7 @@ register: add_template1_schema1 - name: Ensure schema 1 with Template 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -90,7 +91,7 @@ register: add_template2_schema1 - name: Ensure schema 2 with Template 3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -99,7 +100,7 @@ register: add_template3_schema2 - name: Ensure schema 2 with Template 3 exists again - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -108,7 +109,7 @@ register: add_template3_schema2_again - name: Ensure schema 3 with Template 1 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test @@ -117,7 +118,7 @@ register: add_template1_schema3 - name: Ensure schema 3 with Template 2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test_2 @@ -126,7 +127,7 @@ register: add_template2_schema3 - name: Update display name of Template 3 in schema 2 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -136,7 +137,7 @@ register: update_template3_schema2 - name: Verify add - assert: + ansible.builtin.assert: that: - add_template1_schema1_cm is changed - add_template1_schema1_cm.current.name == 'Template1' @@ -155,7 +156,7 @@ - update_template3_schema2.current.displayName == 'Temp 3' - name: Query Template 1 in Schema 1 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -164,7 +165,7 @@ register: query_template1_schema1 - name: Query all Templates in Schema 1 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -172,7 +173,7 @@ register: query_all_templates_schema1 - name: Query Template 1 in Schema 3 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test @@ -181,7 +182,7 @@ register: query_template1_schema3 - name: Query Template 2 in Schema 3 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test_2 @@ -190,7 +191,7 @@ register: query_template2_schema3 - name: Verify query - assert: + ansible.builtin.assert: that: - query_template1_schema1 is not changed - query_template1_schema1.current.name == 'Template1' @@ -202,7 +203,7 @@ - query_template2_schema3.current.name == 'Template2' - name: Remove Template 1 of Schema 1 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -212,7 +213,7 @@ register: remove_template1_schema1 - name: Remove Template 2 of Schema 1 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -221,7 +222,7 @@ register: remove_template2_schema1 - name: Remove non_existing_template - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -231,7 +232,7 @@ register: remove_template_non_existing_template - name: Remove Template 3 in schema 2 in check mode - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -241,7 +242,7 @@ register: remove_template3_schema2_cm - name: Remove Template 3 in schema 2 in normal mode - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -250,7 +251,7 @@ register: remove_template3_schema2_nm - name: Remove Template 3 in schema 2 again - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -259,7 +260,7 @@ register: remove_template3_schema2_nm_again - name: Remove Template 1 of Schema 3 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test @@ -268,7 +269,7 @@ register: remove_template1_schema3 - name: Remove Template 2 of Schema 3 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_3' tenant: ansible_test_2 @@ -277,7 +278,7 @@ register: remove_template2_schema3 - name: non_existing_schema - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: non_schema tenant: ansible_test @@ -287,7 +288,7 @@ register: remove_template_non_existing_schema - name: Verify remove - assert: + ansible.builtin.assert: that: - remove_template1_schema1.current == {} - remove_template1_schema1.previous.name == 'Template1' @@ -307,7 +308,7 @@ # USE NON-EXISTING STATE - name: non_existing_state state - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -317,14 +318,14 @@ register: non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - non_existing_state is not changed - non_existing_state.msg == "value of state must be one of{{':'}} absent, present, query, got{{':'}} non_existing_state" # USE A NON_EXISTING_TEMPLATE - name: non_existing_template - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -334,13 +335,13 @@ register: non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - non_existing_template is not changed - non_existing_template.msg == "Template 'non_existing_template' not found" - name: Template attribute absent in task - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: non_schema tenant: ansible_test @@ -349,13 +350,13 @@ register: absent_template - name: Verify absent_template - assert: + ansible.builtin.assert: that: - absent_template is not changed - absent_template.current == [] - name: Update description schema 1 with Template 1 when version is greater than 3.3 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' schema_description: "this is schema" @@ -367,14 +368,14 @@ when: version.current.version is version('3.3', '>=') - name: Verify add description - assert: + ansible.builtin.assert: that: - add_description is changed when: version.current.version is version('3.3', '>=') # REMOVE Schemas for next CI Run - name: Remove schemas for next ci test - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -385,7 +386,84 @@ # REMOVE Tenant2 specific to this test case - name: Remove tenant2 - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test_2 - state: absent
\ No newline at end of file + state: absent + +# TEST BLOCK FOR MSO VERSION >= 4.1 WHICH ALLOW FOR SCHEMA WITHOUT TEMPLATES +- name: Execute tasks only for MSO version >= 4.1 + when: version.current.version is version('4.1', '>=') + block: + + - name: Ensure schema without templates is not present + cisco.mso.mso_schema: + <<: *mso_info + schema: ansible_test + state: absent + + - name: Create a schema without templates + cisco.mso.mso_schema: + <<: *mso_info + schema: ansible_test + state: present + + - name: Query all templates in schema without templates + cisco.mso.mso_schema_template: + <<: *mso_info + schema: ansible_test + state: query + register: query_all_templates_ansible_test + + - name: Verify schema without templates creation has no templates + ansible.builtin.assert: + that: + - query_all_templates_ansible_test.current == [] + + # Templates are not allowed to do PATCH add operation on schema without templates in earlier versions + # Error would be: "message": "add operation does not apply: doc is missing path: \"/templates/-\": missing value" + - name: Create a template in schema without templates for version >= 4.2 + cisco.mso.mso_schema_template: &ansible_test_template + <<: *mso_info + schema: ansible_test + tenant: ansible_test + template: template_1 + state: present + register: create_template_in_ansible_test + when: version.current.version is version('4.2', '>=') + + - name: Verify creation of template in schema without templates for version >= 4.2 + ansible.builtin.assert: + that: + - create_template_in_ansible_test is changed + - create_template_in_ansible_test.current.displayName == "template_1" + when: version.current.version is version('4.2', '>=') + + - name: Remove a template in schema without templates + cisco.mso.mso_schema_template: + <<: *ansible_test_template + state: absent + register: remove_template_in_ansible_test + + - name: Remove schema without templates + cisco.mso.mso_schema: + <<: *mso_info + schema: ansible_test + state: absent + register: remove_ansible_test + + - name: Verify schema without templates creation is removed + ansible.builtin.assert: + that: + - remove_template_in_ansible_test is not changed + - remove_template_in_ansible_test.current == {} + - remove_ansible_test is changed + when: version.current.version is version('4.2', '<') + + - name: Verify schema without templates creation is removed + ansible.builtin.assert: + that: + - remove_template_in_ansible_test is changed + - remove_template_in_ansible_test.current == {} + - remove_ansible_test is not changed + when: version.current.version is version('4.2', '>=') diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp/tasks/main.yml index bbd5bb1cb..0084bfcd6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -38,13 +38,13 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenant2 - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test_2 state: absent - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -52,7 +52,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -60,7 +60,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -68,7 +68,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -76,7 +76,7 @@ state: present - name: Ensure ANP exist (check_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -86,7 +86,7 @@ register: cm_create_anp - name: Ensure ANP exist (normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -95,7 +95,7 @@ register: nm_create_anp - name: Create ANP again (normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -104,7 +104,7 @@ register: nm_create_anp_again - name: Verify cm_create_anp, nm_create_anp and nm_create_anp_again - assert: + ansible.builtin.assert: that: - cm_create_anp is changed - nm_create_anp is changed @@ -123,7 +123,7 @@ - nm_create_anp_again.current.epgs == [] - name: Create another anp (normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -133,7 +133,7 @@ register: nm_create_another_anp - name: Verify nm_create_another_anp - assert: + ansible.builtin.assert: that: - nm_create_another_anp is changed - nm_create_another_anp.previous == {} @@ -144,7 +144,7 @@ # Add description for version >= 3.3 - name: Create another anp with description(normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -156,7 +156,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_create_another_anp with description - assert: + ansible.builtin.assert: that: - nm_create_another_anp is changed - nm_create_another_anp.previous == {} @@ -167,7 +167,7 @@ when: version.current.version is version('3.3', '>=') - name: Change anp (normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -177,7 +177,7 @@ register: nm_change_anp - name: Verify nm_change_anp - assert: + ansible.builtin.assert: that: - nm_change_anp is changed - nm_change_anp.previous.name == nm_change_anp.current.name == "ANP" @@ -186,7 +186,7 @@ - nm_change_anp.previous.epgs == nm_change_anp.current.epgs == [] - name: Query anp - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -195,7 +195,7 @@ register: query_anp - name: Verify query_anp - assert: + ansible.builtin.assert: that: - query_anp is not changed - query_anp.current.name == "ANP" @@ -203,7 +203,7 @@ - query_anp.current.displayName == "displayName for ANP" - name: Query all - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -211,21 +211,21 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all.current | length == 2 when: version.current.version is version('3.3', '<') - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all.current | length == 3 when: version.current.version is version('3.3', '>=') - name: Query non_existing anp - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -235,12 +235,12 @@ register: query_non_existing_anp - name: Verify query_non_existing_anp - assert: + ansible.builtin.assert: that: - query_non_existing_anp.msg == "ANP 'non_existing_anp' not found" - name: Use non_existing schema - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: non_existing_schema template: Template 1 @@ -250,7 +250,7 @@ register: query_non_existing_schema - name: Use non_existing template - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -260,13 +260,13 @@ register: query_non_existing_template - name: Verify query_non_existing_schema and query_non_existing_template - assert: + ansible.builtin.assert: that: - query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." - query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1, Template2" - name: Remove anp (check_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -276,7 +276,7 @@ register: cm_rm_anp - name: Remove anp (normal_mode) - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -285,7 +285,7 @@ register: nm_rm_anp - name: Verify cm_rm_anp and nm_rm_anp - assert: + ansible.builtin.assert: that: - cm_rm_anp is changed - nm_rm_anp is changed @@ -296,7 +296,7 @@ - nm_rm_anp.previous.epgs == cm_rm_anp.previous.epgs == [] - name: Remove anp again - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -305,7 +305,7 @@ register: nm_rm_anp_again - name: Verify nm_rm_anp_again - assert: + ansible.builtin.assert: that: - nm_rm_anp_again is not changed - nm_rm_anp_again.previous == nm_rm_anp_again.current == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml index a4af6fb6d..16fdddc28 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml @@ -7,14 +7,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -25,13 +25,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -40,7 +40,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -48,7 +48,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -56,7 +56,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -64,7 +64,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -72,7 +72,7 @@ state: present - name: Ensure VRF exist - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -81,13 +81,13 @@ state: present - name: Ensure VRF2 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present vrf: VRF2 state: present - name: Ensure VRF3 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -95,7 +95,7 @@ state: present - name: Ensure VRF4 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -103,7 +103,7 @@ state: present - name: Ensure ANP exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -111,7 +111,7 @@ state: present - name: Ensure ANP2 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -119,7 +119,7 @@ state: present - name: Ensure ANP3 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -127,7 +127,7 @@ state: present - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -136,7 +136,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -147,7 +147,7 @@ state: present - name: Ensure Filter 2 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -156,7 +156,7 @@ state: present - name: Ensure Contract2 exist - mso_schema_template_contract_filter: &contract2_present + cisco.mso.mso_schema_template_contract_filter: &contract2_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -167,7 +167,7 @@ state: present - name: Ensure ansible_test_1 BD exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -178,7 +178,7 @@ state: present - name: Ensure ansible_test_2 BD exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -190,7 +190,7 @@ state: present - name: Ensure ansible_test_3 BD exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -203,7 +203,7 @@ state: present - name: Ensure ansible_test_4 BD exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -217,7 +217,7 @@ # ADD EPG - name: Add EPG (check_mode) - mso_schema_template_anp_epg: &epg_present + cisco.mso.mso_schema_template_anp_epg: &epg_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -232,7 +232,7 @@ register: cm_add_epg - name: Verify cm_add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg is changed - cm_add_epg.previous == {} @@ -243,12 +243,12 @@ - cm_add_epg.current.bdRef.bdName == "ansible_test_1" - name: Add EPG (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present register: nm_add_epg - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg is changed - nm_add_epg.previous == {} @@ -261,13 +261,13 @@ - cm_add_epg.current.bdRef.schemaId == nm_add_epg.current.bdRef.schemaId - name: Add EPG again (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present check_mode: true register: cm_add_epg_again - name: Verify cm_add_epg_again - assert: + ansible.builtin.assert: that: - cm_add_epg_again is not changed - cm_add_epg_again.current.name == cm_add_epg_again.previous.name == "ansible_test_1" @@ -280,12 +280,12 @@ - name: Add EPG again (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present register: nm_add_epg_again - name: Verify nm_add_epg_again - assert: + ansible.builtin.assert: that: - nm_add_epg_again is not changed - nm_add_epg_again.current.name == nm_add_epg_again.previous.name == "ansible_test_1" @@ -297,13 +297,13 @@ - nm_add_epg_again.previous.bdRef.schemaId == nm_add_epg_again.current.bdRef.schemaId - name: Add EPG 2 (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present schema: '{{ mso_schema | default("ansible_test") }}' epg: ansible_test_2 - name: Add EPG 3 in template of schema 1(normal mode) - mso_schema_template_anp_epg: &epg_schema_1_template_2 + cisco.mso.mso_schema_template_anp_epg: &epg_schema_1_template_2 <<: *epg_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -338,7 +338,7 @@ register: nm_add_epg_3 - name: Add EPG 4 in template3 of schema 2(normal mode) - mso_schema_template_anp_epg: &epg_schema_2_template_3 + cisco.mso.mso_schema_template_anp_epg: &epg_schema_2_template_3 <<: *epg_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -355,7 +355,7 @@ register: nm_add_epg_4 - name: Verify nm_add_epg_3 and nm_add_epg_4 - assert: + ansible.builtin.assert: that: - nm_add_epg_3 is changed - nm_add_epg_4 is changed @@ -397,7 +397,7 @@ # CHANGE EPG - name: Change EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present vrf: name: VRF2 @@ -407,7 +407,7 @@ register: cm_change_epg - name: Verify cm_change_epg - assert: + ansible.builtin.assert: that: - cm_change_epg is changed - cm_change_epg.current.name == 'ansible_test_1' @@ -418,7 +418,7 @@ - cm_change_epg.current.bdRef.schemaId == cm_change_epg.previous.bdRef.schemaId - name: Change EPG (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present vrf: name: VRF2 @@ -428,7 +428,7 @@ register: nm_change_epg - name: Verify nm_change_epg - assert: + ansible.builtin.assert: that: - nm_change_epg is changed - nm_change_epg.current.name == 'ansible_test_1' @@ -439,7 +439,7 @@ - nm_change_epg.current.bdRef.schemaId == nm_change_epg.previous.bdRef.schemaId - name: Change EPG again (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present vrf: name: VRF2 @@ -449,7 +449,7 @@ register: cm_change_epg_again - name: Verify cm_change_epg_again - assert: + ansible.builtin.assert: that: - cm_change_epg_again is not changed - cm_change_epg_again.current.name == 'ansible_test_1' @@ -460,7 +460,7 @@ - cm_change_epg_again.current.bdRef.schemaId == cm_change_epg_again.previous.bdRef.schemaId - name: Change EPG again (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present vrf: name: VRF2 @@ -469,7 +469,7 @@ register: nm_change_epg_again - name: Verify nm_change_epg_again - assert: + ansible.builtin.assert: that: - nm_change_epg_again is not changed - nm_change_epg_again.current.name == 'ansible_test_1' @@ -480,7 +480,7 @@ - nm_change_epg_again.current.bdRef.schemaId == nm_change_epg_again.previous.bdRef.schemaId - name: Change EPG to VRF in different template (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_schema_1_template_2 vrf: name: VRF @@ -491,7 +491,7 @@ register: nm_change_epg_vrf3 - name: Change EPG 4 to VRF (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_schema_2_template_3 schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -508,7 +508,7 @@ register: nm_change_epg_vrf4 - name: Verify nm_change_epg_vrf3 and nm_change_epg_vrf4 - assert: + ansible.builtin.assert: that: - nm_change_epg_vrf3 is changed - nm_change_epg_vrf3.current.name == 'ansible_test_3' @@ -521,7 +521,7 @@ - nm_change_epg_vrf4.current.vrfRef.templateName == nm_change_epg_vrf4.current.bdRef.templateName == "Template1" - name: Change EPG 1 settings(normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -547,7 +547,7 @@ register: nm_change_epg_1_settings - name: Change EPG 1 subnets (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -571,7 +571,7 @@ register: nm_change_epg_1_subnets - name: Verify nm_change_epg_1_subnets - assert: + ansible.builtin.assert: that: - nm_change_epg_1_settings is changed - nm_change_epg_1_settings.current.name == "ansible_test_1" @@ -633,7 +633,7 @@ # # QUERY ALL EPGs - name: Query all EPGs in an ANP (check_mode) - mso_schema_template_anp_epg: &epg_query + cisco.mso.mso_schema_template_anp_epg: &epg_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -643,12 +643,12 @@ register: cm_query_all_epgs - name: Query all EPGs (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query register: nm_query_all_epgs - name: Verify query_all_epgs - assert: + ansible.builtin.assert: that: - cm_query_all_epgs is not changed - nm_query_all_epgs is not changed @@ -657,20 +657,20 @@ # QUERY AN EPG - name: Query EPG 1 (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_1 check_mode: true register: cm_query_epg_1 - name: Query EPG 1 (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_1 register: nm_query_epg_1 - name: Query EPG 3 (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query template: Template 2 anp: ANP2 @@ -678,7 +678,7 @@ register: nm_query_epg_3 - name: Query EPG 4 (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -687,7 +687,7 @@ register: nm_query_epg_4 - name: Verify query_epg_x - assert: + ansible.builtin.assert: that: - cm_query_epg_1 is not changed - nm_query_epg_1 is not changed @@ -752,57 +752,57 @@ # REMOVE EPG - name: Remove EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present state: absent check_mode: true register: cm_remove_epg - name: Verify cm_remove_epg - assert: + ansible.builtin.assert: that: - cm_remove_epg is changed - cm_remove_epg.current == {} - name: Remove EPG (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present state: absent register: nm_remove_epg - name: Verify nm_remove_epg - assert: + ansible.builtin.assert: that: - nm_remove_epg is changed - nm_remove_epg.current == {} - name: Remove EPG again (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present state: absent check_mode: true register: cm_remove_epg_again - name: Verify cm_remove_epg_again - assert: + ansible.builtin.assert: that: - cm_remove_epg_again is not changed - cm_remove_epg_again.current == {} - name: Remove EPG again (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present state: absent register: nm_remove_epg_again - name: Verify nm_remove_epg_again - assert: + ansible.builtin.assert: that: - nm_remove_epg_again is not changed - nm_remove_epg_again.current == {} - name: Remove EPG (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -817,7 +817,7 @@ - version.current.version is version('3.3', '>=') block: - name: Add EPG (for version greater than 3.3) - mso_schema_template_anp_epg: &new_epg + cisco.mso.mso_schema_template_anp_epg: &new_epg <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -828,13 +828,13 @@ register: add_epg_desc - name: Verify Add description - assert: + ansible.builtin.assert: that: - add_epg_desc is changed - add_epg_desc.current.description == "Description of ANP EPG" - name: Remove EPG (for version greater than 3.3) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg state: absent @@ -843,7 +843,7 @@ - version.current.version is version('4.0', '>=') block: - name: Add EPG service type parameters (for version greater than 4.0) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg epg_type: 'service' deployment_type: 'third_party' @@ -852,7 +852,7 @@ register: service_type_epg - name: Add EPG service type parameters (for version greater than 4.0) with error - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg epg_type: 'service' deployment_type: 'third_party' @@ -862,7 +862,7 @@ register: service_type_epg_error - name: Verify service type error - assert: + ansible.builtin.assert: that: - service_type_epg_error.msg == "MSO Error 400{{':'}} EPG{{':'}} ansible_test_1 in Schema{{':'}} ansible_test , Template{{':'}} Template1 DeploymentType{{':'}} saas, AccessType {{':'}}publicAndPrivateType, Combination is not supported" @@ -873,7 +873,7 @@ - version.current.version is version('4.0', '<') block: - name: Add EPG service type parameters (for version greater than 3.3 and less than 4.0) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg epg_type: 'service' deployment_type: 'third_party' @@ -882,7 +882,7 @@ register: add_epg - name: Get Validation status for service type parameters - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query @@ -890,13 +890,13 @@ register: query_validate - name: Verify validation - assert: + ansible.builtin.assert: that: - query_validate is not changed - query_validate.msg == "MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} For Deployment type 'Third-party' access type 'PublicAndPrivate' is not supported exception while trying to update schema" - name: Add EPG service type parameters (for version greater than 3.3 and less than 4.0) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg epg_type: 'service' deployment_type: 'cloud_native' @@ -905,7 +905,7 @@ register: add_epg - name: Get Validation status for service type parameters - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query @@ -913,13 +913,13 @@ register: query_validate - name: Verify validation - assert: + ansible.builtin.assert: that: - query_validate is not changed - query_validate.current.result == "true" - name: Add new EPG service type parameters (for version greater than 3.3 and less than 4.0) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *new_epg epg_type: 'service' deployment_type: 'third_party' @@ -928,7 +928,7 @@ register: add_epg - name: Get Validation status for service type parameters - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query @@ -936,14 +936,14 @@ register: query_validate - name: Verify validation - assert: + ansible.builtin.assert: that: - query_validate is not changed - query_validate.current.result == "true" # Add QoS level to EPG - name: Add EPG (for version greater than 3.1) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present name: ansible_test_5 qos_level: 'level2' @@ -951,14 +951,14 @@ when: version.current.version is version('3.1', '>=') - name: Verify Add contract for version greater than 3.1 - assert: + ansible.builtin.assert: that: - add_epg is changed when: version.current.version is version('3.1', '>=') # QUERY NON-EXISTING EPG - name: Query non-existing EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: non_existing_epg check_mode: true @@ -966,14 +966,14 @@ register: cm_query_non_epg - name: Query non-existing EPG (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: non_existing_epg ignore_errors: true register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - cm_query_non_epg is not changed - nm_query_non_epg is not changed @@ -982,7 +982,7 @@ # QUERY NON-EXISTING ANP - name: Query non-existing ANP (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query anp: non_existing_anp check_mode: true @@ -990,14 +990,14 @@ register: cm_query_non_anp - name: Query non-existing ANP (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query anp: non_existing_anp ignore_errors: true register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - cm_query_non_anp is not changed - nm_query_non_anp is not changed @@ -1006,7 +1006,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_2 state: non-existing-state @@ -1015,7 +1015,7 @@ register: cm_non_existing_state - name: Non-existing state for EPG (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_2 state: non-existing-state @@ -1023,7 +1023,7 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -1032,7 +1032,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present schema: non-existing-schema epg: ansible_test_2 @@ -1041,7 +1041,7 @@ register: cm_non_existing_schema - name: Non-existing schema for EPG (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present schema: non-existing-schema epg: ansible_test_2 @@ -1049,7 +1049,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -1057,7 +1057,7 @@ - cm_non_existing_schema.msg == nm_non_existing_schema.msg == "Provided schema 'non-existing-schema' does not exist." - name: Non-existing BD schema for EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 bd: @@ -1069,7 +1069,7 @@ register: cm_non_existing_bd_schema - name: Non-existing BD schema for EPG (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 bd: @@ -1080,7 +1080,7 @@ register: nm_non_existing_bd_schema - name: Verify non_existing_bd_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_bd_schema is not changed - nm_non_existing_bd_schema is not changed @@ -1088,7 +1088,7 @@ - cm_non_existing_bd_schema.msg == nm_non_existing_bd_schema.msg == "Referenced schema 'non-existing-schema' in bdref does not exist" - name: Non-existing VRF schema for EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 vrf: @@ -1100,7 +1100,7 @@ register: cm_non_existing_vrf_schema - name: Non-existing VRF schema for EPG (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 vrf: @@ -1111,7 +1111,7 @@ register: nm_non_existing_vrf_schema - name: Verify non_existing_vrf_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_vrf_schema is not changed - nm_non_existing_vrf_schema is not changed @@ -1120,7 +1120,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for EPG (check_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present template: non-existing-template epg: ansible_test_2 @@ -1129,7 +1129,7 @@ register: cm_non_existing_template - name: Non-existing template for EPG (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present template: non-existing-template epg: ansible_test_2 @@ -1137,7 +1137,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -1146,12 +1146,12 @@ # Checking if contract are removed after re-applying an EPG. (#13 | #62137) - name: Reset EPG 3 in template of schema 1 to avoid cyclic circles (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_schema_1_template_2 register: nm_add_epg_3 - name: Add Contracts to EPG 2 - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1169,41 +1169,41 @@ - { name: Contract2, template: Template 2, type: provider } - name: Query EPG 2 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_2 register: nm_query_contract_epg - name: Verify that 4 contracts are in EPG 2 using nm_query_contract_epg - assert: + ansible.builtin.assert: that: - nm_query_contract_epg.current.contractRelationships | length == 4 - name: Add EPG 2 again (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 register: nm_add_epg_2_again - name: Verify that EPG 2 didn't change - assert: + ansible.builtin.assert: that: - nm_add_epg_2_again is not changed - name: Query EPG 2 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_2 register: nm_query_contract_epg - name: Verify that 4 contracts are in EPG 2 using nm_query_contract_epg - assert: + ansible.builtin.assert: that: - nm_query_contract_epg.current.contractRelationships | length == 4 # Checking if issue when querying EPG and VRF is not defined (#66) - name: Add new test EPG 3 (normal mode) - mso_schema_template_anp_epg: &epg_present_2 + cisco.mso.mso_schema_template_anp_epg: &epg_present_2 <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1214,19 +1214,19 @@ register: nm_add_epg_3 - name: Verify nm_add_epg_3 - assert: + ansible.builtin.assert: that: - nm_add_epg_3 is changed - nm_add_epg_3.current.name == 'ansible_test_3' - "'vrfRef' not in nm_add_epg_3.current" - name: Query test EPG 3 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present_2 register: nm_query_epg_3 - name: Verify nm_query_epg_3 - assert: + ansible.builtin.assert: that: - nm_query_epg_3 is not changed - nm_query_epg_3.current.name == 'ansible_test_3' @@ -1234,7 +1234,7 @@ # Checking if modifying an EPG with existing contracts throw an MSO error. (#82) - name: Change EPG 2 to add VRF (normal_mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present epg: ansible_test_2 vrf: @@ -1244,7 +1244,7 @@ register: nm_change_epg_2_vrf - name: Verify that EPG 2 did change - assert: + ansible.builtin.assert: that: - nm_change_epg_2_vrf is changed - nm_change_epg_2_vrf.current.vrfRef.templateName == "Template1" @@ -1252,12 +1252,12 @@ - nm_change_epg_2_vrf.current.bdRef.bdName == "ansible_test_2" - name: Query EPG 2 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_query epg: ansible_test_2 register: nm_query_contract_epg_2 - name: Verify that 4 contracts are in EPG 2 using nm_query_contract_epg_2 - assert: + ansible.builtin.assert: that: - nm_query_contract_epg_2.current.contractRelationships | length == 4
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_contract/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_contract/tasks/main.yml index 0027cfda4..9ffe1b7fe 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_contract/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_contract/tasks/main.yml @@ -1,17 +1,17 @@ # Test code for the MSO modules +# Copyright: (c) 2024, Akini Ross (@akinross) <akinross@cisco.com> # Copyright: (c) 2020, Lionel Hercot (@lhercot) <lhercot@cisco.com> # Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com> (based on mso_site test case) -# # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,7 +23,7 @@ # CLEAN ENVIRONMENT # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -40,7 +40,7 @@ # state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -49,7 +49,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -59,7 +59,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -67,7 +67,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -75,7 +75,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -83,7 +83,7 @@ state: present - name: Ensure ANP exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -94,7 +94,7 @@ - { schema: '{{ mso_schema | default("ansible_test") }}_2', template: 'Template 3' } - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -103,7 +103,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -114,7 +114,7 @@ state: present - name: Ensure Filter 2 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -123,7 +123,7 @@ state: present - name: Ensure Contract2 exist - mso_schema_template_contract_filter: &contract2_present + cisco.mso.mso_schema_template_contract_filter: &contract2_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -134,7 +134,7 @@ state: present - name: Ensure EPGs exist - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -147,7 +147,7 @@ # ADD Contract to EPG - name: Add Contract1 to EPG (check_mode) - mso_schema_template_anp_epg_contract: &contract_epg_present + cisco.mso.mso_schema_template_anp_epg_contract: &contract_epg_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -161,7 +161,7 @@ register: cm_add_contract_rel - name: Verify cm_add_contract_rel - assert: + ansible.builtin.assert: that: - cm_add_contract_rel is changed - cm_add_contract_rel.previous == {} @@ -170,12 +170,12 @@ - cm_add_contract_rel.current.relationshipType == "consumer" - name: Add Contract to EPG (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present register: nm_add_contract_rel - name: Verify nm_add_contract_rel - assert: + ansible.builtin.assert: that: - nm_add_contract_rel is changed - nm_add_contract_rel.previous == {} @@ -185,13 +185,13 @@ - cm_add_contract_rel.current.contractRef.schemaId == nm_add_contract_rel.current.contractRef.schemaId - name: Add Contract to EPG again (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present check_mode: true register: cm_add_contract_rel_again - name: Verify cm_add_contract_rel_again - assert: + ansible.builtin.assert: that: - cm_add_contract_rel_again is not changed - cm_add_contract_rel_again.previous.contractRef.templateName == "Template1" @@ -204,12 +204,12 @@ - name: Add Contract to EPG again (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present register: nm_add_contract_rel_again - name: Verify nm_add_contract_rel_again - assert: + ansible.builtin.assert: that: - nm_add_contract_rel_again is not changed - nm_add_contract_rel_again.previous.contractRef.templateName == "Template1" @@ -221,7 +221,7 @@ - nm_add_contract_rel_again.previous.contractRef.schemaId == nm_add_contract_rel_again.current.contractRef.schemaId - name: Add Contract1 to EPG - provider (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present contract: name: Contract1 @@ -229,7 +229,7 @@ register: nm_add_contract1_rel_provider - name: Add Contract2 to EPG - consumer (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present contract: name: Contract2 @@ -238,7 +238,7 @@ register: nm_add_contract2_rel_consumer - name: Add Contract1 to EPG 3 - provider (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -252,7 +252,7 @@ register: nm_add_contract3_rel_provider - name: Verify nm_add_contract1_rel_provider, nm_add_contract2_rel_consumer and nm_add_contract3_rel_provider - assert: + ansible.builtin.assert: that: - nm_add_contract1_rel_provider is changed - nm_add_contract2_rel_consumer is changed @@ -267,7 +267,7 @@ # # QUERY ALL Contract to EPG - name: Query all contract relationship for EPG (check_mode) - mso_schema_template_anp_epg_contract: &contract_epg_query + cisco.mso.mso_schema_template_anp_epg_contract: &contract_epg_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -278,12 +278,12 @@ register: cm_query_all_contract_rels - name: Query all contract relationship for EPG (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query register: nm_query_all_contract_rels - name: Verify query_all_contract_rels - assert: + ansible.builtin.assert: that: - cm_query_all_contract_rels is not changed - nm_query_all_contract_rels is not changed @@ -292,7 +292,7 @@ # QUERY A Contract to EPG - name: Query Contract1 relationship for EPG - consumer (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -301,7 +301,7 @@ register: cm_query_contract1_consumer_rel - name: Query Contract1 relationship for EPG - consumer (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -309,7 +309,7 @@ register: nm_query_contract1_consumer_rel - name: Query Contract1 relationship for EPG - provider (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -317,7 +317,7 @@ register: nm_query_contract1_provider_rel - name: Query Contract1 relationship for EPG - consumer (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract2 @@ -326,7 +326,7 @@ register: nm_query_contract2_consumer_rel - name: Query Contract1 relationship for EPG - provider (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -340,7 +340,7 @@ register: nm_query_contract3_provider_rel - name: Verify query_contractX_YYYYY_rel - assert: + ansible.builtin.assert: that: - cm_query_contract1_consumer_rel is not changed - nm_query_contract1_consumer_rel is not changed @@ -359,51 +359,51 @@ # REMOVE Contract to EPG - name: Remove Contract to EPG (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present state: absent check_mode: true register: cm_remove_contract_rel - name: Verify cm_remove_contract_rel - assert: + ansible.builtin.assert: that: - cm_remove_contract_rel is changed - cm_remove_contract_rel.current == {} - name: Remove Contract to EPG (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present state: absent register: nm_remove_contract_rel - name: Verify nm_remove_contract_rel - assert: + ansible.builtin.assert: that: - nm_remove_contract_rel is changed - nm_remove_contract_rel.current == {} - name: Remove Contract to EPG again (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present state: absent check_mode: true register: cm_remove_contract_rel_again - name: Verify cm_remove_contract_rel_again - assert: + ansible.builtin.assert: that: - cm_remove_contract_rel_again is not changed - cm_remove_contract_rel_again.current == {} - name: Remove Contract to EPG again (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_present state: absent register: nm_remove_contract_rel_again - name: Verify nm_remove_contract_rel_again - assert: + ansible.builtin.assert: that: - nm_remove_contract_rel_again is not changed - nm_remove_contract_rel_again.current == {} @@ -411,7 +411,7 @@ # QUERY NON-EXISTING Contract to EPG - name: Query non-existing contract (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: non_existing_contract @@ -421,7 +421,7 @@ register: cm_query_non_contract - name: Query non-existing contract (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: non_existing_contract @@ -430,17 +430,17 @@ register: nm_query_non_contract - name: Verify query_non_contract - assert: + ansible.builtin.assert: that: - cm_query_non_contract is not changed - nm_query_non_contract is not changed - cm_query_non_contract == nm_query_non_contract - - cm_query_non_contract.msg is match("Contract '/schemas/[0-9a-zA-Z]*/templates/Template1/contracts/non_existing_contract' not found") - - nm_query_non_contract.msg is match("Contract '/schemas/[0-9a-zA-Z]*/templates/Template1/contracts/non_existing_contract' not found") + - cm_query_non_contract.msg is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/Template1/contracts/non_existing_contract' and type 'provider' not found") + - nm_query_non_contract.msg is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/Template1/contracts/non_existing_contract' and type 'provider' not found") # QUERY NON-EXISTING EPG - name: Query non-existing EPG (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query epg: non_existing_epg check_mode: true @@ -448,23 +448,23 @@ register: cm_query_non_epg - name: Query non-existing EPG (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query epg: non_existing_epg ignore_errors: true register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - cm_query_non_epg is not changed - nm_query_non_epg is not changed - cm_query_non_epg == nm_query_non_epg - - cm_query_non_epg.msg == nm_query_non_epg.msg == "Provided epg 'non_existing_epg' does not exist. Existing epgs{{':'}} ansible_test_1" + - cm_query_non_epg.msg == nm_query_non_epg.msg == "Provided EPG 'non_existing_epg' not matching existing epg(s){{":"}} ansible_test_1" # QUERY NON-EXISTING ANP - name: Query non-existing ANP (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query anp: non_existing_anp check_mode: true @@ -472,23 +472,23 @@ register: cm_query_non_anp - name: Query non-existing ANP (normal mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query anp: non_existing_anp ignore_errors: true register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - cm_query_non_anp is not changed - nm_query_non_anp is not changed - cm_query_non_anp == nm_query_non_anp - - cm_query_non_anp.msg == nm_query_non_anp.msg == "Provided anp 'non_existing_anp' does not exist. Existing anps{{':'}} ANP" + - cm_query_non_anp.msg == nm_query_non_anp.msg == "Provided ANP 'non_existing_anp' not matching existing anp(s){{":"}} ANP" # USE A NON-EXISTING STATE - name: Non-existing state for contract relationship (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query state: non-existing-state check_mode: true @@ -496,14 +496,14 @@ register: cm_non_existing_state - name: Non-existing state for contract relationship (normal_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -512,7 +512,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for contract relationship (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query schema: non-existing-schema check_mode: true @@ -520,14 +520,14 @@ register: cm_non_existing_schema - name: Non-existing schema for contract relationship (normal_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -535,7 +535,7 @@ - cm_non_existing_schema.msg == nm_non_existing_schema.msg == "Provided schema 'non-existing-schema' does not exist." - name: Non-existing contract schema for contract relationship (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -547,7 +547,7 @@ register: cm_non_existing_contract_schema - name: Non-existing contract schema for contract relationship (normal_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -558,7 +558,7 @@ register: nm_non_existing_contract_schema - name: Verify non_existing_contract_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_contract_schema is not changed - nm_non_existing_contract_schema is not changed @@ -567,7 +567,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for contract relationship (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query template: non-existing-template check_mode: true @@ -575,22 +575,22 @@ register: cm_non_existing_template - name: Non-existing template for contract relationship (normal_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed - cm_non_existing_template == nm_non_existing_template - - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non-existing-template' does not exist. Existing templates{{':'}} Template1, Template2" + - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non-existing-template' not matching existing template(s){{":"}} Template1, Template2" - name: Non-existing contract template for contract relationship (check_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -601,7 +601,7 @@ register: cm_non_existing_contract_template - name: Non-existing contract template for contract relationship (normal_mode) - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *contract_epg_query contract: name: Contract1 @@ -611,10 +611,502 @@ register: nm_non_existing_contract_template - name: Verify non_existing_contract_template - assert: + ansible.builtin.assert: that: - cm_non_existing_contract_template is not changed - nm_non_existing_contract_template is not changed - cm_non_existing_contract_template == nm_non_existing_contract_template - - cm_non_existing_contract_template.msg is match("Contract '/schemas/[0-9a-zA-Z]*/templates/non-existing-template/contracts/Contract1' not found") - - nm_non_existing_contract_template.msg is match("Contract '/schemas/[0-9a-zA-Z]*/templates/non-existing-template/contracts/Contract1' not found")
\ No newline at end of file + - cm_non_existing_contract_template.msg is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/non-existing-template/contracts/Contract1' and type 'provider' not found") + - nm_non_existing_contract_template.msg is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/non-existing-template/contracts/Contract1' and type 'provider' not found") + +# TESTS IN BULK + +# SETUP TEST ENVIRONMENT FOR BULK + +- name: Create template_bulk in schema ansible_test + cisco.mso.mso_schema_template: &bulk_template_present + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + tenant: ansible_test + +- name: Create filter_bulk in template_bulk + cisco.mso.mso_schema_template_filter_entry: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + filter: filter_bulk + entry: filter_entry_bulk + +- name: Create 20 contract_bulk_x in template_bulk + cisco.mso.mso_schema_template_contract_filter: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + contract: "contract_bulk_{{ item }}" + filter: filter_bulk + loop: "{{ range(1, 21, 1) | list }}" + +- name: Create ANP in template_bulk + cisco.mso.mso_schema_template_anp: &anp_bulk + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: template_bulk + anp: anp_bulk + +- name: Create EPG in template_bulk + cisco.mso.mso_schema_template_anp_epg: &epg_bulk + <<: *anp_bulk + epg: epg_bulk + +- name: Set facts for provider contracts + ansible.builtin.set_fact: + provider_contracts_present: [] + provider_contracts_absent: [] + consumer_contracts_present: [] + consumer_contracts_absent: [] + +- name: Create contracts list for appending + ansible.builtin.set_fact: + provider_contracts_present: "{{ provider_contracts_present + [{'name': 'contract_bulk_%s' | format(item), 'type': 'provider'}] }}" + consumer_contracts_present: "{{ consumer_contracts_present + [{'name': 'contract_bulk_%s' | format(item), 'type': 'consumer'}] }}" + loop: "{{ range(1, 21, 1) | list }}" + +- name: Create contracts list for removing + ansible.builtin.set_fact: + provider_contracts_absent: "{{ provider_contracts_absent + [{'name': 'contract_bulk_%s' | format(item), 'type': 'provider'}] }}" + consumer_contracts_absent: "{{ consumer_contracts_absent + [{'name': 'contract_bulk_%s' | format(item), 'type': 'consumer'}] }}" + loop: "{{ range(1, 21, 2) | list }}" + +# CREATE AND UPDATE TESTS FOR BULK + +- name: Append provider contracts (check_mode) + cisco.mso.mso_schema_template_anp_epg_contract: &provider_contracts_append + <<: *epg_bulk + contracts: "{{ provider_contracts_present }}" + register: cm_append_provider_contracts + check_mode: true + +- name: Append provider contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + register: nm_append_provider_contracts + +- name: Append provider contracts again + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + register: nm_append_provider_contracts_again + +- name: Append consumer contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + contracts: "{{ consumer_contracts_present }}" + register: nm_append_consumer_contracts + +- name: Verify appending contracts + ansible.builtin.assert: + that: + - cm_append_provider_contracts is changed + - cm_append_provider_contracts.previous == [] + - cm_append_provider_contracts.current | length == 20 + - cm_append_provider_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - cm_append_provider_contracts.current.0.relationshipType == "provider" + - cm_append_provider_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - cm_append_provider_contracts.current.9.relationshipType == "provider" + - cm_append_provider_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - cm_append_provider_contracts.current.19.relationshipType == "provider" + - nm_append_provider_contracts is changed + - nm_append_provider_contracts.previous == [] + - nm_append_provider_contracts.current | length == 20 + - nm_append_provider_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_append_provider_contracts.current.0.relationshipType == "provider" + - nm_append_provider_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_append_provider_contracts.current.9.relationshipType == "provider" + - nm_append_provider_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_append_provider_contracts.current.19.relationshipType == "provider" + - nm_append_provider_contracts_again is not changed + - nm_append_provider_contracts_again.previous.0.contractRef.contractName == "contract_bulk_1" + - nm_append_provider_contracts_again.previous.0.relationshipType == "provider" + - nm_append_provider_contracts_again.previous.9.contractRef.contractName == "contract_bulk_10" + - nm_append_provider_contracts_again.previous.9.relationshipType == "provider" + - nm_append_provider_contracts_again.previous.19.contractRef.contractName == "contract_bulk_20" + - nm_append_provider_contracts_again.previous.19.relationshipType == "provider" + - nm_append_provider_contracts_again.current | length == 20 + - nm_append_provider_contracts_again.current.0.contractRef.contractName == "contract_bulk_1" + - nm_append_provider_contracts_again.current.0.relationshipType == "provider" + - nm_append_provider_contracts_again.current.9.contractRef.contractName == "contract_bulk_10" + - nm_append_provider_contracts_again.current.9.relationshipType == "provider" + - nm_append_provider_contracts_again.current.19.contractRef.contractName == "contract_bulk_20" + - nm_append_provider_contracts_again.current.19.relationshipType == "provider" + - nm_append_consumer_contracts is changed + - nm_append_consumer_contracts.previous.0.contractRef.contractName == "contract_bulk_1" + - nm_append_consumer_contracts.previous.0.relationshipType == "provider" + - nm_append_consumer_contracts.previous.9.contractRef.contractName == "contract_bulk_10" + - nm_append_consumer_contracts.previous.9.relationshipType == "provider" + - nm_append_consumer_contracts.previous.19.contractRef.contractName == "contract_bulk_20" + - nm_append_consumer_contracts.previous.19.relationshipType == "provider" + - nm_append_consumer_contracts.current | length == 40 + - nm_append_consumer_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_append_consumer_contracts.current.0.relationshipType == "provider" + - nm_append_consumer_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_append_consumer_contracts.current.9.relationshipType == "provider" + - nm_append_consumer_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_append_consumer_contracts.current.19.relationshipType == "provider" + - nm_append_consumer_contracts.current.20.contractRef.contractName == "contract_bulk_1" + - nm_append_consumer_contracts.current.20.relationshipType == "consumer" + - nm_append_consumer_contracts.current.29.contractRef.contractName == "contract_bulk_10" + - nm_append_consumer_contracts.current.29.relationshipType == "consumer" + - nm_append_consumer_contracts.current.39.contractRef.contractName == "contract_bulk_20" + - nm_append_consumer_contracts.current.39.relationshipType == "consumer" + +# REMOVE TESTS FOR BULK + +- name: Remove provider contracts (check_mode) + cisco.mso.mso_schema_template_anp_epg_contract: &provider_contracts_remove + <<: *epg_bulk + contracts: "{{ provider_contracts_absent }}" + state: absent + register: cm_remove_provider_contracts + check_mode: true + +- name: Remove provider contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_remove + register: nm_remove_provider_contracts + +- name: Remove provider contracts again + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_remove + register: nm_remove_provider_contracts_again + +- name: Remove consumer contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_remove + contracts: "{{ consumer_contracts_absent }}" + register: nm_remove_consumer_contracts + +- name: Verify removing contracts + ansible.builtin.assert: + that: + - cm_remove_provider_contracts is changed + - cm_remove_provider_contracts.previous | length == 40 + - cm_remove_provider_contracts.previous.0.contractRef.contractName == "contract_bulk_1" + - cm_remove_provider_contracts.previous.0.relationshipType == "provider" + - cm_remove_provider_contracts.previous.9.contractRef.contractName == "contract_bulk_10" + - cm_remove_provider_contracts.previous.9.relationshipType == "provider" + - cm_remove_provider_contracts.previous.19.contractRef.contractName == "contract_bulk_20" + - cm_remove_provider_contracts.previous.19.relationshipType == "provider" + - cm_remove_provider_contracts.previous.20.contractRef.contractName == "contract_bulk_1" + - cm_remove_provider_contracts.previous.20.relationshipType == "consumer" + - cm_remove_provider_contracts.previous.29.contractRef.contractName == "contract_bulk_10" + - cm_remove_provider_contracts.previous.29.relationshipType == "consumer" + - cm_remove_provider_contracts.previous.39.contractRef.contractName == "contract_bulk_20" + - cm_remove_provider_contracts.previous.39.relationshipType == "consumer" + - cm_remove_provider_contracts.current | length == 30 + - cm_remove_provider_contracts.current.0.contractRef.contractName == "contract_bulk_2" + - cm_remove_provider_contracts.current.0.relationshipType == "provider" + - cm_remove_provider_contracts.current.4.contractRef.contractName == "contract_bulk_10" + - cm_remove_provider_contracts.current.4.relationshipType == "provider" + - cm_remove_provider_contracts.current.9.contractRef.contractName == "contract_bulk_20" + - cm_remove_provider_contracts.current.9.relationshipType == "provider" + - cm_remove_provider_contracts.current.10.contractRef.contractName == "contract_bulk_1" + - cm_remove_provider_contracts.current.10.relationshipType == "consumer" + - cm_remove_provider_contracts.current.19.contractRef.contractName == "contract_bulk_10" + - cm_remove_provider_contracts.current.19.relationshipType == "consumer" + - cm_remove_provider_contracts.current.29.contractRef.contractName == "contract_bulk_20" + - cm_remove_provider_contracts.current.29.relationshipType == "consumer" + - nm_remove_provider_contracts is changed + - nm_remove_provider_contracts.previous | length == 40 + - nm_remove_provider_contracts.previous.0.contractRef.contractName == "contract_bulk_1" + - nm_remove_provider_contracts.previous.0.relationshipType == "provider" + - nm_remove_provider_contracts.previous.9.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts.previous.9.relationshipType == "provider" + - nm_remove_provider_contracts.previous.19.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts.previous.19.relationshipType == "provider" + - nm_remove_provider_contracts.previous.20.contractRef.contractName == "contract_bulk_1" + - nm_remove_provider_contracts.previous.20.relationshipType == "consumer" + - nm_remove_provider_contracts.previous.29.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts.previous.29.relationshipType == "consumer" + - nm_remove_provider_contracts.previous.39.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts.previous.39.relationshipType == "consumer" + - nm_remove_provider_contracts.current | length == 30 + - nm_remove_provider_contracts.current.0.contractRef.contractName == "contract_bulk_2" + - nm_remove_provider_contracts.current.0.relationshipType == "provider" + - nm_remove_provider_contracts.current.4.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts.current.4.relationshipType == "provider" + - nm_remove_provider_contracts.current.9.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts.current.9.relationshipType == "provider" + - nm_remove_provider_contracts.current.10.contractRef.contractName == "contract_bulk_1" + - nm_remove_provider_contracts.current.10.relationshipType == "consumer" + - nm_remove_provider_contracts.current.19.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts.current.19.relationshipType == "consumer" + - nm_remove_provider_contracts.current.29.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts.current.29.relationshipType == "consumer" + - nm_remove_provider_contracts_again is not changed + - nm_remove_provider_contracts_again.previous | length == 30 + - nm_remove_provider_contracts_again.previous.0.contractRef.contractName == "contract_bulk_2" + - nm_remove_provider_contracts_again.previous.0.relationshipType == "provider" + - nm_remove_provider_contracts_again.previous.4.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts_again.previous.4.relationshipType == "provider" + - nm_remove_provider_contracts_again.previous.9.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts_again.previous.9.relationshipType == "provider" + - nm_remove_provider_contracts_again.previous.10.contractRef.contractName == "contract_bulk_1" + - nm_remove_provider_contracts_again.previous.10.relationshipType == "consumer" + - nm_remove_provider_contracts_again.previous.19.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts_again.previous.19.relationshipType == "consumer" + - nm_remove_provider_contracts_again.previous.29.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts_again.previous.29.relationshipType == "consumer" + - nm_remove_provider_contracts_again.current | length == 30 + - nm_remove_provider_contracts_again.current.0.contractRef.contractName == "contract_bulk_2" + - nm_remove_provider_contracts_again.current.0.relationshipType == "provider" + - nm_remove_provider_contracts_again.current.4.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts_again.current.4.relationshipType == "provider" + - nm_remove_provider_contracts_again.current.9.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts_again.current.9.relationshipType == "provider" + - nm_remove_provider_contracts_again.current.10.contractRef.contractName == "contract_bulk_1" + - nm_remove_provider_contracts_again.current.10.relationshipType == "consumer" + - nm_remove_provider_contracts_again.current.19.contractRef.contractName == "contract_bulk_10" + - nm_remove_provider_contracts_again.current.19.relationshipType == "consumer" + - nm_remove_provider_contracts_again.current.29.contractRef.contractName == "contract_bulk_20" + - nm_remove_provider_contracts_again.current.29.relationshipType == "consumer" + - nm_remove_consumer_contracts is changed + - nm_remove_consumer_contracts.previous | length == 30 + - nm_remove_consumer_contracts.previous.0.contractRef.contractName == "contract_bulk_2" + - nm_remove_consumer_contracts.previous.0.relationshipType == "provider" + - nm_remove_consumer_contracts.previous.4.contractRef.contractName == "contract_bulk_10" + - nm_remove_consumer_contracts.previous.4.relationshipType == "provider" + - nm_remove_consumer_contracts.previous.9.contractRef.contractName == "contract_bulk_20" + - nm_remove_consumer_contracts.previous.9.relationshipType == "provider" + - nm_remove_consumer_contracts.previous.10.contractRef.contractName == "contract_bulk_1" + - nm_remove_consumer_contracts.previous.10.relationshipType == "consumer" + - nm_remove_consumer_contracts.previous.19.contractRef.contractName == "contract_bulk_10" + - nm_remove_consumer_contracts.previous.19.relationshipType == "consumer" + - nm_remove_consumer_contracts.previous.29.contractRef.contractName == "contract_bulk_20" + - nm_remove_consumer_contracts.previous.29.relationshipType == "consumer" + - nm_remove_consumer_contracts.current | length == 20 + - nm_remove_consumer_contracts.current.0.contractRef.contractName == "contract_bulk_2" + - nm_remove_consumer_contracts.current.0.relationshipType == "provider" + - nm_remove_consumer_contracts.current.4.contractRef.contractName == "contract_bulk_10" + - nm_remove_consumer_contracts.current.4.relationshipType == "provider" + - nm_remove_consumer_contracts.current.9.contractRef.contractName == "contract_bulk_20" + - nm_remove_consumer_contracts.current.9.relationshipType == "provider" + - nm_remove_consumer_contracts.current.10.contractRef.contractName == "contract_bulk_2" + - nm_remove_consumer_contracts.current.10.relationshipType == "consumer" + - nm_remove_consumer_contracts.current.14.contractRef.contractName == "contract_bulk_10" + - nm_remove_consumer_contracts.current.14.relationshipType == "consumer" + - nm_remove_consumer_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_remove_consumer_contracts.current.19.relationshipType == "consumer" + +# FORCE REPLACE TESTS + +- name: Force replace contracts with contracts (check_mode) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + force_replace: true + register: cm_force_replace_provider_contracts + check_mode: true + +- name: Force replace contracts with contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + force_replace: true + register: nm_force_replace_provider_contracts + +- name: Force replace contracts with contracts again + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + force_replace: true + register: nm_force_replace_provider_contracts_again + +- name: Force replace contracts with new contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + contracts: "{{ consumer_contracts_present }}" + force_replace: true + register: nm_force_replace_consumer_contracts + +- name: Verify force replacing contracts + ansible.builtin.assert: + that: + - cm_force_replace_provider_contracts is changed + - cm_force_replace_provider_contracts.previous | length == 20 + - cm_force_replace_provider_contracts.previous.0.contractRef.contractName == "contract_bulk_2" + - cm_force_replace_provider_contracts.previous.0.relationshipType == "provider" + - cm_force_replace_provider_contracts.previous.4.contractRef.contractName == "contract_bulk_10" + - cm_force_replace_provider_contracts.previous.4.relationshipType == "provider" + - cm_force_replace_provider_contracts.previous.9.contractRef.contractName == "contract_bulk_20" + - cm_force_replace_provider_contracts.previous.9.relationshipType == "provider" + - cm_force_replace_provider_contracts.previous.10.contractRef.contractName == "contract_bulk_2" + - cm_force_replace_provider_contracts.previous.10.relationshipType == "consumer" + - cm_force_replace_provider_contracts.previous.14.contractRef.contractName == "contract_bulk_10" + - cm_force_replace_provider_contracts.previous.14.relationshipType == "consumer" + - cm_force_replace_provider_contracts.previous.19.contractRef.contractName == "contract_bulk_20" + - cm_force_replace_provider_contracts.previous.19.relationshipType == "consumer" + - cm_force_replace_provider_contracts.current | length == 20 + - cm_force_replace_provider_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - cm_force_replace_provider_contracts.current.0.relationshipType == "provider" + - cm_force_replace_provider_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - cm_force_replace_provider_contracts.current.9.relationshipType == "provider" + - cm_force_replace_provider_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - cm_force_replace_provider_contracts.current.19.relationshipType == "provider" + - nm_force_replace_provider_contracts is changed + - nm_force_replace_provider_contracts.previous | length == 20 + - nm_force_replace_provider_contracts.previous.0.contractRef.contractName == "contract_bulk_2" + - nm_force_replace_provider_contracts.previous.0.relationshipType == "provider" + - nm_force_replace_provider_contracts.previous.4.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_provider_contracts.previous.4.relationshipType == "provider" + - nm_force_replace_provider_contracts.previous.9.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_provider_contracts.previous.9.relationshipType == "provider" + - nm_force_replace_provider_contracts.previous.10.contractRef.contractName == "contract_bulk_2" + - nm_force_replace_provider_contracts.previous.10.relationshipType == "consumer" + - nm_force_replace_provider_contracts.previous.14.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_provider_contracts.previous.14.relationshipType == "consumer" + - nm_force_replace_provider_contracts.previous.19.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_provider_contracts.previous.19.relationshipType == "consumer" + - nm_force_replace_provider_contracts.current | length == 20 + - nm_force_replace_provider_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_force_replace_provider_contracts.current.0.relationshipType == "provider" + - nm_force_replace_provider_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_provider_contracts.current.9.relationshipType == "provider" + - nm_force_replace_provider_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_provider_contracts.current.19.relationshipType == "provider" + - nm_force_replace_provider_contracts_again is not changed + - nm_force_replace_provider_contracts_again.previous | length == 20 + - nm_force_replace_provider_contracts_again.previous.0.contractRef.contractName == "contract_bulk_1" + - nm_force_replace_provider_contracts_again.previous.0.relationshipType == "provider" + - nm_force_replace_provider_contracts_again.previous.9.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_provider_contracts_again.previous.9.relationshipType == "provider" + - nm_force_replace_provider_contracts_again.previous.19.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_provider_contracts_again.previous.19.relationshipType == "provider" + - nm_force_replace_provider_contracts.current | length == 20 + - nm_force_replace_provider_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_force_replace_provider_contracts.current.0.relationshipType == "provider" + - nm_force_replace_provider_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_provider_contracts.current.9.relationshipType == "provider" + - nm_force_replace_provider_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_provider_contracts.current.19.relationshipType == "provider" + - nm_force_replace_consumer_contracts.current | length == 20 + - nm_force_replace_consumer_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_force_replace_consumer_contracts.current.0.relationshipType == "consumer" + - nm_force_replace_consumer_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_force_replace_consumer_contracts.current.9.relationshipType == "consumer" + - nm_force_replace_consumer_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_force_replace_consumer_contracts.current.19.relationshipType == "consumer" + +# QUERY TESTS FOR BULK + +- name: Query contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + contracts: "{{ consumer_contracts_present }}" + state: query + register: nm_query_contracts + +- name: Query contracts with non existing contracts (error) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + contracts: + - name: non_contract_3 + type: provider + - name: non_contract_3 + type: consumer + state: query + register: err_query_contracts + ignore_errors: true + +- name: Verify queries for bulk + ansible.builtin.assert: + that: + - nm_query_contracts is not changed + - nm_query_contracts.current | length == 20 + - nm_query_contracts.current.0.contractRef.contractName == "contract_bulk_1" + - nm_query_contracts.current.0.relationshipType == "consumer" + - nm_query_contracts.current.9.contractRef.contractName == "contract_bulk_10" + - nm_query_contracts.current.9.relationshipType == "consumer" + - nm_query_contracts.current.19.contractRef.contractName == "contract_bulk_20" + - nm_query_contracts.current.19.relationshipType == "consumer" + - err_query_contracts is failed + - err_query_contracts.msg.0 is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/template_bulk/contracts/non_contract_3' and type 'provider' not found") + - err_query_contracts.msg.1 is match("Contract with Reference '/schemas/[0-9a-zA-Z]*/templates/template_bulk/contracts/non_contract_3' and type 'consumer' not found") + +# ERROR TESTS FOR BULK + +- name: Mutually exclusive contract and contracts (error) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + contract: + - name: contract_bulk_1 + type: provider + register: err_mutually_exclusive_contract_and_contracts + ignore_errors: true + +- name: Mutually exclusive contract and force_replace (error) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *epg_bulk + contract: + - name: contract_bulk_1 + type: provider + force_replace: true + register: err_mutually_exclusive_contract_and_force_replace + ignore_errors: true + +- name: Missing required attributes for present (error) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *epg_bulk + register: err_missing_required_attributes_present + ignore_errors: true + +- name: Missing required attributes for absent (error) + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *epg_bulk + state: absent + register: err_missing_required_attributes_absent + ignore_errors: true + +- name: Verify queries for bulk + ansible.builtin.assert: + that: + - err_mutually_exclusive_contract_and_contracts is failed + - err_mutually_exclusive_contract_and_contracts.msg == "parameters are mutually exclusive{{":"}} contract|contracts" + - err_mutually_exclusive_contract_and_force_replace is failed + - err_mutually_exclusive_contract_and_force_replace.msg == "parameters are mutually exclusive{{":"}} contract|force_replace" + - err_missing_required_attributes_present is failed + - err_missing_required_attributes_present.msg == "state is present but any of the following are missing{{":"}} contract, contracts" + - err_missing_required_attributes_absent is failed + - err_missing_required_attributes_absent.msg == "state is absent but any of the following are missing{{":"}} contract, contracts, force_replace" + +# FORCE REMOVE ALL CONTRACTS + +- name: Force remove all contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *epg_bulk + force_replace: true + state: absent + register: force_remove_all_contracts + +- name: Force replace all contracts without existing contracts + cisco.mso.mso_schema_template_anp_epg_contract: + <<: *provider_contracts_append + force_replace: true + register: force_replace_all_contracts_without_existing_contracts + +- name: Verify froce removing all contracts + ansible.builtin.assert: + that: + - force_remove_all_contracts is changed + - force_remove_all_contracts.previous | length == 20 + - force_remove_all_contracts.current == [] + - force_replace_all_contracts_without_existing_contracts is changed + - force_replace_all_contracts_without_existing_contracts.previous == [] + - force_replace_all_contracts_without_existing_contracts.current | length == 20 + +# CLEAN UP TEST ENVIRONMENT + +- name: Remove schemas + cisco.mso.mso_schema: + <<: *mso_info + schema: '{{ item }}' + state: absent + loop: + - '{{ mso_schema | default("ansible_test") }}_2' + - '{{ mso_schema | default("ansible_test") }}' diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_selector/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_selector/tasks/main.yml index 013b96b71..0b3264d09 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_selector/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_selector/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,13 +24,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -47,7 +47,7 @@ # state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -56,7 +56,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -66,7 +66,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -74,7 +74,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -82,7 +82,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -90,7 +90,7 @@ state: present - name: Ensure ANP exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -102,7 +102,7 @@ # ADD EPGs - name: Ensure EPGs exist - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ item.schema }}' template: '{{ item.template }}' @@ -115,7 +115,7 @@ # ADD Selector to EPG - name: Add Selector to EPG (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -127,7 +127,7 @@ register: cm_add_selector_1 - name: Verify cm_add_selector_1 - assert: + ansible.builtin.assert: that: - cm_add_selector_1 is changed - cm_add_selector_1.previous == {} @@ -135,7 +135,7 @@ - cm_add_selector_1.current.expressions == [] - name: Add Selector 1 to EPG with space in selector name (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -147,13 +147,13 @@ register: nm_add_selector1_with_space_in_name - name: Verify nm_add_selector1_with_space_in_name - assert: + ansible.builtin.assert: that: - nm_add_selector1_with_space_in_name is not changed - nm_add_selector1_with_space_in_name.msg == "There should not be any space in selector name." - name: Add Selector to EPG (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -164,7 +164,7 @@ register: nm_add_selector_1 - name: Verify nm_add_selector_1 - assert: + ansible.builtin.assert: that: - nm_add_selector_1 is changed - nm_add_selector_1.previous == {} @@ -172,7 +172,7 @@ - nm_add_selector_1.current.expressions == [] - name: Add Selector to EPG again (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -184,7 +184,7 @@ register: cm_add_selector_1_again - name: Verify cm_add_selector_1_again - assert: + ansible.builtin.assert: that: - cm_add_selector_1_again is not changed - cm_add_selector_1_again.previous.name == "selector_1" @@ -193,7 +193,7 @@ - cm_add_selector_1_again.current.expressions == [] - name: Add Selector to EPG again (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -204,7 +204,7 @@ register: nm_add_selector_1_again - name: Verify nm_add_selector_1_again - assert: + ansible.builtin.assert: that: - nm_add_selector_1_again is not changed - nm_add_selector_1_again.previous.name == "selector_1" @@ -213,7 +213,7 @@ - nm_add_selector_1_again.current.expressions == [] - name: Add Selector 2 to EPG (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -229,7 +229,7 @@ register: cm_add_selector_2 - name: Verify cm_add_selector_2 - assert: + ansible.builtin.assert: that: - cm_add_selector_2 is changed - cm_add_selector_2.previous == {} @@ -239,7 +239,7 @@ - cm_add_selector_2.current.expressions[0].value == "test" - name: Add Selector 2 to EPG (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -254,7 +254,7 @@ register: nm_add_selector_2 - name: Verify nm_add_selector_2 - assert: + ansible.builtin.assert: that: - nm_add_selector_2 is changed - nm_add_selector_2.previous == {} @@ -264,7 +264,7 @@ - nm_add_selector_2.current.expressions[0].value == "test" - name: Add Selector 2 to EPG with space in expression type (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -280,13 +280,13 @@ register: nm_add_selector2_with_space_in_expression_type - name: Verify nm_add_selector2_with_space_in_expression_type - assert: + ansible.builtin.assert: that: - nm_add_selector2_with_space_in_expression_type is not changed - nm_add_selector2_with_space_in_expression_type.msg == "There should not be any space in 'type' attribute of expression 'expression 1'" - name: Change Selector 2 - keyExist(normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -302,13 +302,13 @@ register: nm_change_selector_2_key_exist - name: Verify nm_change_selector_2_key_exist - assert: + ansible.builtin.assert: that: - nm_change_selector_2_key_exist is not changed - nm_change_selector_2_key_exist.msg == "Attribute 'value' is not supported for operator 'has_key' in expression 'expression_5'" - name: Change Selector 2 - keyNotExist (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -324,13 +324,13 @@ register: nm_change_selector_2_key_not_exist - name: Verify nm_change_selector_2_key_not_exist - assert: + ansible.builtin.assert: that: - nm_change_selector_2_key_not_exist is not changed - nm_change_selector_2_key_not_exist.msg == "Attribute 'value' is not supported for operator 'does_not_have_key' in expression 'expression_6'" - name: Change Selector 2 - equals (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -345,13 +345,13 @@ register: nm_change_selector_2_equals - name: Verify nm_change_selector_2_equals - assert: + ansible.builtin.assert: that: - nm_change_selector_2_equals is not changed - nm_change_selector_2_equals.msg == "Attribute 'value' needed for operator 'equals' in expression 'expression_6'" - name: Change Selector 2 expressions (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -380,14 +380,14 @@ register: nm_change_selector_2 - name: Verify nm_change_selector_2 - assert: + ansible.builtin.assert: that: - nm_change_selector_2 is changed - nm_change_selector_2.current.name == "selector_2" - nm_change_selector_2.current.expressions | length == 6 - name: Change Selector 2 expressions again (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -416,14 +416,14 @@ register: nm_change_selector_2_again - name: Verify nm_change_selector_2_again - assert: + ansible.builtin.assert: that: - nm_change_selector_2_again is not changed - nm_change_selector_2_again.current.name == "selector_2" - nm_change_selector_2_again.current.expressions | length == 6 - name: Query all selectors (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -434,7 +434,7 @@ register: cm_query_all_selectors - name: Verify cm_query_all_selectors - assert: + ansible.builtin.assert: that: - cm_query_all_selectors is not changed - cm_query_all_selectors.current | length == 2 @@ -444,7 +444,7 @@ - cm_query_all_selectors.current[1].expressions | length == 6 - name: Query all selectors (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -454,7 +454,7 @@ register: nm_query_all_selectors - name: Verify nm_query_all_selectors - assert: + ansible.builtin.assert: that: - nm_query_all_selectors is not changed - nm_query_all_selectors.current | length == 2 @@ -464,7 +464,7 @@ - nm_query_all_selectors.current[1].expressions | length == 6 - name: Query specific selector (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -476,14 +476,14 @@ register: cm_query_selector1 - name: Verify cm_query_selector1 - assert: + ansible.builtin.assert: that: - cm_query_selector1 is not changed - cm_query_selector1.current.name == "selector_1" - cm_query_selector1.current.expressions == [] - name: Query specific selector (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -494,14 +494,14 @@ register: nm_query_selector1 - name: Verify nm_query_selector1 - assert: + ansible.builtin.assert: that: - nm_query_selector1 is not changed - nm_query_selector1.current.name == "selector_1" - nm_query_selector1.current.expressions == [] - name: Query specific selector2 (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -512,7 +512,7 @@ register: nm_query_selector2 - name: Verify nm_query_selector2 - assert: + ansible.builtin.assert: that: - nm_query_selector2 is not changed - nm_query_selector2.current.name == "selector_2" @@ -537,7 +537,7 @@ - nm_query_selector2.current.expressions[5].value == "" # - name: Remove selector 1 (check_mode) -# mso_schema_template_anp_epg_selector: +# cisco.mso.mso_schema_template_anp_epg_selector: # <<: *mso_info # schema: '{{ mso_schema | default("ansible_test") }}' # template: Template 1 @@ -549,13 +549,13 @@ # register: cm_remove_selector_1 # - name: Verify cm_remove_selector_1 -# assert: +# ansible.builtin.assert: # that: # - cm_remove_selector_1 is changed # - cm_remove_selector_1.current == {} # - name: Remove selector 1 (normal_mode) -# mso_schema_template_anp_epg_selector: +# cisco.mso.mso_schema_template_anp_epg_selector: # <<: *mso_info # schema: '{{ mso_schema | default("ansible_test") }}' # template: Template 1 @@ -566,13 +566,13 @@ # register: nm_remove_selector_1 # - name: Verify nm_remove_selector_1 -# assert: +# ansible.builtin.assert: # that: # - nm_remove_selector_1 is changed # - nm_remove_selector_1.current == {} - name: Remove selector 2 (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -583,14 +583,14 @@ register: nm_remove_selector_2 - name: Verify nm_remove_selector_2 - assert: + ansible.builtin.assert: that: - nm_remove_selector_2 is changed - nm_remove_selector_2.current == {} # QUERY NON-EXISTING Selector to EPG - name: Query non-existing selector (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -603,7 +603,7 @@ register: cm_query_non_selector - name: Query non-existing selector (normal mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -615,7 +615,7 @@ register: nm_query_non_selector - name: Verify cm_query_non_selector and nm_query_non_selector - assert: + ansible.builtin.assert: that: - cm_query_non_selector is not changed - nm_query_non_selector is not changed @@ -625,7 +625,7 @@ # QUERY NON-EXISTING EPG - name: Query non-existing EPG (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -638,7 +638,7 @@ register: cm_query_non_epg - name: Query non-existing EPG (normal mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -650,7 +650,7 @@ register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - cm_query_non_epg is not changed - nm_query_non_epg is not changed @@ -659,7 +659,7 @@ # QUERY NON-EXISTING ANP - name: Query non-existing ANP (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -672,7 +672,7 @@ register: cm_query_non_anp - name: Query non-existing ANP (normal mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -684,7 +684,7 @@ register: nm_query_non_anp - name: Verify query_non_anp - assert: + ansible.builtin.assert: that: - cm_query_non_anp is not changed - nm_query_non_anp is not changed @@ -693,7 +693,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -706,7 +706,7 @@ register: cm_non_existing_state - name: Non-existing state (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -718,7 +718,7 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -727,7 +727,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -740,7 +740,7 @@ register: cm_non_existing_template - name: Non-existing template (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -752,7 +752,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -761,7 +761,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema (check_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -774,7 +774,7 @@ register: cm_non_existing_schema - name: Non-existing schema (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -786,7 +786,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_useg_attribute/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_useg_attribute/tasks/main.yml index ef17edac1..8445b226c 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_useg_attribute/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_anp_epg_useg_attribute/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: "Please define the following variables: mso_hostname, mso_username and mso_password." when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: "{{ mso_hostname }}" username: "{{ mso_username }}" @@ -23,13 +23,13 @@ # Setup Part - name: Remove schemas - mso_schema: &ansible_schema_absent + cisco.mso.mso_schema: &ansible_schema_absent <<: *mso_info schema: ansible_test state: absent - name: Ensure ansible_test tenant absent - mso_tenant: &ansible_tenant_absent + cisco.mso.mso_tenant: &ansible_tenant_absent <<: *mso_info tenant: ansible_test users: @@ -37,12 +37,12 @@ state: absent - name: Ensure ansible_test tenant present - mso_tenant: &ansible_tenant_present + cisco.mso.mso_tenant: &ansible_tenant_present <<: *ansible_tenant_absent state: present - name: Ensure ansible_test schema with ans_test_template exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: ansible_test tenant: ansible_test @@ -50,7 +50,7 @@ state: present - name: Ensure ans_test_anp exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: ansible_test template: ans_test_template @@ -58,7 +58,7 @@ state: present - name: Ensure ans_test_epg exist - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: ansible_test template: ans_test_template @@ -68,7 +68,7 @@ state: present - name: Ensure ans_test_epg_2 exist without useg_epg - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: ansible_test template: ans_test_template @@ -79,7 +79,7 @@ # Test Part # Note: Ignore the below task, which is used to reference the attributes to other tasks - name: Invalid test - check for missing required attributes error message - mso_schema_template_anp_epg_useg_attribute: &useg_attribute_present + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &useg_attribute_present <<: *mso_info schema: ansible_test template: ans_test_template @@ -90,8 +90,26 @@ ignore_errors: true register: ans_test_uSeg_1_nt +- name: Invalid test - ans_test_uSeg_1 present - attribute_type - ip, useg_subnet - true, with value + cisco.mso.mso_schema_template_anp_epg_useg_attribute: + <<: *useg_attribute_present + name: ans_test_uSeg_2 + attribute_type: ip + useg_subnet: true + value: "1.2.3.4" + ignore_errors: true + register: ans_test_uSeg_1_nt1 + +- name: Assertions check for invalid tests - ans_test_uSeg_1 + ansible.builtin.assert: + that: + - ans_test_uSeg_1_nt is not changed + - ans_test_uSeg_1_nt.msg == "state is present but all of the following are missing{{':'}} name, type" + - ans_test_uSeg_1_nt1 is not changed + - ans_test_uSeg_1_nt1.msg == "The value of uSeg subnet IP should be an empty string or 0.0.0.0, when the useg_subnet is set to true." + - name: ans_test_uSeg_1 present - attribute_type - ip, useg_subnet - true, without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *mso_info schema: ansible_test template: ans_test_template @@ -103,7 +121,7 @@ register: ans_test_uSeg_1 - name: Invalid test - ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_2 attribute_type: ip @@ -112,34 +130,36 @@ register: ans_test_uSeg_2_nt - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - check mode - mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_2_cm_present + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_2_cm_present <<: *useg_attribute_present name: ans_test_uSeg_2 attribute_type: ip useg_subnet: false - value: 11.22.33.44/24 + value: 11.22.33.44 check_mode: true register: ans_test_uSeg_2_cm_present - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - normal mode - mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_2_nm_present + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_2_nm_present <<: *ans_test_uSeg_2_cm_present + output_level: debug register: ans_test_uSeg_2_nm_present - name: ans_test_uSeg_2 present - attribute_type - ip, useg_subnet - false, with value - normal mode again - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *ans_test_uSeg_2_nm_present + output_level: debug register: ans_test_uSeg_2_nm_present_again - name: Assertions check for add ans_test_uSeg_1 and ans_test_uSeg_2 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_1 is changed - ans_test_uSeg_1.current != {} - ans_test_uSeg_1.current.name == "ans_test_uSeg_1" - ans_test_uSeg_1.current.type == "ip" - ans_test_uSeg_1.current.value == "0.0.0.0" - - ans_test_uSeg_1.current.fvSubnet == false + - ans_test_uSeg_1.current.fvSubnet == true - ans_test_uSeg_1.current.description == "ans_test_uSeg_1" - ans_test_uSeg_2_nt is not changed - ans_test_uSeg_2_nt.msg == "useg_subnet is False but all of the following are missing{{':'}} value" @@ -148,33 +168,31 @@ - ans_test_uSeg_2_cm_present.previous == {} - ans_test_uSeg_2_cm_present.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_cm_present.current.type == "ip" - - ans_test_uSeg_2_cm_present.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_cm_present.current.fvSubnet == true + - ans_test_uSeg_2_cm_present.current.value == "11.22.33.44" - ans_test_uSeg_2_cm_present.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present is changed - ans_test_uSeg_2_nm_present.current != {} - ans_test_uSeg_2_nm_present.previous == {} - ans_test_uSeg_2_nm_present.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present.current.type == "ip" - - ans_test_uSeg_2_nm_present.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present.current.fvSubnet == true + - ans_test_uSeg_2_nm_present.current.value == "11.22.33.44" + - ans_test_uSeg_2_nm_present.sent.fvSubnet == false - ans_test_uSeg_2_nm_present.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present_again is not changed - ans_test_uSeg_2_nm_present_again.current != {} - ans_test_uSeg_2_nm_present_again.previous != {} - ans_test_uSeg_2_nm_present_again.current.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present_again.current.type == "ip" - - ans_test_uSeg_2_nm_present_again.current.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present_again.current.fvSubnet == true + - ans_test_uSeg_2_nm_present_again.current.value == "11.22.33.44" + - ans_test_uSeg_2_nm_present_again.sent.fvSubnet == false - ans_test_uSeg_2_nm_present_again.current.description == "uSeg Attr object created using Ansible" - ans_test_uSeg_2_nm_present_again.previous.name == "ans_test_uSeg_2" - ans_test_uSeg_2_nm_present_again.previous.type == "ip" - - ans_test_uSeg_2_nm_present_again.previous.value == "11.22.33.44/24" - - ans_test_uSeg_2_nm_present_again.previous.fvSubnet == true + - ans_test_uSeg_2_nm_present_again.previous.value == "11.22.33.44" - ans_test_uSeg_2_nm_present_again.previous.description == "uSeg Attr object created using Ansible" - name: Invalid test - ans_test_uSeg_3 present - attribute_type - mac and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_3 attribute_type: mac @@ -182,7 +200,7 @@ register: ans_test_uSeg_3_nt - name: ans_test_uSeg_3 present - attribute_type - mac and with value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_3 attribute_type: mac @@ -190,7 +208,7 @@ register: ans_test_uSeg_3 - name: Assertions check for add ans_test_uSeg_3 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_3_nt is not changed - ans_test_uSeg_3_nt.msg == "Failed due to invalid 'value' and the attribute_type is{{':'}} mac." @@ -203,7 +221,7 @@ - ans_test_uSeg_3.current.value == "aa:bb:cc:dd:ee:ff" - name: Invalid test - ans_test_uSeg_4 present - attribute_type - dns and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_4 attribute_type: dns @@ -211,7 +229,7 @@ register: ans_test_uSeg_4_nt - name: ans_test_uSeg_4 present - attribute_type - dns and with value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_4 attribute_type: dns @@ -219,7 +237,7 @@ register: ans_test_uSeg_4 - name: Assertions check for add ans_test_uSeg_4 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_4_nt is not changed - ans_test_uSeg_4_nt.msg == "Failed due to invalid 'value' and the attribute_type is{{':'}} dns." @@ -232,7 +250,7 @@ - ans_test_uSeg_4.current.value == "test_dns_value" - name: Invalid test - ans_test_uSeg_6 present - attribute_type - vm_datacenter and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -241,7 +259,7 @@ register: ans_test_uSeg_6_nt - name: Invalid test - ans_test_uSeg_6 present - attribute_type - vm_datacenter, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -250,7 +268,7 @@ register: ans_test_uSeg_6_nt1 - name: ans_test_uSeg_6 present - attribute_type - vm_datacenter, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 attribute_type: vm_datacenter @@ -259,7 +277,7 @@ register: ans_test_uSeg_6 - name: Assertions check for add ans_test_uSeg_6 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_6_nt is not changed - ans_test_uSeg_6_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_datacenter." @@ -274,7 +292,7 @@ - ans_test_uSeg_6.current.value == "test_vm_datacenter_value" - name: Invalid test - ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -283,7 +301,7 @@ register: ans_test_uSeg_7_nt - name: Invalid test - ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -292,7 +310,7 @@ register: ans_test_uSeg_7_nt1 - name: ans_test_uSeg_7 present - attribute_type - vm_hypervisor_identifier, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_7 attribute_type: vm_hypervisor_identifier @@ -301,7 +319,7 @@ register: ans_test_uSeg_7 - name: Assertions check for add ans_test_uSeg_7 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_7_nt is not changed - ans_test_uSeg_7_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_hypervisor_identifier." @@ -316,7 +334,7 @@ - ans_test_uSeg_7.current.value == "test_vm_hypervisor_identifier_value" - name: Invalid test - ans_test_uSeg_8 present - attribute_type - vm_operating_system and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -325,7 +343,7 @@ register: ans_test_uSeg_8_nt - name: Invalid test - ans_test_uSeg_8 present - attribute_type - vm_operating_system, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -334,7 +352,7 @@ register: ans_test_uSeg_8_nt1 - name: ans_test_uSeg_8 present - attribute_type - vm_operating_system, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_8 attribute_type: vm_operating_system @@ -343,7 +361,7 @@ register: ans_test_uSeg_8 - name: Assertions check for add ans_test_uSeg_8 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_8_nt is not changed - ans_test_uSeg_8_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_operating_system." @@ -358,7 +376,7 @@ - ans_test_uSeg_8.current.value == "test_vm_operating_system_value" - name: Invalid test - ans_test_uSeg_9 present - attribute_type - vm_tag and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -367,7 +385,7 @@ register: ans_test_uSeg_9_nt - name: Invalid test - ans_test_uSeg_9 present - attribute_type - vm_tag, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -376,7 +394,7 @@ register: ans_test_uSeg_9_nt1 - name: ans_test_uSeg_9 present - attribute_type - vm_tag, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_9 attribute_type: vm_tag @@ -385,7 +403,7 @@ register: ans_test_uSeg_9 - name: Assertions check for add ans_test_uSeg_9 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_9_nt is not changed - ans_test_uSeg_9_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_tag." @@ -400,7 +418,7 @@ - ans_test_uSeg_9.current.value == "test_vm_tag_value" - name: Invalid test - ans_test_uSeg_10 present - attribute_type - vm_identifier and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -409,7 +427,7 @@ register: ans_test_uSeg_10_nt - name: Invalid test - ans_test_uSeg_10 present - attribute_type - vm_identifier, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -418,7 +436,7 @@ register: ans_test_uSeg_10_nt1 - name: ans_test_uSeg_10 present - attribute_type - vm_identifier, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_10 attribute_type: vm_identifier @@ -427,7 +445,7 @@ register: ans_test_uSeg_10 - name: Assertions check for add ans_test_uSeg_10 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_10_nt is not changed - ans_test_uSeg_10_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_identifier." @@ -442,7 +460,7 @@ - ans_test_uSeg_10.current.value == "test_vm_identifier_value" - name: Invalid test - ans_test_uSeg_11 present - attribute_type - vmm_domain and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -451,7 +469,7 @@ register: ans_test_uSeg_11_nt - name: Invalid test - ans_test_uSeg_11 present - attribute_type - vmm_domain, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -460,7 +478,7 @@ register: ans_test_uSeg_11_nt1 - name: ans_test_uSeg_11 present - attribute_type - vmm_domain, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_11 attribute_type: vmm_domain @@ -469,7 +487,7 @@ register: ans_test_uSeg_11 - name: Assertions check for add ans_test_uSeg_11 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_11_nt is not changed - ans_test_uSeg_11_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vmm_domain." @@ -484,7 +502,7 @@ - ans_test_uSeg_11.current.value == "test_vmm_domain_value" - name: Invalid test - ans_test_uSeg_12 present - attribute_type - vm_name and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -493,7 +511,7 @@ register: ans_test_uSeg_12_nt - name: Invalid test - ans_test_uSeg_12 present - attribute_type - vm_name, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -502,7 +520,7 @@ register: ans_test_uSeg_12_nt1 - name: ans_test_uSeg_12 present - attribute_type - vm_name, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_12 attribute_type: vm_name @@ -511,7 +529,7 @@ register: ans_test_uSeg_12 - name: Assertions check for add ans_test_uSeg_12 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_12_nt is not changed - ans_test_uSeg_12_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vm_name." @@ -526,7 +544,7 @@ - ans_test_uSeg_12.current.value == "test_vm_value" - name: Invalid test - ans_test_uSeg_13 present - attribute_type - vnic_dn and without operator - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -535,7 +553,7 @@ register: ans_test_uSeg_13_nt - name: Invalid test - ans_test_uSeg_13 present - attribute_type - vnic_dn, operator - equals and without value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -544,7 +562,7 @@ register: ans_test_uSeg_13_nt1 - name: ans_test_uSeg_13 present - attribute_type - vnic_dn, operator - equals and value - mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_13_present + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_13_present <<: *useg_attribute_present name: ans_test_uSeg_13 attribute_type: vnic_dn @@ -553,7 +571,7 @@ register: ans_test_uSeg_13 - name: Assertions check for add ans_test_uSeg_12 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_13_nt is not changed - ans_test_uSeg_13_nt.msg == "Failed due to invalid 'value' or 'operator' and the attribute_type is{{':'}} vnic_dn." @@ -569,7 +587,7 @@ # Query Part - name: Invalid test - Query an uSeg Attr with name - invalid_useg_attr - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: invalid_useg_attr state: query @@ -577,20 +595,20 @@ ignore_errors: true - name: Query an uSeg Attr with name - ans_test_uSeg_1 - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_6 state: query register: query_a_useg_6 - name: Query all uSeg Attrs - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present state: query register: query_all_useg_objects - name: Assertions check for query uSeg Attr objects - assert: + ansible.builtin.assert: that: - invalid_useg_attr is not changed - invalid_useg_attr.msg == "The uSeg Attribute{{':'}} invalid_useg_attr not found." @@ -604,21 +622,21 @@ # Update Part - name: Update ans_test_uSeg_13 object description and value - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *ans_test_uSeg_13_present description: "ans_test_uSeg_13 updated!" value: test_vnic_dn_value_updated register: ans_test_uSeg_13_update - name: Query an uSeg Attr with name - ans_test_uSeg_13 to check the updated changes - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present name: ans_test_uSeg_13 state: query register: query_a_useg_object_with_name - name: Assertions check for update ans_test_uSeg_13 object - assert: + ansible.builtin.assert: that: - ans_test_uSeg_13_update is changed - ans_test_uSeg_13_update.current != {} @@ -640,7 +658,7 @@ # Cleanup Part - name: ans_test_uSeg_1 absent with check mode - mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_1_cm_absent + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_1_cm_absent <<: *useg_attribute_present name: ans_test_uSeg_1 state: absent @@ -648,17 +666,17 @@ register: ans_test_uSeg_1_cm_absent - name: ans_test_uSeg_1 absent with normal mode - mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_1_nm_absent + cisco.mso.mso_schema_template_anp_epg_useg_attribute: &ans_test_uSeg_1_nm_absent <<: *ans_test_uSeg_1_cm_absent register: ans_test_uSeg_1_nm_absent - name: ans_test_uSeg_1 absent with normal mode again - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *ans_test_uSeg_1_nm_absent register: ans_test_uSeg_1_nm_absent_again - name: Assertions check for ans_test_uSeg_1 absent - assert: + ansible.builtin.assert: that: - ans_test_uSeg_1_cm_absent is changed - ans_test_uSeg_1_cm_absent.current == {} @@ -671,7 +689,7 @@ - ans_test_uSeg_1_nm_absent_again.previous == {} - name: Query all uSeg Attrs - invalid template name - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present template: ans_test_template_123 state: query @@ -679,7 +697,7 @@ register: query_invalid_template - name: Query all uSeg Attrs - invalid Application Profile name - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present anp: ans_test_anp_123 state: query @@ -687,7 +705,7 @@ register: query_invalid_ap - name: Query all uSeg Attrs - invalid EPG name - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present epg: ans_test_epg_123 state: query @@ -695,7 +713,7 @@ register: query_invalid_epg - name: Invalid test - ans_test_anp_123 present under ans_test_epg_2 - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present epg: ans_test_epg_2 name: ans_test_anp_123 @@ -705,7 +723,7 @@ register: ans_test_epg_2_nt - name: Assertions check for invalid inputs - assert: + ansible.builtin.assert: that: - query_invalid_template is not changed - query_invalid_template.msg is match("Provided template 'ans_test_template_123' not matching existing template.+") @@ -717,27 +735,26 @@ - ans_test_epg_2_nt.msg is match("ans_test_epg_2{{':'}} is not a valid uSeg EPG.") - name: Remove ansible_test schema to delete all uSeg Attr objects - mso_schema: + cisco.mso.mso_schema: <<: *ansible_schema_absent schema: ansible_test state: absent # To check all uSeg Attrs removed from the machine - name: Query all uSeg Attrs - Cleanup Part - mso_schema_template_anp_epg_useg_attribute: + cisco.mso.mso_schema_template_anp_epg_useg_attribute: <<: *useg_attribute_present state: query ignore_errors: true register: query_useg_absent_check - name: Assertions check for query all uSeg Attrs - Cleanup Part - assert: + ansible.builtin.assert: that: - query_useg_absent_check is not changed - query_useg_absent_check.current == {} - name: Remove ansible_test tenant - mso_tenant: - <<: *ansible_tenant_present + cisco.mso.mso_tenant: + <<: *ansible_tenant_absent state: absent - <<: *mso_info
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd/tasks/main.yml index a10ed8e14..6f87222cb 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,18 +24,18 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Set version vars - set_fact: - mso_l3mcast: false + ansible.builtin.set_fact: + cisco.mso.mso_l3mcast: false when: version.current.version is version('2.2.4', '=') - name: Ensure site exist - mso_site: &site_present + cisco.mso.mso_site: &site_present <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -46,7 +46,7 @@ state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -55,7 +55,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove DHCP policies - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' tenant: ansible_test @@ -69,7 +69,7 @@ - version.current.version is version('4.0', '<') - name: Remove DHCP option policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' tenant: ansible_test @@ -83,7 +83,7 @@ - version.current.version is version('4.0', '<') - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -93,7 +93,7 @@ state: present - name: Ensure schema 1 with Template1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -101,28 +101,28 @@ state: present - name: Ensure schema 1 with Template2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test template: Template2 - name: Ensure schema 2 with Template3 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test template: Template3 - name: Ensure schema 2 with Template5 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test template: Template5 - name: Ensure VRF exist - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -131,32 +131,32 @@ state: present - name: Ensure VRF2 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present vrf: VRF2 - name: Ensure VRF3 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present template: Template2 vrf: VRF3 - name: Ensure VRF4 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 vrf: VRF4 - name: Ensure VRF5 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 vrf: VRF5 - name: Ensure ansible_test_1 BD does not exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -166,7 +166,7 @@ state: absent - name: Ensure ansible_test_2 BD does not exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -176,7 +176,7 @@ state: absent - name: Ensure ansible_test_3 BD does not exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -188,7 +188,7 @@ state: absent - name: Ensure ansible_test_4 BD does not exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -200,7 +200,7 @@ state: absent - name: Ensure multiple DHCP policies exist - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' description: "My Test DHCP Policies" @@ -215,7 +215,7 @@ - version.current.version is version('4.0', '<') - name: Ensure multiple DHCP option policies exist - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' description: "My Test DHCP Policy Options" @@ -231,7 +231,7 @@ # ADD BD - name: Add bd (check_mode) - mso_schema_template_bd: &bd_present + cisco.mso.mso_schema_template_bd: &bd_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -243,7 +243,7 @@ register: cm_add_bd - name: Verify cm_add_bd - assert: + ansible.builtin.assert: that: - cm_add_bd is changed - cm_add_bd.previous == {} @@ -252,12 +252,12 @@ - cm_add_bd.current.vrfRef.vrfName == "VRF" - name: Add bd (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present register: nm_add_bd - name: Verify nm_add_bd - assert: + ansible.builtin.assert: that: - nm_add_bd is changed - nm_add_bd.previous == {} @@ -267,13 +267,13 @@ - cm_add_bd.current.vrfRef.schemaId == nm_add_bd.current.vrfRef.schemaId - name: Add bd again (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present check_mode: true register: cm_add_bd_again - name: Verify cm_add_bd_again - assert: + ansible.builtin.assert: that: - cm_add_bd_again is not changed - cm_add_bd_again.previous.name == "ansible_test_1" @@ -285,12 +285,12 @@ - cm_add_bd_again.previous.vrfRef.schemaId == cm_add_bd_again.current.vrfRef.schemaId - name: Add bd again (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present register: nm_add_bd_again - name: Verify nm_add_bd_again - assert: + ansible.builtin.assert: that: - nm_add_bd_again is not changed - nm_add_bd_again.previous.name == "ansible_test_1" @@ -302,7 +302,7 @@ - nm_add_bd_again.previous.vrfRef.schemaId == nm_add_bd_again.current.vrfRef.schemaId - name: Add bd 2 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -340,7 +340,7 @@ register: nm_add_bd_2 - name: Add bd 3 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -352,7 +352,7 @@ register: nm_add_bd_3 - name: Add bd 4 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -364,7 +364,7 @@ register: nm_add_bd_4 - name: Verify nm_add_bd_2 and nm_add_bd_3 - assert: + ansible.builtin.assert: that: - nm_add_bd_2 is changed - nm_add_bd_3 is changed @@ -406,7 +406,7 @@ - nm_add_bd_2.current.subnets[3].querier == false - name: Add bd 5 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -434,7 +434,7 @@ register: nm_add_bd_5 - name: Verify nm_add_bd_5 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_add_bd_5 is changed - nm_add_bd_5.current.name == "ansible_test_5" @@ -448,7 +448,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_add_bd_5 for a version that's 3.1 - assert: + ansible.builtin.assert: that: - nm_add_bd_5 is changed - nm_add_bd_5.current.name == "ansible_test_5" @@ -467,7 +467,7 @@ when: version.current.version is version('3.1.1g', '>=') - name: Add bd 5 again (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -495,20 +495,20 @@ register: nm_add_again_bd_5 - name: Verify nm_add_again_bd_5 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_add_again_bd_5 is not changed when: version.current.version is version('3.1.1g', '<') - name: Verify nm_add_again_bd_5 for a version that's between 3.1 and 4.0 - assert: + ansible.builtin.assert: that: - nm_add_again_bd_5 is not changed when: - version.current.version is version('3.1.1g', '>=') - name: Add bd 5 with different values for new options (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -536,13 +536,13 @@ register: nm_bd_5_options - name: Verify nm_bd_5_options for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_bd_5_options is not changed when: version.current.version is version('3.1.1g', '<') - name: Verify nm_bd_5_options for a version that's 3.1 - assert: + ansible.builtin.assert: that: - nm_bd_5_options is changed - nm_bd_5_options.current.unkMcastAct == "opt-flood" @@ -552,7 +552,7 @@ when: version.current.version is version('3.1.1g', '>=') - name: Change bd 5_1 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -580,20 +580,20 @@ register: nm_change_bd_5_1 - name: Verify nm_change_bd_5_1 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_1 is changed when: version.current.version is version('3.1.1g', '<') - name: Verify nm_change_bd_5_1 for a version that's 3.1 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_1 is changed - nm_change_bd_5_1.current.arpFlood == true when: version.current.version is version('3.1.1g', '>=') - name: Change bd 5_2 (normal mode) - mso_schema_template_bd: &change_bd5_2 + cisco.mso.mso_schema_template_bd: &change_bd5_2 <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -622,21 +622,21 @@ register: nm_change_bd_5_2 - name: Verify nm_change_bd_5_2 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_2 is changed - nm_change_bd_5_2.current.l2UnknownUnicast == "flood" when: version.current.version is version('3.1.1g', '<') - name: Verify nm_change_bd_5_2 for a version that's after 3.1 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_2 is changed - nm_change_bd_5_2.current.arpFlood == true when: version.current.version is version('3.1.1g', '>=') - name: Change bd 5_3 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -665,14 +665,14 @@ register: nm_change_bd_5_3 - name: Verify nm_change_bd_5_3 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_3 is changed - nm_change_bd_5_3.msg is match ("MSO Error 143{{':'}} Invalid Field{{':'}} BD 'ansible_test_5' l2UnknownUnicast cannot be flood when intersiteBumTrafficAllow is off") when: version.current.version is version('3.1.1g', '<') - name: Verify nm_change_bd_5_3 for a version that's after 3.1 and before 3.3 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_3 is changed # Inconsistency shown in returned error messages for v3.1.1 @@ -686,7 +686,7 @@ - version.current.version is version('3.1.1g', '>=') - name: Verify nm_change_bd_5_3 for a version that's after 4.0 - assert: + ansible.builtin.assert: that: - nm_change_bd_5_3 is changed - nm_change_bd_5_3.msg is match ("MSO Error 400{{':'}} BD{{':'}} ansible_test_5 in Schema{{':'}} ansible_test_2 , Template{{':'}} Template5 BD ansible_test_5 l2UnknownUnicast cannot be flood when intersiteBumTrafficAllow is off") @@ -694,7 +694,7 @@ - version.current.version is version('4.0', '>=') - name: Get Validation status - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' state: query @@ -705,7 +705,7 @@ - version.current.version is version('4.0', '<') # mso_schema_validate not needed after 4.0 because validation is done upon request - name: Verify query_validate for a version that's after 3.3 - assert: + ansible.builtin.assert: that: - query_validate is not changed - query_validate.msg is match ("MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} Template 'Template5', BD 'ansible_test_5' {{':'}} ARP Flooding has to be disabled if L2 Stretch enabled and BUM traffic disabled exception while trying to update schema") @@ -715,13 +715,13 @@ # Reverting back to bd 5_2 - name: Change bd 5_3 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *change_bd5_2 register: nm_change_bd_5_3_again when: query_validate is failed - name: Get Validation status - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' state: query @@ -731,7 +731,7 @@ - version.current.version is version('4.0', '<') # mso_schema_validate not needed after 4.0 because validation is done upon request - name: Change bd 5 for query (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -759,7 +759,7 @@ # CHANGE BD - name: Change bd (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF2 @@ -767,7 +767,7 @@ register: cm_change_bd - name: Verify cm_change_bd - assert: + ansible.builtin.assert: that: - cm_change_bd is changed - cm_change_bd.current.name == 'ansible_test_1' @@ -776,7 +776,7 @@ - cm_change_bd.current.vrfRef.schemaId == cm_change_bd.previous.vrfRef.schemaId - name: Change bd (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF2 @@ -784,7 +784,7 @@ register: nm_change_bd - name: Verify nm_change_bd - assert: + ansible.builtin.assert: that: - nm_change_bd is changed - nm_change_bd.current.name == 'ansible_test_1' @@ -793,7 +793,7 @@ - nm_change_bd.current.vrfRef.schemaId == nm_change_bd.previous.vrfRef.schemaId - name: Change bd again (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF2 @@ -801,7 +801,7 @@ register: cm_change_bd_again - name: Verify cm_change_bd_again - assert: + ansible.builtin.assert: that: - cm_change_bd_again is not changed - cm_change_bd_again.current.name == 'ansible_test_1' @@ -810,14 +810,14 @@ - cm_change_bd_again.current.vrfRef.schemaId == cm_change_bd_again.previous.vrfRef.schemaId - name: Change bd again (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF2 register: nm_change_bd_again - name: Verify nm_change_bd_again - assert: + ansible.builtin.assert: that: - nm_change_bd_again is not changed - nm_change_bd_again.current.name == 'ansible_test_1' @@ -826,7 +826,7 @@ - nm_change_bd_again.current.vrfRef.schemaId == nm_change_bd_again.previous.vrfRef.schemaId - name: Change bd to VRF3 in other template (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF3 @@ -834,7 +834,7 @@ register: nm_change_bd_vrf3 - name: Change bd to VRF4 in other schema (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present vrf: name: VRF4 @@ -843,7 +843,7 @@ register: nm_change_bd_vrf4 - name: Verify nm_change_bd_vrf3 and nm_change_bd_vrf4 - assert: + ansible.builtin.assert: that: - nm_change_bd_vrf3 is changed - nm_change_bd_vrf3.current.name == nm_change_bd_vrf4.current.name == 'ansible_test_1' @@ -853,7 +853,7 @@ - nm_change_bd_vrf4.current.vrfRef.templateName == "Template3" - name: Change bd 1 settings(normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -885,7 +885,7 @@ register: nm_change_bd_1_settings - name: Change bd 1 subnets (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -916,7 +916,7 @@ register: nm_change_bd_1_subnets - name: Verify nm_change_bd_1_subnets - assert: + ansible.builtin.assert: that: - nm_change_bd_1_settings is changed - nm_change_bd_1_settings.current.name == "ansible_test_1" @@ -979,21 +979,21 @@ - nm_change_bd_1_subnets.current.subnets[2].querier == true - name: Verify l3MCast nm_change_bd_1_subnets (version == 2.2.4) - assert: + ansible.builtin.assert: that: - nm_change_bd_1_settings.current.l3MCast == false - nm_change_bd_1_subnets.current.l3MCast == false when: version.current.version is version('2.2.4', '=') - name: Verify l3MCast nm_change_bd_1_subnets (version != 2.2.4) - assert: + ansible.builtin.assert: that: - nm_change_bd_1_settings.current.l3MCast == true - nm_change_bd_1_subnets.current.l3MCast == true when: version.current.version is version('2.2.4', '!=') - name: Add bd with multiple dhcp policies for mso version > 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1045,7 +1045,7 @@ - version.current.version is version('4.0', '<') - name: Verify addition of DHCP policies for mso version > 3.1.1g - assert: + ansible.builtin.assert: that: - nm_bd_dhcp_policies is changed - nm_bd_dhcp_policies.current.dhcpLabels | length == 3 @@ -1067,7 +1067,7 @@ - version.current.version is version('4.0', '<') - name: Change bd with multiple dhcp policies for mso version > 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1114,7 +1114,7 @@ - version.current.version is version('4.0', '<') - name: Verify change in DHCP policies for mso version > 3.1.1g - assert: + ansible.builtin.assert: that: - change_nm_bd_dhcp_policies is changed - change_nm_bd_dhcp_policies.current.dhcpLabels | length == 2 @@ -1133,7 +1133,7 @@ # Add BD with new options for mso version > 3.1.1g - name: Add bd with new options available in mso versions > 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1169,7 +1169,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify subnets in nm_bd_new_subnet_options - assert: + ansible.builtin.assert: that: - nm_bd_new_subnet_options is changed - nm_bd_new_subnet_options.current.name == 'ansible_test_new_options' @@ -1194,7 +1194,7 @@ # Change BD with new options for mso version > 3.1.1g - name: Try Changing bd with another subnet to primary IP - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1232,7 +1232,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify subnets in nm_bd_subnet_second_primary - assert: + ansible.builtin.assert: that: - nm_bd_subnet_second_primary.msg is match ("MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} Only one preferred subnet per address family is allowed under BD ansible_test_new_options of Template Template1 exception while trying to update schema") when: @@ -1240,7 +1240,7 @@ - version.current.version is version('3.3', '<') - name: Add bd with new option flood in encap available in mso versions > 3.1.1g with l2 set to true - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1264,7 +1264,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify nm_bd_new_encap_flood_non - assert: + ansible.builtin.assert: that: - nm_bd_new_encap_flood_non.msg is match ("MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} Template 'Template1', BD 'ansible_test_flood_encap' {{':'}} Multi destination flood in encapsulation is only supported when l2Stretch is disabled exception while trying to update schema") when: @@ -1272,7 +1272,7 @@ - version.current.version is version('3.3', '<') - name: Add bd with new option flood in encap available in mso versions > 3.1.1g l2 set to false - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1293,13 +1293,13 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify nm_bd_new_encap_flood - assert: + ansible.builtin.assert: that: - nm_bd_new_encap_flood.current.multiDstPktAct == "encap-flood" when: version.current.version is version('3.1.1g', '>') - name: Add bd with new option description in mso versions >= 3.3 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1319,13 +1319,13 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_bd_desc - assert: + ansible.builtin.assert: that: - nm_bd_desc.current.description == "ansible_test_bd" when: version.current.version is version('3.3', '>=') - name: Add bd with change in description in mso versions >= 3.3 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1345,13 +1345,13 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_bd_desc_2 - assert: + ansible.builtin.assert: that: - nm_bd_desc_2.current.description == "ansible_test_bd_again" when: version.current.version is version('3.3', '>=') - name: Ensure bd ansible_test_unicast_false is removed >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1360,7 +1360,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Ensure bd ansible_test_unicast_true is removed >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1369,7 +1369,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Add bd with change in unicast routing false in mso versions >= 3.1.1g (check mode) - mso_schema_template_bd: &unicast_routing_false_present + cisco.mso.mso_schema_template_bd: &unicast_routing_false_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1385,26 +1385,26 @@ when: version.current.version is version('3.1.1g', '>') - name: Add bd with change in unicast routing false in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_false_present register: nm_ansible_test_unicast_false when: version.current.version is version('3.1.1g', '>') - name: Add bd again with unicast routing false in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_false_present register: nm_ansible_test_unicast_false_again when: version.current.version is version('3.1.1g', '>') - name: Change bd with unicast routing to true in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_false_present unicast_routing: true register: nm_ansible_test_unicast_false_to_true when: version.current.version is version('3.1.1g', '>') - name: Add bd with change in unicast routing true in mso versions >= 3.1.1g (check mode) - mso_schema_template_bd: &unicast_routing_true_present + cisco.mso.mso_schema_template_bd: &unicast_routing_true_present <<: *unicast_routing_false_present bd: ansible_test_unicast_true unicast_routing: true @@ -1413,26 +1413,26 @@ when: version.current.version is version('3.1.1g', '>') - name: Add bd with change in unicast routing true in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_true_present register: nm_ansible_test_unicast_true when: version.current.version is version('3.1.1g', '>') - name: Add bd again with unicast routing true in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_true_present register: nm_ansible_test_unicast_true_again when: version.current.version is version('3.1.1g', '>') - name: Change bd with unicast routing to false in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_true_present unicast_routing: false register: nm_ansible_test_unicast_true_to_false when: version.current.version is version('3.1.1g', '>') - name: Verify unicast routing - assert: + ansible.builtin.assert: that: - cm_ansible_test_unicast_false is changed - cm_ansible_test_unicast_false.current.unicastRouting == false @@ -1455,14 +1455,14 @@ when: version.current.version is version('3.1.1g', '>') - name: Remove bd with change in unicast routing false in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_false_present state: absent register: ansible_test_unicast_false when: version.current.version is version('3.1.1g', '>') - name: Remove bd with change in unicast routing true in mso versions >= 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *unicast_routing_true_present state: absent register: ansible_test_unicast_true @@ -1472,7 +1472,7 @@ # QUERY ALL BD - name: Query all bd (check_mode) - mso_schema_template_bd: &bd_query + cisco.mso.mso_schema_template_bd: &bd_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1481,12 +1481,12 @@ register: cm_query_all_bds - name: Query all bd (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query register: nm_query_all_bds - name: Verify query_all_bds for version < 3.1.1g - assert: + ansible.builtin.assert: that: - cm_query_all_bds is not changed - nm_query_all_bds is not changed @@ -1494,7 +1494,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify query_all_bds for version > 3.1.1g and version < 3.3 - assert: + ansible.builtin.assert: that: - cm_query_all_bds is not changed - nm_query_all_bds is not changed @@ -1504,7 +1504,7 @@ - version.current.version is version('3.3', '<') - name: Verify query_all_bds for version >= 3.3 and < 4.0 - assert: + ansible.builtin.assert: that: - cm_query_all_bds is not changed - nm_query_all_bds is not changed @@ -1514,7 +1514,7 @@ - version.current.version is version('3.7', '<') - name: Verify query_all_bds for version >= 4.0 - assert: + ansible.builtin.assert: that: - cm_query_all_bds is not changed - nm_query_all_bds is not changed @@ -1523,27 +1523,27 @@ # QUERY A BD - name: Query bd 1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_1 check_mode: true register: cm_query_bd - name: Query bd 1 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_1 register: nm_query_bd - name: Query bd 2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query template: Template2 bd: ansible_test_2 register: nm_query_bd_2 - name: Query bd 3 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template3 @@ -1551,7 +1551,7 @@ register: nm_query_bd_3 - name: Query bd 5 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -1559,7 +1559,7 @@ register: nm_query_bd_5 - name: Verify query_bd - assert: + ansible.builtin.assert: that: - cm_query_bd is not changed - nm_query_bd is not changed @@ -1594,7 +1594,7 @@ - nm_query_bd_2.current.subnets[3].shared == false - name: Verify nm_query_bd_5 for a version that's before 3.1 - assert: + ansible.builtin.assert: that: - nm_query_bd_5 is not changed - nm_query_bd_5.current.name == "ansible_test_5" @@ -1606,7 +1606,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_query_bd_5 for a version that's 3.1 - assert: + ansible.builtin.assert: that: - nm_query_bd_5 is not changed - nm_query_bd_5.current.name == "ansible_test_5" @@ -1623,7 +1623,7 @@ when: version.current.version is version('3.1.1g', '>=') - name: Query bd with multiple dhcp policies for mso version > 3.1.1g - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_multiple_dhcp state: query @@ -1634,7 +1634,7 @@ - version.current.version is version('4.0', '<') - name: Verify query of DHCP policies for mso version > 3.1.1g - assert: + ansible.builtin.assert: that: - query_nm_bd_dhcp_policies is not changed - query_nm_bd_dhcp_policies.current.name == 'ansible_test_multiple_dhcp' @@ -1654,7 +1654,7 @@ # Query BD with new options for mso version > 3.1.1g - name: Query bd with new option flood in encap available in mso versions > 3.1.1g with l2 set to false - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_flood_encap state: query @@ -1662,7 +1662,7 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify query_bd_new_encap_flood - assert: + ansible.builtin.assert: that: - query_bd_new_encap_flood is not changed - query_bd_new_encap_flood.current.name == 'ansible_test_flood_encap' @@ -1678,14 +1678,14 @@ when: version.current.version is version('3.1.1g', '>') - name: Verify query_bd_new_encap_flood - assert: + ansible.builtin.assert: that: - query_bd_new_encap_flood.current.l3MCast == false when: version.current.version is version('3.2', '>=') # REMOVE BD - name: Remove bd (check_mode) - mso_schema_template_bd: &bd_absent + cisco.mso.mso_schema_template_bd: &bd_absent <<: *bd_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1695,47 +1695,47 @@ register: cm_remove_bd - name: Verify cm_remove_bd - assert: + ansible.builtin.assert: that: - cm_remove_bd is changed - cm_remove_bd.current == {} - name: Remove bd (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_absent register: nm_remove_bd - name: Verify nm_remove_bd - assert: + ansible.builtin.assert: that: - nm_remove_bd is changed - nm_remove_bd.current == {} - name: Remove bd again (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_absent check_mode: true register: cm_remove_bd_again - name: Verify cm_remove_bd_again - assert: + ansible.builtin.assert: that: - cm_remove_bd_again is not changed - cm_remove_bd_again.current == {} - name: Remove bd again (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_absent register: nm_remove_bd_again - name: Verify nm_remove_bd_again - assert: + ansible.builtin.assert: that: - nm_remove_bd_again is not changed - nm_remove_bd_again.current == {} - name: Remove bd 5 (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_absent schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template5 @@ -1743,13 +1743,13 @@ register: nm_remove_bd_5 - name: Verify nm_remove_bd_5 - assert: + ansible.builtin.assert: that: - nm_remove_bd_5 is changed - nm_remove_bd_5.current == {} - name: Remove bd ansible_test_multiple_dhcp (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_absent schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -1761,7 +1761,7 @@ - version.current.version is version('4.0', '<') - name: Verify nm_remove_ansible_test_multiple_dhcp - assert: + ansible.builtin.assert: that: - nm_remove_ansible_test_multiple_dhcp is changed - nm_remove_ansible_test_multiple_dhcp.current == {} @@ -1772,7 +1772,7 @@ # QUERY NON-EXISTING BD - name: Query non-existing bd (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_1 check_mode: true @@ -1780,14 +1780,14 @@ register: cm_query_non_bd - name: Query non-existing bd (normal mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query bd: ansible_test_1 ignore_errors: true register: nm_query_non_bd - name: Verify query_non_bd - assert: + ansible.builtin.assert: that: - cm_query_non_bd is not changed - nm_query_non_bd is not changed @@ -1797,7 +1797,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for bd (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query state: non-existing-state check_mode: true @@ -1805,14 +1805,14 @@ register: cm_non_existing_state - name: Non-existing state for bd (normal_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -1821,7 +1821,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for bd (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query schema: non-existing-schema check_mode: true @@ -1829,14 +1829,14 @@ register: cm_non_existing_schema - name: Non-existing schema for bd (normal_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -1845,7 +1845,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for bd (check_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query template: non-existing-template check_mode: true @@ -1853,14 +1853,14 @@ register: cm_non_existing_template - name: Non-existing template for bd (normal_mode) - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -1869,7 +1869,7 @@ # CLEAN UP DHCP Policies - name: Ensure DHCP policies are removed - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' tenant: ansible_test @@ -1883,7 +1883,7 @@ - version.current.version is version('4.0', '<') - name: Ensure DHCP option policies are removed - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' tenant: ansible_test @@ -1898,7 +1898,7 @@ # REMOVE Schemas for next CI Run - name: Remove schemas for next ci test - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_dhcp_policy/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_dhcp_policy/tasks/main.yml index b6b2d7a80..b7f0d632f 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_dhcp_policy/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_dhcp_policy/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -34,7 +34,7 @@ - version.current.version is version('4.0', '<') block: - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -43,7 +43,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove DHCP policies - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' tenant: ansible_test @@ -54,7 +54,7 @@ - 'ansible_test_dhcp_policy3' - name: Remove DHCP option policies - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' tenant: ansible_test @@ -64,7 +64,7 @@ - 'ansible_test_dhcp_policy_option2' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -74,7 +74,7 @@ state: present - name: Ensure schema 1 with Template1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -82,7 +82,7 @@ state: present - name: Ensure VRF exists - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -91,7 +91,7 @@ state: present - name: Ensure multiple DHCP policies exist - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' description: "My Test DHCP Policies" @@ -103,7 +103,7 @@ - 'ansible_test_dhcp_policy3' - name: Ensure multiple DHCP option policies exist - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' description: "My Test DHCP Policy Options" @@ -115,7 +115,7 @@ # ADD BD - name: Add bd - mso_schema_template_bd: &bd_present + cisco.mso.mso_schema_template_bd: &bd_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -131,14 +131,14 @@ state: present - name: Add bd2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present bd: ansible_test_2 state: present # Add dhcp policies - name: Add DHCP policy in check mode - mso_schema_template_bd_dhcp_policy: &dhcp_present + cisco.mso.mso_schema_template_bd_dhcp_policy: &dhcp_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -152,17 +152,17 @@ check_mode: true - name: Add DHCP policy in normal mode - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present register: nm_add_dhcp - name: Add DHCP policy again in normal mode - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present register: nm_add_dhcp_again - name: Add another DHCP policy in normal mode - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present name: ansible_test_dhcp_policy2 version: 1 @@ -173,14 +173,14 @@ - name: Add dhcp for query all (normal mode) - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present name: ansible_test_dhcp_policy3 version: 1 register: nm_add_dhcp3 - name: Verify cm_add_dhcp, nm_add_dhcp, nm_add_dhcp2 and nm_add_dhcp3 - assert: + ansible.builtin.assert: that: - cm_add_dhcp is changed - nm_add_dhcp is changed @@ -198,7 +198,7 @@ # CHANGE dhcp policies - name: Change dhcp policy (normal mode) - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -211,7 +211,7 @@ register: nm_change_dhcp - name: Verify nm_change_dhcp - assert: + ansible.builtin.assert: that: - nm_change_dhcp is changed - nm_change_dhcp.current.name == 'ansible_test_dhcp_policy1' @@ -219,7 +219,7 @@ - nm_change_dhcp.current.dhcpOptionLabel.name == 'ansible_test_dhcp_policy_option2' - name: Change dhcp policy again (normal mode) - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -233,7 +233,7 @@ - name: Verify nm_change_dhcp - assert: + ansible.builtin.assert: that: - nm_change_dhcp_again is changed - nm_change_dhcp_again.current.name == 'ansible_test_dhcp_policy1' @@ -242,7 +242,7 @@ # QUERY ALL dhcp policies - name: Query all dhcp (check_mode) - mso_schema_template_bd_dhcp_policy: &dhcp_query + cisco.mso.mso_schema_template_bd_dhcp_policy: &dhcp_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -253,13 +253,13 @@ - name: Query all dhcp (normal mode) - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query register: nm_query_all_dhcp - name: Verify query_all_dhcp - assert: + ansible.builtin.assert: that: - cm_query_all_dhcp is not changed - nm_query_all_dhcp is not changed @@ -267,13 +267,13 @@ # QUERY a DHCP policy - name: Query single dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query name: ansible_test_dhcp_policy1 register: nm_query_dhcp - name: Verify nm_query_dhcp - assert: + ansible.builtin.assert: that: - nm_query_dhcp is not changed - nm_query_dhcp.current.name == 'ansible_test_dhcp_policy1' @@ -282,7 +282,7 @@ # QUERY a non associated DHCP policy - name: Query non associated dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query bd: ansible_test_2 name: ansible_test_dhcp_policy1 @@ -290,13 +290,13 @@ register: non_dhcp - name: Verify non_dhcp - assert: + ansible.builtin.assert: that: - non_dhcp.msg is match ("DHCP policy not associated with the bd") # REMOVE DHCP policy - name: Remove dhcp policy - mso_schema_template_bd_dhcp_policy: &dhcp_absent + cisco.mso.mso_schema_template_bd_dhcp_policy: &dhcp_absent <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -306,26 +306,26 @@ register: nm_remove_dhcp - name: Verify nm_remove_dhcp - assert: + ansible.builtin.assert: that: - nm_remove_dhcp is changed - nm_remove_dhcp.current == {} - name: Remove dhcp again (check_mode) - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_absent register: nm_remove_dhcp_again - name: Verify nm_remove_dhcp_again - assert: + ansible.builtin.assert: that: - nm_remove_dhcp_again is not changed - nm_remove_dhcp_again.current == {} # QUERY NON-EXISTING DHCP policy - name: Query non-existing dhcp policy - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -339,14 +339,14 @@ register: nm_query_non_dhcp - name: Verify nm_query_non_dhcp - assert: + ansible.builtin.assert: that: - nm_query_non_dhcp is not changed - nm_query_non_dhcp.msg is match ("DHCP policy 'non_policy' does not exist") # QUERY NON-EXISTING DHCP policy option - name: Query non-existing dhcp policy option - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -360,70 +360,70 @@ register: nm_query_non_dhcp_option - name: Verify nm_query_non_dhcp - assert: + ansible.builtin.assert: that: - nm_query_non_dhcp_option is not changed - nm_query_non_dhcp_option.msg is match ("DHCP option policy 'non_option' does not exist") # USE A NON-EXISTING STATE - name: Non-existing state for dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - nm_non_existing_state is not changed - nm_non_existing_state.msg is match ("value of state must be one of{{':'}} absent, present, query, got{{':'}} non-existing-state") # USE A NON-EXISTING SCHEMA - name: Non-existing schema for dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - nm_non_existing_schema is not changed - nm_non_existing_schema.msg is match ("Provided schema 'non-existing-schema' does not exist.") # USE A NON-EXISTING TEMPLATE - name: Non-existing template for dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - nm_non_existing_template is not changed - nm_non_existing_template.msg is match ("Provided template 'non-existing-template' does not exist. Existing templates{{':'}} Template1") # USE A NON-EXISTING BD - name: Non-existing bd for dhcp - mso_schema_template_bd_dhcp_policy: + cisco.mso.mso_schema_template_bd_dhcp_policy: <<: *dhcp_query bd: non-existing-bd ignore_errors: true register: nm_non_existing_bd - name: Verify non_existing_bd - assert: + ansible.builtin.assert: that: - nm_non_existing_bd is not changed - nm_non_existing_bd.msg is match ("Provided BD 'non-existing-bd' does not exist. Existing BDs{{':'}} ansible_test_1") # REMOVE Schemas for next CI Run - name: Remove schemas for next ci test - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -433,7 +433,7 @@ # CLEAN UP DHCP Policies - name: Ensure DHCP policies are removed - mso_dhcp_relay_policy: + cisco.mso.mso_dhcp_relay_policy: <<: *mso_info dhcp_relay_policy: '{{ item }}' tenant: ansible_test @@ -444,7 +444,7 @@ - 'ansible_test_dhcp_policy3' - name: Ensure DHCP option policies are removed - mso_dhcp_option_policy: + cisco.mso.mso_dhcp_option_policy: <<: *mso_info dhcp_option_policy: '{{ item }}' tenant: ansible_test diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_subnet/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_subnet/tasks/main.yml index 75a3b4747..45d5612d6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_subnet/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_bd_subnet/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,18 +24,18 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Set version vars - set_fact: - mso_l3mcast: false + ansible.builtin.set_fact: + cisco.mso.mso_l3mcast: false when: version.current.version is version('2.2.4', '=') - name: Ensure site exist - mso_site: &site_present + cisco.mso.mso_site: &site_present <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -46,7 +46,7 @@ state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -55,7 +55,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -65,7 +65,7 @@ state: present - name: Ensure schema 1 with Template1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -73,7 +73,7 @@ state: present - name: Ensure schema 2 with Template2 exists - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -81,7 +81,7 @@ state: present - name: Ensure VRF exists - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -90,7 +90,7 @@ state: present - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -98,7 +98,7 @@ # ADD BD - name: Add bd - mso_schema_template_bd: &bd_present + cisco.mso.mso_schema_template_bd: &bd_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -120,7 +120,7 @@ state: present - name: Add bd 2 - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -141,7 +141,7 @@ version: 1 - name: Add bd - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -164,7 +164,7 @@ # Add subnet - name: Add subnet in check mode - mso_schema_template_bd_subnet: &subnet_present + cisco.mso.mso_schema_template_bd_subnet: &subnet_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -180,22 +180,22 @@ check_mode: true - name: Add subnet (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present register: nm_add_subnet - name: Add subnet again (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present register: nm_add_subnet_again - name: Add subnet for query all (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present subnet: 2.16.0.1/24 - name: Verify cm_add_subnet and nm_add_subnet - assert: + ansible.builtin.assert: that: - cm_add_subnet is changed - nm_add_subnet is changed @@ -214,7 +214,7 @@ - nm_add_subnet.current.querier == true - name: Add subnet 2 (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -229,7 +229,7 @@ register: nm_add_subnet_2 - name: Verify nm_bd_2 for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_add_subnet_2.current.ip == "10.1.1.1/24" - nm_add_subnet_2.current.noDefaultGateway == false @@ -239,7 +239,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_bd_2 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_add_subnet_2.current.ip == "10.1.1.1/24" - nm_add_subnet_2.current.noDefaultGateway == false @@ -251,7 +251,7 @@ # CHANGE Subnet - name: Change subnet 2 (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -266,7 +266,7 @@ register: nm_change_subnet2 - name: Verify nm_change_subnet2 for a version < 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet2 is not changed - nm_change_subnet2.current.ip == "10.1.1.1/24" @@ -277,7 +277,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_change_subnet2 for a version >= 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet2 is changed - nm_change_subnet2.current.ip == "10.1.1.1/24" @@ -289,7 +289,7 @@ when: version.current.version is version('3.1.1g', '>=') - name: Change subnet2 again (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -304,7 +304,7 @@ register: nm_change_subnet2_again - name: Verify nm_change_subnet2_again for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet2_again is not changed - nm_change_subnet2_again.current.ip == "10.1.1.1/24" @@ -315,7 +315,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify cm_change_subnet2 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet2_again is not changed - nm_change_subnet2_again.current.ip == "10.1.1.1/24" @@ -328,7 +328,7 @@ # Primary parameter - name: Add subnet 3 with primary and querier parameters (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -345,7 +345,7 @@ register: nm_add_subnet_3 - name: Verify nm_add_subnet_3 for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_add_subnet_3.current.ip == "10.1.1.5/24" - nm_add_subnet_3.current.noDefaultGateway == false @@ -355,7 +355,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_add_subnet_3 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_add_subnet_3.current.ip == "10.1.1.5/24" - nm_add_subnet_3.current.noDefaultGateway == false @@ -368,7 +368,7 @@ # CHANGE Subnet - name: Change subnet 3 (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -385,7 +385,7 @@ register: nm_change_subnet3 - name: Verify nm_change_subnet3 for a version < 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet3 is not changed - nm_change_subnet3.current.ip == "10.1.1.5/24" @@ -396,7 +396,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_change_subnet2 for a version >= 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet3 is changed - nm_change_subnet3.current.ip == "10.1.1.5/24" @@ -409,7 +409,7 @@ when: version.current.version is version('3.1.1g', '>=') - name: Change subnet3 again (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -426,7 +426,7 @@ register: nm_change_subnet3_again - name: Verify nm_change_subnet2_again for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet3_again is not changed - nm_change_subnet3_again.current.ip == "10.1.1.5/24" @@ -437,7 +437,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify cm_change_subnet2 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_change_subnet3_again is not changed - nm_change_subnet3_again.current.ip == "10.1.1.5/24" @@ -451,7 +451,7 @@ # QUERY ALL Subnets - name: Query all subnet (check_mode) - mso_schema_template_bd_subnet: &subnet_query + cisco.mso.mso_schema_template_bd_subnet: &subnet_query <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -461,12 +461,12 @@ register: cm_query_all_subnet - name: Query all subnet (normal mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query register: nm_query_all_subnet - name: Verify query_all_subnet - assert: + ansible.builtin.assert: that: - cm_query_all_subnet is not changed - nm_query_all_subnet is not changed @@ -474,7 +474,7 @@ # QUERY A subnet - name: Query subnet2 - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template2 @@ -483,7 +483,7 @@ register: nm_query_subnet2 - name: Verify nm_query_subnet2 for a version that's < 3.1 - assert: + ansible.builtin.assert: that: - nm_query_subnet2 is not changed - nm_query_subnet2.current.ip == "10.1.1.1/24" @@ -494,7 +494,7 @@ when: version.current.version is version('3.1.1g', '<') - name: Verify nm_query_subnet2 for a version that's >= 3.1 - assert: + ansible.builtin.assert: that: - nm_query_subnet2 is not changed - nm_query_subnet2.current.ip == "10.1.1.1/24" @@ -507,7 +507,7 @@ # REMOVE Subnet - name: Remove subnet - mso_schema_template_bd_subnet: &subnet_absent + cisco.mso.mso_schema_template_bd_subnet: &subnet_absent <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -517,25 +517,25 @@ register: nm_remove_subnet - name: Verify nm_remove_subnet - assert: + ansible.builtin.assert: that: - nm_remove_subnet is changed - nm_remove_subnet.current == {} - name: Remove subnet again (check_mode) - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_absent register: nm_remove_subnet_again - name: Verify nm_remove_subnet_again - assert: + ansible.builtin.assert: that: - nm_remove_subnet_again is not changed - nm_remove_subnet_again.current == {} # QUERY NON-EXISTING Subnet - name: Query non-existing subnet - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query bd: ansible_test_1 subnet: 172.16.0.3/24 @@ -543,56 +543,56 @@ register: nm_query_non_subnet - name: Verify nm_query_non_subnet - assert: + ansible.builtin.assert: that: - nm_query_non_subnet is not changed - nm_query_non_subnet.msg is match ("Subnet IP '172.16.0.3/24' not found") # USE A NON-EXISTING STATE - name: Non-existing state for subnet - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - nm_non_existing_state is not changed - nm_non_existing_state.msg is match ("value of state must be one of{{':'}} absent, present, query, got{{':'}} non-existing-state") # USE A NON-EXISTING SCHEMA - name: Non-existing schema for subnet - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - nm_non_existing_schema is not changed - nm_non_existing_schema.msg is match ("Provided schema 'non-existing-schema' does not exist.") # USE A NON-EXISTING TEMPLATE - name: Non-existing template for subnet - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - nm_non_existing_template is not changed - nm_non_existing_template.msg is match ("Provided template 'non-existing-template' does not exist. Existing templates{{':'}} Template1") # USE NON-EXISTING OPTIONS - name: Add subnet with no description - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -602,26 +602,26 @@ register: nm_add_subnet_no_desc - name: Verify nm_add_subnet_no_desc - assert: + ansible.builtin.assert: that: - nm_add_subnet_no_desc.current.description == "172.16.0.5/24" # USE A NON-EXISTING BD - name: Non-existing bd for subnet - mso_schema_template_bd_subnet: + cisco.mso.mso_schema_template_bd_subnet: <<: *subnet_query bd: non-existing-bd ignore_errors: true register: nm_non_existing_bd - name: Verify non_existing_bd - assert: + ansible.builtin.assert: that: - nm_non_existing_bd is not changed - nm_non_existing_bd.msg is match ("Provided BD 'non-existing-bd' does not exist. Existing BDs{{':'}} ansible_test_1") - name: Remove schemas for next ci test - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_clone/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_clone/tasks/main.yml index 0039a9b02..1128a3ee8 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_clone/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_clone/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,7 +21,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -37,7 +37,7 @@ - Schema2 - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -47,7 +47,7 @@ state: present - name: Ensure user is defined under common tenant - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: common users: @@ -100,7 +100,7 @@ - { schema: 'Schema2', template: 'Template3', epg: 'ansible_test_3' } - name: Add Selector to EPG (normal_mode) - mso_schema_template_anp_epg_selector: + cisco.mso.mso_schema_template_anp_epg_selector: <<: *mso_info schema: 'Schema1' template: Template1 @@ -176,7 +176,7 @@ register: add_template_tenant - name: Verify add_templates - assert: + ansible.builtin.assert: that: - cm_add_template is not changed - add_template is changed @@ -205,7 +205,7 @@ register: non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - non_existing_template is not changed - non_existing_template.msg == "Source template with the name 'non_existing_template' does not exist." @@ -222,7 +222,7 @@ register: non_existing_source_schema - name: Verify non_existing_source_schema - assert: + ansible.builtin.assert: that: - non_existing_source_schema is not changed - non_existing_source_schema.msg == "Schema with the name 'non_existing_schema' does not exist." @@ -241,7 +241,7 @@ register: non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - non_existing_schema is not changed - non_existing_schema.msg == "Schema with the name 'non_existing_schema' does not exist." @@ -256,7 +256,7 @@ register: wrong_template_name - name: Verify wrong_template_name - assert: + ansible.builtin.assert: that: - wrong_template_name is not changed - wrong_template_name.msg == "Source and destination templates in the same schema cannot have same names." @@ -272,7 +272,7 @@ register: template_already_exist - name: Verify template_already_exist - assert: + ansible.builtin.assert: that: - template_already_exist is not changed - template_already_exist.msg == "Template with the name 'Template2' already exists. Please use another name." @@ -288,6 +288,6 @@ - Schema1 - name: Verify rm_schema - assert: + ansible.builtin.assert: that: - rm_schema is changed
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_filter/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_filter/tasks/main.yml index 08f6d5cf5..9236b1b58 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_filter/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_filter/tasks/main.yml @@ -9,14 +9,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -27,25 +27,25 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schema 2 - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' state: absent - name: Remove schema 1 - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: absent - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -53,7 +53,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -61,13 +61,13 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present template: Template 2 state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -86,7 +86,7 @@ register: add_filter - name: Ensure Filter2 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *filter_present template: Template 2 filter: Filter2 @@ -94,7 +94,7 @@ state: present - name: Ensure Filter3 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *filter_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -103,28 +103,28 @@ state: present - name: Ensure Filter4 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *filter_present filter: Filter4 entry: Filter4Entry state: present - name: Ensure Filter5 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *filter_present filter: Filter5 entry: Filter5Entry state: present - name: Ensure Filter-6 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *filter_present filter: Filter-6 entry: Filter-6Entry state: present - name: Ensure Contract_1 contract does not exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -135,14 +135,14 @@ state: absent - name: Ensure Contract_2 contract does not exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present template: Template 2 contract: Contract2 state: absent - name: Ensure Contract_3 contract does not exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -150,26 +150,26 @@ state: absent - name: Ensure Contract_4 contract does not exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 state: absent - name: Ensure Contract_5 contract does not exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract5 state: absent - name: Ensure Contract_6 contract does not exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract-6 state: absent # ADD CONTRACT - name: Add contract (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -178,7 +178,7 @@ register: cm_add_contract - name: Verify cm_add_contract - assert: + ansible.builtin.assert: that: - cm_add_contract is changed - cm_add_contract.previous == {} @@ -186,7 +186,7 @@ - cm_add_contract.current.filterRef.templateName == "Template1" - name: Add contract (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -194,7 +194,7 @@ register: nm_add_contract - name: Verify nm_add_contract - assert: + ansible.builtin.assert: that: - nm_add_contract is changed - nm_add_contract.previous == {} @@ -203,7 +203,7 @@ - cm_add_contract.current.filterRef.schemaId == nm_add_contract.current.filterRef.schemaId - name: Add contract again (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -212,7 +212,7 @@ register: cm_add_contract_again - name: Verify cm_add_contract_again - assert: + ansible.builtin.assert: that: - cm_add_contract_again is not changed - cm_add_contract_again.current.filterRef.filterName == "Filter1" @@ -222,7 +222,7 @@ - cm_add_contract_again.previous.filterRef.schemaId == cm_add_contract_again.current.filterRef.schemaId - name: Add contract again (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -230,7 +230,7 @@ register: nm_add_contract_again - name: Verify nm_add_contract_again - assert: + ansible.builtin.assert: that: - nm_add_contract_again is not changed - nm_add_contract_again.current.filterRef.filterName == "Filter1" @@ -241,7 +241,7 @@ - nm_add_contract_again.previous.filterRef.schemaId == nm_add_contract_again.current.filterRef.schemaId - name: Add Contract2 (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present template: Template 2 contract: Contract2 @@ -252,14 +252,14 @@ register: cm_add_contract_2 - name: Verify cm_add_contract_2 - assert: + ansible.builtin.assert: that: - cm_add_contract_2 is changed - cm_add_contract_2.current.filterRef.filterName == "Filter1" - cm_add_contract_2.current.filterRef.templateName == "Template1" - name: Add Contract2 (nomal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present template: Template 2 contract: Contract2 @@ -269,7 +269,7 @@ register: nm_add_contract_2 - name: Verify nm_add_contract_2 - assert: + ansible.builtin.assert: that: - nm_add_contract_2 is changed - nm_add_contract_2.current.filterRef.filterName == "Filter1" @@ -277,7 +277,7 @@ - cm_add_contract_2.current.filterRef.schemaId == nm_add_contract_2.current.filterRef.schemaId - name: Add Contract3 (nomal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -289,14 +289,14 @@ register: nm_add_contract_3 - name: Verify nm_add_contract_3 - assert: + ansible.builtin.assert: that: - nm_add_contract_3 is changed - nm_add_contract_3.current.filterRef.filterName == "Filter1" - nm_add_contract_3.current.filterRef.templateName == "Template1" - name: Add Contract4 (nomal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -305,7 +305,7 @@ register: nm_add_contract_4 - name: Verify nm_add_contract_4 - assert: + ansible.builtin.assert: that: - nm_add_contract_4 is changed - nm_add_contract_4.current.filterRef.filterName == "Filter1" @@ -314,7 +314,7 @@ # create CONTRACT FILTER with diff options - name: Add Contract filter to both-way(check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_filter_type: both-way @@ -325,7 +325,7 @@ register: cm_add_contract_filter_both_way - name: Add Contract filter to both-way(normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_filter_type: both-way @@ -335,7 +335,7 @@ register: nm_add_contract_filter_both_way - name: Verify cm_change_contract_filter_both_way - assert: + ansible.builtin.assert: that: - cm_add_contract_filter_both_way is changed - nm_add_contract_filter_both_way is changed @@ -352,7 +352,7 @@ - cm_add_contract_filter_both_way.current.filterType == "both-way" - name: Change Contract type one_way Filter type consumer-to-provider(normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract5 contract_filter_type: one-way @@ -362,7 +362,7 @@ register: nm_one_way_and_consumer_to_provider - name: Verify nm_one_way_and_consumer_to_provider - assert: + ansible.builtin.assert: that: - nm_one_way_and_consumer_to_provider is changed - nm_one_way_and_consumer_to_provider.previous == {} @@ -372,7 +372,7 @@ - nm_one_way_and_consumer_to_provider.current.filterType == "consumer-to-provider" - name: Change Contract type one_way Filter type provider-to-consumer(normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract-6 contract_filter_type: one-way @@ -382,7 +382,7 @@ register: nm_one_way_and_provider_to_consumer - name: Verify nm create contract filter with different type - assert: + ansible.builtin.assert: that: - nm_one_way_and_provider_to_consumer is changed - nm_one_way_and_provider_to_consumer.current.contractFilterType == "oneWay" @@ -392,7 +392,7 @@ # change contract display name - name: change contract display name - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -401,7 +401,7 @@ register: nm_change_display_name - name: Verify nm_change_display_name - assert: + ansible.builtin.assert: that: - nm_change_display_name is changed - nm_change_display_name.current.displayName == "newDisplayContract4" @@ -409,7 +409,7 @@ # change contract filter_directives to log - name: change contract filter_directives to log(check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -419,7 +419,7 @@ register: cm_change_filter_directives_log - name: change contract filter_directives to log(normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -428,7 +428,7 @@ register: nm_change_filter_directives_log - name: Verify change_contract_filter_directives to log - assert: + ansible.builtin.assert: that: - cm_change_filter_directives_log is changed - nm_change_filter_directives_log is changed @@ -438,7 +438,7 @@ - nm_change_filter_directives_log.current.directives[0] == "log" - name: change contract filter_directives to log and none(normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -447,7 +447,7 @@ register: nm_change_filter_directives_log_and_none - name: Verify nm_change_filter_directives_log_and_none - assert: + ansible.builtin.assert: that: - nm_change_filter_directives_log_and_none is changed - nm_change_filter_directives_log_and_none.previous.directives[0] == "log" @@ -455,7 +455,7 @@ # change contract filter_directives to policy_compression - name: change contract filter_directives to policy_compression (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -465,7 +465,7 @@ register: cm_change_filter_directives_pc - name: change contract filter_directives to policy_compression (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -474,7 +474,7 @@ register: nm_change_filter_directives_pc - name: Verify change_contract_filter_directives to pc - assert: + ansible.builtin.assert: that: - cm_change_filter_directives_pc is changed - nm_change_filter_directives_pc is changed @@ -484,7 +484,7 @@ - nm_change_filter_directives_pc.current.directives[0] == "no_stats" - name: change contract filter_directives to log, none, policy compression (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract4 filter: Filter1 @@ -493,14 +493,14 @@ register: nm_change_filter_directives_log_and_none_pc - name: Verify nm_change_filter_directives_log_and_none_pc - assert: + ansible.builtin.assert: that: - nm_change_filter_directives_log_and_none_pc is changed - nm_change_filter_directives_log_and_none_pc.previous.directives[0] == "no_stats" - nm_change_filter_directives_log_and_none_pc.current.directives == ["log", "none", "no_stats"] - name: Change Contract1 scope to global (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_scope: global @@ -508,14 +508,14 @@ register: nm_change_contract_scope_global - name: Verify nm_change_contract_scope_global - assert: + ansible.builtin.assert: that: - nm_change_contract_scope_global is changed - nm_change_contract_scope_global.current.contractScope == "global" - nm_change_contract_scope_global.previous.contractScope == "context" - name: Change Contract1 scope to tenant(normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_scope: tenant @@ -523,14 +523,14 @@ register: nm_change_contract_scope_tenant - name: Verify nm_change_contract_scope_tenant - assert: + ansible.builtin.assert: that: - nm_change_contract_scope_tenant is changed - nm_change_contract_scope_tenant.previous.contractScope == "global" - nm_change_contract_scope_tenant.current.contractScope == "tenant" - name: Change Contract1 scope application_profile(normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_scope: application-profile @@ -538,14 +538,14 @@ register: nm_change_contract_scope_application_profile - name: Verify nm_change_contract_scope_application_profile - assert: + ansible.builtin.assert: that: - nm_change_contract_scope_application_profile is changed - nm_change_contract_scope_application_profile.previous.contractScope == "tenant" - nm_change_contract_scope_application_profile.current.contractScope == "application-profile" - name: Change Contract1 scope to vrf(normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 contract_scope: vrf @@ -553,28 +553,28 @@ register: nm_change_contract_scope_vrf - name: Verify nm_change_contract_scope_vrf - assert: + ansible.builtin.assert: that: - nm_change_contract_scope_vrf is changed - nm_change_contract_scope_vrf.current.contractScope == "context" - nm_change_contract_scope_vrf.previous.contractScope == "application-profile" - name: Change Contract1 scope to default(normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 state: present register: nm_change_contract_scope_default - name: Verify nm_change_contract_scope_default - assert: + ansible.builtin.assert: that: - nm_change_contract_scope_default is not changed - nm_change_contract_scope_default.current.contractScope == "context" - nm_change_contract_scope_default.previous.contractScope == "context" - name: Change Contract1 description (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 description: changed description @@ -583,7 +583,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_change_contract_description - assert: + ansible.builtin.assert: that: - nm_change_contract_description is changed - nm_change_contract_description.current.description == "changed description" @@ -591,7 +591,7 @@ when: version.current.version is version('3.3', '>=') - name: Change Contract1 description empty (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 description: "" @@ -600,7 +600,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_change_contract_description_empty - assert: + ansible.builtin.assert: that: - nm_change_contract_description_empty is changed - nm_change_contract_description_empty.current.description == "" @@ -608,7 +608,7 @@ when: version.current.version is version('3.3', '>=') - name: Change Contract1 qos_level (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 qos_level: level1 @@ -617,14 +617,14 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_change_contract_qos_level - assert: + ansible.builtin.assert: that: - nm_change_contract_qos is changed - nm_change_contract_qos.current.prio == "level1" when: version.current.version is version('3.3', '>=') - name: Change Contract1 qos_level unspecified (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 qos_level: unspecified @@ -633,7 +633,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_change_contract_qos_level_unspecified - assert: + ansible.builtin.assert: that: - nm_change_contract_qos_unspecified is changed - nm_change_contract_qos_unspecified.current.prio == "unspecified" @@ -641,7 +641,7 @@ when: version.current.version is version('3.3', '>=') - name: Ensure contract filter_type set to both-way (normal mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -651,7 +651,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_contract_filter_both_way - assert: + ansible.builtin.assert: that: - nm_contract_filter_both_way.current.contractFilterType == "bothWay" - nm_contract_filter_both_way.current.filterType == "both-way" @@ -660,7 +660,7 @@ - name: Change contract filter_type set to one-way with consumer-to-provider (normal mode) # Test to check that filter type cannot be changed from two-way to one-way type # changed behaviour due to error handling is now handled in code - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present contract: Contract1 filter: Filter1 @@ -671,14 +671,14 @@ when: version.current.version is version('3.3', '>=') - name: Verify nm_contract_filter_consumer_to_provider - assert: + ansible.builtin.assert: that: - nm_contract_filter_consumer_to_provider.msg == "Current filter type 'bothWay' for contract 'Contract1' is not allowed to change to 'oneWay'." when: version.current.version is version('3.3', '>=') # QUERY ALL CONTRACT - name: Query Contract1 filters (check_mode) - mso_schema_template_contract_filter: &Contract_query + cisco.mso.mso_schema_template_contract_filter: &Contract_query host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -694,19 +694,19 @@ register: cm_contract1_query_result - name: Query Contract1 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query register: nm_contract1_query_result - name: Verify query_contract_1 - assert: + ansible.builtin.assert: that: - cm_contract1_query_result is not changed - nm_contract1_query_result is not changed - cm_contract1_query_result.current | length == nm_contract1_query_result.current | length == 2 - name: Query Contract2 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -715,7 +715,7 @@ register: nm_contract2_query_result - name: Query Contract3 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -723,7 +723,7 @@ register: nm_contract3_query_result - name: Query Contract4 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -731,7 +731,7 @@ register: nm_contract4_query_result - name: Query Contract5 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -741,7 +741,7 @@ register: nm_contract5_query_result - name: Query Contract-6 filters (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -751,7 +751,7 @@ register: nm_contract6_query_result - name: Verify query_contract - assert: + ansible.builtin.assert: that: - nm_contract2_query_result is not changed - nm_contract3_query_result is not changed @@ -764,7 +764,7 @@ # QUERY A SPECIFIC CONTRACT FILTER - name: Query Contract1 Filter1 (check_mode) - mso_schema_template_contract_filter: &Contract_filter_query + cisco.mso.mso_schema_template_contract_filter: &Contract_filter_query host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -781,7 +781,7 @@ register: cm_contract1_filter1_query_result - name: Query Contract1 Filter4 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -791,7 +791,7 @@ register: nm_contract1_filter4_query_result - name: Query Contract2 Filter1 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -802,7 +802,7 @@ register: nm_contract2_filter1_query_result - name: Query Contract3 Filter1 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -814,7 +814,7 @@ register: nm_contract3_filter1_query_result - name: Query Contract4 Filter1 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -824,7 +824,7 @@ register: nm_contract4_filter1_query_result - name: Query Contract5 Filter5 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -836,7 +836,7 @@ register: nm_contract5_filter5_query_result - name: Query Contract-6 Filter-6 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_filter_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -848,7 +848,7 @@ register: nm_contract6_filter6_query_result - name: Verify contract1_filter1_query_result - assert: + ansible.builtin.assert: that: - cm_contract1_filter1_query_result is not changed - nm_contract1_filter4_query_result is not changed @@ -860,7 +860,7 @@ # REMOVE CONTRACT Filter - name: Remove contract1 filter1 (check_mode) - mso_schema_template_contract_filter: &contract1_filter1_absent + cisco.mso.mso_schema_template_contract_filter: &contract1_filter1_absent host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -877,7 +877,7 @@ register: cm_remove_contract1_filter1 - name: Verify cm_remove_contract1_filter1 - assert: + ansible.builtin.assert: that: - cm_remove_contract1_filter1 is changed - cm_remove_contract1_filter1.current == {} @@ -885,12 +885,12 @@ - cm_remove_contract1_filter1.previous.filterRef.templateName == "Template1" - name: Remove contract1 filter1 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract1_filter1_absent register: nm_remove_contract1_filter1 - name: Verify nm_remove_contract1_filter1 - assert: + ansible.builtin.assert: that: - nm_remove_contract1_filter1 is changed - nm_remove_contract1_filter1.current == {} @@ -898,38 +898,38 @@ - nm_remove_contract1_filter1.previous.filterRef.templateName == "Template1" - name: Remove contract1 filter1 again (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract1_filter1_absent check_mode: true register: cm_remove_contract1_filter1_again - name: Verify cm_remove_contract1_filter1_again - assert: + ansible.builtin.assert: that: - cm_remove_contract1_filter1_again is not changed - cm_remove_contract1_filter1_again.current == {} - cm_remove_contract1_filter1_again.previous == {} - name: Remove contract1 filter1 again (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract1_filter1_absent register: nm_remove_contract1_filter1_again - name: Verify nm_remove_contract1_filter1_again - assert: + ansible.builtin.assert: that: - nm_remove_contract1_filter1_again is not changed - nm_remove_contract1_filter1_again.current == {} - nm_remove_contract1_filter1_again.previous == {} - name: Remove contract1 filter4 (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract1_filter1_absent filter: Filter4 register: nm_remove_contract1_filter4 - name: Verify nm_remove_contract1_filter4 - assert: + ansible.builtin.assert: that: - nm_remove_contract1_filter4 is changed - nm_remove_contract1_filter4.current == {} @@ -937,20 +937,20 @@ - nm_remove_contract1_filter4.previous.filterRef.templateName == "Template1" - name: Remove contract1 filter4 again (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract1_filter1_absent filter: Filter4 register: nm_remove_contract1_filter4_again - name: Verify nm_remove_contract1_filter4_again - assert: + ansible.builtin.assert: that: - nm_remove_contract1_filter4_again is not changed - nm_remove_contract1_filter4_again.previous == nm_remove_contract1_filter4_again.current == {} # QUERY NON-EXISTING FILTER - name: Query non-existing filter (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -961,7 +961,7 @@ register: cm_query_non_filter - name: Query non-existing filter (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -971,13 +971,13 @@ register: nm_query_non_filter - name: Verify query_non_filter - assert: + ansible.builtin.assert: that: - cm_query_non_filter is not changed - nm_query_non_filter is not changed - name: Add contract (for version greater than 3.3) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -992,7 +992,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify Add contract for version greater than 3.3 - assert: + ansible.builtin.assert: that: - add_contract is changed - add_contract.current.action == "deny" @@ -1001,7 +1001,7 @@ # # QUERY NON-EXISTING CONTRACT - name: Query non-existing contract (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1011,7 +1011,7 @@ register: cm_query_non_contract - name: Query non-existing contract (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1020,7 +1020,7 @@ register: nm_query_non_contract - name: Verify query_non_contract - assert: + ansible.builtin.assert: that: - cm_query_non_contract is not changed - nm_query_non_contract is not changed @@ -1029,14 +1029,14 @@ when: version.current.version is version('3.3', '<') - name: Verify query_non_contract when version greater than 3.3 - assert: + ansible.builtin.assert: that: - cm_query_non_contract.msg == nm_query_non_contract.msg == "Provided contract 'non-existing-contract' does not exist. Existing contracts{{':'}} Contract4, Contract5, Contract-6, Contract1" when: version.current.version is version('3.3', '>=') # USE A NON-EXISTING SCHEMA - name: Non-existing schema for contrct (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query template: Template 1 schema: non-existing-schema @@ -1045,7 +1045,7 @@ register: cm_query_non_schema - name: Non-existing schema for contrct (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query template: Template 1 schema: non-existing-schema @@ -1054,7 +1054,7 @@ - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_query_non_schema is not changed - nm_query_non_schema is not changed @@ -1063,7 +1063,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for contract (check_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -1072,7 +1072,7 @@ register: cm_query_non_template - name: Non-existing template for contract (normal_mode) - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *Contract_query schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -1080,7 +1080,7 @@ register: nm_query_non_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_query_non_template is not changed - nm_query_non_template is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_service_graph/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_service_graph/tasks/main.yml index 8bc3ce625..6c39668b6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_service_graph/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_contract_service_graph/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,19 +22,19 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Remove schema 2 - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' state: absent - name: Remove schema 1 - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: absent - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -42,7 +42,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -50,13 +50,13 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present template: Template 2 state: present - name: Ensure schema 2 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -89,7 +89,7 @@ state: present - name: Ensure Contract_1 contract exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -98,7 +98,7 @@ state: present - name: Ensure Contract_2 contract exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -131,7 +131,7 @@ state: present - name: Ensure VRF_1 vrf exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -140,7 +140,7 @@ state: present - name: Ensure BD_1 bd exist - mso_schema_template_bd: &bd_present + cisco.mso.mso_schema_template_bd: &bd_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -150,13 +150,13 @@ state: present - name: Ensure BD_2 bd exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *bd_present bd: BD2 state: present - name: Ensure BD_3 bd exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -167,7 +167,7 @@ state: present - name: Ensure AP1 in Template 1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -175,7 +175,7 @@ state: present - name: Ensure AP1 in Template 1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -183,7 +183,7 @@ state: present - name: Ensure EPG1 in AP1 in Template 1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -194,7 +194,7 @@ state: present - name: Ensure EPG2 in AP1 in Template 1 exists - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -205,7 +205,7 @@ state: present - name: Add Contract1 to EPG1 provider - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -217,7 +217,7 @@ state: present - name: Add Contract1 to EPG1 consumer - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -229,7 +229,7 @@ state: present - name: Add Contract2 to EPG2 provider - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -241,7 +241,7 @@ state: present - name: Add Contract2 to EPG2 consumer - mso_schema_template_anp_epg_contract: + cisco.mso.mso_schema_template_anp_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -255,7 +255,7 @@ # TESTS - name: Add service graph 1 to Contract1 (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -271,7 +271,7 @@ register: cm_add_sg1_to_c1 - name: Add service graph 1 to Contract1 - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -286,7 +286,7 @@ register: nm_add_sg1_to_c1 - name: Verify service graph 1 is added to Contract1 - assert: + ansible.builtin.assert: that: - cm_add_sg1_to_c1 is changed - cm_add_sg1_to_c1.previous == {} @@ -312,7 +312,7 @@ - nm_add_sg1_to_c1.current.serviceNodesRelationship.1.serviceNodeRef.serviceNodeName == "load-balancer" - name: Add service graph 1 to Contract1 again (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -328,7 +328,7 @@ register: cm_add_sg1_to_c1_again - name: Add service graph 1 to Contract1 again - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -343,7 +343,7 @@ register: nm_add_sg1_to_c1_again - name: Verify service graph 1 is added to Contract1 again - assert: + ansible.builtin.assert: that: - cm_add_sg1_to_c1_again is not changed - cm_add_sg1_to_c1_again.previous.serviceGraphRef.serviceGraphName == "SG1" @@ -367,7 +367,7 @@ - nm_add_sg1_to_c1_again.previous.serviceNodesRelationship.1.serviceNodeRef.serviceNodeName == "load-balancer" - name: Change service graph 1 node to Contract1 (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -383,7 +383,7 @@ register: cm_change_sg1_to_c1 - name: Change service graph 1 node to Contract1 - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -398,7 +398,7 @@ register: nm_change_sg1_to_c1 - name: Verify service graph 1 is added to Contract1 again - assert: + ansible.builtin.assert: that: - cm_change_sg1_to_c1 is changed - cm_change_sg1_to_c1.current.serviceNodesRelationship.0.consumerConnector.bdRef.bdName == "BD2" @@ -420,7 +420,7 @@ - nm_change_sg1_to_c1.previous.serviceNodesRelationship.0.providerConnector.connectorType == "general" - name: Query service graph 1 to Contract1 (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -430,7 +430,7 @@ register: cm_query_sg1_to_c1 - name: Query service graph 1 to Contract1 - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -440,7 +440,7 @@ register: nm_query_sg1_to_c1 - name: Verify queried service graph 1 - assert: + ansible.builtin.assert: that: - cm_query_sg1_to_c1 is not changed - cm_query_sg1_to_c1.current.serviceNodesRelationship.0.consumerConnector.bdRef.bdName == "BD2" @@ -458,7 +458,7 @@ - nm_query_sg1_to_c1.current.serviceNodesRelationship.0.providerConnector.connectorType == "general" - name: Remove service graph 1 from Contract1 (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -469,7 +469,7 @@ register: cm_remove_sg1_from_c1 - name: Remove service graph 1 from Contract1 - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -479,7 +479,7 @@ register: nm_remove_sg1_from_c1 - name: Verify service graph 1 is removed from Contract1 - assert: + ansible.builtin.assert: that: - cm_remove_sg1_from_c1 is changed - cm_remove_sg1_from_c1.current == {} @@ -505,7 +505,7 @@ - nm_remove_sg1_from_c1.previous.serviceNodesRelationship.1.serviceNodeRef.serviceNodeName == "load-balancer" - name: Add service graph 2 to Contract2 with BD in other schema (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -525,7 +525,7 @@ register: cm_add_sg2_to_c2 - name: Add service graph 2 to Contract2 with BD in other schema - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -544,7 +544,7 @@ register: nm_add_sg2_to_c2 - name: Verify service graph 2 is added to Contract2 - assert: + ansible.builtin.assert: that: - cm_add_sg2_to_c2 is changed - cm_add_sg2_to_c2.previous == {} @@ -570,7 +570,7 @@ - nm_add_sg2_to_c2.current.serviceNodesRelationship.1.serviceNodeRef.serviceNodeName == "load-balancer" - name: Query service graph 2 to Contract2 (check_mode) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -580,7 +580,7 @@ register: cm_query_sg2_to_c2 - name: Query service graph 2 to Contract2 - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -590,7 +590,7 @@ register: nm_query_sg2_to_c2 - name: Verify queried service graph 1 - assert: + ansible.builtin.assert: that: - cm_query_sg2_to_c2 is not changed - cm_query_sg2_to_c2.current.serviceNodesRelationship.0.consumerConnector.bdRef.bdName == "BD1" @@ -612,7 +612,7 @@ # NOT EXISTING INPUT - name: Not existing template provided for absent - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template False @@ -623,7 +623,7 @@ register: not_existing_template_input_absent - name: Not existing contract provided for absent - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -634,7 +634,7 @@ register: not_existing_contract_input_absent - name: Not existing service graph provided for absent - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -644,7 +644,7 @@ register: not_existing_service_graph_input_absent - name: Not existing service graph provided for query - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -654,7 +654,7 @@ register: not_existing_service_graph_input_query - name: Not existing template provided for present - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -671,7 +671,7 @@ register: not_existing_template_input_present - name: Not existing service graph provided for present - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -688,7 +688,7 @@ register: not_existing_service_graph_input_present - name: Verify non_existing_input - assert: + ansible.builtin.assert: that: - not_existing_template_input_absent is not changed - not_existing_template_input_absent.msg.startswith("Provided template") @@ -704,7 +704,7 @@ # False input - name: False service graph node amount provided ( less than 2 as provided in SG1 config ) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -718,7 +718,7 @@ register: nm_false_sg1_to_c1_less_than_2 - name: False service graph node amount provided ( more than 2 as provided in SG1 config ) - mso_schema_template_contract_service_graph: + cisco.mso.mso_schema_template_contract_service_graph: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -736,7 +736,7 @@ register: nm_false_sg1_to_c1_more_than_2 - name: Verify false_sg1_to_c1 - assert: + ansible.builtin.assert: that: - nm_false_sg1_to_c1_less_than_2 is not changed - nm_false_sg1_to_c1_less_than_2.msg.startswith("Not enough service nodes defined") diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy/tasks/main.yml index 58f043256..5e9a46801 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy/tasks/main.yml @@ -4,7 +4,7 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml index fce5cf8e8..34607bec5 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3[0].txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,13 +22,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exist - mso_site: &site_present + cisco.mso.mso_site: &site_present <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -39,7 +39,7 @@ state: present - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -50,7 +50,7 @@ state: present - name: Undeploy templates if deployed to clean the environment before ndo 4.0 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: "{{ item }}" @@ -76,7 +76,7 @@ # when: version.current.version is version('4.0', '>=') - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -85,7 +85,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -95,7 +95,7 @@ state: present - name: Ensure schema 1 with Template 1, Template 2 - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -106,7 +106,7 @@ - Template 2 - name: Add a new site to a schema with Template 1, Template 2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -117,7 +117,7 @@ - Template 2 - name: Ensure VRF1 exists on Template1 - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -125,7 +125,7 @@ state: present - name: Ensure VRF2 exists on Template2 - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -133,7 +133,7 @@ state: present - name: Ensure ANP exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -141,7 +141,7 @@ state: present - name: Ensure ANP2 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -149,7 +149,7 @@ state: present - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -157,7 +157,7 @@ register: status1_temp1 - name: Check deployment status of Template 2 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -165,7 +165,7 @@ register: status1_temp2 - name: Verify status after adding VRFs and ANPs - assert: + ansible.builtin.assert: that: - status1_temp1.current[0].anps[0].state == 'created' - status1_temp1.current[0].vrfs[0].state == 'created' @@ -173,7 +173,7 @@ - status1_temp2.current[0].vrfs[0].state == 'created' - name: Check deployment status by querying site - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -181,7 +181,7 @@ register: status_site - name: Check deployment status by querying site and Template1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -190,7 +190,7 @@ register: status_site_temp1 - name: Check deployment status by querying site and Template2 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -199,7 +199,7 @@ register: status_site_temp2 - name: Verify status after querying site before deployment - assert: + ansible.builtin.assert: that: - status_site.current | length == 2 - status_site_temp1.current.anps[0].state == 'created' @@ -209,7 +209,7 @@ - name: Ensure ansible_test_1 BD exists - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -220,7 +220,7 @@ state: present - name: Ensure ansible_test_2 BD exists - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -231,7 +231,7 @@ state: present - name: Add EPG to Template 1 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -244,7 +244,7 @@ state: present - name: Add EPG to Template 2 - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -257,7 +257,7 @@ state: present - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -265,7 +265,7 @@ register: status2_temp1 - name: Check deployment status of Template 2 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -273,7 +273,7 @@ register: status2_temp2 - name: Verify status after adding BDs and EPGs - assert: + ansible.builtin.assert: that: - status2_temp1.current[0].bds[0].state == 'created' - status2_temp1.current[0].anps[0].epgs[0].state == 'created' @@ -281,7 +281,7 @@ - status2_temp2.current[0].anps[0].epgs[0].state == 'created' - name: Add VRF3 exists to Template1 - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -289,7 +289,7 @@ state: present - name: Add ansible_test_3 BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -300,7 +300,7 @@ state: present - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -308,18 +308,18 @@ register: status3_temp1 - name: Verify status after adding new BD and VRF and changing EPG1 - assert: + ansible.builtin.assert: that: - status3_temp1.current[0].bds[0].state == 'created' - status3_temp1.current[0].vrfs[0].state == 'created' # mso_schema_template_deploy is deprecated in MSO/NDO v4.0+, different api endpoint thus different module -# when new module created, remove block and do execution for each mso_schema_template_deploy tasks +# when new module created, remove block and do execution for each cisco.mso.mso_schema_template_deploy tasks - name: Execute tasks only for MSO version < 4.0 when: version.current.version is version('4.0', '<') block: - name: Deploy templates - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: "{{ item }}" @@ -331,7 +331,7 @@ - Template 2 - name: Change EPG - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -344,7 +344,7 @@ state: present - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -352,12 +352,12 @@ register: status_change_temp1 - name: Verify status after changing EPG - assert: + ansible.builtin.assert: that: - status_change_temp1.current[0].anps[0].epgs[0].state == 'modified' - name: Delete ansible_test_1 BD - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -368,7 +368,7 @@ state: absent - name: Delete VRF1 - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -376,7 +376,7 @@ state: absent - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -384,7 +384,7 @@ register: status4_temp1 - name: Verify status after deleting VRF1 - assert: + ansible.builtin.assert: that: - status4_temp1.current[0].bds[0].state == 'deleted' - status4_temp1.current[0].vrfs[0].state == 'deleted' @@ -392,7 +392,7 @@ - name: Try deploy and check results block: - name: Deploy templates Template 1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -400,7 +400,7 @@ state: deploy - name: Check deployment status of Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -408,31 +408,31 @@ register: status5_temp1 - name: Increment the retry count - set_fact: + ansible.builtin.set_fact: retry_count: "{{ 0 if retry_count is undefined else retry_count | int + 1 }}" rescue: - - fail: + - ansible.builtin.fail: msg: Status5_temp1 correct value retrieved continuing when: - status5_temp1.current[0] is defined - status5_temp1.current[0].anps == [] - - fail: + - ansible.builtin.fail: msg: Maximum retries of deploy and check group for status5_temp1 reached when: retry_count | int == 10 - - debug: + - ansible.builtin.debug: msg: "Deploy and check group for status5_temp1 failed, let's give it another shot" - name: Reset the retry count - set_fact: + ansible.builtin.set_fact: retry_count: - name: Try deploy and check results block: - name: Deploy templates Template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -440,7 +440,7 @@ state: deploy - name: Check deployment status of Template 2 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -448,25 +448,25 @@ register: status5_temp2 - name: Increment the retry count - set_fact: + ansible.builtin.set_fact: retry_count: "{{ 0 if retry_count is undefined else retry_count | int + 1 }}" rescue: - - fail: + - ansible.builtin.fail: msg: status5_temp2 correct value retrieved continuing when: - status5_temp2.current[0] is defined - status5_temp2.current[0].anps == [] - - fail: + - ansible.builtin.fail: msg: Maximum retries of deploy and check group for status5_temp2 reached when: retry_count | int == 10 - - debug: + - ansible.builtin.debug: msg: "Deploy and check group for status5_temp2 failed, let's give it another shot" - name: Verify status after deploying Templates to site - assert: + ansible.builtin.assert: that: - status5_temp1.current[0].anps == [] - status5_temp1.current[0].bds == [] @@ -476,19 +476,19 @@ - status5_temp2.current[0].vrfs == [] - name: Check status of all templates - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query register: all_templates - name: Verify all - assert: + ansible.builtin.assert: that: - all_templates.current.policyStates | length == 2 - name: Check deployment status by querying site - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -496,13 +496,13 @@ register: status2_site - name: Reset the retry count - set_fact: + ansible.builtin.set_fact: retry_count: - name: Try deploy and check results for a site and Template1 block: - name: Deploy templates Template1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -510,7 +510,7 @@ state: deploy - name: Check deployment status by querying site and Template1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -519,27 +519,27 @@ register: status2_site_temp1 - name: Increment the retry count - set_fact: + ansible.builtin.set_fact: retry_count: "{{ 0 if retry_count is undefined else retry_count | int + 1 }}" rescue: - - fail: + - ansible.builtin.fail: msg: status2_site_temp1 correct value retrieved continuing when: - status2_site_temp1.current is defined - status2_site_temp1.current.anps == [] - - fail: + - ansible.builtin.fail: msg: Maximum retries of deploy and check group for status2_site_temp1 reached when: retry_count | int == 10 - - debug: + - ansible.builtin.debug: msg: "Deploy and check group for status2_site_temp1 failed, let's give it another shot" - name: Try deploy and check results for a site and Template2 block: - name: Deploy templates Template2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -547,7 +547,7 @@ state: deploy - name: Check deployment status by querying site and Template2 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template2 @@ -556,25 +556,25 @@ register: status2_site_temp2 - name: Increment the retry count - set_fact: + ansible.builtin.set_fact: retry_count: "{{ 0 if retry_count is undefined else retry_count | int + 1 }}" rescue: - - fail: + - ansible.builtin.fail: msg: status2_site_temp2 correct value retrieved continuing when: - status2_site_temp2.current is defined - status2_site_temp2.current.anps == [] - - fail: + - ansible.builtin.fail: msg: Maximum retries of deploy and check group for status2_site_temp2 reached when: retry_count | int == 10 - - debug: + - ansible.builtin.debug: msg: "Deploy and check group for status2_site_temp2 failed, let's give it another shot" - name: Verify status after querying site post deployment - assert: + ansible.builtin.assert: that: - status2_site.current | length == 2 - status2_site_temp1.current.anps == [] @@ -585,7 +585,7 @@ - status2_site_temp2.current.vrfs == [] - name: Check deployment status by querying site and non associated Template 1 - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -595,12 +595,12 @@ register: status_site_temp3 - name: Verify status after querying site with non associated Template 1 - assert: + ansible.builtin.assert: that: - status_site_temp3.msg == "Provided Template 'Template1' not associated with Site 'aws_ansible_test'." - name: Check Non-existing schema - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: non-existing-schema state: query @@ -608,12 +608,12 @@ register: non_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - non_schema.msg == "Schema 'non-existing-schema' not found." - name: Check deployment status of non-existing-template - mso_schema_template_deploy_status: + cisco.mso.mso_schema_template_deploy_status: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -622,6 +622,6 @@ register: non_temp - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - non_temp.msg == "Template 'non-existing-template' not found."
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml index e76869456..e2f094754 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml @@ -7,14 +7,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -25,7 +25,7 @@ output_level: '{{ mso_output_level | default("info") }}' # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -42,13 +42,13 @@ # state: present - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Undeploy templates if deployed from previous test case - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: "{{ item }}" @@ -60,7 +60,7 @@ - Template 2 - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -69,7 +69,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -79,7 +79,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -87,7 +87,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -95,7 +95,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -103,7 +103,7 @@ state: present - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -112,7 +112,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -123,7 +123,7 @@ state: present - name: Ensure Filter 2 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -132,7 +132,7 @@ state: present - name: Ensure Contract2 exist - mso_schema_template_contract_filter: &contract2_present + cisco.mso.mso_schema_template_contract_filter: &contract2_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -143,7 +143,7 @@ state: present - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -152,7 +152,7 @@ state: present - name: Ensure VRF2 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -160,7 +160,7 @@ state: present - name: Ensure VRF3 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -168,7 +168,7 @@ state: present - name: Ensure VRF4 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -176,7 +176,7 @@ state: present - name: Ensure L3out exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -186,7 +186,7 @@ state: present - name: Ensure L3out2 exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -196,7 +196,7 @@ state: present - name: Ensure L3out3 exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -208,7 +208,7 @@ state: present - name: Ensure L3out4 exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -220,7 +220,7 @@ state: present - name: Ensure ANP exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -228,7 +228,7 @@ state: present - name: Ensure ANP2 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -236,7 +236,7 @@ state: present - name: Ensure ANP3 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -244,7 +244,7 @@ state: present - name: Ensure ANP4 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -252,7 +252,7 @@ state: present - name: Ensure ansible_test_1 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -260,7 +260,7 @@ state: absent - name: Ensure ansible_test_2 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -268,7 +268,7 @@ state: absent - name: Ensure ansible_test_3 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -276,7 +276,7 @@ state: absent - name: Ensure ansible_test_4 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -284,7 +284,7 @@ state: absent - name: Ensure ansible_test_6 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -292,7 +292,7 @@ state: absent - name: Ensure ansible_test_7 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -301,7 +301,7 @@ # ADD external EPG - name: Add external EPG (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -313,7 +313,7 @@ register: cm_add_epg - name: Verify cm_add_epg - assert: + ansible.builtin.assert: that: - cm_add_epg is changed - cm_add_epg.previous == {} @@ -322,7 +322,7 @@ - cm_add_epg.current.vrfRef.vrfName == "VRF" - name: Add external EPG (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -333,7 +333,7 @@ register: nm_add_epg - name: Verify nm_add_epg - assert: + ansible.builtin.assert: that: - nm_add_epg is changed - nm_add_epg.previous == {} @@ -343,7 +343,7 @@ - cm_add_epg.current.vrfRef.schemaId == nm_add_epg.current.vrfRef.schemaId - name: Add external EPG again (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -357,7 +357,7 @@ register: cm_add_epg_again - name: Verify cm_add_epg_again - assert: + ansible.builtin.assert: that: - cm_add_epg_again is not changed - cm_add_epg_again.previous.name == "ansible_test_1" @@ -370,7 +370,7 @@ - name: Add epg again (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -383,7 +383,7 @@ register: nm_add_epg_again - name: Verify nm_add_epg_again - assert: + ansible.builtin.assert: that: - nm_add_epg_again is not changed - nm_add_epg_again.previous.name == "ansible_test_1" @@ -395,7 +395,7 @@ - nm_add_epg_again.previous.vrfRef.schemaId == nm_add_epg_again.current.vrfRef.schemaId - name: Add external EPG 2(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -412,7 +412,7 @@ register: nm_add_epg_2 - name: Add external EPG 3 (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -429,7 +429,7 @@ register: nm_add_epg_3 - name: Add external EPG 4 (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -440,7 +440,7 @@ register: nm_add_epg_4 - name: Verify nm_add_epg_2 and nm_add_epg_3 - assert: + ansible.builtin.assert: that: - nm_add_epg_2 is changed - nm_add_epg_3 is changed @@ -454,7 +454,7 @@ - nm_add_epg_3.current.vrfRef.schemaId != nm_add_epg.current.vrfRef.schemaId - name: Add external EPG 5 (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -471,13 +471,13 @@ register: nm_add_epg_5 - name: Verify nm_add_epg_5 - assert: + ansible.builtin.assert: that: - nm_add_epg_5 is changed - nm_add_epg_5.current.name == "ansible_test_5" - name: Add external EPG 5 again with L3Out (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -498,13 +498,13 @@ register: nm_add_epg_5_again - name: Verify nm_add_epg_5_again - assert: + ansible.builtin.assert: that: - nm_add_epg_5_again is changed - nm_add_epg_5_again.current.name == "ansible_test_5" - name: Add external EPG 6 with external epg type cloud (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -522,7 +522,7 @@ register: nm_add_epg_6 - name: Verify nm_add_epg_6 - assert: + ansible.builtin.assert: that: - nm_add_epg_6 is changed - nm_add_epg_6.current.name == "ansible_test_6" @@ -531,7 +531,7 @@ - nm_add_epg_6.current.anpRef.anpName == "ANP1" - name: Add external EPG 6 with external epg type cloud again(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -549,13 +549,13 @@ register: nm_add_epg_6_again - name: Verify nm_add_epg_6_again - assert: + ansible.builtin.assert: that: - nm_add_epg_6_again is not changed - nm_add_epg_6_again.current.name == "ansible_test_6" - name: Add external EPG 6 with external epg type cloud with modification(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -573,7 +573,7 @@ register: nm_add_epg_6_again_2 - name: Verify nm_add_epg_6_again - assert: + ansible.builtin.assert: that: - nm_add_epg_6_again_2 is changed - nm_add_epg_6_again_2.current.name == "ansible_test_6" @@ -581,7 +581,7 @@ - nm_add_epg_6_again_2.current.anpRef.anpName == "ANP1" - name: Add external EPG 7 with external epg type on-premise explicitly mentioned again(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -599,7 +599,7 @@ register: nm_add_epg_7 - name: Verify nm_add_epg_7 - assert: + ansible.builtin.assert: that: - nm_add_epg_7 is changed - nm_add_epg_7.current.name == "ansible_test_7" @@ -607,7 +607,7 @@ - nm_add_epg_7.current.vrfRef.vrfName == "VRF" - name: Add external EPG 7 with external epg type not mentioned again(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -624,14 +624,14 @@ register: nm_add_epg_7_again - name: Verify nm_add_epg_7_again - assert: + ansible.builtin.assert: that: - nm_add_epg_7_again is not changed - nm_add_epg_7_again.current.name == "ansible_test_7" # CHANGE external EPG - name: Change epg from different template (check_mode) - mso_schema_template_external_epg: &change_epg_template + cisco.mso.mso_schema_template_external_epg: &change_epg_template <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -645,7 +645,7 @@ register: cm_change_epg - name: Verify cm_change_epg from different template to own template - assert: + ansible.builtin.assert: that: - cm_change_epg is changed - cm_change_epg.current.name == 'ansible_test_2' @@ -654,13 +654,13 @@ - cm_change_epg.current.vrfRef.schemaId == cm_change_epg.previous.vrfRef.schemaId - name: Change epg from different template to own template (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *change_epg_template state: present register: nm_change_epg - name: Verify nm_change_epg from different template to own template - assert: + ansible.builtin.assert: that: - nm_change_epg is changed - nm_change_epg.current.name == 'ansible_test_2' @@ -669,13 +669,13 @@ - nm_change_epg.current.vrfRef.schemaId == nm_change_epg.previous.vrfRef.schemaId - name: Change epg again from different template (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *change_epg_template check_mode: true register: cm_change_epg_again - name: Verify cm_change_epg_again - assert: + ansible.builtin.assert: that: - cm_change_epg_again is not changed - cm_change_epg_again.current.name == 'ansible_test_2' @@ -684,13 +684,13 @@ - cm_change_epg_again.current.vrfRef.schemaId == cm_change_epg_again.previous.vrfRef.schemaId - name: Change epg again from different template (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *change_epg_template state: present register: nm_change_epg_again - name: Verify nm_change_epg_again from different template to own template - assert: + ansible.builtin.assert: that: - nm_change_epg_again is not changed - nm_change_epg_again.current.name == 'ansible_test_2' @@ -699,7 +699,7 @@ - nm_change_epg_again.current.vrfRef.schemaId == nm_change_epg_again.previous.vrfRef.schemaId - name: Change VRF from different schema (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -712,7 +712,7 @@ register: nm_change_epg_vrf4 - name: Verify nm_change_epg_vrf4 and nm_change_epg_vrf2 - assert: + ansible.builtin.assert: that: - nm_change_epg_vrf4 is changed - nm_change_epg_vrf4.current.name == 'ansible_test_3' @@ -721,7 +721,7 @@ - nm_change_epg_vrf4.current.vrfRef.schemaId != nm_change_epg_vrf4.previous.vrfRef.schemaId - name: Change epg 1 l3out(normal mode) - mso_schema_template_external_epg: &change_l3out + cisco.mso.mso_schema_template_external_epg: &change_l3out <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -738,7 +738,7 @@ register: nm_change_epg_1_l3out - name: Change epg 1 settings(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *change_l3out vrf: name: VRF @@ -748,7 +748,7 @@ register: nm_change_epg_1_settings - name: Verify nm_change_epg_1_settings and nm_change_epg_1_l3out - assert: + ansible.builtin.assert: that: - nm_change_epg_1_settings is changed - nm_change_epg_1_settings.previous.vrfRef.vrfName == 'VRF2' @@ -767,7 +767,7 @@ - nm_change_epg_1_l3out.current.l3outRef.templateName == 'Template1' - name: Change epg 4 preferredGroup(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -779,7 +779,7 @@ register: nm_change_epg_4_preferred_group - name: Change epg 4 preferredGroup again(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -791,7 +791,7 @@ register: nm_change_epg_4_preferred_group_again - name: Verify nm_change_epg_4_preferred_group and nm_change_epg_4_preferred_group_again - assert: + ansible.builtin.assert: that: - nm_change_epg_4_preferred_group is changed - nm_change_epg_4_preferred_group_again is changed @@ -800,7 +800,7 @@ # QUERY ALL EPG - name: Query all EPG (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -809,7 +809,7 @@ register: cm_query_all_epgs - name: Query all EPG (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -817,7 +817,7 @@ register: nm_query_all_epgs - name: Verify query_all_epgs - assert: + ansible.builtin.assert: that: - cm_query_all_epgs is not changed - nm_query_all_epgs is not changed @@ -825,7 +825,7 @@ # QUERY AN EPG - name: Query epg 1(check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -835,7 +835,7 @@ register: cm_query_epg_1 - name: Query epg 1(normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -844,7 +844,7 @@ register: nm_query_epg_1 - name: Verify cm_query_epg_1 and nm_query_epg_1 - assert: + ansible.builtin.assert: that: - cm_query_epg_1 is not changed - nm_query_epg_1 is not changed @@ -857,7 +857,7 @@ - nm_query_epg_1.current.l3outRef.schemaId == nm_query_epg_1.current.vrfRef.schemaId - name: Query epg 5(normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -866,12 +866,12 @@ register: nm_query_epg_5 - name: Verify nm_query_epg_5 - assert: + ansible.builtin.assert: that: - nm_query_epg_5.current.l3outRef.l3outName == 'L3out' - name: Query epg 6(normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -880,13 +880,13 @@ register: nm_query_epg_6 - name: Verify nm_query_epg_5 - assert: + ansible.builtin.assert: that: - nm_add_epg_6.current.anpRef.anpName == "ANP1" # REMOVE EPG - name: Remove EPG 4 (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -896,13 +896,13 @@ register: cm_remove_epg_4 - name: Verify cm_remove_epg_4 - assert: + ansible.builtin.assert: that: - cm_remove_epg_4 is changed - cm_remove_epg_4.current == {} - name: Remove EPG 4 (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -911,13 +911,13 @@ register: nm_remove_epg_4 - name: Verify nm_remove_epg_4 - assert: + ansible.builtin.assert: that: - nm_remove_epg_4 is changed - nm_remove_epg_4.current == {} - name: Remove EPG 4 again (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -926,13 +926,13 @@ register: nm_remove_epg_4_again - name: Verify nm_remove_epg_4_again - assert: + ansible.builtin.assert: that: - nm_remove_epg_4_again is not changed - nm_remove_epg_4_again.previous == nm_remove_epg_4_again.current == {} - name: Add external EPG 4 description for version greater than 3.3 - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -945,7 +945,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify add_epg_4 for version greater than 3.3 - assert: + ansible.builtin.assert: that: - add_epg_4 is changed - add_epg_4.current.name == "ansible_test_4" @@ -958,7 +958,7 @@ # QUERY NON-EXISTING EPG - name: Query non-existing EPG (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -969,7 +969,7 @@ register: cm_query_non_existing_epg - name: Query non-existing EPG (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -979,7 +979,7 @@ register: nm_query_non_existing_epg - name: Verify cm_query_non_existing_epg and nm_query_non_existing_epg - assert: + ansible.builtin.assert: that: - cm_query_non_existing_epg is not changed - nm_query_non_existing_epg is not changed @@ -988,7 +988,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for epg (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -998,7 +998,7 @@ register: cm_non_existing_schema - name: Non-existing schema for epg (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -1007,7 +1007,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -1016,7 +1016,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for epg (check_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -1026,7 +1026,7 @@ register: cm_non_existing_template - name: Non-existing template for epg (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -1035,7 +1035,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -1044,7 +1044,7 @@ # Checking if contract are removed after re-applying an EPG. (#13 | #62137) - name: Remove EPG 2/5/6/7 to avoid circle errors (normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -1057,7 +1057,7 @@ - ansible_test_7 - name: Add Contracts to EPG 1 - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1074,7 +1074,7 @@ - { name: Contract2, template: Template 2, type: provider } - name: Query contract EPG 1(normal mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1083,12 +1083,12 @@ register: nm_query_epg1_contract - name: Verify nm_query_epg1_contract - assert: + ansible.builtin.assert: that: - nm_query_epg1_contract.current.contractRelationships | length == 4 - name: Add EPG 1 again (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1103,12 +1103,12 @@ register: nm_add_epg_1_again - name: Verify that EPG 1 didn't change - assert: + ansible.builtin.assert: that: - nm_add_epg_1_again is not changed - name: Query contract EPG 1 again - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1117,13 +1117,13 @@ register: nm_query_epg1_contract_again - name: Verify that 4 contracts are in EPG 1 using nm_query_epg1_contract_again - assert: + ansible.builtin.assert: that: - nm_query_epg1_contract_again.current.contractRelationships | length == 4 # Checking if modifying an external EPG with existing contracts throw an MSO error. (#82) - name: Change external EPG 1 VRF (normal_mode) - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1136,7 +1136,7 @@ register: nm_change_ext_epg_1_vrf - name: Verify that external EPG 1 did change - assert: + ansible.builtin.assert: that: - nm_change_ext_epg_1_vrf is changed - nm_change_ext_epg_1_vrf.current.vrfRef.templateName == "Template1" @@ -1144,7 +1144,7 @@ - nm_change_ext_epg_1_vrf.current.l3outRef.l3outName == "L3out2" - name: Query EPG 1 - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -1153,6 +1153,6 @@ register: nm_query_contract_ext_epg_1 - name: Verify that 4 contracts are in external EPG 1 using nm_query_contract_ext_epg_1 - assert: + ansible.builtin.assert: that: - nm_query_contract_ext_epg_1.current.contractRelationships | length == 4
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_contract/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_contract/tasks/main.yml index 44eb30623..2a410dcb1 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_contract/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_contract/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -30,7 +30,7 @@ # state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -45,7 +45,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -61,7 +61,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -75,7 +75,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -83,7 +83,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -91,7 +91,7 @@ state: present - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -105,7 +105,7 @@ state: present - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -120,7 +120,7 @@ state: present - name: Ensure Filter 2 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -135,7 +135,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: &contract_present + cisco.mso.mso_schema_template_contract_filter: &contract_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -152,7 +152,7 @@ state: present - name: Ensure Contract2 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *contract_present template: Template 2 contract: Contract2 @@ -162,7 +162,7 @@ state: present - name: Ensure external EPGs exist - mso_schema_template_externalepg: + cisco.mso.mso_schema_template_externalepg: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -184,7 +184,7 @@ # ADD Contract to External EPG - name: Add Contract1 to External EPG (check_mode) - mso_schema_template_external_epg_contract: &contract_ext_epg_present + cisco.mso.mso_schema_template_external_epg_contract: &contract_ext_epg_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -203,7 +203,7 @@ register: cm_add_contract_rel - name: Verify cm_add_contract_rel - assert: + ansible.builtin.assert: that: - cm_add_contract_rel is changed - cm_add_contract_rel.previous == {} @@ -212,12 +212,12 @@ - cm_add_contract_rel.current.relationshipType == "consumer" - name: Add Contract to External EPG (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present register: nm_add_contract_rel - name: Verify nm_add_contract_rel - assert: + ansible.builtin.assert: that: - nm_add_contract_rel is changed - nm_add_contract_rel.previous == {} @@ -227,13 +227,13 @@ - cm_add_contract_rel.current.contractRef.schemaId == nm_add_contract_rel.current.contractRef.schemaId - name: Add Contract to External EPG again (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present check_mode: true register: cm_add_contract_rel_again - name: Verify cm_add_contract_rel_again - assert: + ansible.builtin.assert: that: - cm_add_contract_rel_again is not changed - cm_add_contract_rel_again.previous.contractRef.templateName == "Template1" @@ -246,12 +246,12 @@ - name: Add Contract to External EPG again (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present register: nm_add_contract_rel_again - name: Verify nm_add_contract_rel_again - assert: + ansible.builtin.assert: that: - nm_add_contract_rel_again is not changed - nm_add_contract_rel_again.previous.contractRef.templateName == "Template1" @@ -263,7 +263,7 @@ - nm_add_contract_rel_again.previous.contractRef.schemaId == nm_add_contract_rel_again.current.contractRef.schemaId - name: Add Contract1 to External EPG - provider (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present contract: name: Contract1 @@ -271,7 +271,7 @@ register: nm_add_contract1_rel_provider - name: Add Contract2 to External EPG - consumer (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present contract: name: Contract2 @@ -280,7 +280,7 @@ register: nm_add_contract2_rel_consumer - name: Add Contract1 to External EPG 3 - provider (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: 'Template 3' @@ -293,7 +293,7 @@ register: nm_add_contract3_rel_provider - name: Verify nm_add_contract1_rel_provider, nm_add_contract2_rel_consumer and nm_add_contract3_rel_provider - assert: + ansible.builtin.assert: that: - nm_add_contract1_rel_provider is changed - nm_add_contract2_rel_consumer is changed @@ -310,7 +310,7 @@ # # QUERY ALL Contract to External EPG - name: Query all contract relationship for External EPG (check_mode) - mso_schema_template_external_epg_contract: &contract_ext_epg_query + cisco.mso.mso_schema_template_external_epg_contract: &contract_ext_epg_query host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -326,12 +326,12 @@ register: cm_query_all_contract_rels - name: Query all contract relationship for External EPG (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query register: nm_query_all_contract_rels - name: Verify query_all_contract_rels - assert: + ansible.builtin.assert: that: - cm_query_all_contract_rels is not changed - nm_query_all_contract_rels is not changed @@ -340,7 +340,7 @@ # QUERY A Contract to External EPG - name: Query Contract1 relationship for External EPG - consumer (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -349,7 +349,7 @@ register: cm_query_contract1_consumer_rel - name: Query Contract1 relationship for External EPG - consumer (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -357,7 +357,7 @@ register: nm_query_contract1_consumer_rel - name: Query Contract1 relationship for External EPG - provider (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -365,7 +365,7 @@ register: nm_query_contract1_provider_rel - name: Query Contract1 relationship for External EPG - consumer (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract2 @@ -374,7 +374,7 @@ register: nm_query_contract2_consumer_rel - name: Query Contract1 relationship for External EPG - provider (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -387,7 +387,7 @@ register: nm_query_contract3_provider_rel - name: Verify query_contractX_YYYYY_rel - assert: + ansible.builtin.assert: that: - cm_query_contract1_consumer_rel is not changed - nm_query_contract1_consumer_rel is not changed @@ -408,51 +408,51 @@ # REMOVE Contract to External EPG - name: Remove Contract to External EPG (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present state: absent check_mode: true register: cm_remove_contract_rel - name: Verify cm_remove_contract_rel - assert: + ansible.builtin.assert: that: - cm_remove_contract_rel is changed - cm_remove_contract_rel.current == {} - name: Remove Contract to External EPG (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present state: absent register: nm_remove_contract_rel - name: Verify nm_remove_contract_rel - assert: + ansible.builtin.assert: that: - nm_remove_contract_rel is changed - nm_remove_contract_rel.current == {} - name: Remove Contract to External EPG again (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present state: absent check_mode: true register: cm_remove_contract_rel_again - name: Verify cm_remove_contract_rel_again - assert: + ansible.builtin.assert: that: - cm_remove_contract_rel_again is not changed - cm_remove_contract_rel_again.current == {} - name: Remove Contract to External EPG again (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_present state: absent register: nm_remove_contract_rel_again - name: Verify nm_remove_contract_rel_again - assert: + ansible.builtin.assert: that: - nm_remove_contract_rel_again is not changed - nm_remove_contract_rel_again.current == {} @@ -460,7 +460,7 @@ # QUERY NON-EXISTING Contract to External EPG - name: Query non-existing contract (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: non_existing_contract @@ -470,7 +470,7 @@ register: cm_query_non_contract - name: Query non-existing contract (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: non_existing_contract @@ -479,7 +479,7 @@ register: nm_query_non_contract - name: Verify query_non_contract - assert: + ansible.builtin.assert: that: - cm_query_non_contract is not changed - nm_query_non_contract is not changed @@ -489,7 +489,7 @@ # QUERY NON-EXISTING ExtEPG - name: Query non-existing ExtEPG (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query external_epg: non_existing_ext_epg check_mode: true @@ -497,14 +497,14 @@ register: cm_query_non_ext_epg - name: Query non-existing ExtEPG (normal mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query external_epg: non_existing_ext_epg ignore_errors: true register: nm_query_non_ext_epg - name: Verify query_non_ext_epg - assert: + ansible.builtin.assert: that: - cm_query_non_ext_epg is not changed - nm_query_non_ext_epg is not changed @@ -513,7 +513,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for contract relationship (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query state: non-existing-state check_mode: true @@ -521,14 +521,14 @@ register: cm_non_existing_state - name: Non-existing state for contract relationship (normal_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -537,7 +537,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for contract relationship (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query schema: non-existing-schema check_mode: true @@ -545,14 +545,14 @@ register: cm_non_existing_schema - name: Non-existing schema for contract relationship (normal_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query schema: non-existing-schema ignore_errors: true register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -560,7 +560,7 @@ - cm_non_existing_schema.msg == nm_non_existing_schema.msg == "Provided schema 'non-existing-schema' does not exist." - name: Non-existing contract schema for contract relationship (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -572,7 +572,7 @@ register: cm_non_existing_contract_schema - name: Non-existing contract schema for contract relationship (normal_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -583,7 +583,7 @@ register: nm_non_existing_contract_schema - name: Verify non_existing_contract_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_contract_schema is not changed - nm_non_existing_contract_schema is not changed @@ -592,7 +592,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for contract relationship (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query template: non-existing-template check_mode: true @@ -600,14 +600,14 @@ register: cm_non_existing_template - name: Non-existing template for contract relationship (normal_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query template: non-existing-template ignore_errors: true register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -615,7 +615,7 @@ - cm_non_existing_template.msg == nm_non_existing_template.msg == "Provided template 'non-existing-template' does not exist. Existing templates{{':'}} Template1, Template2" - name: Non-existing contract template for contract relationship (check_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -626,7 +626,7 @@ register: cm_non_existing_contract_template - name: Non-existing contract template for contract relationship (normal_mode) - mso_schema_template_external_epg_contract: + cisco.mso.mso_schema_template_external_epg_contract: <<: *contract_ext_epg_query contract: name: Contract1 @@ -636,7 +636,7 @@ register: nm_non_existing_contract_template - name: Verify non_existing_contract_template - assert: + ansible.builtin.assert: that: - cm_non_existing_contract_template is not changed - nm_non_existing_contract_template is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_selector/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_selector/tasks/main.yml index 5911f7667..b663cd703 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_selector/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_selector/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,7 +24,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -33,7 +33,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -43,7 +43,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -51,7 +51,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -59,7 +59,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -67,7 +67,7 @@ state: present - name: Ensure VRF exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -75,7 +75,7 @@ state: present - name: Ensure VRF2 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -83,7 +83,7 @@ state: present - name: Ensure ANP1 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -91,7 +91,7 @@ state: present - name: Ensure ANP2 exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -99,7 +99,7 @@ state: present - name: Ensure L3out exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -109,7 +109,7 @@ state: present - name: Ensure L3out2 exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -120,7 +120,7 @@ # ADD External EPGs - name: Ensure External EPG1 exists - mso_schema_template_externalepg: + cisco.mso.mso_schema_template_externalepg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -140,7 +140,7 @@ state: present - name: Ensure External EPG2 exists - mso_schema_template_externalepg: + cisco.mso.mso_schema_template_externalepg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -161,7 +161,7 @@ # ADD Selector to EPG - name: Add Selector to extEPG1 (check_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -172,7 +172,7 @@ register: cm_add_selector_1 - name: Verify cm_add_selector_1 - assert: + ansible.builtin.assert: that: - cm_add_selector_1 is changed - cm_add_selector_1.previous == {} @@ -180,7 +180,7 @@ - cm_add_selector_1.current.expressions == [] - name: Add Selector 1 to extEPG1 (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -191,7 +191,7 @@ register: nm_add_selector_1 - name: Verify nm_add_selector_1 - assert: + ansible.builtin.assert: that: - nm_add_selector_1 is changed - nm_add_selector_1.previous == {} @@ -199,7 +199,7 @@ - nm_add_selector_1.current.expressions == [] - name: Add Selector 1 to extEPG1 again(normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -210,12 +210,12 @@ register: nm_add_selector_1_again - name: Verify nm_add_selector_1_again - assert: + ansible.builtin.assert: that: - nm_add_selector_1_again is not changed - name: Add Selector to extEPG1 again (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -225,12 +225,12 @@ register: nm_add_selector_1_again - name: Verify nm_add_selector_1_again - assert: + ansible.builtin.assert: that: - nm_add_selector_1_again is not changed - name: Add Selector 2 to extEPG1 (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -244,7 +244,7 @@ register: nm_add_selector_2 - name: Verify nm_add_selector_2 - assert: + ansible.builtin.assert: that: - nm_add_selector_2 is changed - nm_add_selector_2.previous == {} @@ -254,7 +254,7 @@ - nm_add_selector_2.current.expressions[0].value == "10.0.0.0" - name: Add Selector 3 to extEPG1 (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -268,7 +268,7 @@ register: nm_add_selector_3 - name: Verify nm_add_selector_3 - assert: + ansible.builtin.assert: that: - nm_add_selector_3 is changed - nm_add_selector_3.previous == {} @@ -276,7 +276,7 @@ - nm_add_selector_3.current.expressions[0].value == "10.1.1.1" - name: Remove slector_1 - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -286,13 +286,13 @@ register: nm_remove_selector_1 - name: Verify nm_remove_selector_1 - assert: + ansible.builtin.assert: that: - nm_remove_selector_1 is changed # QUERY selectors - name: Query all selectors of extEPG1 - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -301,12 +301,12 @@ register: nm_query_all - name: Verify nm_query_all - assert: + ansible.builtin.assert: that: - nm_query_all is not changed - name: Query a selector of extEPG1 - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -316,13 +316,13 @@ register: nm_query_selector_2 - name: Verify nm_query_selector_2 - assert: + ansible.builtin.assert: that: - nm_query_selector_2 is not changed - nm_query_selector_2.current.expressions[0].value == "10.0.0.0" - name: Query a removed selector_1 of extEPG1 - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -333,13 +333,13 @@ register: nm_query_removed - name: Verify nm_query_removed - assert: + ansible.builtin.assert: that: - nm_query_removed.msg == "Selector 'selector_1' not found" # QUERY NON-EXISTING External EPG - name: Query non-existing EPG (normal mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -350,14 +350,14 @@ register: nm_query_non_epg - name: Verify query_non_epg - assert: + ansible.builtin.assert: that: - nm_query_non_epg is not changed - nm_query_non_epg.msg == "Provided external epg 'non_extEPG1' does not exist. Existing epgs{{':'}} extEPG1, extEPG2" # USE A NON-EXISTING STATE - name: Non-existing state (check_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -369,7 +369,7 @@ register: cm_non_existing_state - name: Non-existing state (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -380,7 +380,7 @@ register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -389,7 +389,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template (check_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -401,7 +401,7 @@ register: cm_non_existing_template - name: Non-existing template (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -412,7 +412,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -421,7 +421,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema (check_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -433,7 +433,7 @@ register: cm_non_existing_schema - name: Non-existing schema (normal_mode) - mso_schema_template_external_epg_selector: + cisco.mso.mso_schema_template_external_epg_selector: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -444,7 +444,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml index 06b5e65b7..56cd80be1 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml @@ -5,14 +5,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -23,13 +23,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Undeploy templates if deployed from previous test case - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: "{{ item }}" @@ -41,7 +41,7 @@ - Template 2 - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -50,7 +50,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure ansible_test_1 external EPG does not exist - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -59,7 +59,7 @@ ignore_errors: true - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -67,7 +67,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -75,7 +75,7 @@ state: present - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -83,7 +83,7 @@ state: present - name: Ensure L3out exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -93,7 +93,7 @@ state: present - name: Ensure ANP exists - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -101,7 +101,7 @@ state: present - name: Add external EPG - mso_schema_template_external_epg: + cisco.mso.mso_schema_template_external_epg: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -112,7 +112,7 @@ # ADD external EPG subnet - name: Add external EPG subnet (check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -123,14 +123,14 @@ register: cm_add_epg_subnet - name: Verify cm_add_epg_subnet - assert: + ansible.builtin.assert: that: - cm_add_epg_subnet is changed - cm_add_epg_subnet.previous == {} - cm_add_epg_subnet.current.ip == "10.0.0.0/24" - name: Add external EPG subnet (normal mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -140,14 +140,14 @@ register: nm_add_epg_subnet - name: Verify nm_add_epg_subnet - assert: + ansible.builtin.assert: that: - nm_add_epg_subnet is changed - nm_add_epg_subnet.previous == {} - nm_add_epg_subnet.current.ip == "10.0.0.0/24" - name: Add external EPG subnet again (check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -158,14 +158,14 @@ register: cm_add_epg_subnet_again - name: Verify cm_add_epg_subnet_again - assert: + ansible.builtin.assert: that: - cm_add_epg_subnet_again is not changed - cm_add_epg_subnet_again.previous.ip == "10.0.0.0/24" - cm_add_epg_subnet_again.current.ip == "10.0.0.0/24" - name: Add epg again subnet (normal mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -175,14 +175,14 @@ register: nm_add_epg_subnet_again - name: Verify nm_add_epg_subnet_again - assert: + ansible.builtin.assert: that: - nm_add_epg_subnet_again is not changed - nm_add_epg_subnet_again.previous.ip == "10.0.0.0/24" - nm_add_epg_subnet_again.current.ip == "10.0.0.0/24" - name: Add external EPG subnet 2 - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -192,14 +192,14 @@ register: add_epg_subnet_2 - name: Verify add_epg_subnet_2 - assert: + ansible.builtin.assert: that: - add_epg_subnet_2 is changed - add_epg_subnet_2.current.ip == "10.0.0.2/24" # QUERY ALL EPG Subnets - name: Query all EPG (check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -209,7 +209,7 @@ register: cm_query_all_epg_subnets - name: Query all EPG (normal mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -218,7 +218,7 @@ register: nm_query_all_epg_subnets - name: Verify query_all_epg_subnets - assert: + ansible.builtin.assert: that: - cm_query_all_epg_subnets is not changed - nm_query_all_epg_subnets is not changed @@ -226,7 +226,7 @@ # QUERY AN EPG subnet - name: Query epg subnet 1(check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -237,7 +237,7 @@ register: cm_query_epg_subnet_1 - name: Query epg subnet 1(normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -247,7 +247,7 @@ register: nm_query_epg_subnet_1 - name: Verify cm_query_epg_subnet_1 and nm_query_epg_subnet_1 - assert: + ansible.builtin.assert: that: - cm_query_epg_subnet_1 is not changed - nm_query_epg_subnet_1 is not changed @@ -255,7 +255,7 @@ # REMOVE EPG - name: Remove EPG subnet 1 (check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -266,13 +266,13 @@ register: cm_remove_epg_subnet_1 - name: Verify cm_remove_epg_subnet_1 - assert: + ansible.builtin.assert: that: - cm_remove_epg_subnet_1 is changed - cm_remove_epg_subnet_1.current == {} - name: Remove EPG subnet 1 (normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -282,13 +282,13 @@ register: nm_remove_epg_subnet_1 - name: Verify nm_remove_epg_subnet_1 - assert: + ansible.builtin.assert: that: - nm_remove_epg_subnet_1 is changed - nm_remove_epg_subnet_1.current == {} - name: Remove EPG subnet 1 again (normal mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -298,14 +298,14 @@ register: nm_remove_epg_subnet_1_again - name: Verify nm_remove_epg_subnet_1_again - assert: + ansible.builtin.assert: that: - nm_remove_epg_subnet_1_again is not changed - nm_remove_epg_subnet_1_again.previous == nm_remove_epg_subnet_1_again.current == {} # Chcek aggregate when scope parameter Shared control is absent and present - name: Add aggregate without Shared control scope parameter - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -318,12 +318,12 @@ register: add_epg_subnet_no_ag - name: Verify add_epg_subnet_no_ag - assert: + ansible.builtin.assert: that: - add_epg_subnet_no_ag is changed - name: Verify add_epg_subnet_no_ag (3.1.1g to 3.1.1n) - assert: + ansible.builtin.assert: that: - add_epg_subnet_no_ag.msg == "MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} Aggregate should be enabled only if shared-rtctrl is enabled in Scope exception while trying to update schema" when: @@ -331,14 +331,14 @@ - version.current.version is version('3.2', '<') - name: Verify add_epg_subnet_no_ag (version < 3.1.1g) - assert: + ansible.builtin.assert: that: - add_epg_subnet_no_ag.msg == "MSO Error 400{{':'}} Bad Request{{':'}} Aggregate should be enabled only if shared-rtctrl is enabled in Scope" when: - version.current.version is version('3.1.1g', '<') - name: Verify add_epg_subnet_no_ag (version >= 4.0) - assert: + ansible.builtin.assert: that: - add_epg_subnet_no_ag.msg == "MSO Error 400{{':'}} ExternalEPG{{':'}} ansible_test_1 in Schema{{':'}} ansible_test , Template{{':'}} Template1 External EPG validation error{{':'}} aggregate should be enabled only if shared-rtctrl is enabled in Scope for subnet 10.0.0.2/24" when: @@ -349,7 +349,7 @@ when: version.current.version is version('4.0', '<') block: - name: Get Validation status - mso_schema_validate: + cisco.mso.mso_schema_validate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' state: query @@ -358,7 +358,7 @@ when: version.current.version is version('3.6', '>=') - name: Verify query_validate for a version that's after 3.6 - assert: + ansible.builtin.assert: that: - query_validate is not changed - query_validate.msg is match ("MSO Error 400{{':'}} Bad Request{{':'}} Patch Failed, Received{{':'}} Aggregate should be enabled only if shared-rtctrl is enabled in Scope exception while trying to update schema") @@ -366,7 +366,7 @@ - version.current.version is version('3.6', '>=') - name: Add aggregate with Shared control scope parameter - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -379,13 +379,13 @@ register: add_epg_subnet_ag - name: Verify add_epg_subnet_ag - assert: + ansible.builtin.assert: that: - add_epg_subnet_ag is changed - add_epg_subnet_ag.current.aggregate[0] == "shared-rtctrl" - name: Change EPG subnet 2 by changing Route Controls - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -401,7 +401,7 @@ register: change_epg_subnet - name: Verify change_epg_subnet - assert: + ansible.builtin.assert: that: - change_epg_subnet is changed - change_epg_subnet.current.ip == "10.0.0.2/24" @@ -409,7 +409,7 @@ # QUERY NON-EXISTING EPG subnet - name: Query non-existing EPG subnet(check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -421,7 +421,7 @@ register: cm_query_non_existing_epg_subnet - name: Query non-existing EPG subnet(normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -432,7 +432,7 @@ register: nm_query_non_existing_epg_subnet - name: Verify cm_query_non_existing_epg_subnet and nm_query_non_existing_epg_subnet - assert: + ansible.builtin.assert: that: - cm_query_non_existing_epg_subnet is not changed - nm_query_non_existing_epg_subnet is not changed @@ -441,7 +441,7 @@ # QUERY NON-EXISTING EPG - name: Query non-existing EPG subnet(check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -453,7 +453,7 @@ register: cm_query_non_existing_epg - name: Query non-existing EPG subnet(normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -464,7 +464,7 @@ register: nm_query_non_existing_epg - name: Verify cm_query_non_existing_epg and nm_query_non_existing_epg - assert: + ansible.builtin.assert: that: - cm_query_non_existing_epg is not changed - nm_query_non_existing_epg is not changed @@ -473,7 +473,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for epg subnet(check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -485,7 +485,7 @@ register: cm_non_existing_schema - name: Non-existing schema for epg subnet(normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: non-existing-schema template: Template 1 @@ -496,7 +496,7 @@ register: nm_non_existing_schema - name: Verify non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -505,7 +505,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for epg subnet(check_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -517,7 +517,7 @@ register: cm_non_existing_template - name: Non-existing template for epg subnet(normal_mode) - mso_schema_template_external_epg_subnet: + cisco.mso.mso_schema_template_external_epg_subnet: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non-existing-template @@ -528,7 +528,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_filter_entry/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_filter_entry/tasks/main.yml index 262a1903d..e2648acd6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_filter_entry/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_filter_entry/tasks/main.yml @@ -3,14 +3,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,13 +21,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Ensure site exist - mso_site: &site_present + cisco.mso.mso_site: &site_present <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -38,7 +38,7 @@ state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -47,7 +47,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test users: @@ -57,7 +57,7 @@ state: present - name: Ensure schema 1 with Template1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -97,7 +97,7 @@ register: add_filter_again - name: Verify add_filter - assert: + ansible.builtin.assert: that: - cm_add_filter is changed - cm_add_filter.previous == {} @@ -123,13 +123,12 @@ when: version.current.version is version('3.3', '>=') - name: Verify add_filter_only - assert: + ansible.builtin.assert: that: - add_filter_descr is changed - add_filter_descr.current.description == "filter entry description" when: version.current.version is version('3.3', '>=') - - name: Create filter without filter entry cisco.mso.mso_schema_template_filter_entry: <<: *mso_info @@ -141,7 +140,7 @@ register: add_filter_only - name: Verify add_filter_only - assert: + ansible.builtin.assert: that: - add_filter_only is not changed - add_filter_only.msg == "state is present but all of the following are missing{{':'}} entry" @@ -194,7 +193,7 @@ register: query_all - name: Verify query - assert: + ansible.builtin.assert: that: - query_filter is not changed - query_all is not changed @@ -223,7 +222,7 @@ register: query_non_existing_entry - name: Verify query cases - assert: + ansible.builtin.assert: that: - query_non_existing_filter is not changed - query_non_existing_entry is not changed @@ -241,7 +240,7 @@ register: remove_filter - name: Verify delete filter_entry3 - assert: + ansible.builtin.assert: that: - remove_filter is changed - remove_filter.current == {} @@ -259,7 +258,7 @@ register: nm_non_existing_template - name: Verify nm_non_existing_template - assert: + ansible.builtin.assert: that: - nm_non_existing_template is not changed - nm_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1" @@ -297,7 +296,7 @@ register: remove_non_existing_entry - name: Verify non_existing - assert: + ansible.builtin.assert: that: - query_non_existing_filter is not changed - query_non_existing_filter.msg == "Filter 'non_existing_filter' not found" @@ -305,7 +304,6 @@ - remove_non_existing_entry is not changed - nm_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1" - # Delete filter entries - name: Delete filter entry 3 cisco.mso.mso_schema_template_filter_entry: @@ -321,6 +319,6 @@ - 'filter_entry2' - name: Verify remove_multiple_entries - assert: + ansible.builtin.assert: that: - remove_multiple_entries is changed
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_l3out/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_l3out/tasks/main.yml index a61752fa6..e6cf75650 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_l3out/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_l3out/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,13 +21,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -36,7 +36,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -46,7 +46,7 @@ state: present - name: Ensure schema 1 with Template1, and Template2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -57,7 +57,7 @@ - { template: Template2} - name: Ensure VRF1 exists - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -65,7 +65,7 @@ state: present - name: Verify L3Out doesn't exist - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -73,7 +73,7 @@ state: absent - name: Add new L3Out (check_mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -85,7 +85,7 @@ register: cm_add_l3out - name: Add new L3Out (normal mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -96,7 +96,7 @@ register: nm_add_l3out - name: Add L3Out again - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -107,7 +107,7 @@ register: add_l3out_again - name: Verify add - assert: + ansible.builtin.assert: that: - cm_add_l3out is changed - cm_add_l3out.previous == {} @@ -124,7 +124,7 @@ - nm_add_l3out.current.vrfRef.schemaId == add_l3out_again.current.vrfRef.schemaId - name: Add new L3Outs - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -138,12 +138,12 @@ - { l3out: L3out3} - name: Verify add - assert: + ansible.builtin.assert: that: - new_l3outs is changed - name: Query a specific L3Out - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -152,7 +152,7 @@ register: query_l3out - name: Query all L3outs - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -160,13 +160,13 @@ register: query_all - name: Verify query - assert: + ansible.builtin.assert: that: - query_l3out is not changed - query_all is not changed - name: Remove an L3Out - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -175,7 +175,7 @@ register: delete_l3out - name: Verify delete - assert: + ansible.builtin.assert: that: - delete_l3out is changed - delete_l3out.previous.name == "L3out1" @@ -183,7 +183,7 @@ # USE A NON_EXISTING_TEMPLATE - name: non_existing_template (check_mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -196,7 +196,7 @@ register: cm_non_existing_template - name: non_existing_template (normal_mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -208,7 +208,7 @@ register: nm_non_existing_template - name: Verify cm_non_existing_template and nm_non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -216,7 +216,7 @@ # QUERY NON-EXISTING L3Out - name: Query non-existing L3Out (check_mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -227,7 +227,7 @@ register: cm_query_non_l3out - name: Query non-existing L3Out (normal_mode) - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -237,7 +237,7 @@ register: nm_query_non_l3out - name: Verify cm_query_non_l3out and nm_query_non_l3out - assert: + ansible.builtin.assert: that: - cm_query_non_l3out is not changed - nm_query_non_l3out is not changed @@ -246,7 +246,7 @@ # Add description for version >= 3.3 - name: Add new L3Out - mso_schema_template_l3out: + cisco.mso.mso_schema_template_l3out: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 @@ -259,7 +259,7 @@ when: version.current.version is version('3.3', '>=') - name: Verify add description - assert: + ansible.builtin.assert: that: - add_desc is changed when: version.current.version is version('3.3', '>=')
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_migrate/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_migrate/tasks/main.yml index 44940f0d6..219eb7641 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_migrate/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_migrate/tasks/main.yml @@ -5,12 +5,12 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -21,14 +21,14 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version # CLEAN ENVIRONMENT - name: Ensure site exist - mso_site: &site_present + cisco.mso.mso_site: &site_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -45,7 +45,7 @@ state: present - name: Undeploy a schema 2 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -55,7 +55,7 @@ register: undeploy_template2 - name: Undeploy a schema 1 template 1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -65,7 +65,7 @@ register: undeploy_template1 - name: Remove a site from a schema 1 with Template 1 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -75,7 +75,7 @@ register: rm_site_temp1 - name: Remove a site from a schema 2 with Template 2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -85,7 +85,7 @@ register: rm_site_temp2 - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -101,7 +101,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -117,7 +117,7 @@ state: present - name: Ensure schemas with Template 1 exist - mso_schema_template: &schema_present + cisco.mso.mso_schema_template: &schema_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -134,7 +134,7 @@ - '{{ mso_schema | default("ansible_test") }}_2' - name: Ensure schema 2 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *schema_present schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -143,7 +143,7 @@ register: schema2_template2 - name: Add a new site to a schema 1 with Template 1 in normal mode - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' @@ -152,7 +152,7 @@ register: add_site_nm1 - name: Add a new site to a schema 2 with Template 2 in normal mode - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -161,7 +161,7 @@ register: add_site_nm2 - name: Ensure VRF exist - mso_schema_template_vrf: &vrf_present + cisco.mso.mso_schema_template_vrf: &vrf_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -176,7 +176,7 @@ state: present - name: Ensure ANP exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -190,7 +190,7 @@ state: present - name: Ensure ANP2 exist - mso_schema_template_anp: + cisco.mso.mso_schema_template_anp: host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -204,7 +204,7 @@ state: present - name: Ensure ansible_test_1 BD exist - mso_schema_template_bd: + cisco.mso.mso_schema_template_bd: <<: *vrf_present schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -220,7 +220,7 @@ - '{{ BD_2 | default("ansible_test") }}_2' - name: Ensure EPG exist - mso_schema_template_anp_epg: &epg_present + cisco.mso.mso_schema_template_anp_epg: &epg_present host: '{{ mso_hostname }}' username: '{{ mso_username }}' password: '{{ mso_password }}' @@ -242,7 +242,7 @@ register: cm_add_epg - name: Add EPG 2 (normal mode) - mso_schema_template_anp_epg: + cisco.mso.mso_schema_template_anp_epg: <<: *epg_present anp: ANP2 epg: '{{ item }}' @@ -252,7 +252,7 @@ - '{{ EPG_4 | default("ansible_test") }}_4' - name: Migration of objects between templates - mso_schema_template_migrate: + cisco.mso.mso_schema_template_migrate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -270,7 +270,7 @@ register: object_migrate - name: Deploy a schema 1 template 1 after version 4.0 - ndo_schema_template_deploy: + cisco.mso.ndo_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -280,7 +280,7 @@ when: version.current.version is version('4.0', '>=') - name: Migration of BD objects between templates - mso_schema_template_migrate: + cisco.mso.mso_schema_template_migrate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -293,7 +293,7 @@ register: bd_migrate - name: Deploy a schema 2 template 2 after version 4.0 - ndo_schema_template_deploy: + cisco.mso.ndo_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -303,7 +303,7 @@ when: version.current.version is version('4.0', '>=') - name: Migration of EPG objects between templates - mso_schema_template_migrate: + cisco.mso.mso_schema_template_migrate: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 1 @@ -323,7 +323,7 @@ - version.current.version is version('4.0', '<') block: - name: Undeploy a schema 2 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -333,7 +333,7 @@ register: undeploy_template2 - name: Undeploy a schema 1 template 1 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -347,7 +347,7 @@ - version.current.version is version('4.0', '>=') block: - name: Undeploy a schema 2 template 2 - ndo_schema_template_deploy: + cisco.mso.ndo_schema_template_deploy: <<: *mso_info template: Template 2 schema: '{{ mso_schema | default("ansible_test") }}_2' @@ -356,7 +356,7 @@ state: undeploy - name: Undeploy a schema 1 template 1 - ndo_schema_template_deploy: + cisco.mso.ndo_schema_template_deploy: <<: *mso_info template: Template 1 schema: '{{ mso_schema | default("ansible_test") }}' @@ -365,7 +365,7 @@ state: undeploy - name: Remove a site from a schema 2 with Template 2 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' site: '{{ mso_site | default("ansible_test") }}' @@ -374,7 +374,7 @@ register: rm_site_temp2 - name: Remove a site from a schema 1 with Template 1 - mso_schema_site: + cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' site: '{{ mso_site | default("ansible_test") }}' diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_service_graph/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_service_graph/tasks/main.yml index d11a3f4a2..6cb66c2ca 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_service_graph/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_service_graph/tasks/main.yml @@ -4,42 +4,41 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: - msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' + ansible.builtin.fail: + msg: "Please define the following variables: mso_hostname, mso_username and mso_password." when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined - # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info - host: '{{ mso_hostname }}' - username: '{{ mso_username }}' - password: '{{ mso_password }}' - validate_certs: '{{ mso_validate_certs | default(false) }}' - use_ssl: '{{ mso_use_ssl | default(true) }}' - use_proxy: '{{ mso_use_proxy | default(false) }}' + host: "{{ mso_hostname }}" + username: "{{ mso_username }}" + password: "{{ mso_password }}" + validate_certs: "{{ mso_validate_certs | default(false) }}" + use_ssl: "{{ mso_use_ssl | default(true) }}" + use_proxy: "{{ mso_use_proxy | default(false) }}" output_level: '{{ mso_output_level | default("info") }}' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info - schema: '{{ item }}' + schema: "{{ item }}" state: absent loop: - - '{{ mso_schema | default("ansible_test") }}_2' - - '{{ mso_schema | default("ansible_test") }}' + - '{{ mso_schema | default("ansible_test") }}_2' + - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: - - '{{ mso_username }}' + - "{{ mso_username }}" state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -63,17 +62,17 @@ check_mode: true - name: Verify sg1_cm - assert: + ansible.builtin.assert: that: - - sg1_cm is changed - - sg1_cm.current.name == "SG1" - - sg1_cm.current.displayName == "sg" - - sg1_cm.current.nodeFilter == "allow-all" - - sg1_cm.current.serviceGraphRef.templateName == "Template1" - - sg1_cm.current.serviceNodes | length == 3 - - sg1_cm.current.serviceNodes.0.name == "firewall" - - sg1_cm.current.serviceNodes.1.name == "load-balancer" - - sg1_cm.current.serviceNodes.2.name == "other" + - sg1_cm is changed + - sg1_cm.current.name == "SG1" + - sg1_cm.current.displayName == "sg" + - sg1_cm.current.nodeFilter == "allow-all" + - sg1_cm.current.serviceGraphRef.templateName == "Template1" + - sg1_cm.current.serviceNodes | length == 3 + - sg1_cm.current.serviceNodes.0.name == "node1" + - sg1_cm.current.serviceNodes.1.name == "node2" + - sg1_cm.current.serviceNodes.2.name == "node3" - name: Create a service graph (normal mode) cisco.mso.mso_schema_template_service_graph: @@ -97,7 +96,7 @@ template: Template1 service_graph: SG1 display_name: sg - service_nodes: + service_nodes: - type: firewall - type: load-balancer - type: other @@ -106,26 +105,26 @@ register: sg1_again - name: Verify sg1 and sg1_again - assert: + ansible.builtin.assert: that: - - sg1 is changed - - sg1_again is not changed - - sg1.current.name == "SG1" - - sg1.current.displayName == "sg" - - sg1.current.nodeFilter == "allow-all" - - sg1.current.serviceGraphRef.templateName == "Template1" - - sg1.current.serviceNodes | length == 3 - - sg1.current.serviceNodes.0.name == "firewall" - - sg1.current.serviceNodes.1.name == "load-balancer" - - sg1.current.serviceNodes.2.name == "other" - - sg1_again.current.name == "SG1" - - sg1_again.current.displayName == "sg" - - sg1_again.current.nodeFilter == "allow-all" - - sg1_again.current.serviceGraphRef.templateName == "Template1" - - sg1_again.current.serviceNodes | length == 3 - - sg1_again.current.serviceNodes.0.name == "firewall" - - sg1_again.current.serviceNodes.1.name == "load-balancer" - - sg1_again.current.serviceNodes.2.name == "other" + - sg1 is changed + - sg1_again is not changed + - sg1.current.name == "SG1" + - sg1.current.displayName == "sg" + - sg1.current.nodeFilter == "allow-all" + - sg1.current.serviceGraphRef.templateName == "Template1" + - sg1.current.serviceNodes | length == 3 + - sg1.current.serviceNodes.0.name == "node1" + - sg1.current.serviceNodes.1.name == "node2" + - sg1.current.serviceNodes.2.name == "node3" + - sg1_again.current.name == "SG1" + - sg1_again.current.displayName == "sg" + - sg1_again.current.nodeFilter == "allow-all" + - sg1_again.current.serviceGraphRef.templateName == "Template1" + - sg1_again.current.serviceNodes | length == 3 + - sg1_again.current.serviceNodes.0.name == "node1" + - sg1_again.current.serviceNodes.1.name == "node2" + - sg1_again.current.serviceNodes.2.name == "node3" - name: Create another service graph SG2 cisco.mso.mso_schema_template_service_graph: @@ -134,7 +133,7 @@ template: Template1 service_graph: SG2 display_name: Service_Graph2 - service_nodes: + service_nodes: - type: firewall - type: load-balancer filter_after_first_node: filters_from_contract @@ -142,16 +141,16 @@ register: sg2 - name: Verify sg2 - assert: + ansible.builtin.assert: that: - - sg2 is changed - - sg2.current.name == "SG2" - - sg2.current.displayName == "Service_Graph2" - - sg2.current.nodeFilter == "filters-from-contract" - - sg2.current.serviceGraphRef.templateName == "Template1" - - sg2.current.serviceNodes | length == 2 - - sg2.current.serviceNodes.0.name == "firewall" - - sg2.current.serviceNodes.1.name == "load-balancer" + - sg2 is changed + - sg2.current.name == "SG2" + - sg2.current.displayName == "Service_Graph2" + - sg2.current.nodeFilter == "filters-from-contract" + - sg2.current.serviceGraphRef.templateName == "Template1" + - sg2.current.serviceNodes | length == 2 + - sg2.current.serviceNodes.0.name == "node1" + - sg2.current.serviceNodes.1.name == "node2" - name: Change Service Graph SG2 cisco.mso.mso_schema_template_service_graph: @@ -160,7 +159,7 @@ template: Template1 service_graph: SG2 display_name: Service_Graph_changed - service_nodes: + service_nodes: - type: firewall - type: load-balancer filter_after_first_node: filters_from_contract @@ -168,16 +167,16 @@ register: sg2_change - name: Verify sg2_change - assert: + ansible.builtin.assert: that: - - sg2_change is changed - - sg2_change.current.name == "SG2" - - sg2_change.current.displayName == "Service_Graph_changed" - - sg2_change.current.nodeFilter == "filters-from-contract" - - sg2_change.current.serviceGraphRef.templateName == "Template1" - - sg2_change.current.serviceNodes | length == 2 - - sg2_change.current.serviceNodes.0.name == "firewall" - - sg2_change.current.serviceNodes.1.name == "load-balancer" + - sg2_change is changed + - sg2_change.current.name == "SG2" + - sg2_change.current.displayName == "Service_Graph_changed" + - sg2_change.current.nodeFilter == "filters-from-contract" + - sg2_change.current.serviceGraphRef.templateName == "Template1" + - sg2_change.current.serviceNodes | length == 2 + - sg2_change.current.serviceNodes.0.name == "node1" + - sg2_change.current.serviceNodes.1.name == "node2" - name: Create another service graph with no display name cisco.mso.mso_schema_template_service_graph: @@ -185,22 +184,22 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 service_graph: SG3 - service_nodes: + service_nodes: - type: firewall filter_after_first_node: filters_from_contract state: present register: sg3 - name: Verify sg3 - assert: + ansible.builtin.assert: that: - - sg3 is changed - - sg3.current.name == "SG3" - - sg3.current.displayName == "SG3" - - sg3.current.nodeFilter == "filters-from-contract" - - sg3.current.serviceGraphRef.templateName == "Template1" - - sg3.current.serviceNodes.0.name == "firewall" - - sg3.current.serviceNodes | length == 1 + - sg3 is changed + - sg3.current.name == "SG3" + - sg3.current.displayName == "SG3" + - sg3.current.nodeFilter == "filters-from-contract" + - sg3.current.serviceGraphRef.templateName == "Template1" + - sg3.current.serviceNodes.0.name == "node1" + - sg3.current.serviceNodes | length == 1 - name: Create service graph SG3 with addition of new service node type cisco.mso.mso_schema_template_service_graph: @@ -208,7 +207,7 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 service_graph: SG3 - service_nodes: + service_nodes: - type: firewall - type: other filter_after_first_node: filters_from_contract @@ -216,16 +215,16 @@ register: sg3_other - name: Verify sg3_other - assert: + ansible.builtin.assert: that: - - sg3_other is changed - - sg3_other.current.name == "SG3" - - sg3_other.current.displayName == "SG3" - - sg3_other.current.nodeFilter == "filters-from-contract" - - sg3_other.current.serviceGraphRef.templateName == "Template1" - - sg3_other.current.serviceNodes.0.name == "firewall" - - sg3_other.current.serviceNodes.1.name == "other" - - sg3_other.current.serviceNodes | length == 2 + - sg3_other is changed + - sg3_other.current.name == "SG3" + - sg3_other.current.displayName == "SG3" + - sg3_other.current.nodeFilter == "filters-from-contract" + - sg3_other.current.serviceGraphRef.templateName == "Template1" + - sg3_other.current.serviceNodes.0.name == "node1" + - sg3_other.current.serviceNodes.1.name == "node2" + - sg3_other.current.serviceNodes | length == 2 - name: Create service graph SG3 interchanging the index of service node types cisco.mso.mso_schema_template_service_graph: @@ -233,7 +232,7 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 service_graph: SG3 - service_nodes: + service_nodes: - type: other - type: firewall filter_after_first_node: filters_from_contract @@ -241,16 +240,16 @@ register: sg3_interchange - name: Verify sg3_interchange - assert: + ansible.builtin.assert: that: - - sg3_interchange is changed - - sg3_interchange.current.name == "SG3" - - sg3_interchange.current.displayName == "SG3" - - sg3_interchange.current.nodeFilter == "filters-from-contract" - - sg3_interchange.current.serviceGraphRef.templateName == "Template1" - - sg3_interchange.current.serviceNodes.1.name == "firewall" - - sg3_interchange.current.serviceNodes.0.name == "other" - - sg3_interchange.current.serviceNodes | length == 2 + - sg3_interchange is changed + - sg3_interchange.current.name == "SG3" + - sg3_interchange.current.displayName == "SG3" + - sg3_interchange.current.nodeFilter == "filters-from-contract" + - sg3_interchange.current.serviceGraphRef.templateName == "Template1" + - sg3_interchange.current.serviceNodes.1.name == "node2" + - sg3_interchange.current.serviceNodes.0.name == "node1" + - sg3_interchange.current.serviceNodes | length == 2 - name: Create another service graph with non existing node type cisco.mso.mso_schema_template_service_graph: @@ -258,7 +257,7 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template1 service_graph: SG4 - service_nodes: + service_nodes: - type: non_existing_type filter_after_first_node: filters_from_contract state: present @@ -266,9 +265,9 @@ ignore_errors: true - name: Verify sg4 - assert: + ansible.builtin.assert: that: - - sg4.msg == "Provided service node type 'non_existing_type' does not exist. Existing node types include{{':'}} firewall, load-balancer, other", + - sg4.msg == "Provided service node type 'non_existing_type' does not exist. Existing node types include{{':'}} firewall, load-balancer, other", - name: Query service graph SG cisco.mso.mso_schema_template_service_graph: @@ -280,16 +279,16 @@ register: query_sg - name: Verify query_sg - assert: + ansible.builtin.assert: that: - - query_sg is not changed - - query_sg.current.name == "SG1" - - query_sg.current.displayName == "sg" - - query_sg.current.nodeFilter == "allow-all" - - query_sg.current.serviceNodes | length == 3 - - query_sg.current.serviceNodes.0.name == "firewall" - - query_sg.current.serviceNodes.1.name == "load-balancer" - - query_sg.current.serviceNodes.2.name == "other" + - query_sg is not changed + - query_sg.current.name == "SG1" + - query_sg.current.displayName == "sg" + - query_sg.current.nodeFilter == "allow-all" + - query_sg.current.serviceNodes | length == 3 + - query_sg.current.serviceNodes.0.name == "node1" + - query_sg.current.serviceNodes.1.name == "node2" + - query_sg.current.serviceNodes.2.name == "node3" - name: Query all service graphs cisco.mso.mso_schema_template_service_graph: @@ -300,10 +299,10 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - - query_all is not changed - - query_all.current | length == 3 + - query_all is not changed + - query_all.current | length == 3 - name: Query non_existing service graph cisco.mso.mso_schema_template_service_graph: @@ -316,9 +315,9 @@ register: query_non_existing_sg - name: Verify query_non_existing_sg - assert: + ansible.builtin.assert: that: - - query_non_existing_sg.msg == "Service Graph 'non_existent' not found" + - query_non_existing_sg.msg == "Service Graph 'non_existent' not found" - name: Use non_existing schema cisco.mso.mso_schema_template_service_graph: @@ -341,10 +340,10 @@ register: query_non_existing_template - name: Verify query_non_existing_schema and query_non_existing_template - assert: + ansible.builtin.assert: that: - - query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." - - query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1" + - query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." + - query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1" - name: Remove service graph (check mode) cisco.mso.mso_schema_template_service_graph: @@ -357,11 +356,11 @@ check_mode: true - name: Verify rm_sg_cm - assert: + ansible.builtin.assert: that: - - rm_sg_cm is changed - - rm_sg_cm.current == {} - - rm_sg_cm.previous.name == "SG1" + - rm_sg_cm is changed + - rm_sg_cm.current == {} + - rm_sg_cm.previous.name == "SG1" - name: Remove service graph (normal mode) cisco.mso.mso_schema_template_service_graph: @@ -373,11 +372,11 @@ register: rm_sg - name: Verify rm_sg - assert: + ansible.builtin.assert: that: - - rm_sg is changed - - rm_sg.current == {} - - rm_sg.previous.name == "SG1" + - rm_sg is changed + - rm_sg.current == {} + - rm_sg.previous.name == "SG1" - name: Remove service graph again cisco.mso.mso_schema_template_service_graph: @@ -389,8 +388,8 @@ register: rm_sg_again - name: Verify rm_sg_again - assert: + ansible.builtin.assert: that: - - rm_sg_again is not changed - - rm_sg_again.current == {} - - rm_sg_again.previous == {} + - rm_sg_again is not changed + - rm_sg_again.current == {} + - rm_sg_again.previous == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf/tasks/main.yml index 0f25a76b0..ed6a2cdd5 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf/tasks/main.yml @@ -8,14 +8,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -26,7 +26,7 @@ output_level: '{{ mso_output_level | default("info") }}' # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -43,7 +43,7 @@ # state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -52,7 +52,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -62,7 +62,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -70,7 +70,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -78,7 +78,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -86,7 +86,7 @@ state: present - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -95,7 +95,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -107,7 +107,7 @@ # ADD VRF1 - name: Add a new VRF1 (check mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -117,14 +117,14 @@ register: vrf1_cm - name: Verify vrf1_cm - assert: + ansible.builtin.assert: that: - vrf1_cm is changed - vrf1_cm.current.name == 'VRF1' - vrf1_cm.current.displayName == 'VRF1' - name: Add VRF1 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -133,14 +133,14 @@ register: vrf1_nm - name: Verify vrf1_nm - assert: + ansible.builtin.assert: that: - vrf1_nm is changed - vrf1_nm.current.name == 'VRF1' - vrf1_nm.current.displayName == 'VRF1' - name: Add VRF2 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -151,7 +151,7 @@ register: vrf2_nm - name: Verify vrf2_nm - assert: + ansible.builtin.assert: that: - vrf2_nm is changed - vrf2_nm.current.name == 'VRF2' @@ -160,7 +160,7 @@ - vrf2_nm.current.l3MCast == True - name: Add VRF3 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -169,14 +169,14 @@ register: vrf3_nm - name: Verify vrf3_nm - assert: + ansible.builtin.assert: that: - vrf3_nm is changed - vrf3_nm.current.name == 'VRF3' - vrf3_nm.current.displayName == 'VRF3' - name: Add preferred_group to VRF3 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -186,7 +186,7 @@ register: vrf3_nm_change - name: Verify vrf3_nm_change - assert: + ansible.builtin.assert: that: - vrf3_nm_change is changed - vrf3_nm_change.current.name == 'VRF3' @@ -194,7 +194,7 @@ # ADD EXISTING VRF - name: Add VRF2 again (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -205,13 +205,13 @@ register: vrf2_nm_again - name: Verify vrf2_nm_again - assert: + ansible.builtin.assert: that: - vrf2_nm_again is not changed # CHANGE VRF SETTINGS - name: Change VRF1 settings (check mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -223,7 +223,7 @@ register: vrf1_change_cm - name: Change VRF1 settings (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -234,7 +234,7 @@ register: vrf1_change_nm - name: Change VRF2 settings (check mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -248,7 +248,7 @@ register: vrf2_change_cm - name: Change VRF2 settings (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -261,7 +261,7 @@ register: vrf2_change_nm - name: Verify vrf2_nm - assert: + ansible.builtin.assert: that: - vrf1_change_cm is changed - vrf1_change_nm is changed @@ -278,7 +278,7 @@ # ADD VRF4 WITH NO STATE - name: Add VRF4 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -287,13 +287,13 @@ register: vrf4_nm_stateless - name: Verify vrf4_nm_stateless - assert: + ansible.builtin.assert: that: - vrf4_nm_stateless is changed # QUERY A VRF - name: Query VRF2 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -302,13 +302,13 @@ register: vrf2_query - name: Verify vrf2_query - assert: + ansible.builtin.assert: that: - vrf2_query is not changed # QUERY ALL VRFs - name: Query all (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -316,13 +316,13 @@ register: vrfs_query - name: Verify vrfs_query - assert: + ansible.builtin.assert: that: - vrfs_query is not changed # REMOVE A VRF - name: Remove VRF3 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -331,7 +331,7 @@ register: vrf3_remove - name: Verify vrf3_remove - assert: + ansible.builtin.assert: that: - vrf3_remove is changed - vrf3_remove.previous.name == 'VRF3' @@ -339,7 +339,7 @@ # REMOVE A VRF - name: Remove VRF3 again (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -348,13 +348,13 @@ register: vrf3_remove_again - name: Verify vrf3_remove_again - assert: + ansible.builtin.assert: that: - vrf3_remove_again is not changed # QUERY REMOVED VRF - name: Query VRF3 (normal mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -364,13 +364,13 @@ register: vrf3_query_removed - name: Verify vrf3_query_removed - assert: + ansible.builtin.assert: that: - vrf3_query_removed.msg == "VRF 'VRF3' not found" # Enable vzAny on VRF - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -379,7 +379,7 @@ state: present - name: Add Contract1 to VRF with type consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -391,7 +391,7 @@ register: nm_add_contract1_consumer - name: Verify nm_add_contract1_consumer - assert: + ansible.builtin.assert: that: - nm_add_contract1_consumer is changed - nm_add_contract1_consumer.previous == {} @@ -400,7 +400,7 @@ - nm_add_contract1_consumer.current.relationshipType == "consumer" - name: Add Contract1 to VRF with type provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -412,7 +412,7 @@ register: nm_add_contract1_provider - name: Verify nm_add_contract1_provider - assert: + ansible.builtin.assert: that: - nm_add_contract1_provider is changed - nm_add_contract1_provider.previous == {} @@ -422,7 +422,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for VRF (check_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: non_existing_schema template: Template 1 @@ -432,7 +432,7 @@ register: cm_non_existing_schema - name: Non-existing schema for VRF (normal_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: non_existing_schema template: Template 1 @@ -441,7 +441,7 @@ register: nm_non_existing_schema - name: Verify nm_non_existing_schema - assert: + ansible.builtin.assert: that: - cm_non_existing_schema is not changed - nm_non_existing_schema is not changed @@ -450,7 +450,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing template for vrf (check_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -460,7 +460,7 @@ register: cm_non_existing_template - name: Non-existing template for vrf (normal_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -469,7 +469,7 @@ register: nm_non_existing_template - name: Verify non_existing_template - assert: + ansible.builtin.assert: that: - cm_non_existing_template is not changed - nm_non_existing_template is not changed @@ -478,7 +478,7 @@ # Checking if contract are removed after re-applying an VRF. - name: Add VRF again (normal_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -488,12 +488,12 @@ register: nm_add_VRF_again - name: Verify that VRF didn't changed - assert: + ansible.builtin.assert: that: - nm_add_VRF_again is not changed - name: Verify contract VRF again - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -502,14 +502,14 @@ register: nm_query_vrf_contract_again - name: Verify 2 contracts are in VRF - assert: + ansible.builtin.assert: that: - nm_query_vrf_contract_again is not changed - nm_query_vrf_contract_again.current | length == 2 # Checking if modifying VRF with existing contracts throw an MSO error. (#82) - name: Change VRF (normal_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -520,14 +520,14 @@ register: nm_change_vrf - name: Verify that VRF did change - assert: + ansible.builtin.assert: that: - nm_change_vrf is changed - nm_change_vrf.current.name == "VRF" - nm_change_vrf.current.l3MCast == True - name: Verify contract VRF again - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -536,7 +536,7 @@ register: nm_query_change_vrf_contract_again - name: Verify 2 contracts are in VRF - assert: + ansible.builtin.assert: that: - nm_query_change_vrf_contract_again is not changed - nm_query_change_vrf_contract_again.current | length == 2 diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf_contract/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf_contract/tasks/main.yml index 3a5f816a1..931af593a 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf_contract/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_template_vrf_contract/tasks/main.yml @@ -7,14 +7,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -25,7 +25,7 @@ output_level: '{{ mso_output_level | default("info") }}' # - name: Ensure site exist -# mso_site: &site_present +# cisco.mso.mso_site: &site_present # host: '{{ mso_hostname }}' # username: '{{ mso_username }}' # password: '{{ mso_password }}' @@ -42,7 +42,7 @@ # state: present - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -51,7 +51,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exist - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -61,7 +61,7 @@ state: present - name: Ensure schema 1 with Template 1 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -69,7 +69,7 @@ state: present - name: Ensure schema 1 with Template 2 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -77,7 +77,7 @@ state: present - name: Ensure schema 2 with Template 3 exist - mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' tenant: ansible_test @@ -85,7 +85,7 @@ state: present - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -93,7 +93,7 @@ state: present - name: Ensure VRF2 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -102,7 +102,7 @@ state: present - name: Ensure VRF3 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -111,7 +111,7 @@ state: present - name: Ensure VRF4 exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -120,7 +120,7 @@ state: present - name: Ensure Filter 1 exist - mso_schema_template_filter_entry: + cisco.mso.mso_schema_template_filter_entry: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -129,7 +129,7 @@ state: present - name: Ensure Contract1 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -140,7 +140,7 @@ state: present - name: Ensure Contract4 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -151,7 +151,7 @@ state: present - name: Ensure Contract2 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -162,7 +162,7 @@ state: present - name: Ensure Contract3 exist - mso_schema_template_contract_filter: + cisco.mso.mso_schema_template_contract_filter: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -174,7 +174,7 @@ # ADD Contract to VRF - name: Add Contract1 to VRF with vzany disabled - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -187,13 +187,13 @@ register: add_contract1_vrf_vzany_disabled - name: Verify add_contract1_vrf_vzany_disabled - assert: + ansible.builtin.assert: that: - add_contract1_vrf_vzany_disabled.msg == "vzAny attribute on vrf 'VRF' is disabled." # Enable vzAny on VRF - name: Ensure VRF exist - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -202,7 +202,7 @@ state: present - name: Add Contract1 to VRF with type consumer (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -215,7 +215,7 @@ register: cm_add_contract1_consumer - name: Verify cm_add_contract1_consumer - assert: + ansible.builtin.assert: that: - cm_add_contract1_consumer is changed - cm_add_contract1_consumer.previous == {} @@ -224,7 +224,7 @@ - cm_add_contract1_consumer.current.relationshipType == "consumer" - name: Add Contract1 to VRF with type consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -236,7 +236,7 @@ register: nm_add_contract1_consumer - name: Verify nm_add_contract1_consumer - assert: + ansible.builtin.assert: that: - nm_add_contract1_consumer is changed - nm_add_contract1_consumer.previous == {} @@ -246,7 +246,7 @@ - cm_add_contract1_consumer.current.contractRef.schemaId == nm_add_contract1_consumer.current.contractRef.schemaId - name: Add Contract1 to VRF with type provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -258,7 +258,7 @@ register: nm_add_contract1_provider - name: Verify nm_add_contract1_provider - assert: + ansible.builtin.assert: that: - nm_add_contract1_provider is changed - nm_add_contract1_provider.previous == {} @@ -267,7 +267,7 @@ - nm_add_contract1_provider.current.relationshipType == "provider" - name: Add Contract1 to VRF with type consumer again(normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -279,7 +279,7 @@ register: nm_add_contract1_consumer_again - name: Verify nm_add_contract1_consumer_again - assert: + ansible.builtin.assert: that: - nm_add_contract1_consumer_again is not changed - nm_add_contract1_consumer_again.current.contractRef.templateName == "Template1" == nm_add_contract1_consumer_again.previous.contractRef.templateName @@ -287,7 +287,7 @@ - nm_add_contract1_consumer_again.current.relationshipType == "consumer" == nm_add_contract1_consumer_again.previous.relationshipType - name: Add Contract1 to VRF with type provider again(normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -299,7 +299,7 @@ register: nm_add_contract1_provider_again - name: Verify nm_add_contract1_provider_again - assert: + ansible.builtin.assert: that: - nm_add_contract1_provider_again is not changed - nm_add_contract1_provider_again.current.contractRef.templateName == "Template1" == nm_add_contract1_provider_again.previous.contractRef.templateName @@ -307,7 +307,7 @@ - nm_add_contract1_provider_again.current.relationshipType == "provider" == nm_add_contract1_provider_again.previous.relationshipType - name: Add Contract4 to VRF2 with type consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -321,7 +321,7 @@ register: nm_add_vrf2_consumer - name: Add Contract4 to VRF2 with type provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -335,7 +335,7 @@ register: nm_add_vrf2_provider - name: nm_add_vrf2_consumer and nm_add_vrf2_provider - assert: + ansible.builtin.assert: that: - nm_add_vrf2_consumer is changed - nm_add_vrf2_provider is changed @@ -346,7 +346,7 @@ - nm_add_vrf2_provider.current.relationshipType == "provider" - name: Add Contract3 to VRF3 with type consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -360,7 +360,7 @@ register: nm_add_vrf3_consumer - name: Add Contract3 to VRF3 with type provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 @@ -374,7 +374,7 @@ register: nm_add_vrf3_provider - name: nm_add_vrf3_consumer and nm_add_vrf3_provider - assert: + ansible.builtin.assert: that: - nm_add_vrf3_consumer is changed - nm_add_vrf3_provider is changed @@ -385,7 +385,7 @@ - nm_add_vrf3_provider.current.relationshipType == "provider" - name: Add Contract2 to VRF4 with type consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -399,7 +399,7 @@ register: nm_add_vrf4_consumer - name: Add Contract2 to VRF4 with type provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 @@ -413,7 +413,7 @@ register: nm_add_vrf4_provider - name: nm_add_vrf4_consumer and nm_add_vrf4_provider - assert: + ansible.builtin.assert: that: - nm_add_vrf4_consumer is changed - nm_add_vrf4_provider is changed @@ -425,7 +425,7 @@ # REMOVE A Contract to VRF - name: Remove contract4 to VRF2 - provider (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -438,7 +438,7 @@ register: cm_remove_contract4_vrf2_provider - name: Remove contract4 to VRF2 - provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -450,7 +450,7 @@ register: nm_remove_contract4_vrf2_provider - name: Remove contract4 to VRF2 - consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -462,7 +462,7 @@ register: nm_remove_contract4_vrf2_consumer - name: Verify cm_remove_contract4_vrf2_provider and cm_remove_contract4_vrf2_provider and nm_remove_contract4_vrf2_consumer - assert: + ansible.builtin.assert: that: - cm_remove_contract4_vrf2_provider is changed - nm_remove_contract4_vrf2_provider is changed @@ -478,7 +478,7 @@ - nm_remove_contract4_vrf2_consumer.previous.relationshipType == "consumer" - name: Remove contract4 to VRF2 - provider again (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -490,7 +490,7 @@ register: nm_remove_contract4_vrf2_provider_again - name: Verify nm_remove_contract4_vrf2_provider_again - assert: + ansible.builtin.assert: that: - nm_remove_contract4_vrf2_provider_again is not changed - nm_remove_contract4_vrf2_provider_again.previous == {} @@ -498,7 +498,7 @@ # QUERY A Contract to VRF - name: Query Contract1 relationship for VRF - consumer (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -511,7 +511,7 @@ register: cm_query_VRF_contract1_consumer - name: Query Contract1 relationship for VRF - consumer (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -524,7 +524,7 @@ register: nm_query_VRF_contract1_consumer - name: Verify cm_query_VRF_contract1_consumer and nm_query_VRF_contract1_consumer - assert: + ansible.builtin.assert: that: - cm_query_VRF_contract1_consumer is not changed - nm_query_VRF_contract1_consumer is not changed @@ -534,7 +534,7 @@ - cm_query_VRF_contract1_consumer.current.contractRef.templateName == nm_query_VRF_contract1_consumer.current.contractRef.templateName == "Template1" - name: Query Contract1 relationship for VRF - provider (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -547,7 +547,7 @@ register: cm_query_VRF_contract1_provider - name: Query Contract1 relationship for VRF - provider (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -560,7 +560,7 @@ register: nm_query_VRF_contract1_provider - name: Verify cm_query_VRF_contract1_provider and nm_query_VRF_contract1_provider - assert: + ansible.builtin.assert: that: - cm_query_VRF_contract1_provider is not changed - nm_query_VRF_contract1_provider is not changed @@ -571,7 +571,7 @@ # QUERY ALL Contract to VRF - name: Query all contracts relationship for VRF (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -581,7 +581,7 @@ register: cm_query_all_contract_vrf - name: Query all contracts relationship for VRF (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -590,7 +590,7 @@ register: nm_query_all_contract_vrf - name: Verify cm_query_all_contract_vrf and nm_query_all_contract_vrf - assert: + ansible.builtin.assert: that: - nm_query_all_contract_vrf is not changed - cm_query_all_contract_vrf is not changed @@ -598,7 +598,7 @@ # QUERY ALL Contracts to VRF2 - name: Query all contracts relationship for VRF2 (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -608,7 +608,7 @@ register: cm_query_all_contract_vrf2 - name: Query all contracts relationship for VRF2 (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -617,7 +617,7 @@ register: nm_query_all_contract_vrf2 - name: Verify cm_query_all_contract_vrf2 and nm_query_all_contract_vrf2 - assert: + ansible.builtin.assert: that: - nm_query_all_contract_vrf2 is not changed - cm_query_all_contract_vrf2 is not changed @@ -625,7 +625,7 @@ # QUERY NON-EXISTING Contract to VRF - name: Query non-existing contract (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -639,7 +639,7 @@ register: cm_query_non_existing_contract - name: Query non-existing contract (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -652,7 +652,7 @@ register: nm_query_non_existing_contract - name: Verify cm_query_non_existing_contract and nm_query_non_existing_contract - assert: + ansible.builtin.assert: that: - cm_query_non_existing_contract is not changed - nm_query_non_existing_contract is not changed @@ -662,7 +662,7 @@ # QUERY NON-EXISTING VRF - name: Query non-existing VRF (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -673,7 +673,7 @@ register: cm_query_non_existing_vrf - name: Query non-existing VRF (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -683,7 +683,7 @@ register: nm_query_non_existing_vrf - name: Verify cm_query_non_existing_vrf and nm_query_non_existing_vrf - assert: + ansible.builtin.assert: that: - cm_query_non_existing_vrf is not changed - nm_query_non_existing_vrf is not changed @@ -693,7 +693,7 @@ # USE A NON-EXISTING SCHEMA - name: Non-existing schema for contract relationship (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: non_existing_schema template: Template 1 @@ -704,7 +704,7 @@ register: cm_query_non_existing_schema - name: Non-existing schema for contract relationship (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: non_existing_schema template: Template 1 @@ -714,7 +714,7 @@ register: nm_query_non_existing_schema - name: Verify cm_query_non_existing_schema and nm_query_non_existing_schema - assert: + ansible.builtin.assert: that: - cm_query_non_existing_schema is not changed - nm_query_non_existing_schema is not changed @@ -722,7 +722,7 @@ - nm_query_non_existing_schema.msg == "Provided schema 'non_existing_schema' does not exist." - name: Non-existing contract schema for contract relationship (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -737,7 +737,7 @@ register: cm_query_non_existing_contract_schema - name: Non-existing schema for contract relationship (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -751,7 +751,7 @@ register: nm_query_non_existing_contract_schema - name: Verify cm_query_non_existing_contract_schema and nm_query_non_existing_contract_schema - assert: + ansible.builtin.assert: that: - cm_query_non_existing_contract_schema is not changed - nm_query_non_existing_contract_schema is not changed @@ -760,7 +760,7 @@ # USE A NON-EXISTING TEMPLATE - name: Non-existing templateName for contract relationship (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -771,7 +771,7 @@ register: cm_query_non_existing_template - name: Non-existing templateName for contract relationship (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: non_existing_template @@ -781,7 +781,7 @@ register: nm_query_non_existing_template - name: Verify cm_query_non_existing_template and nm_query_non_existing_template - assert: + ansible.builtin.assert: that: - cm_query_non_existing_template is not changed - nm_query_non_existing_template is not changed @@ -789,7 +789,7 @@ - nm_query_non_existing_template.msg == "Provided template 'non_existing_template' does not exist. Existing templates{{':'}} Template1, Template2" - name: Non-existing contract templateName for contract relationship (check_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -805,7 +805,7 @@ register: cm_query_non_existing_contract_template - name: Non-existing contract templateName for contract relationship (normal_mode) - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -820,7 +820,7 @@ register: nm_query_non_existing_contract_template - name: Verify cm_query_non_existing_contract_template and nm_query_non_existing_contract_template - assert: + ansible.builtin.assert: that: - cm_query_non_existing_contract_template is not changed - nm_query_non_existing_contract_template is not changed @@ -829,7 +829,7 @@ # Checking if contract are removed after re-applying an VRF. - name: Add VRF again (normal_mode) - mso_schema_template_vrf: + cisco.mso.mso_schema_template_vrf: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -839,12 +839,12 @@ register: nm_add_VRF_again - name: Verify that VRF didn't changed - assert: + ansible.builtin.assert: that: - nm_add_VRF_again is not changed - name: Verify contract VRF again - mso_schema_template_vrf_contract: + cisco.mso.mso_schema_template_vrf_contract: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 @@ -853,7 +853,7 @@ register: nm_query_vrf_contract_again - name: Verify 2 contracts are in VRF - assert: + ansible.builtin.assert: that: - nm_query_vrf_contract_again is not changed - nm_query_vrf_contract_again.current | length == 2
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_validate/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_validate/tasks/main.yml index 9de7d1fb1..54217c8e6 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_validate/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_schema_validate/tasks/main.yml @@ -5,7 +5,7 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_service_node_type/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_service_node_type/tasks/main.yml index d6b25df94..22c497200 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_service_node_type/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_service_node_type/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -40,7 +40,7 @@ check_mode: true - name: Verify node_cm - assert: + ansible.builtin.assert: that: - node_cm is changed - node_cm.current.displayName == "test" @@ -55,7 +55,7 @@ register: node1 - name: Verify node1 - assert: + ansible.builtin.assert: that: - node1 is changed - node1.current.displayName == "test" @@ -69,7 +69,7 @@ register: node2 - name: Verify node2 - assert: + ansible.builtin.assert: that: - node2 is changed - node2.current.displayName == "TEST2" @@ -83,7 +83,7 @@ register: node2_again - name: Verify node2_again - assert: + ansible.builtin.assert: that: - node2_again is not changed - node2_again.current.displayName == "TEST2" @@ -99,7 +99,7 @@ ignore_errors: true - name: Verify node2_different_display_name - assert: + ansible.builtin.assert: that: - node2_different_display_name.msg == "Service Node Type 'TEST1' already exists with display name 'test' which is different from provided display name 'change_test'." @@ -111,7 +111,7 @@ register: query_node1 - name: Verify query_node1 - assert: + ansible.builtin.assert: that: - query_node1 is not changed - query_node1.current.displayName == "test" @@ -124,7 +124,7 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all is not changed - query_all.current | length >= 4 @@ -138,7 +138,7 @@ register: cm_rm - name: Verify cm_rm - assert: + ansible.builtin.assert: that: - cm_rm is changed - cm_rm.previous.name == "TEST1" @@ -151,7 +151,7 @@ register: rm_node1 - name: Verify rm_node1 - assert: + ansible.builtin.assert: that: - rm_node1 is changed - rm_node1.current == {} @@ -166,7 +166,7 @@ ignore_errors: true - name: Verify query_absent - assert: + ansible.builtin.assert: that: - query_absent.msg == "Service Node Type 'TEST1' not found" @@ -178,7 +178,7 @@ register: rm_node2 - name: Verify rm_node2 - assert: + ansible.builtin.assert: that: - rm_node2 is changed - rm_node2.current == {} @@ -192,7 +192,7 @@ register: rm_node2_again - name: Verify rm_node2_again - assert: + ansible.builtin.assert: that: - rm_node2_again is not changed - rm_node2_again.current == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_site/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_site/tasks/main.yml index 9285613cb..0da63e0d0 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_site/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_site/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: site_dict: {} mso_info: &mso_info host: '{{ mso_hostname }}' @@ -23,13 +23,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Undeploy a schema 1 template 1 - mso_schema_template_deploy: &schema_undeploy + cisco.mso.mso_schema_template_deploy: &schema_undeploy <<: *mso_info schema: ansible_test template: Template 1 @@ -41,7 +41,7 @@ - '{{ mso_site | default("ansible_test") }}_2' - name: Undeploy a schema 1 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *schema_undeploy template: Template 2 site: '{{ item }}' @@ -52,7 +52,7 @@ - '{{ mso_site | default("ansible_test") }}_2' - name: Undeploy a schema 2 template 3 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *schema_undeploy schema: ansible_test_2 template: Template 3 @@ -64,7 +64,7 @@ - '{{ mso_site | default("ansible_test") }}_2' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -75,33 +75,32 @@ - 'Schema2' - name: Remove tenant ansible_test - mso_tenant: &tenant_absent + cisco.mso.mso_tenant: &tenant_absent <<: *mso_info tenant: ansible_test state: absent - name: Remove tenant ansible_test2 - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: ansible_test2 register: cm_remove_tenant - name: Remove site - mso_site: &site_absent + cisco.mso.mso_site: &site_absent <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' state: absent - name: Remove site 2 - mso_site: + cisco.mso.mso_site: <<: *site_absent site: '{{ mso_site | default("ansible_test") }}_2' register: cm_remove_site - # ADD SITE - name: Add site (check_mode) - mso_site: &site_present + cisco.mso.mso_site: &site_present <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -121,101 +120,100 @@ register: cm_add_site - name: Verify cm_add_site - assert: + ansible.builtin.assert: that: - cm_add_site is changed - cm_add_site.previous == {} - name: Verify cm_add_site (MSO) - assert: + ansible.builtin.assert: that: - cm_add_site.current.id is not defined - cm_add_site.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify cm_add_site (ND) - assert: + ansible.builtin.assert: that: - cm_add_site.current.id == "" - cm_add_site.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Add site (normal mode) - mso_site: *site_present + cisco.mso.mso_site: *site_present register: nm_add_site - name: Verify nm_add_site - assert: + ansible.builtin.assert: that: - nm_add_site is changed - nm_add_site.previous == {} - name: Verify nm_add_site (MSO) - assert: + ansible.builtin.assert: that: - nm_add_site.current.id is defined - nm_add_site.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify nm_add_site (ND) - assert: + ansible.builtin.assert: that: - nm_add_site.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Add site again (check_mode) - mso_site: *site_present + cisco.mso.mso_site: *site_present check_mode: true register: cm_add_site_again - name: Verify cm_add_site_again - assert: + ansible.builtin.assert: that: - cm_add_site_again is not changed - cm_add_site_again.current.id == nm_add_site.current.id - name: Verify cm_add_site_again (MSO) - assert: + ansible.builtin.assert: that: - cm_add_site_again.previous.name == mso_site|default("ansible_test") - cm_add_site_again.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify cm_add_site_again (ND) - assert: + ansible.builtin.assert: that: - cm_add_site_again.previous.common.name == mso_site|default("ansible_test") - cm_add_site_again.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Add site again (normal mode) - mso_site: *site_present + cisco.mso.mso_site: *site_present register: nm_add_site_again - name: Verify nm_add_site_again - assert: + ansible.builtin.assert: that: - nm_add_site_again is not changed - nm_add_site_again.current.id == nm_add_site.current.id - name: Verify nm_add_site_again (MSO) - assert: + ansible.builtin.assert: that: - nm_add_site_again.previous.name == mso_site|default("ansible_test") - nm_add_site_again.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify nm_add_site_again (ND) - assert: + ansible.builtin.assert: that: - nm_add_site_again.previous.common.name == mso_site|default("ansible_test") - nm_add_site_again.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - # CHANGE SITE - name: Change site (check_mode) - mso_site: + cisco.mso.mso_site: <<: *site_present site: '{{ mso_site | default("ansible_test") }}' apic_login_domain: '{{ apic_login_domain | default("test") }}' @@ -229,12 +227,12 @@ register: cm_change_site - name: Verify cm_change_site - assert: + ansible.builtin.assert: that: - cm_change_site.current.id == nm_add_site.current.id - name: Verify cm_change_site (MSO) - assert: + ansible.builtin.assert: that: - cm_change_site is changed - cm_change_site.current.location.lat == 51.887318 @@ -245,13 +243,13 @@ when: version.current.version is version('3.2', '<') - name: Verify cm_change_site (ND) - assert: + ansible.builtin.assert: that: - cm_change_site.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Change site (normal mode) - mso_site: + cisco.mso.mso_site: <<: *site_present site: '{{ mso_site | default("ansible_test") }}' apic_login_domain: '{{ apic_login_domain | default("test") }}' @@ -265,12 +263,12 @@ register: nm_change_site - name: Verify nm_change_site - assert: + ansible.builtin.assert: that: - nm_change_site.current.id == nm_add_site.current.id - name: Verify nm_change_site (MSO) - assert: + ansible.builtin.assert: that: - nm_change_site is changed - nm_change_site.current.location.lat == 51.887318 @@ -281,13 +279,13 @@ when: version.current.version is version('3.2', '<') - name: Verify nm_change_site (ND) - assert: + ansible.builtin.assert: that: - nm_change_site.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Change site again (check_mode) - mso_site: + cisco.mso.mso_site: <<: *site_present site: '{{ mso_site | default("ansible_test") }}' apic_login_domain: '{{ apic_login_domain | default("test") }}' @@ -301,13 +299,13 @@ register: cm_change_site_again - name: Verify cm_change_site_again - assert: + ansible.builtin.assert: that: - cm_change_site_again is not changed - cm_change_site_again.current.id == nm_add_site.current.id - name: Verify cm_change_site_again (MSO) - assert: + ansible.builtin.assert: that: - cm_change_site_again.current.location.lat == 51.887318 - cm_change_site_again.current.location.long == 5.447084 @@ -317,13 +315,13 @@ when: version.current.version is version('3.2', '<') - name: Verify cm_change_site_again (ND) - assert: + ansible.builtin.assert: that: - cm_change_site_again.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') - name: Change site again (normal mode) - mso_site: + cisco.mso.mso_site: <<: *site_present site: '{{ mso_site | default("ansible_test") }}' apic_login_domain: '{{ apic_login_domain | default("test") }}' @@ -337,13 +335,13 @@ register: nm_change_site_again - name: Verify nm_change_site_again - assert: + ansible.builtin.assert: that: - nm_change_site_again is not changed - nm_change_site_again.current.id == nm_add_site.current.id - name: Verify nm_change_site_again (MSO) - assert: + ansible.builtin.assert: that: - nm_change_site_again.current.location.lat == 51.887318 - nm_change_site_again.current.location.long == 5.447084 @@ -353,48 +351,47 @@ when: version.current.version is version('3.2', '<') - name: Verify nm_change_site_again (ND) - assert: + ansible.builtin.assert: that: - nm_change_site_again.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') # QUERY ALL SITES - name: Query all sites (check_mode) - mso_site: &site_query + cisco.mso.mso_site: &site_query <<: *mso_info state: query check_mode: true register: cm_query_all_sites - name: Query all sites (normal mode) - mso_site: *site_query + cisco.mso.mso_site: *site_query register: nm_query_all_sites - name: Verify query_all_sites - assert: + ansible.builtin.assert: that: - cm_query_all_sites is not changed - nm_query_all_sites is not changed # NOTE: Order of sites is not stable between calls #- cm_query_all_sites == nm_query_all_sites - # QUERY A SITE - name: Query our site - mso_site: + cisco.mso.mso_site: <<: *site_query site: '{{ mso_site | default("ansible_test") }}' check_mode: true register: cm_query_site - name: Query our site - mso_site: + cisco.mso.mso_site: <<: *site_query site: '{{ mso_site | default("ansible_test") }}' register: nm_query_site - name: Verify query_site - assert: + ansible.builtin.assert: that: - cm_query_site is not changed - cm_query_site.current.id == nm_add_site.current.id @@ -403,14 +400,14 @@ - cm_query_site == nm_query_site - name: Verify query_site (MSO) - assert: + ansible.builtin.assert: that: - cm_query_site.current.name == mso_site|default("ansible_test") - nm_query_site.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify query_site (ND) - assert: + ansible.builtin.assert: that: - cm_query_site.current.common.name == mso_site|default("ansible_test") - nm_query_site.current.common.name == mso_site|default("ansible_test") @@ -418,65 +415,64 @@ # REMOVE SITE - name: Remove site (check_mode) - mso_site: *site_absent + cisco.mso.mso_site: *site_absent check_mode: true register: cm_remove_site - name: Verify cm_remove_site - assert: + ansible.builtin.assert: that: - cm_remove_site is changed - cm_remove_site.current == {} - name: Remove site (normal mode) - mso_site: *site_absent + cisco.mso.mso_site: *site_absent register: nm_remove_site - name: Verify nm_remove_site - assert: + ansible.builtin.assert: that: - nm_remove_site is changed - nm_remove_site.current == {} - name: Remove site again (check_mode) - mso_site: *site_absent + cisco.mso.mso_site: *site_absent check_mode: true register: cm_remove_site_again - name: Verify cm_remove_site_again - assert: + ansible.builtin.assert: that: - cm_remove_site_again is not changed - cm_remove_site_again.current == {} - name: Remove site again (normal mode) - mso_site: *site_absent + cisco.mso.mso_site: *site_absent register: nm_remove_site_again - name: Verify nm_remove_site_again - assert: + ansible.builtin.assert: that: - nm_remove_site_again is not changed - nm_remove_site_again.current == {} - # QUERY NON-EXISTING SITE - name: Query non-existing site (check_mode) - mso_site: + cisco.mso.mso_site: <<: *site_query site: '{{ mso_site | default("ansible_test") }}' check_mode: true register: cm_query_non_site - name: Query non-existing site (normal mode) - mso_site: + cisco.mso.mso_site: <<: *site_query site: '{{ mso_site | default("ansible_test") }}' register: nm_query_non_site # TODO: Implement more tests - name: Verify query_non_site - assert: + ansible.builtin.assert: that: - cm_query_non_site is not changed - nm_query_non_site is not changed @@ -484,7 +480,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for site (check_mode) - mso_site: + cisco.mso.mso_site: <<: *site_query state: non-existing-state check_mode: true @@ -492,14 +488,14 @@ register: cm_non_existing_state - name: Non-existing state for bd (normal_mode) - mso_site: + cisco.mso.mso_site: <<: *site_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -508,7 +504,7 @@ # ADD SITE - name: Add site (normal_mode) - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -521,20 +517,20 @@ register: nm_add_site_no_location - name: Verify nm_add_site_no_location - assert: + ansible.builtin.assert: that: - nm_add_site_no_location is changed - nm_add_site_no_location.previous == {} - nm_add_site_no_location.current.id is defined - name: Verify nm_add_site_no_location (MSO) - assert: + ansible.builtin.assert: that: - nm_add_site_no_location.current.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '<') - name: Verify nm_add_site_no_location (ND) - assert: + ansible.builtin.assert: that: - nm_add_site_no_location.current.common.name == mso_site|default("ansible_test") when: version.current.version is version('3.2', '>=') @@ -543,18 +539,18 @@ when: version.current.version is version('4.0', '>=') block: - name: Query all sites (check_mode) - mso_site: + cisco.mso.mso_site: <<: *mso_info state: query register: sites - name: Add sites to dict - set_fact: + ansible.builtin.set_fact: site_dict: "{{ site_dict | combine( { item.common.name : { 'id' : item.id, 'site_group_id' : item.common.siteGroup } } ) }}" loop: "{{ sites.current }}" - name: Render a connectivity jinja2 template - set_fact: + ansible.builtin.set_fact: site_payload: "{{ lookup('template', 'connectivity.j2') }}" - name: Configure site connectivity diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant/tasks/main.yml index e5cc5a0e6..88a12ee95 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant/tasks/main.yml @@ -4,14 +4,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,7 +22,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Ensure sites exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ item.site }}' apic_username: '{{ item.username }}' @@ -36,7 +36,7 @@ - { site: 'aws_{{ mso_site | default("ansible_test") }}', username: '{{ aws_apic_username }}', password: '{{ aws_apic_password }}', id: '{{ aws_site_id | default(102) }}', urls: '{{ aws_apic_hostname }}' } - name: Undeploy a schema 1 template 1 - mso_schema_template_deploy: &schema_undeploy + cisco.mso.mso_schema_template_deploy: &schema_undeploy <<: *mso_info schema: ansible_test template: Template 1 @@ -48,7 +48,7 @@ - 'aws_{{ mso_site | default("ansible_test") }}' - name: Undeploy a schema 1 template 2 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *schema_undeploy template: Template 2 site: '{{ item }}' @@ -59,7 +59,7 @@ - 'aws_{{ mso_site | default("ansible_test") }}' - name: Undeploy a schema 2 template 3 - mso_schema_template_deploy: + cisco.mso.mso_schema_template_deploy: <<: *schema_undeploy schema: ansible_test_2 template: Template 3 @@ -71,7 +71,7 @@ - 'aws_{{ mso_site | default("ansible_test") }}' - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -80,7 +80,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Remove tenants - mso_tenant: &tenant_absent + cisco.mso.mso_tenant: &tenant_absent <<: *mso_info tenant: '{{ item }}' state: absent @@ -92,7 +92,7 @@ # ADD TENANT - name: Add tenant (check_mode) - mso_tenant: &tenant_present + cisco.mso.mso_tenant: &tenant_present <<: *mso_info tenant: ansible_test display_name: Ansible test title @@ -102,7 +102,7 @@ register: cm_add_tenant - name: Verify cm_add_tenant - assert: + ansible.builtin.assert: that: - cm_add_tenant is changed - cm_add_tenant.previous == {} @@ -112,11 +112,11 @@ - cm_add_tenant.current.userAssociations | length == 1 - name: Add tenant (normal mode) - mso_tenant: *tenant_present + cisco.mso.mso_tenant: *tenant_present register: nm_add_tenant - name: Verify nm_add_tenant - assert: + ansible.builtin.assert: that: - nm_add_tenant is changed - nm_add_tenant.previous == {} @@ -126,12 +126,12 @@ - nm_add_tenant.current.userAssociations | length == 1 - name: Add tenant again (check_mode) - mso_tenant: *tenant_present + cisco.mso.mso_tenant: *tenant_present check_mode: true register: cm_add_tenant_again - name: Verify cm_add_tenant_again - assert: + ansible.builtin.assert: that: - cm_add_tenant_again is not changed - cm_add_tenant_again.previous.name == 'ansible_test' @@ -142,11 +142,11 @@ - cm_add_tenant_again.current.userAssociations == cm_add_tenant_again.previous.userAssociations - name: Add tenant again (normal mode) - mso_tenant: *tenant_present + cisco.mso.mso_tenant: *tenant_present register: nm_add_tenant_again - name: Verify nm_add_tenant_again - assert: + ansible.builtin.assert: that: - nm_add_tenant_again is not changed - nm_add_tenant_again.previous.name == 'ansible_test' @@ -158,7 +158,7 @@ # ADD TENANT WITH USERS - name: Add tenant 2 (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test2 users: @@ -168,24 +168,24 @@ register: nm_add_tenant2 - name: Verify nm_add_tenant2 - assert: + ansible.builtin.assert: that: - nm_add_tenant2 is changed - name: Verify nm_add_tenant2 (when mso_username != admin) - assert: + ansible.builtin.assert: that: - nm_add_tenant2.current.userAssociations | length == 2 when: mso_username != 'admin' - name: Verify nm_add_tenant2 (when mso_username == admin) - assert: + ansible.builtin.assert: that: - nm_add_tenant2.current.userAssociations | length == 1 when: mso_username == 'admin' - name: Add tenant 2 again (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test2 users: @@ -195,24 +195,59 @@ register: nm_add_tenant2_again - name: Verify nm_add_tenant2_again - assert: + ansible.builtin.assert: that: - nm_add_tenant2_again is not changed - name: Verify nm_add_tenant2_again (when mso_username != admin) - assert: + ansible.builtin.assert: that: - nm_add_tenant2_again.current.userAssociations | length == 2 when: mso_username != 'admin' - name: Verify nm_add_tenant2_again (when mso_username == admin) - assert: + ansible.builtin.assert: that: - nm_add_tenant2_again.current.userAssociations | length == 1 when: mso_username == 'admin' +# ADD TENANT WITH REMOTE USERS +- name: Add tenant 3 (check_mode) + cisco.mso.mso_tenant: + <<: *tenant_present + tenant: ansible_test3 + display_name: null + remote_users: + - name: ansible_github_ci + login_domain: test + state: present + check_mode: true + register: cm_add_rmt_usr_tenant3 + +- name: Verify cm_add_rmt_usr_tenant3 + ansible.builtin.assert: + that: + - cm_add_rmt_usr_tenant3 is changed + +- name: Add tenant 3 (normal_mode) + cisco.mso.mso_tenant: + <<: *tenant_present + tenant: ansible_test3 + display_name: null + remote_users: + - name: ansible_github_ci + login_domain: test + state: present + register: nm_add_rmt_usr_tenant3 + +- name: Verify cm_add_rmt_usr_tenant3 + ansible.builtin.assert: + that: + - nm_add_rmt_usr_tenant3 is changed + - nm_add_rmt_usr_tenant3.current.name == 'ansible_test3' + - name: Add tenant 3 with duplicate admin user (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test3 users: @@ -224,13 +259,13 @@ register: nm_add_tenant3_with_duplicate_admin - name: Verify nm_add_tenant3_with_duplicate_admin - assert: + ansible.builtin.assert: that: - - nm_add_tenant3_with_duplicate_admin is not changed + - nm_add_tenant3_with_duplicate_admin is changed - nm_add_tenant3_with_duplicate_admin.msg == "User 'admin' is duplicate." - name: Add tenant 3 with invalid user (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test3 users: @@ -241,41 +276,44 @@ register: nm_add_tenant3_with_invalid_user - name: nm_add_tenant3_with_invalid_user - assert: + ansible.builtin.assert: that: - nm_add_tenant3_with_invalid_user is not changed - nm_add_tenant3_with_invalid_user.msg == "User 'invalid user' is not a valid user name." - name: Add tenant 3 (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test3 users: - '{{ mso_username }}' + remote_users: + - name: ansible_github_ci + login_domain: test display_name: null state: present register: nm_add_tenant3 - name: Verify nm_add_tenant3 - assert: + ansible.builtin.assert: that: - nm_add_tenant3 is changed - name: Verify nm_add_tenant3 (when mso_username != admin) - assert: + ansible.builtin.assert: that: - - nm_add_tenant3.current.userAssociations | length == 2 + - nm_add_tenant3.current.userAssociations | length == 3 when: mso_username != 'admin' - name: Verify nm_add_tenant3 (when mso_username == admin) - assert: + ansible.builtin.assert: that: - nm_add_tenant3.current.userAssociations | length == 1 when: mso_username == 'admin' # CHANGE TENANT - name: Change tenant (check_mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test description: Ansible test tenant 2 @@ -283,7 +321,7 @@ register: cm_change_tenant - name: Verify cm_change_tenant - assert: + ansible.builtin.assert: that: - cm_change_tenant is changed - cm_change_tenant.current.id == nm_add_tenant.current.id @@ -291,7 +329,7 @@ - cm_change_tenant.current.description == 'Ansible test tenant 2' - name: Change tenant (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test description: Ansible test tenant 2 @@ -299,7 +337,7 @@ register: nm_change_tenant - name: Verify nm_change_tenant - assert: + ansible.builtin.assert: that: - nm_change_tenant is changed - nm_change_tenant.current.id == nm_add_tenant.current.id @@ -307,7 +345,7 @@ - nm_change_tenant.current.description == 'Ansible test tenant 2' - name: Change tenant again (check_mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test description: Ansible test tenant 2 @@ -315,7 +353,7 @@ register: cm_change_tenant_again - name: Verify cm_change_tenant_again - assert: + ansible.builtin.assert: that: - cm_change_tenant_again is not changed - cm_change_tenant_again.current.id == nm_add_tenant.current.id @@ -323,58 +361,56 @@ - cm_change_tenant_again.current.description == 'Ansible test tenant 2' - name: Change tenant again (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: ansible_test description: Ansible test tenant 2 register: nm_change_tenant_again - name: Verify nm_change_tenant_again - assert: + ansible.builtin.assert: that: - nm_change_tenant_again is not changed - nm_change_tenant_again.current.id == nm_add_tenant.current.id - nm_change_tenant_again.current.name == 'ansible_test' - nm_change_tenant_again.current.description == 'Ansible test tenant 2' - # QUERY ALL TENANTS - name: Query all tenants (check_mode) - mso_tenant: &tenant_query + cisco.mso.mso_tenant: &tenant_query <<: *mso_info state: query check_mode: true register: cm_query_all_tenants - name: Query all tenants (normal mode) - mso_tenant: *tenant_query + cisco.mso.mso_tenant: *tenant_query register: nm_query_all_tenants - name: Verify query_all_tenants - assert: + ansible.builtin.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 - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_query tenant: ansible_test check_mode: true register: cm_query_tenant - name: Query our tenant - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_query tenant: ansible_test register: nm_query_tenant - name: Verify query_tenant - assert: + ansible.builtin.assert: that: - cm_query_tenant is not changed - cm_query_tenant.current.id == nm_add_tenant.current.id @@ -386,83 +422,81 @@ - nm_query_tenant.current.description == 'Ansible test tenant 2' - cm_query_tenant.current == nm_query_tenant.current - # REMOVE TENANT - name: Remove tenant (check_mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: ansible_test check_mode: true register: cm_remove_tenant - name: Verify cm_remove_tenant - assert: + ansible.builtin.assert: that: - cm_remove_tenant is changed - cm_remove_tenant.current == {} - name: Remove tenant (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: ansible_test register: nm_remove_tenant - name: Verify nm_remove_tenant - assert: + ansible.builtin.assert: that: - nm_remove_tenant is changed - nm_remove_tenant.current == {} - name: Remove tenant again (check_mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: ansible_test check_mode: true register: cm_remove_tenant_again - name: Verify cm_remove_tenant_again - assert: + ansible.builtin.assert: that: - cm_remove_tenant_again is not changed - cm_remove_tenant_again.current == {} - name: Remove tenant again (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: ansible_test register: nm_remove_tenant_again - name: Verify nm_remove_tenant_again - assert: + ansible.builtin.assert: that: - nm_remove_tenant_again is not changed - nm_remove_tenant_again.current == {} - # QUERY NON-EXISTING TENANT - name: Query non-existing tenant (check_mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_query tenant: ansible_test check_mode: true register: cm_query_non_tenant - name: Query non-existing tenant (normal mode) - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_query tenant: ansible_test register: nm_query_non_tenant # TODO: Implement more tests - name: Verify query_non_tenant - assert: + ansible.builtin.assert: that: - cm_query_non_tenant is not changed - nm_query_non_tenant is not changed - cm_query_non_tenant.current == nm_query_non_tenant.current - name: Add common tenant - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: common display_name: common @@ -470,13 +504,13 @@ register: nm_add_common_tenant - name: Verify nm_add_common_tenant - assert: + ansible.builtin.assert: that: - nm_add_common_tenant is changed - nm_add_common_tenant.current.name == "common" - name: Add tenant with site - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_present tenant: tenant_with_site display_name: tenant_with_site @@ -484,37 +518,37 @@ register: nm_add_tenant_with_site - name: Verify nm_add_tenant_with_site - assert: + ansible.builtin.assert: that: - nm_add_tenant_with_site is changed - nm_add_tenant_with_site.current.name == "tenant_with_site" - name: Remove common tenant - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: common ignore_errors: true register: rm_common - name: Verify rm_common - assert: + ansible.builtin.assert: that: - rm_common.msg is search("Common [Tt]enant cannot be deleted") - name: Remove tenant_with_site - mso_tenant: + cisco.mso.mso_tenant: <<: *tenant_absent tenant: tenant_with_site register: rm_tenant_with_site - name: Verify rm_tenant_with_site - assert: + ansible.builtin.assert: that: - rm_tenant_with_site is changed - rm_tenant_with_site.current == {} - name: Remove "anstest_imp_tenant" to the MSO if exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: anstest_imp_tenant display_name: anstest_imp_tenant_display_name @@ -524,7 +558,7 @@ register: pre_test_anstest_imp_tenant_absent - name: Import "anstest_imp_tenant" to the MSO with check mode - mso_tenant: &cm_import_anstest_imp_tenant_present + cisco.mso.mso_tenant: &cm_import_anstest_imp_tenant_present <<: *mso_info tenant: anstest_imp_tenant display_name: anstest_imp_tenant_display_name @@ -535,7 +569,7 @@ register: cm_import_anstest_imp_tenant_present - name: Assertions check for import "anstest_imp_tenant" to the MSO with check mode - assert: + ansible.builtin.assert: that: - cm_import_anstest_imp_tenant_present is changed - cm_import_anstest_imp_tenant_present.current != {} @@ -545,12 +579,12 @@ - cm_import_anstest_imp_tenant_present.current.description == "anstest_imp_tenant_description" - name: Import "anstest_imp_tenant" to the MSO with normal mode - mso_tenant: &nm_import_anstest_imp_tenant_present + cisco.mso.mso_tenant: &nm_import_anstest_imp_tenant_present <<: *cm_import_anstest_imp_tenant_present register: nm_import_anstest_imp_tenant_present - name: Assertions check for import "anstest_imp_tenant" to the MSO with normal mode - assert: + ansible.builtin.assert: that: - nm_import_anstest_imp_tenant_present is changed - nm_import_anstest_imp_tenant_present.current != {} @@ -560,12 +594,12 @@ - nm_import_anstest_imp_tenant_present.current.description == "anstest_imp_tenant_description" - name: Import "anstest_imp_tenant" to the MSO with normal mode - idempotency works - mso_tenant: + cisco.mso.mso_tenant: <<: *nm_import_anstest_imp_tenant_present register: idempotency_nm_import_anstest_imp_tenant_present - name: Idempotency assertions check for import "anstest_imp_tenant" to the MSO with normal mode - assert: + ansible.builtin.assert: that: - idempotency_nm_import_anstest_imp_tenant_present is not changed - idempotency_nm_import_anstest_imp_tenant_present.current != {} @@ -578,14 +612,14 @@ - idempotency_nm_import_anstest_imp_tenant_present.previous.description == "anstest_imp_tenant_description" - name: Query a tenant with name "anstest_imp_tenant" when it is imported to the MSO - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: anstest_imp_tenant state: query register: query_anstest_imp_tenant - name: Assertions check for query a tenant with name "anstest_imp_tenant" when it is imported to the MSO - assert: + ansible.builtin.assert: that: - query_anstest_imp_tenant is not changed - query_anstest_imp_tenant.current != {} @@ -594,7 +628,7 @@ - query_anstest_imp_tenant.current.description == "anstest_imp_tenant_description" - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with check mode - mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_yes + cisco.mso.mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_yes <<: *mso_info tenant: anstest_imp_tenant orchestrator_only: yes @@ -603,7 +637,7 @@ register: cm_anstest_imp_tenant_absent_orchestrator_only_yes - name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with check mode - assert: + ansible.builtin.assert: that: - cm_anstest_imp_tenant_absent_orchestrator_only_yes is changed - cm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} @@ -613,12 +647,12 @@ - cm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.description == "anstest_imp_tenant_description" - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode - mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_yes + cisco.mso.mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_yes <<: *cm_anstest_imp_tenant_absent_orchestrator_only_yes register: nm_anstest_imp_tenant_absent_orchestrator_only_yes - name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode - assert: + ansible.builtin.assert: that: - nm_anstest_imp_tenant_absent_orchestrator_only_yes is changed - nm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} @@ -628,24 +662,24 @@ - nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous.description == "anstest_imp_tenant_description" - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode - idempotency works - mso_tenant: + cisco.mso.mso_tenant: <<: *nm_anstest_imp_tenant_absent_orchestrator_only_yes register: idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes - name: Idempotency assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value yes with normal mode - assert: + ansible.builtin.assert: that: - idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes is not changed - idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes.current == {} - idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_yes.previous == {} - name: Import "anstest_imp_tenant" to the MSO with normal mode once again - mso_tenant: + cisco.mso.mso_tenant: <<: *nm_import_anstest_imp_tenant_present register: nm_import_tenant_once_again - name: Assertions check for import "anstest_imp_tenant" to the MSO with normal mode once again - assert: + ansible.builtin.assert: that: - nm_import_tenant_once_again is changed - nm_import_tenant_once_again.current != {} @@ -655,14 +689,14 @@ - nm_import_tenant_once_again.current.description == "anstest_imp_tenant_description" - name: Update "anstest_imp_tenant" tenant description with check mode - mso_tenant: &cm_update_anstest_imp_tenant + cisco.mso.mso_tenant: &cm_update_anstest_imp_tenant <<: *nm_import_anstest_imp_tenant_present description: "updated_anstest_imp_tenant_description" check_mode: true register: cm_update_anstest_imp_tenant - name: Assertions check for update "anstest_imp_tenant" tenant description with check mode - assert: + ansible.builtin.assert: that: - cm_update_anstest_imp_tenant is changed - cm_update_anstest_imp_tenant.current != {} @@ -675,12 +709,12 @@ - cm_update_anstest_imp_tenant.previous.description == "anstest_imp_tenant_description" - name: Update "anstest_imp_tenant" tenant description with normal mode - mso_tenant: &nm_update_anstest_imp_tenant + cisco.mso.mso_tenant: &nm_update_anstest_imp_tenant <<: *cm_update_anstest_imp_tenant register: nm_update_anstest_imp_tenant - name: Assertions check for update "anstest_imp_tenant" tenant description with normal mode - assert: + ansible.builtin.assert: that: - nm_update_anstest_imp_tenant is changed - nm_update_anstest_imp_tenant.current != {} @@ -693,12 +727,12 @@ - nm_update_anstest_imp_tenant.previous.description == "anstest_imp_tenant_description" - name: Update "anstest_imp_tenant" tenant description with normal mode - idempotency works - mso_tenant: + cisco.mso.mso_tenant: <<: *nm_update_anstest_imp_tenant register: nm_idempotency_update_anstest_imp_tenant - name: Idempotency assertions check for update "anstest_imp_tenant" tenant description with normal mode - assert: + ansible.builtin.assert: that: - nm_idempotency_update_anstest_imp_tenant is not changed - nm_idempotency_update_anstest_imp_tenant.current != {} @@ -712,7 +746,7 @@ # Orchestrator Only no will remove the tenant from MSO and APIC - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with check mode - mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_no + cisco.mso.mso_tenant: &cm_anstest_imp_tenant_absent_orchestrator_only_no <<: *mso_info tenant: anstest_imp_tenant orchestrator_only: no @@ -721,7 +755,7 @@ register: cm_anstest_imp_tenant_absent_orchestrator_only_no - name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with check mode - assert: + ansible.builtin.assert: that: - cm_anstest_imp_tenant_absent_orchestrator_only_no is changed - cm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} @@ -731,12 +765,12 @@ - cm_anstest_imp_tenant_absent_orchestrator_only_no.previous.description == "updated_anstest_imp_tenant_description" - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode - mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_no + cisco.mso.mso_tenant: &nm_anstest_imp_tenant_absent_orchestrator_only_no <<: *cm_anstest_imp_tenant_absent_orchestrator_only_no register: nm_anstest_imp_tenant_absent_orchestrator_only_no - name: Assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode - assert: + ansible.builtin.assert: that: - nm_anstest_imp_tenant_absent_orchestrator_only_no is changed - nm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} @@ -746,12 +780,12 @@ - nm_anstest_imp_tenant_absent_orchestrator_only_no.previous.description == "updated_anstest_imp_tenant_description" - name: Remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode - idempotency works - mso_tenant: + cisco.mso.mso_tenant: <<: *nm_anstest_imp_tenant_absent_orchestrator_only_no register: idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no - name: Idempotency assertions check for remove "anstest_imp_tenant" tenant from MSO and APIC using orchestrator_only flag value no with normal mode - assert: + ansible.builtin.assert: that: - idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no is not changed - idempotency_nm_anstest_imp_tenant_absent_orchestrator_only_no.current == {} diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant_site/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant_site/tasks/main.yml index 7e3ce378c..0bb711447 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant_site/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_tenant_site/tasks/main.yml @@ -6,14 +6,14 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -24,13 +24,13 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version - name: Remove schemas - mso_schema: + cisco.mso.mso_schema: <<: *mso_info schema: '{{ item }}' state: absent @@ -39,7 +39,7 @@ - '{{ mso_schema | default("ansible_test") }}' - name: Ensure tenant ansible_test exists to validate the invalid_site_mso_site - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -48,7 +48,7 @@ register: ansible_test_tenant_present - name: Dissociate clouds that are associated with ansible_tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ item }}' @@ -62,7 +62,7 @@ when: ansible_test_tenant_present.current != {} - name: Assertion check for the tenant site dissociation - assert: + ansible.builtin.assert: that: - tenant_site_absent_check.results.0.current == {} - tenant_site_absent_check.warnings.0 == "Site 'invalid_site_ansible_test' is not a valid site name." @@ -72,7 +72,7 @@ when: ansible_test_tenant_present.current != {} - name: Remove tenant ansible_test - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -80,7 +80,7 @@ state: absent - name: Ensure non-cloud site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' apic_username: '{{ apic_username }}' @@ -91,7 +91,7 @@ state: present - name: Ensure azure site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'azure_{{ mso_site | default("ansible_test") }}' apic_username: '{{ azure_apic_username }}' @@ -102,7 +102,7 @@ state: present - name: Ensure aws site exists - mso_site: + cisco.mso.mso_site: <<: *mso_info site: 'aws_{{ mso_site | default("ansible_test") }}' apic_username: '{{ aws_apic_username }}' @@ -113,7 +113,7 @@ state: present - name: Ensure tenant ansible_test exists - mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -121,7 +121,7 @@ state: present - name: Associate non-cloud site with ansible_test in check mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -130,12 +130,12 @@ register: ncs_cm - name: Verify ncs_cm - assert: + ansible.builtin.assert: that: - ncs_cm is changed - name: Associate non-cloud site with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -143,12 +143,12 @@ register: ncs_nm - name: Verify ncs_nm - assert: + ansible.builtin.assert: that: - ncs_nm is changed - name: Associate non-cloud site with ansible_test again in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -156,12 +156,12 @@ register: ncs_nm_again - name: Verify ncs_nm_again - assert: + ansible.builtin.assert: that: - ncs_nm_again is not changed - name: Associate aws site with ansible_test in check mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -174,7 +174,7 @@ register: aaws_cm - name: Verify aaws_cm - assert: + ansible.builtin.assert: that: - aaws_cm is changed - aaws_cm.current.awsAccount != 'null' @@ -182,7 +182,7 @@ - aaws_cm.current.awsAccount[0].isTrusted == false - name: Associate aws site with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -194,7 +194,7 @@ register: aaws_nm - name: Verify aaws_nm - assert: + ansible.builtin.assert: that: - aaws_nm is changed - aaws_nm.current.awsAccount != 'null' @@ -202,7 +202,7 @@ - aaws_nm.current.awsAccount[0].isTrusted == false - name: Associate aws site with ansible_test again in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -214,12 +214,12 @@ register: aaws_nm_again - name: Verify aaws_nm_again - assert: + ansible.builtin.assert: that: - aaws_nm_again is not changed - name: Associate aws site with ansible_test in normal mode when aws_trusted is false and aws_access_key is missing - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -231,12 +231,12 @@ register: aaws_nm_ak - name: Verify aaws_nm_ak - assert: + ansible.builtin.assert: that: - aaws_nm_ak.msg is match ("aws_access_key is a required field in untrusted mode.") - name: Associate aws site with ansible_test in normal mode when aws_trusted is true - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -246,12 +246,12 @@ register: aws_nm_trusted - name: Verify aws_nm_trusted - assert: + ansible.builtin.assert: that: - aws_nm_trusted is changed - name: Associate aws site with ansible_test in normal mode when aws_trusted is false and secret_key is missing - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -263,12 +263,12 @@ register: aaws_nm_sk - name: Verify aaws_nm_sk - assert: + ansible.builtin.assert: that: - aaws_nm_sk.msg is match ("secret_key is a required field in untrusted mode.") - name: Associate aws site with ansible_test, with organization mode true - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -281,12 +281,12 @@ register: aaws_nm_om - name: Verify aaws_nm_om - assert: + ansible.builtin.assert: that: - aaws_nm_om.current.awsAccount[0].isAccountInOrg == true - name: Associate azure site with access_type not present, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -295,12 +295,12 @@ register: aazure_shared_nm - name: Verify aazure_shared_nm - assert: + ansible.builtin.assert: that: - aazure_shared_nm is changed - name: Associate azure site in shared mode with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -310,12 +310,12 @@ register: aazure_shared_nm - name: Verify aazure_shared_nm - assert: + ansible.builtin.assert: that: - aazure_shared_nm is not changed - name: Associate azure site with managed mode, with ansible_test in normal mode having no application_id - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -327,12 +327,12 @@ register: aazure_managed_nm_app - name: Verify aazure_managed_nm_app - assert: + ansible.builtin.assert: that: - aazure_managed_nm_app.msg is match ("azure_application_id is required when in managed mode.") - name: Associate azure site with managed mode, with ansible_test in normal mode having no subscription_id - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -344,12 +344,12 @@ register: aazure_managed_nm_si - name: Verify aazure_managed_nm_si - assert: + ansible.builtin.assert: that: - aazure_managed_nm_si.msg is match ("azure_susbscription_id is required when in managed mode.") - name: Associate azure site with managed mode, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -362,7 +362,7 @@ register: aazure_managed_nm - name: Verify aazure_managed_nm - assert: + ansible.builtin.assert: that: - aazure_managed_nm is changed - aazure_managed_nm.current.azureAccount != 'null' @@ -372,7 +372,7 @@ - aazure_managed_nm.current.azureAccount[0].cloudActiveDirectory == [] - name: Associate azure site with credentials mode, with ansible_test in normal mode having no azure_subscription_id - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -388,12 +388,12 @@ register: aazure_credentials_nm_si - name: Verify aazure_credentials_nm_si - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_si.msg is match ("azure_subscription_id is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode having no azure_application_id - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -409,12 +409,12 @@ register: aazure_credentials_nm_app - name: Verify aazure_credentials_nm_app - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_app.msg is match ("azure_application_id is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode having no secret_key - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -430,12 +430,12 @@ register: aazure_credentials_nm_secret - name: Verify aazure_credentials_nm_secret - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_secret.msg is match ("secret_key is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode having no azure_active_directory_id - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -451,12 +451,12 @@ register: aazure_credentials_nm_ad - name: Verify aazure_credentials_nm_ad - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_ad.msg is match ("azure_active_directory_id is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode having no azure_active_directory_name - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -472,12 +472,12 @@ register: aazure_credentials_nm_adn - name: Verify aazure_credentials_nm_adn - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_adn.msg is match ("azure_active_directory_name is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode having no azure_credential_name - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -493,12 +493,12 @@ register: aazure_credentials_nm_cdn - name: Verify aazure_credentials_nm_cdn - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_cdn.msg is match ("azure_credential_name is required when in unmanaged mode.") - name: Associate azure site with credentials mode, with ansible_test in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -514,7 +514,7 @@ register: aazure_credentials_nm - name: Verify aazure_credentials_nm - assert: + ansible.builtin.assert: that: - aazure_credentials_nm is changed - aazure_credentials_nm.current.azureAccount[0].cloudSubscription.cloudApplicationId == '100' @@ -526,7 +526,7 @@ - aazure_credentials_nm.current.azureAccount[0].cloudApplication[0].cloudCredentialName == 'cApicApp' - name: Associate azure site with credentials mode, with ansible_test again in normal mode - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -542,12 +542,12 @@ register: aazure_credentials_nm_again - name: Verify aazure_credentials_nm_again - assert: + ansible.builtin.assert: that: - aazure_credentials_nm_again is not changed - name: Query associated non-cloud site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -555,12 +555,12 @@ register: anc_query - name: Verify anc_query - assert: + ansible.builtin.assert: that: - anc_query is not changed - name: Query associated azure site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -576,12 +576,12 @@ register: aazure_query - name: Verify aazure_query - assert: + ansible.builtin.assert: that: - aazure_query is not changed - name: Query associated aws site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -589,24 +589,24 @@ register: aaws_query - name: Verify aaws_query - assert: + ansible.builtin.assert: that: - aaws_query is not changed - name: Query all associated sites of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test state: query register: all_sites_query - name: Verify all_sites_query - assert: + ansible.builtin.assert: that: - all_sites_query is not changed - name: Dissociate non-cloud site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -614,12 +614,12 @@ register: dnc - name: Verify dnc - assert: + ansible.builtin.assert: that: - dnc is changed - name: Query dissociated non-cloud site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' @@ -628,12 +628,12 @@ register: dnc_query - name: Verify dnc_query - assert: + ansible.builtin.assert: that: - dnc_query.msg is match ("Site Id [0-9a-zA-Z]* not associated with tenant Id [0-9a-zA-Z]*") - name: Dissociate azure site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -641,12 +641,12 @@ register: dazure - name: Verify dazure - assert: + ansible.builtin.assert: that: - dazure is changed - name: Query dissociated azure site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'azure_{{ mso_site | default("ansible_test") }}' @@ -655,12 +655,12 @@ register: dazure_query - name: Verify dnc_query - assert: + ansible.builtin.assert: that: - dazure_query.msg is match ("Site Id [0-9a-zA-Z]* not associated with tenant Id [0-9a-zA-Z]*") - name: Dissociate aws site with ansible_test - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -668,12 +668,12 @@ register: daaws - name: Verify daaws - assert: + ansible.builtin.assert: that: - daaws is changed - name: Query dissociated aws site of a tenant - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: 'aws_{{ mso_site | default("ansible_test") }}' @@ -682,12 +682,12 @@ register: daaws_query - name: Verify daaws_query - assert: + ansible.builtin.assert: that: - daaws_query.msg is match ("No site associated with tenant Id [0-9a-zA-Z]*") - name: Query all - mso_tenant_site: + cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test state: query @@ -695,6 +695,6 @@ register: query_all - name: Verify query_all - assert: + ansible.builtin.assert: that: - query_all.msg is match ("No site associated with tenant Id [0-9a-zA-Z]*")
\ No newline at end of file diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_user/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_user/tasks/main.yml index 2aa2d2bf6..1a51e8a0e 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_user/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_user/tasks/main.yml @@ -4,12 +4,12 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -20,7 +20,7 @@ output_level: '{{ mso_output_level | default("info") }}' - name: Query MSO version - mso_version: + cisco.mso.mso_version: <<: *mso_info state: query register: version @@ -30,7 +30,7 @@ block: # CLEAN ENVIRONMENT - name: Remove user ansible_test - mso_user: &user_absent + cisco.mso.mso_user: &user_absent <<: *mso_info user: '{{ item }}' state: absent @@ -42,7 +42,7 @@ # ADD USER - name: Add user (check_mode) - mso_user: &user_present + cisco.mso.mso_user: &user_present <<: *mso_info user: ansible_test user_password: 'S0m3!1n1t14l!p455w0rd' @@ -61,7 +61,7 @@ register: cm_add_user - name: Verify cm_add_user - assert: + ansible.builtin.assert: that: - cm_add_user is changed - cm_add_user.previous == {} @@ -75,11 +75,11 @@ - cm_add_user.current.roles[0].accessType == 'readWrite' - name: Add user (normal mode) - mso_user: *user_present + cisco.mso.mso_user: *user_present register: nm_add_user - name: Verify nm_add_user - assert: + ansible.builtin.assert: that: - nm_add_user is changed - nm_add_user.previous == {} @@ -93,7 +93,7 @@ - nm_add_user.current.roles[0].accessType == 'readWrite' - name: Add user again (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_present # NOTE: We need to modify the password for a new user user_password: 'S0m3!n3w!p455w0rd' @@ -101,7 +101,7 @@ register: cm_add_user_again - name: Verify cm_add_user_again - assert: + ansible.builtin.assert: that: - cm_add_user_again is changed - cm_add_user_again.previous.username == 'ansible_test' @@ -109,14 +109,14 @@ - cm_add_user_again.current.username == 'ansible_test' - name: Add user again (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_present # NOTE: We need to modify the password for a new user user_password: 'S0m3!n3w!p455w0rd' register: nm_add_user_again - name: Verify nm_add_user_again - assert: + ansible.builtin.assert: that: - nm_add_user_again is changed - nm_add_user_again.previous.username == 'ansible_test' @@ -124,7 +124,7 @@ - nm_add_user_again.current.username == 'ansible_test' - name: Add user with read only role (check_mode) - mso_user: &user_present2 + cisco.mso.mso_user: &user_present2 <<: *mso_info user: ansible_test_read user_password: '#123455#123455Aa' @@ -143,7 +143,7 @@ register: cm_add_user2 - name: Verify cm_add_user2 - assert: + ansible.builtin.assert: that: - cm_add_user2 is changed - cm_add_user2.previous == {} @@ -157,11 +157,11 @@ - cm_add_user2.current.roles[0].accessType == 'readOnly' - name: Add user with read only role (normal mode) - mso_user: *user_present2 + cisco.mso.mso_user: *user_present2 register: nm_add_user2 - name: Verify nm_add_user2 - assert: + ansible.builtin.assert: that: - nm_add_user2 is changed - nm_add_user2.current.id is defined @@ -174,18 +174,18 @@ - nm_add_user2.current.roles[0].accessType == 'readOnly' - name: Add user with read only role again (check mode) - mso_user: + cisco.mso.mso_user: <<: *user_present2 user_password: '#123455#123455Aa' check_mode: true register: cm_add_user2_again - name: Add user with read only role again (normal mode) - mso_user: *user_present2 + cisco.mso.mso_user: *user_present2 register: nm_add_user2 - name: Add user3 with read only role and no password (check_mode) - mso_user: &user_present3 + cisco.mso.mso_user: &user_present3 <<: *mso_info user: ansible_test_read_2 # NOTE: First name, last name, phone and email are mandatory on creation @@ -204,18 +204,18 @@ register: nm_add_user3 - name: Verify nm_add_user2 - assert: + ansible.builtin.assert: that: - nm_add_user3.msg == "The user ansible_test_read_2 does not exist. The 'user_password' attribute is required to create a new user." - name: Add user3 with read only role and with password (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_present3 user_password: '#123455#123455Aa' register: nm_add_user3_again - name: Verify nm_add_user3_again - assert: + ansible.builtin.assert: that: - nm_add_user3_again is changed - nm_add_user3_again.current.id is defined @@ -229,7 +229,7 @@ # CHANGE USER - name: Change user (check_mode) - mso_user: &user_change + cisco.mso.mso_user: &user_change <<: *mso_info user: ansible_test roles: @@ -244,7 +244,7 @@ register: cm_change_user - name: Verify cm_change_user - assert: + ansible.builtin.assert: that: - cm_change_user is changed - cm_change_user.current.id == nm_add_user.current.id @@ -253,13 +253,13 @@ - cm_change_user.current.phoneNumber == '+32 478 436 300' - name: Change user (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_change output_level: debug register: nm_change_user - name: Verify nm_change_user - assert: + ansible.builtin.assert: that: - nm_change_user is changed - nm_change_user.current.id == nm_add_user.current.id @@ -268,13 +268,13 @@ - nm_change_user.current.phoneNumber == '+32 478 436 300' - name: Change user again (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_change check_mode: true register: cm_change_user_again - name: Verify cm_change_user_again - assert: + ansible.builtin.assert: that: - cm_change_user_again is not changed - cm_change_user_again.current.id == nm_add_user.current.id @@ -283,12 +283,12 @@ - cm_change_user_again.current.phoneNumber == '+32 478 436 300' - name: Change user again (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_change register: nm_change_user_again - name: Verify nm_change_user_again - assert: + ansible.builtin.assert: that: - nm_change_user_again is not changed - nm_change_user_again.current.id == nm_add_user.current.id @@ -297,7 +297,7 @@ - nm_change_user_again.current.phoneNumber == '+32 478 436 300' - name: Add second user - mso_user: + cisco.mso.mso_user: <<: *user_change user: ansible_test2 user_password: 'S0m3!1n1t14l!p455w0rd' @@ -309,7 +309,7 @@ register: nm_add_user_2 - name: Change user 2 again (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_change user: ansible_test2 user_password: null @@ -318,7 +318,7 @@ register: nm_change_user_2_again - name: Verify nm_change_user_2_again - assert: + ansible.builtin.assert: that: - nm_change_user_2_again is not changed - nm_change_user_2_again.current.id == nm_add_user_2.current.id @@ -328,18 +328,18 @@ # QUERY ALL USERS - name: Query all users (check_mode) - mso_user: &user_query + cisco.mso.mso_user: &user_query <<: *mso_info state: query check_mode: true register: cm_query_all_users - name: Query all users (normal mode) - mso_user: *user_query + cisco.mso.mso_user: *user_query register: nm_query_all_users - name: Verify query_all_users - assert: + ansible.builtin.assert: that: - cm_query_all_users is not changed - nm_query_all_users is not changed @@ -349,20 +349,20 @@ # QUERY A USER - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *user_query user: '{{ mso_username }}' check_mode: true register: cm_query_user - name: Query our user - mso_user: + cisco.mso.mso_user: <<: *user_query user: '{{ mso_username }}' register: nm_query_user - name: Verify query_user - assert: + ansible.builtin.assert: that: - cm_query_user is not changed - cm_query_user.current.id is defined @@ -376,20 +376,20 @@ when: version.current.version is version('3.2', '<') block: - name: Query our read-only user - mso_user: + cisco.mso.mso_user: <<: *user_query user: ansible_test_read register: nm_query_user2 - name: Verify query_user2 - assert: + ansible.builtin.assert: that: - nm_query_user2 is not changed - nm_query_user2.current.roles[0].accessType == 'readOnly' # REMOVE USER - name: Remove user (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_absent user: ansible_test state: absent @@ -397,26 +397,26 @@ register: cm_remove_user - name: Verify cm_remove_user - assert: + ansible.builtin.assert: that: - cm_remove_user is changed - cm_remove_user.current == {} - name: Remove user (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_absent user: ansible_test state: absent register: nm_remove_user - name: Verify nm_remove_user - assert: + ansible.builtin.assert: that: - nm_remove_user is changed - nm_remove_user.current == {} - name: Remove user again (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_absent user: ansible_test state: absent @@ -424,41 +424,41 @@ register: cm_remove_user_again - name: Verify cm_remove_user_again - assert: + ansible.builtin.assert: that: - cm_remove_user_again is not changed - cm_remove_user_again.current == {} - name: Remove user again (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_absent user: ansible_test state: absent register: nm_remove_user_again - name: Verify nm_remove_user_again - assert: + ansible.builtin.assert: that: - nm_remove_user_again is not changed - nm_remove_user_again.current == {} # QUERY NON-EXISTING USER - name: Query non-existing user (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_query user: ansible_test check_mode: true register: cm_query_non_user - name: Query non-existing user (normal mode) - mso_user: + cisco.mso.mso_user: <<: *user_query user: ansible_test register: nm_query_non_user # TODO: Implement more tests - name: Verify query_non_user - assert: + ansible.builtin.assert: that: - cm_query_non_user is not changed - nm_query_non_user is not changed @@ -468,42 +468,41 @@ when: version.current.version is version('3.2', '<') block: - name: inactive user (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_present account_status: inactive check_mode: true register: cm_inactive_user - name: inactive user (normal_mode) - mso_user: + cisco.mso.mso_user: <<: *user_present account_status: inactive register: nm_inactive_user - name: Verify cm_inactive_user and nm_inactive_user - assert: + ansible.builtin.assert: that: - cm_inactive_user is changed - nm_inactive_user is changed - cm_inactive_user.current.accountStatus == "inactive" - nm_inactive_user.current.accountStatus == "inactive" - - name: active user (check_mode) - mso_user: + cisco.mso.mso_user: <<: *user_present account_status: active check_mode: true register: cm_active_user - name: active user (normal_mode) - mso_user: + cisco.mso.mso_user: <<: *user_present account_status: active register: nm_active_user - name: Verify cm_active_user and nm_active_user - assert: + ansible.builtin.assert: that: - cm_active_user is changed - nm_active_user is changed diff --git a/ansible_collections/cisco/mso/tests/integration/targets/mso_version/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/mso_version/tasks/main.yml index fc3eb585e..3c7cb0d08 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/mso_version/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/mso_version/tasks/main.yml @@ -4,13 +4,13 @@ # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) - name: Test that we have an ACI MultiSite host, username and password - fail: + ansible.builtin.fail: msg: 'Please define the following variables: mso_hostname, mso_username and mso_password.' when: mso_hostname is not defined or mso_username is not defined or mso_password is not defined # CLEAN ENVIRONMENT - name: Set vars - set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -22,14 +22,14 @@ # QUERY VERSION - name: Query MSO version - mso_version: &mso_query + cisco.mso.mso_version: &mso_query <<: *mso_info state: query check_mode: true register: cm_query_version - name: Verify cm_query_version - assert: + ansible.builtin.assert: that: - cm_query_version is not changed - cm_query_version.current.id is defined @@ -37,12 +37,12 @@ - cm_query_version.current.timestamp is defined - name: Query MSO version (normal mode) - mso_version: + cisco.mso.mso_version: <<: *mso_query register: nm_query_version - name: Verify nm_query_version - assert: + ansible.builtin.assert: that: - nm_query_version is not changed - nm_query_version.current.id is defined @@ -54,7 +54,7 @@ # USE A NON-EXISTING STATE - name: Non-existing state for version (check_mode) - mso_version: + cisco.mso.mso_version: <<: *mso_query state: non-existing-state check_mode: true @@ -62,14 +62,14 @@ register: cm_non_existing_state - name: Non-existing state for version (normal_mode) - mso_version: + cisco.mso.mso_version: <<: *mso_query state: non-existing-state ignore_errors: true register: nm_non_existing_state - name: Verify non_existing_state - assert: + ansible.builtin.assert: that: - cm_non_existing_state is not changed - nm_non_existing_state is not changed @@ -84,7 +84,7 @@ when: ansible_connection != 'local' - name: Verify query_version_global_params - assert: + ansible.builtin.assert: that: - query_version_global_params is not changed - query_version_global_params.current.id is defined diff --git a/ansible_collections/cisco/mso/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml b/ansible_collections/cisco/mso/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml index 3af935cfc..ed295450e 100644 --- a/ansible_collections/cisco/mso/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml +++ b/ansible_collections/cisco/mso/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml @@ -220,7 +220,7 @@ - Template 2 - name: Verify undeploy_template - assert: + ansible.builtin.assert: that: - item is not changed - '"undeploy" in item.current.reqDetails' |