From 58fbdcce8bb30ce7a9d875ab27b916c6f350dd9d Mon Sep 17 00:00:00 2001 From: Sabari Jaganathan <93724860+sajagana@users.noreply.github.com> Date: Fri, 3 Jan 2025 07:44:32 +0530 Subject: [PATCH 1/3] Removed cloud site tasks from test files --- .../targets/mso_rest/tasks/error_handling.yml | 2 +- .../targets/mso_rest/tasks/json_inline.yml | 2 - .../targets/mso_schema_site/tasks/main.yml | 17 +- .../mso_schema_site_anp/tasks/main.yml | 176 +----- .../mso_schema_site_anp_epg/tasks/main.yml | 179 +----- .../tasks/main.yml | 13 +- .../tasks/main.yml | 25 +- .../mso_schema_site_anp_epg_selector/aliases | 2 +- .../tasks/main.yml | 13 +- .../targets/mso_schema_site_bd/tasks/main.yml | 6 +- .../mso_schema_site_bd_l3out/tasks/main.yml | 7 +- .../mso_schema_site_bd_subnet/tasks/main.yml | 6 +- .../aliases | 2 +- .../tasks/main.yml | 124 +--- .../aliases | 2 +- .../mso_schema_site_l3out/tasks/main.yml | 20 +- .../tasks/l4_l7_devices.yml | 219 +------ .../tasks/main.yml | 424 +------------- .../mso_schema_site_vrf_region/aliases | 2 +- .../mso_schema_site_vrf_region_cidr/aliases | 2 +- .../aliases | 2 +- .../aliases | 2 +- .../tasks/main.yml | 19 +- .../tasks/main.yml | 26 - .../tasks/main.yml | 9 + .../targets/mso_tenant/tasks/main.yml | 17 +- .../targets/mso_tenant_site/tasks/main.yml | 539 +----------------- .../ndo_schema_template_deploy/tasks/main.yml | 74 +-- 28 files changed, 162 insertions(+), 1769 deletions(-) diff --git a/tests/integration/targets/mso_rest/tasks/error_handling.yml b/tests/integration/targets/mso_rest/tasks/error_handling.yml index 456220eac..e7f2a54ea 100644 --- a/tests/integration/targets/mso_rest/tasks/error_handling.yml +++ b/tests/integration/targets/mso_rest/tasks/error_handling.yml @@ -82,7 +82,7 @@ that: - error_on_name_resolution.msg is search("Name or service not known") when: - - version.current.version is version('3.7', '>=') + - version.current.version is version('3.7', '>=') and version.current.version is version('4.1', '<') - name: Error on invalid path cisco.mso.mso_rest: diff --git a/tests/integration/targets/mso_rest/tasks/json_inline.yml b/tests/integration/targets/mso_rest/tasks/json_inline.yml index 9eff34f24..cfcd54bd6 100644 --- a/tests/integration/targets/mso_rest/tasks/json_inline.yml +++ b/tests/integration/targets/mso_rest/tasks/json_inline.yml @@ -97,8 +97,6 @@ loop: - '{{ mso_schema | default("ansible_test") }}_2' - '{{ mso_schema | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' - name: Remove tenant ansible_test cisco.mso.mso_tenant: diff --git a/tests/integration/targets/mso_schema_site/tasks/main.yml b/tests/integration/targets/mso_schema_site/tasks/main.yml index 5e356a0fd..1a477b3f7 100644 --- a/tests/integration/targets/mso_schema_site/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site/tasks/main.yml @@ -41,16 +41,23 @@ - '{{ mso_schema | default("ansible_test") }}_2' - '{{ mso_schema | default("ansible_test") }}' +- name: Ensure tenant ansible_test not exists + cisco.mso.mso_tenant: + <<: *mso_info + tenant: ansible_test + users: + - "{{ mso_username }}" + state: absent + ignore_errors: true + register: ansible_test_absent + - name: Ensure sites removed from tenant ansible_test cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' state: absent - loop: - - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' + when: ansible_test_absent.current != {} - name: Ensure tenant ansible_test exists cisco.mso.mso_tenant: diff --git a/tests/integration/targets/mso_schema_site_anp/tasks/main.yml b/tests/integration/targets/mso_schema_site_anp/tasks/main.yml index 03909d8cf..1caefe12e 100644 --- a/tests/integration/targets/mso_schema_site_anp/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_anp/tasks/main.yml @@ -45,38 +45,12 @@ - https://{{ apic_hostname }} state: present -- name: Ensure aws site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'aws_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ aws_apic_username }}' - apic_password: '{{ aws_apic_password }}' - apic_site_id: '{{ aws_site_id | default(102) }}' - urls: - - https://{{ aws_apic_hostname }} - state: present - -- name: Ensure azure site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'azure_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ azure_apic_username }}' - apic_password: '{{ azure_apic_password }}' - apic_site_id: '{{ azure_site_id | default(103) }}' - urls: - - https://{{ azure_apic_hostname }} - state: present - - name: Ensure sites removed from tenant ansible_test cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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 exists cisco.mso.mso_tenant: @@ -86,34 +60,13 @@ - '{{ mso_username }}' state: present -- name: Associate non-cloud site with ansible_test again in normal mode +- name: Associate site with ansible_test again in normal mode 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - secret_key: "0" - state: present - register: aaws_nm - -- name: Associate azure site with access_type not present, with ansible_test in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - cloud_account: uni/tn-ansible_test/act-[100]-vendor-azure - state: present - register: aazure_shared_nm - - name: Ensure schema 1 with Template 1, and Template 2 exist cisco.mso.mso_schema_template: <<: *mso_info @@ -134,17 +87,6 @@ template: Template 4 state: present -- name: Add cloud site to a schema - cisco.mso.mso_schema_site: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: '{{item.site}}' - template: '{{item.template}}' - state: present - loop: - - { site: 'azure_{{ mso_site | default("ansible_test") }}', template: 'Template 1' } - - { site: 'aws_{{ mso_site | default("ansible_test") }}', template: 'Template 2' } - - name: Add physical site to a schema cisco.mso.mso_schema_site: <<: *mso_info @@ -203,61 +145,6 @@ template: Template 3 state: present -- name: Add ANP to site azure (check_mode) - cisco.mso.mso_schema_site_anp: - <<: *mso_info - site: 'azure_{{ mso_site | default("ansible_test") }}' - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - anp: ANP - state: present - check_mode: true - register: cm_add_anp - -- name: Add ANP to site azure (normal mode) - cisco.mso.mso_schema_site_anp: - <<: *mso_info - site: 'azure_{{ mso_site | default("ansible_test") }}' - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - anp: ANP - state: present - register: nm_add_anp - -- name: Verify add_anp values - ansible.builtin.assert: - that: - - cm_add_anp.current.anpRef.anpName == 'ANP' - - nm_add_anp.current.anpRef.anpName == 'ANP' - -- name: Verify add_anp change - 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 - cisco.mso.mso_schema_site_anp: - <<: *mso_info - site: 'aws_{{ mso_site | default("ansible_test") }}' - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 2 - anp: ANP_2 - state: present - register: add_anp - -- name: Verify add_anp value - ansible.builtin.assert: - that: - - add_anp.current.anpRef.anpName == 'ANP_2' - -- name: Verify add_anp change - 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 cisco.mso.mso_schema_site_anp: <<: *mso_info @@ -390,42 +277,6 @@ - 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) - cisco.mso.mso_schema_site_anp: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: Template 1 - anp: ANP - state: non-existing-state - ignore_errors: true - register: nm_non_existing_state - -- name: Verify non_existing_state - 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) - cisco.mso.mso_schema_site_anp: - <<: *mso_info - schema: non-existing-schema - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: Template 1 - anp: ANP - state: query - ignore_errors: true - register: nm_non_existing_schema - -- name: Verify non_existing_schema - 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) cisco.mso.mso_schema_site_anp: @@ -444,24 +295,6 @@ - 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) - cisco.mso.mso_schema_site_anp: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}_2' - site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template 4 - anp: ANP_4 - state: present - ignore_errors: true - register: nm_no_site_associated - -- name: Verify cm_no_site_associated and 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 'Template4'. Associate the site with the template using mso_schema_site." - # USE A NON-EXISTING SITE-TEMPLATE - name: Non-existing site-template (normal_mode) cisco.mso.mso_schema_site_anp: @@ -474,8 +307,9 @@ ignore_errors: true register: nm_non_existing_site_template -- name: Verify non_existing_site_template +- name: Verify non_existing_site_template for NDO version > 3.7 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 + - 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") + when: version.current.version is version('3.7', '>') diff --git a/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml b/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml index 28e836a55..8cf5daeed 100644 --- a/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_anp_epg/tasks/main.yml @@ -58,41 +58,16 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' state: absent - loop: - - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' -- name: Associate non-cloud site with ansible_test again in normal mode +- name: Associate site with ansible_test again in normal mode 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - secret_key: "0" - state: present - register: aaws_nm - -- name: Associate azure site with access_type not present, with ansible_test in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - cloud_account: uni/tn-ansible_test/act-[100]-vendor-azure - state: present - register: aazure_shared_nm - - name: Ensure schema 1 with Template 1, and Template 2 exist cisco.mso.mso_schema_template: <<: *mso_info @@ -113,18 +88,6 @@ template: Template 4 state: present -- name: Add cloud site to a schema - cisco.mso.mso_schema_site: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: '{{item.site}}' - template: '{{item.template}}' - state: present - loop: - - { site: 'azure_{{ mso_site | default("ansible_test") }}', template: 'Template 1' } - - { site: 'aws_{{ mso_site | default("ansible_test") }}', template: 'Template 2' } - when: version.current.version is version('3', '<') or version.current.version is version('3.2', '>=') - - name: Add physical site to a schema cisco.mso.mso_schema_site: <<: *mso_info @@ -494,63 +457,6 @@ - nm_query_non_anp.msg == "Provided anp 'ANP_3' does not exist at site level." when: version.current.version is version('4.0', '<') # no change in NDO4.0 because site will already be present when template is defined -# USE A NON-EXISTING STATE -- name: Non-existing state (normal_mode) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: Template 1 - anp: ANP - epg: ansible_test_1 - state: non-existing-state - ignore_errors: true - register: nm_non_existing_state - -- name: Verify non_existing_state - 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) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: non-existing-template - anp: ANP - epg: ansible_test_1 - state: query - ignore_errors: true - register: nm_non_existing_template - -- name: Verify non_existing_template - 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) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: non-existing-schema - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: Template 1 - anp: ANP - epg: ansible_test_1 - state: query - ignore_errors: true - register: nm_non_existing_schema - -- name: Verify non_existing_schema - 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) cisco.mso.mso_schema_site_anp_epg: @@ -587,8 +493,8 @@ 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', '>=') + - 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") + when: version.current.version is version('4.0', '>=') - name: Verify non_existing_site_template ansible.builtin.assert: @@ -597,25 +503,6 @@ - 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") when: version.current.version is version('3', '>=') and version.current.version is version('3.2', '<') -# USE A TEMPLATE WITHOUT ANY SITE -- name: Add EPG to Template without any site associated (normal mode) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}_2' - site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template 4 - anp: ANP_4 - epg: ansible_test_1 - state: present - ignore_errors: true - register: nm_no_site_associated - -- name: Verify cm_no_site_associated and 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 'Template4'. Associate the site with the template using mso_schema_site." - # ADDING PRIVATE LINK LABEL # Add private link label when MSO version >= 3.3 - name: Execute tasks only for MSO version >= 3.3 @@ -629,42 +516,6 @@ template: 'Template 1' state: absent - - name: Ensure region for VRF1 at site level exists - cisco.mso.mso_schema_site_vrf_region_cidr: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - site: 'azure_{{ mso_site | default("ansible_test") }}' - vrf: VRF1 - region: us-west-1 - cidr: 10.0.0.0/16 - state: present - - - name: Ensure Private Link Label in Azure VRF subnet exist (MSO >3.3) - cisco.mso.mso_schema_site_vrf_region_cidr_subnet: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - site: 'azure_{{ mso_site | default("ansible_test") }}' - vrf: VRF1 - region: us-west-1 - cidr: 10.0.0.0/16 - subnet: 10.0.0.0/24 - private_link_label: 'New_Private_Link_Label' - zone: null - - - name: Ensure another Private Link Label in Azure VRF subnet exist (MSO >3.3) - cisco.mso.mso_schema_site_vrf_region_cidr_subnet: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - site: 'azure_{{ mso_site | default("ansible_test") }}' - vrf: VRF1 - region: us-west-1 - cidr: 10.0.0.0/16 - subnet: 10.0.1.0/26 - private_link_label: 'PLL' - - name: Add new EPG service type parameters (for version greater than 3.3) cisco.mso.mso_schema_template_anp_epg: <<: *mso_info @@ -681,25 +532,3 @@ service_type: 'Azure-Storage' access_type: 'private' state: present - - - name: Add private link label to the EPG (for version greater than 3.3) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - anp: ANP - epg: ansible_test_1 - site: 'azure_{{ mso_site | default("ansible_test") }}' - private_link_label: 'New_Private_Link_Label' - state: present - - - name: Change private link label in the EPG (for version greater than 3.3) - cisco.mso.mso_schema_site_anp_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template 1 - anp: ANP - epg: ansible_test_1 - site: 'azure_{{ mso_site | default("ansible_test") }}' - private_link_label: 'PLL' - state: present \ No newline at end of file diff --git a/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml b/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml index 2940874aa..db77f8d1a 100644 --- a/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_anp_epg_bulk_staticport/tasks/main.yml @@ -20,6 +20,13 @@ use_proxy: '{{ mso_use_proxy | default(true) }}' output_level: '{{ mso_output_level | default("debug") }}' +# QUERY VERSION +- name: Query MSO version + cisco.mso.mso_version: + <<: *mso_info + state: query + register: version + - name: Remove Schemas cisco.mso.mso_schema: <<: *mso_info @@ -44,12 +51,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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: diff --git a/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml b/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml index 969f9c449..2b840549f 100644 --- a/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_anp_epg_domain/tasks/main.yml @@ -23,6 +23,13 @@ use_proxy: '{{ mso_use_proxy | default(true) }}' output_level: '{{ mso_output_level | default("info") }}' +# QUERY VERSION +- name: Query MSO version + cisco.mso.mso_version: + <<: *mso_info + state: query + register: version + - name: Remove Schemas cisco.mso.mso_schema: <<: *mso_info @@ -47,13 +54,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' state: absent - loop: - - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' - ignore_errors: true - name: Ensure tenant ansible_test exist cisco.mso.mso_tenant: @@ -678,15 +680,6 @@ - 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) cisco.mso.mso_schema_site_anp_epg_domain: @@ -1064,4 +1057,4 @@ 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 site associated with template 'Template3'. Associate the site with the template using mso_schema_site." diff --git a/tests/integration/targets/mso_schema_site_anp_epg_selector/aliases b/tests/integration/targets/mso_schema_site_anp_epg_selector/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_anp_epg_selector/aliases +++ b/tests/integration/targets/mso_schema_site_anp_epg_selector/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml b/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml index 054ec970e..0af832741 100644 --- a/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_anp_epg_staticport/tasks/main.yml @@ -23,6 +23,13 @@ use_proxy: '{{ mso_use_proxy | default(true) }}' output_level: '{{ mso_output_level | default("info") }}' +# QUERY VERSION +- name: Query MSO version + cisco.mso.mso_version: + <<: *mso_info + state: query + register: version + - name: Remove Schemas cisco.mso.mso_schema: <<: *mso_info @@ -47,12 +54,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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: diff --git a/tests/integration/targets/mso_schema_site_bd/tasks/main.yml b/tests/integration/targets/mso_schema_site_bd/tasks/main.yml index c7770dfb6..0e98ba702 100644 --- a/tests/integration/targets/mso_schema_site_bd/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_bd/tasks/main.yml @@ -54,12 +54,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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 exists cisco.mso.mso_tenant: diff --git a/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml b/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml index 6ae17044d..76e0a2675 100644 --- a/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_bd_l3out/tasks/main.yml @@ -62,12 +62,9 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' state: absent - loop: - - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' + ignore_errors: true - name: Ensure tenant ansible_test exists cisco.mso.mso_tenant: diff --git a/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml b/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml index 9da901308..1ed49b4b7 100644 --- a/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_bd_subnet/tasks/main.yml @@ -50,12 +50,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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 exists cisco.mso.mso_tenant: diff --git a/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases b/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases +++ b/tests/integration/targets/mso_schema_site_contract_service_graph_listener/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml b/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml index 76c0a46d8..477e3d070 100644 --- a/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_external_epg/tasks/main.yml @@ -51,12 +51,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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: @@ -69,12 +65,12 @@ state: present ignore_errors: true -- name: Associate non-cloud site with ansible_test +- name: Associate site with ansible_test cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' - state: present + state: present register: add_ncs - name: Verify add_ncs @@ -107,7 +103,7 @@ # Ensure pre requisites exist - name: Ensure schema 1 with Template1 and 2 exists - cisco.mso.mso_schema_template: + cisco.mso.mso_schema_template: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' tenant: ansible_test @@ -233,7 +229,7 @@ when: version.current.version is version('3.3', '>=') block: # Associate site to schema/template after creating External EPG - - name: Add non-cloud site to a schema + - name: Add site to a schema cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' @@ -287,7 +283,7 @@ that: - cm_add_epg is changed - cm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') + when: version.current.version is version('4.0', '<') - name: Add external EPG to site (normal mode) cisco.mso.mso_schema_site_external_epg: @@ -312,7 +308,7 @@ that: - nm_add_epg is changed - nm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') + when: version.current.version is version('4.0', '<') - name: ADD External EPG1 to site again cisco.mso.mso_schema_site_external_epg: @@ -343,7 +339,7 @@ l3out_on_apic: true state: present register: nm_add_ext_epg_l3out_apic - + - name: Update external EPG to site with l3out_on_apic true again cisco.mso.mso_schema_site_external_epg: <<: *add_ext_epg_l3out_apic @@ -493,7 +489,7 @@ - nm_remove_epg.current == {} # Associate site to schema/template before creating External EPG - - name: Add non-cloud site to a schema + - name: Add site to a schema cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' @@ -509,7 +505,7 @@ - add_site.current.siteId is match ("[0-9a-zA-Z]*") - add_site.current.templateName == "Template2" - - name: Add non-cloud site to a schema + - name: Add site to a schema cisco.mso.mso_schema_site: <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' @@ -573,13 +569,13 @@ that: - nm_add_epg is changed - nm_add_epg.previous == {} - when: version.current.version is version('4.0', '<') + 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', '<') + 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 @@ -960,99 +956,3 @@ - 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 '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 - cisco.mso.mso_schema_template_anp: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template4 - anp: ANP4 - state: present - -- name: Ensure VRF4 exists - cisco.mso.mso_schema_template_vrf: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template4 - vrf: VRF4 - state: present - -- name: Ensure L3Out4 Exists - cisco.mso.mso_schema_template_l3out: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template4 - vrf: - name: VRF4 - l3out: L3out4 - state: present - -- 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: Template4 - external_epg: ext_epg_4 - type: cloud - vrf: - name: VRF4 - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template4 - anp: - name: ANP4 - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template4 - state: present - register: nm_add_ext_epg_4 - -- name: Execute azure tasks - when: - - version.current.version is version('3.3', '>=') - - version.current.version is version('4.3', '<') - block: - - 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: Template4 - state: present - when: version.current.version is version('3.3', '>=') - register: add_cloud_site - - - name: Add external EPG to site (normal mode) - cisco.mso.mso_schema_site_external_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'azure_{{ mso_site | default("ansible_test") }}' - 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 - ansible.builtin.assert: - that: - - 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) - cisco.mso.mso_schema_site_external_epg: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'azure_{{ mso_site | default("ansible_test") }}' - 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 - ansible.builtin.assert: - that: - - nm_add_ext_epg_site_again is not changed - - nm_add_ext_epg_site_again.current.externalEpgRef.externalEpgName == "ext_epg_4" - - nm_add_ext_epg_site_again.current.routeReachabilityInternetType == "site-ext" diff --git a/tests/integration/targets/mso_schema_site_external_epg_selector/aliases b/tests/integration/targets/mso_schema_site_external_epg_selector/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_external_epg_selector/aliases +++ b/tests/integration/targets/mso_schema_site_external_epg_selector/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_l3out/tasks/main.yml b/tests/integration/targets/mso_schema_site_l3out/tasks/main.yml index 1ed86e254..5cc92171f 100644 --- a/tests/integration/targets/mso_schema_site_l3out/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_l3out/tasks/main.yml @@ -52,15 +52,11 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: '{{ item }}' + site: '{{ mso_site | default("ansible_test") }}' 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 exists - cisco.mso.mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: @@ -243,12 +239,12 @@ - nm_query_all_l3out is not changed - cm_query_all_l3out.current | length == 2 - nm_query_all_l3out.current | length == 2 - - "'{{cm_query_all_l3out.current[0].l3outRef.l3outName}}' in l3outs" - - "'{{cm_query_all_l3out.current[1].l3outRef.l3outName}}' in l3outs" - - "'{{nm_query_all_l3out.current[0].l3outRef.l3outName}}' in l3outs" - - "'{{nm_query_all_l3out.current[1].l3outRef.l3outName}}' in l3outs" - - cm_query_all_l3out.current[0].l3outRef.schemaId == nm_query_all_l3out.current[0].l3outRef.schemaId - - cm_query_all_l3out.current[0].l3outRef.templateName == nm_query_all_l3out.current[0].l3outRef.templateName == "Template1" + - cm_query_all_l3out.current.0.l3outRef.l3outName == "L3out1" + - cm_query_all_l3out.current.1.l3outRef.l3outName == "L3out2" + - nm_query_all_l3out.current.0.l3outRef.l3outName == "L3out1" + - nm_query_all_l3out.current.1.l3outRef.l3outName == "L3out2" + - cm_query_all_l3out.current.0.l3outRef.schemaId == nm_query_all_l3out.current.0.l3outRef.schemaId + - cm_query_all_l3out.current.0.l3outRef.templateName == nm_query_all_l3out.current.0.l3outRef.templateName == "Template1" - name: Query a specific L3Out (check_mode) cisco.mso.mso_schema_site_l3out: diff --git a/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml b/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml index 1d5585200..14c5df700 100644 --- a/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml +++ b/tests/integration/targets/mso_schema_site_service_graph/tasks/l4_l7_devices.yml @@ -38,200 +38,27 @@ <<: *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: +- name: Add devices to APIC + cisco.aci.aci_rest: <<: *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 + 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/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml b/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml index 369fde0b7..79c448448 100644 --- a/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_service_graph/tasks/main.yml @@ -61,13 +61,8 @@ cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - site: "{{ item }}" + site: '{{ mso_site | default("ansible_test") }}' 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 @@ -103,19 +98,6 @@ 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: @@ -127,7 +109,6 @@ loop: - "Template1" - "Template2" - - "Template3" # Azure Task - name: Ensure schema 2 with Template1 exists cisco.mso.mso_schema_template: @@ -636,407 +617,6 @@ - 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 @@ -1087,7 +667,7 @@ - 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" + - 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: diff --git a/tests/integration/targets/mso_schema_site_vrf_region/aliases b/tests/integration/targets/mso_schema_site_vrf_region/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_vrf_region/aliases +++ b/tests/integration/targets/mso_schema_site_vrf_region/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_vrf_region_cidr/aliases b/tests/integration/targets/mso_schema_site_vrf_region_cidr/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_vrf_region_cidr/aliases +++ b/tests/integration/targets/mso_schema_site_vrf_region_cidr/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/aliases b/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/aliases +++ b/tests/integration/targets/mso_schema_site_vrf_region_cidr_subnet/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_site_vrf_region_hub_network/aliases b/tests/integration/targets/mso_schema_site_vrf_region_hub_network/aliases index 5042c9c09..cd28d3c36 100644 --- a/tests/integration/targets/mso_schema_site_vrf_region_hub_network/aliases +++ b/tests/integration/targets/mso_schema_site_vrf_region_hub_network/aliases @@ -1,2 +1,2 @@ # No ACI MultiSite infrastructure, so not enabled -# unsupported +unsupported diff --git a/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml b/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml index 16fdddc28..7c3c2ecb3 100644 --- a/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml +++ b/tests/integration/targets/mso_schema_template_anp_epg/tasks/main.yml @@ -77,6 +77,7 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 vrf: VRF + preferred_group: true layer3_multicast: true state: present @@ -92,6 +93,7 @@ schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 vrf: VRF3 + preferred_group: true state: present - name: Ensure VRF4 exist @@ -168,7 +170,7 @@ - name: Ensure ansible_test_1 BD exist cisco.mso.mso_schema_template_bd: - <<: *vrf_present + <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 bd: ansible_test_1 @@ -179,7 +181,7 @@ - name: Ensure ansible_test_2 BD exist cisco.mso.mso_schema_template_bd: - <<: *vrf_present + <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 1 bd: ansible_test_2 @@ -191,7 +193,7 @@ - name: Ensure ansible_test_3 BD exist cisco.mso.mso_schema_template_bd: - <<: *vrf_present + <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}' template: Template 2 bd: ansible_test_3 @@ -204,7 +206,7 @@ - name: Ensure ansible_test_4 BD exist cisco.mso.mso_schema_template_bd: - <<: *vrf_present + <<: *mso_info schema: '{{ mso_schema | default("ansible_test") }}_2' template: Template 3 bd: ansible_test_4 @@ -861,10 +863,17 @@ ignore_errors: true register: service_type_epg_error - - name: Verify service type error + - name: Verify service type error for MSO version > 3.7 + ansible.builtin.assert: + that: + - service_type_epg_error.msg is match ("MSO Error 400{{':'}} EPG{{':'}} ansible_test_1 in Schema{{':'}} .+, Template{{':'}} Template1 DeploymentType{{':'}} saas, AccessType {{':'}}publicAndPrivateType, Combination is not supported") + when: version.current.version is version('3.7', '>') + + - name: Verify service type error for MSO version <= 3.7 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" + when: version.current.version is version('3.7', '<=') # Add EPG when MSO version >= 3.3 and < 4.0 - name: Execute tasks only for MSO version >= 3.3 and < 4.0 diff --git a/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml b/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml index 34607bec5..d0ee063f3 100644 --- a/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml +++ b/tests/integration/targets/mso_schema_template_deploy_status/tasks/main.yml @@ -38,17 +38,6 @@ - https://{{ apic_hostname }} state: present -- name: Ensure aws site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'aws_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ aws_apic_username }}' - apic_password: '{{ aws_apic_password }}' - apic_site_id: '{{ aws_site_id | default(102) }}' - urls: - - https://{{ aws_apic_hostname }} - state: present - - name: Undeploy templates if deployed to clean the environment before ndo 4.0 cisco.mso.mso_schema_template_deploy: <<: *mso_info @@ -584,21 +573,6 @@ - status2_site_temp2.current.bds == [] - status2_site_temp2.current.vrfs == [] - - name: Check deployment status by querying site and non associated Template 1 - cisco.mso.mso_schema_template_deploy_status: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - template: Template1 - site: 'aws_{{ mso_site | default("ansible_test") }}' - state: query - ignore_errors: true - register: status_site_temp3 - - - name: Verify status after querying site with non associated Template 1 - ansible.builtin.assert: - that: - - status_site_temp3.msg == "Provided Template 'Template1' not associated with Site 'aws_ansible_test'." - - name: Check Non-existing schema cisco.mso.mso_schema_template_deploy_status: <<: *mso_info diff --git a/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml b/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml index e2f094754..b7da3bb11 100644 --- a/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml +++ b/tests/integration/targets/mso_schema_template_external_epg/tasks/main.yml @@ -766,6 +766,15 @@ - nm_change_epg_1_l3out.current.l3outRef.l3outName == 'L3out2' - nm_change_epg_1_l3out.current.l3outRef.templateName == 'Template1' +- name: Enable VRF preferred_group + cisco.mso.mso_schema_template_vrf: + <<: *mso_info + schema: '{{ mso_schema | default("ansible_test") }}' + template: Template 1 + vrf: VRF + preferred_group: true + state: present + - name: Change epg 4 preferredGroup(normal mode) cisco.mso.mso_schema_template_external_epg: <<: *mso_info diff --git a/tests/integration/targets/mso_tenant/tasks/main.yml b/tests/integration/targets/mso_tenant/tasks/main.yml index ace41ffda..d25421c87 100644 --- a/tests/integration/targets/mso_tenant/tasks/main.yml +++ b/tests/integration/targets/mso_tenant/tasks/main.yml @@ -33,7 +33,6 @@ state: present loop: - { site: '{{ mso_site | default("ansible_test") }}', username: '{{ apic_username }}', password: '{{ apic_password }}', id: '{{ apic_site_id | default(101) }}', urls: '{{ apic_hostname }}' } - # - { 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 cisco.mso.mso_schema_template_deploy: &schema_undeploy @@ -45,7 +44,6 @@ ignore_errors: true loop: - '{{ mso_site | default("ansible_test") }}' - # - 'aws_{{ mso_site | default("ansible_test") }}' - name: Undeploy a schema 1 template 2 cisco.mso.mso_schema_template_deploy: @@ -56,7 +54,6 @@ ignore_errors: true loop: - '{{ mso_site | default("ansible_test") }}' - # - 'aws_{{ mso_site | default("ansible_test") }}' - name: Undeploy a schema 2 template 3 cisco.mso.mso_schema_template_deploy: @@ -68,7 +65,6 @@ ignore_errors: true loop: - '{{ mso_site | default("ansible_test") }}' - # - 'aws_{{ mso_site | default("ansible_test") }}' - name: Remove schemas cisco.mso.mso_schema: @@ -89,6 +85,7 @@ - ansible_test2 - ansible_test3 - tenant_with_site + ignore_errors: true # ADD TENANT - name: Add tenant (check_mode) @@ -213,10 +210,14 @@ # ADD TENANT WITH REMOTE USERS - name: Add tenant 3 (check_mode) - cisco.mso.mso_tenant: - <<: *tenant_present + cisco.mso.mso_tenant: &remote_user_login + <<: *mso_info + username: '{{ mso_remote_username | default(mso_username) }}' + password: '{{ mso_remote_password | default(mso_password) }}' + login_domain: '{{ mso_remote_login_domain | default("") }}' tenant: ansible_test3 display_name: null + description: Ansible test tenant remote_users: - name: r_ansible_github_ci login_domain: test @@ -231,7 +232,7 @@ - name: Add tenant 3 (normal_mode) cisco.mso.mso_tenant: - <<: *tenant_present + <<: *remote_user_login tenant: ansible_test3 display_name: null remote_users: @@ -283,7 +284,7 @@ - name: Add tenant 3 (normal mode) cisco.mso.mso_tenant: - <<: *tenant_present + <<: *remote_user_login tenant: ansible_test3 users: - '{{ mso_username }}' diff --git a/tests/integration/targets/mso_tenant_site/tasks/main.yml b/tests/integration/targets/mso_tenant_site/tasks/main.yml index 0bb711447..4b2dd2b84 100644 --- a/tests/integration/targets/mso_tenant_site/tasks/main.yml +++ b/tests/integration/targets/mso_tenant_site/tasks/main.yml @@ -13,7 +13,7 @@ # CLEAN ENVIRONMENT - name: Set vars - ansible.builtin.set_fact: + ansible.builtin.set_fact: mso_info: &mso_info host: '{{ mso_hostname }}' username: '{{ mso_username }}' @@ -47,7 +47,7 @@ state: present register: ansible_test_tenant_present -- name: Dissociate clouds that are associated with ansible_tenant +- name: Dissociate sites that are associated with ansible_tenant cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test @@ -56,8 +56,6 @@ loop: - 'invalid_site_{{ mso_site | default("ansible_test") }}' - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' register: tenant_site_absent_check when: ansible_test_tenant_present.current != {} @@ -67,19 +65,17 @@ - tenant_site_absent_check.results.0.current == {} - tenant_site_absent_check.warnings.0 == "Site 'invalid_site_ansible_test' is not a valid site name." - tenant_site_absent_check.results.1.current == {} - - tenant_site_absent_check.results.2.current == {} - - tenant_site_absent_check.results.3.current == {} when: ansible_test_tenant_present.current != {} - name: Remove tenant ansible_test - cisco.mso.mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: - '{{ mso_username }}' state: absent -- name: Ensure non-cloud site exists +- name: Ensure site exists cisco.mso.mso_site: <<: *mso_info site: '{{ mso_site | default("ansible_test") }}' @@ -90,43 +86,21 @@ - https://{{ apic_hostname }} state: present -- name: Ensure azure site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'azure_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ azure_apic_username }}' - apic_password: '{{ azure_apic_password }}' - apic_site_id: '{{ azure_site_id | default(103) }}' - urls: - - https://{{ azure_apic_hostname }} - state: present - -- name: Ensure aws site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'aws_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ aws_apic_username }}' - apic_password: '{{ aws_apic_password }}' - apic_site_id: '{{ aws_site_id | default(102) }}' - urls: - - https://{{ aws_apic_hostname }} - state: present - - name: Ensure tenant ansible_test exists - cisco.mso.mso_tenant: + cisco.mso.mso_tenant: <<: *mso_info tenant: ansible_test users: - '{{ mso_username }}' state: present -- name: Associate non-cloud site with ansible_test in check mode +- name: Associate site with ansible_test in check mode cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' state: present - check_mode: true + check_mode: true register: ncs_cm - name: Verify ncs_cm @@ -134,7 +108,7 @@ that: - ncs_cm is changed -- name: Associate non-cloud site with ansible_test in normal mode +- name: Associate site with ansible_test in normal mode cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test @@ -147,12 +121,12 @@ that: - ncs_nm is changed -- name: Associate non-cloud site with ansible_test again in normal mode +- name: Associate site with ansible_test again in normal mode cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' - state: present + state: present register: ncs_nm_again - name: Verify ncs_nm_again @@ -160,398 +134,12 @@ that: - ncs_nm_again is not changed -- name: Associate aws site with ansible_test in check mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - secret_key: "0" - state: present - check_mode: true - register: aaws_cm - -- name: Verify aaws_cm - ansible.builtin.assert: - that: - - aaws_cm is changed - - aaws_cm.current.awsAccount != 'null' - - aaws_cm.current.awsAccount[0].isAccountInOrg == false - - aaws_cm.current.awsAccount[0].isTrusted == false - -- name: Associate aws site with ansible_test in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - secret_key: "0" - state: present - register: aaws_nm - -- name: Verify aaws_nm - ansible.builtin.assert: - that: - - aaws_nm is changed - - aaws_nm.current.awsAccount != 'null' - - aaws_nm.current.awsAccount[0].isAccountInOrg == false - - aaws_nm.current.awsAccount[0].isTrusted == false - -- name: Associate aws site with ansible_test again in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - secret_key: "0" - state: present - register: aaws_nm_again - -- name: Verify aaws_nm_again - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - secret_key: "0" - state: present - ignore_errors: true - register: aaws_nm_ak - -- name: Verify aaws_nm_ak - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: true - state: present - register: aws_nm_trusted - -- name: Verify aws_nm_trusted - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: "000000000000" - aws_trusted: false - aws_access_key: "1" - state: present - ignore_errors: true - register: aaws_nm_sk - -- name: Verify aaws_nm_sk - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - aws_account_org: true - cloud_account: "000000000000" - secret_key: "0" - aws_access_key: "1" - state: present - ignore_errors: true - register: aaws_nm_om - -- name: Verify aaws_nm_om - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - cloud_account: uni/tn-ansible_test/act-[100]-vendor-azure - state: present - register: aazure_shared_nm - -- name: Verify aazure_shared_nm - ansible.builtin.assert: - that: - - aazure_shared_nm is changed - -- name: Associate azure site in shared mode with ansible_test in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - cloud_account: uni/tn-ansible_test/act-[100]-vendor-azure - azure_access_type: shared - state: present - register: aazure_shared_nm - -- name: Verify aazure_shared_nm - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: managed - state: present - ignore_errors: true - register: aazure_managed_nm_app - -- name: Verify aazure_managed_nm_app - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_application_id: "100" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: managed - state: present - ignore_errors: true - register: aazure_managed_nm_si - -- name: Verify aazure_managed_nm_si - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_application_id: "100" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: managed - state: present - ignore_errors: true - register: aazure_managed_nm - -- name: Verify aazure_managed_nm - ansible.builtin.assert: - that: - - aazure_managed_nm is changed - - aazure_managed_nm.current.azureAccount != 'null' - - aazure_managed_nm.current.azureAccount[0].cloudSubscription.cloudApplicationId == '100' - - aazure_managed_nm.current.azureAccount[0].cloudSubscription.cloudSubscriptionId == '9' - - aazure_managed_nm.current.azureAccount[0].cloudApplication == [] - - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_application_id: "100" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_si - -- name: Verify aazure_credentials_nm_si - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_app - -- name: Verify aazure_credentials_nm_app - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_credential_name: cApicApp - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - azure_application_id: "100" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_secret - -- name: Verify aazure_credentials_nm_secret - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_credential_name: cApicApp - azure_active_directory_name: CiscoINSBUAd - azure_application_id: "100" - secret_key: iins - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_ad - -- name: Verify aazure_credentials_nm_ad - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_application_id: "100" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_adn - -- name: Verify aazure_credentials_nm_adn - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - secret_key: iins - azure_active_directory_name: CiscoINSBUAd - azure_active_directory_id: "32" - azure_application_id: "100" - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - ignore_errors: true - register: aazure_credentials_nm_cdn - -- name: Verify aazure_credentials_nm_cdn - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_application_id: "100" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - register: aazure_credentials_nm - -- name: Verify aazure_credentials_nm - ansible.builtin.assert: - that: - - aazure_credentials_nm is changed - - aazure_credentials_nm.current.azureAccount[0].cloudSubscription.cloudApplicationId == '100' - - aazure_credentials_nm.current.azureAccount[0].cloudSubscription.cloudSubscriptionId == '9' - - aazure_credentials_nm.current.azureAccount[0].cloudActiveDirectory[0].cloudActiveDirectoryId == '32' - - aazure_credentials_nm.current.azureAccount[0].cloudActiveDirectory[0].cloudActiveDirectoryName == 'CiscoINSBUAd' - - aazure_credentials_nm.current.azureAccount[0].cloudApplication[0].cloudApplicationId == '100' - - aazure_credentials_nm.current.azureAccount[0].cloudApplication[0].cloudActiveDirectoryId == '32' - - aazure_credentials_nm.current.azureAccount[0].cloudApplication[0].cloudCredentialName == 'cApicApp' - -- name: Associate azure site with credentials mode, with ansible_test again in normal mode - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_application_id: "100" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: present - register: aazure_credentials_nm_again - -- name: Verify aazure_credentials_nm_again - ansible.builtin.assert: - that: - - aazure_credentials_nm_again is not changed - -- name: Query associated non-cloud site of a tenant +- name: Query associated site of a tenant cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test site: '{{ mso_site | default("ansible_test") }}' - state: query + state: query register: anc_query - name: Verify anc_query @@ -559,45 +147,11 @@ that: - anc_query is not changed -- name: Query associated azure site of a tenant - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - azure_subscription_id: "9" - azure_application_id: "100" - azure_credential_name: cApicApp - secret_key: iins - azure_active_directory_id: "32" - azure_active_directory_name: CiscoINSBUAd - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - azure_access_type: unmanaged - state: query - register: aazure_query - -- name: Verify aazure_query - ansible.builtin.assert: - that: - - aazure_query is not changed - -- name: Query associated aws site of a tenant - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - state: query - register: aaws_query - -- name: Verify aaws_query - ansible.builtin.assert: - that: - - aaws_query is not changed - - name: Query all associated sites of a tenant cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - state: query + state: query register: all_sites_query - name: Verify all_sites_query @@ -605,7 +159,7 @@ that: - all_sites_query is not changed -- name: Dissociate non-cloud site with ansible_test +- name: Dissociate site with ansible_test cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test @@ -618,7 +172,7 @@ that: - dnc is changed -- name: Query dissociated non-cloud site of a tenant +- name: Query dissociated site of a tenant cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test @@ -627,71 +181,24 @@ ignore_errors: true register: dnc_query -- name: Verify dnc_query - 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - state: absent - register: dazure - -- name: Verify dazure +- name: Verify dnc_query for MSO version >= 3.7 ansible.builtin.assert: that: - - dazure is changed - -- name: Query dissociated azure site of a tenant - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - state: query - ignore_errors: true - register: dazure_query + - dnc_query.msg is match ("No site associated with tenant Id [0-9a-zA-Z]*") + when: version.current.version is version('3.7', '>=') -- name: Verify dnc_query +- name: Verify dnc_query MSO version <= 3.7 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 - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - state: absent - register: daaws - -- name: Verify daaws - ansible.builtin.assert: - that: - - daaws is changed - -- name: Query dissociated aws site of a tenant - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - state: query - ignore_errors: true - register: daaws_query - -- name: Verify daaws_query - ansible.builtin.assert: - that: - - daaws_query.msg is match ("No site associated with tenant Id [0-9a-zA-Z]*") + - dnc_query.msg is match ("Site Id [0-9a-zA-Z]* not associated with tenant Id [0-9a-zA-Z]*") + when: version.current.version is version('3.7', '<=') - name: Query all cisco.mso.mso_tenant_site: <<: *mso_info tenant: ansible_test - state: query - ignore_errors: true + state: query + ignore_errors: true register: query_all - name: Verify query_all diff --git a/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml b/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml index ed295450e..726444db3 100644 --- a/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml +++ b/tests/integration/targets/ndo_schema_template_deploy/tasks/main.yml @@ -38,28 +38,6 @@ - https://{{ apic_hostname }} state: present -- name: Ensure aws site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'aws_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ aws_apic_username }}' - apic_password: '{{ aws_apic_password }}' - apic_site_id: '{{ aws_site_id | default(102) }}' - urls: - - https://{{ aws_apic_hostname }} - state: present - -- name: Ensure azure site exists - cisco.mso.mso_site: - <<: *mso_info - site: 'azure_{{ mso_site | default("ansible_test") }}' - apic_username: '{{ azure_apic_username }}' - apic_password: '{{ azure_apic_password }}' - apic_site_id: '{{ azure_site_id | default(103) }}' - urls: - - https://{{ azure_apic_hostname }} - state: present - - name: Undeploy template cisco.mso.ndo_schema_template_deploy: <<: *mso_info @@ -277,40 +255,6 @@ <<: *fail_validation state: absent -- name: Ensure AWS site is present under tenant ansible_test - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'aws_{{ mso_site | default("ansible_test") }}' - cloud_account: '000000000000' - aws_access_key: 1 - secret_key: 0 - state: present - -- name: Ensure Azure site is present under tenant ansible_test - cisco.mso.mso_tenant_site: - <<: *mso_info - tenant: ansible_test - site: 'azure_{{ mso_site | default("ansible_test") }}' - cloud_account: uni/tn-ansible_test/act-[9]-vendor-azure - state: present - -- name: Add AWS site to a schema - cisco.mso.mso_schema_site: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'aws_{{ mso_site | default("ansible_test") }}' - template: Template 1 - state: present - -- name: Add Azure site to a schema - cisco.mso.mso_schema_site: - <<: *mso_info - schema: '{{ mso_schema | default("ansible_test") }}' - site: 'azure_{{ mso_site | default("ansible_test") }}' - template: Template 1 - state: present - - name: Deploy templates cisco.mso.ndo_schema_template_deploy: <<: *mso_info @@ -318,8 +262,6 @@ template: Template 1 sites: - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' state: deploy register: deploy_template_all @@ -346,8 +288,6 @@ template: Template 1 sites: - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' state: redeploy register: redeploy_template_all @@ -366,8 +306,6 @@ template: Template 1 sites: - '{{ mso_site | default("ansible_test") }}' - - 'aws_{{ mso_site | default("ansible_test") }}' - - 'azure_{{ mso_site | default("ansible_test") }}' state: undeploy register: undeploy_template_all @@ -387,16 +325,12 @@ - '"isRedeploy" in redeploy_template_all.current.reqDetails' - undeploy_template_all is not changed - '"undeploy" in undeploy_template_all.current.reqDetails' - - undeploy_template_all.current.reqDetails.undeploy | length == 3 - - deployment_status.current | length == 3 - - query_deploy_status_all.current.status | length == 3 + - undeploy_template_all.current.reqDetails.undeploy | length == 1 + - deployment_status.current | length == 1 + - query_deploy_status_all.current.status | length == 1 - query_deploy_status_all.current.status.0.status.siteStatus == "Succeeded" - - query_deploy_status_all.current.status.1.status.siteStatus == "Succeeded" - - query_deploy_status_all.current.status.2.status.siteStatus == "Succeeded" - - query_redeploy_status_all.current.status | length == 3 + - query_redeploy_status_all.current.status | length == 1 - query_redeploy_status_all.current.status.0.status.siteStatus == "Succeeded" - - query_redeploy_status_all.current.status.1.status.siteStatus == "Succeeded" - - query_redeploy_status_all.current.status.2.status.siteStatus == "Succeeded" - query_undeploy_status_all.current.status == [] - name: Verify multiple sites 4.0 specific From 17502bd7d3d9d563020f7e6ff2ec48505863590f Mon Sep 17 00:00:00 2001 From: Sabari Jaganathan <93724860+sajagana@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:33:25 +0530 Subject: [PATCH 2/3] [ignore] Removed cloud sites from the mso_schema_site_contract_service_graph module tasks and removed cloud site details from inventory.networking file --- .../tasks/l4_l7_devices.yml | 365 ++---- .../tasks/main.yml | 1142 ++++++++--------- 2 files changed, 613 insertions(+), 894 deletions(-) diff --git a/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml b/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml index e7bacfa91..fddd80153 100644 --- a/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml +++ b/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/l4_l7_devices.yml @@ -38,275 +38,102 @@ <<: *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: +- name: Remove the redirect_policy2 from the common tenant - setup part + cisco.aci.aci_rest: <<: *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 }}]" + 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 - 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 ansible_tenant to the APIC + cisco.aci.aci_tenant: + <<: *aci_info + tenant: '{{ mso_tenant | default("ansible_test") }}' + state: present - - 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 } +- 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/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml b/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml index ebee2fb2a..c0e5f49f1 100644 --- a/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml +++ b/tests/integration/targets/mso_schema_site_contract_service_graph/tasks/main.yml @@ -67,25 +67,12 @@ users: ["{{ mso_username }}"] state: present -- name: Associate Azure site with '{{ mso_tenant | default("ansible_test") }}' +- name: Associate tenant with ansible_test site 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: @@ -132,9 +119,9 @@ 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' + - name: 'ansible_tenant_firewall1' + - name: 'ansible_tenant_adc' + - name: 'ansible_tenant_other' state: present - name: Add Filter1 to ansible_template1 @@ -272,614 +259,519 @@ - 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") +- 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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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: 'ansible_tenant_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-ansible_tenant_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-ansible_tenant_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-ansible_tenant_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 From c7f2cc6c2752cf57893269e786d69f1c94a869a2 Mon Sep 17 00:00:00 2001 From: Sabari Jaganathan <93724860+sajagana@users.noreply.github.com> Date: Fri, 31 Jan 2025 16:45:13 +0530 Subject: [PATCH 3/3] [ignore] Removed cloud sites from inventory.networking --- tests/integration/inventory.networking | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/integration/inventory.networking b/tests/integration/inventory.networking index 680627d67..bec5ba4de 100644 --- a/tests/integration/inventory.networking +++ b/tests/integration/inventory.networking @@ -26,10 +26,6 @@ aws_apic_hostname=52.52.20.121 aws_apic_username=ansible_github_ci aws_apic_password="sJ94G92#8dq2hx*K4qh" aws_site_id=20 -azure_apic_hostname=20.245.236.136 -azure_apic_username=ansible_github_ci -azure_apic_password="sJ94G92#8dq2hx*K4qh" -azure_site_id=10 ansible_python_interpreter=/usr/bin/python3.9 mso_remote_location=173.36.219.190 mso_radius_server=173.36.219.128