mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -07:00
Add integration tests and fix nxos providers (#26913)
* fix issues with python3.x * Add integration testa and fix for nxos_evpn_vni * add nxos_evpn_vni to nxos.yaml * fix get_vtp_config() * add new integration tests * fix rollback * add integration test files
This commit is contained in:
parent
cee9b08e70
commit
9b9a8749da
66 changed files with 1158 additions and 80 deletions
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_evpn_vni/meta/main.yml
Normal file
2
test/integration/targets/nxos_evpn_vni/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_evpn_vni/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_evpn_vni/tasks/cli.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
3
test/integration/targets/nxos_evpn_vni/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_evpn_vni/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
28
test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: collect all nxapi test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nxapi"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: enable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- feature nxapi
|
||||
- nxapi http port 80
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: disable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- no feature nxapi
|
||||
provider: "{{ cli }}"
|
74
test/integration/targets/nxos_evpn_vni/tests/cli/sanity.yaml
Normal file
74
test/integration/targets/nxos_evpn_vni/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_evpn_vni sanity test"
|
||||
|
||||
- name: "Setup"
|
||||
nxos_config: &remove_evpn
|
||||
lines: no nv overlay evpn
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: "Enable nv overlay evpn"
|
||||
nxos_config:
|
||||
lines: nv overlay evpn
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: "Configure nxos_evpn_vni"
|
||||
nxos_evpn_vni: &evpn_vni
|
||||
vni: 6000
|
||||
route_distinguisher: "60:10"
|
||||
route_target_import:
|
||||
- "5000:10"
|
||||
- "4100:100"
|
||||
route_target_export: auto
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_evpn_vni: *evpn_vni
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: "remove nxos_evpn_vni"
|
||||
nxos_evpn_vni: &rvni
|
||||
vni: 6000
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_evpn_vni: *rvni
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: "Remove nv overlay evpn"
|
||||
nxos_config: *remove_evpn
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_evpn_vni sanity test"
|
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_evpn_vni sanity test"
|
||||
|
||||
- name: "Setup"
|
||||
nxos_config: &remove_evpn
|
||||
lines: no nv overlay evpn
|
||||
provider: "{{ nxapi }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: "Enable nv overlay evpn"
|
||||
nxos_config:
|
||||
lines: nv overlay evpn
|
||||
provider: "{{ nxapi }}"
|
||||
match: none
|
||||
|
||||
- name: "Configure nxos_evpn_vni"
|
||||
nxos_evpn_vni: &evpn_vni
|
||||
vni: 6000
|
||||
route_distinguisher: "60:10"
|
||||
route_target_import:
|
||||
- "5000:10"
|
||||
- "4100:100"
|
||||
route_target_export: auto
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_evpn_vni: *evpn_vni
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: "remove nxos_evpn_vni"
|
||||
nxos_evpn_vni: &rvni
|
||||
vni: 6000
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_evpn_vni: *rvni
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: "Remove nv overlay evpn"
|
||||
nxos_config: *remove_evpn
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_evpn_vni sanity test"
|
Loading…
Add table
Add a link
Reference in a new issue