Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed cloud site tasks from test files (DCNE-233) #593

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tests/integration/inventory.networking
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/targets/mso_rest/tasks/json_inline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@
loop:
- '{{ mso_schema | default("ansible_test") }}_2'
- '{{ mso_schema | default("ansible_test") }}'
- 'aws_{{ mso_site | default("ansible_test") }}'
sajagana marked this conversation as resolved.
Show resolved Hide resolved
- 'azure_{{ mso_site | default("ansible_test") }}'

- name: Remove tenant ansible_test
cisco.mso.mso_tenant:
Expand Down
17 changes: 12 additions & 5 deletions tests/integration/targets/mso_schema_site/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
176 changes: 5 additions & 171 deletions tests/integration/targets/mso_schema_site_anp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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")
- 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', '>')
Loading