mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00: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:
@@ -60,6 +60,15 @@
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_nxapi' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_evpn_vni
|
||||
when: "limit_to in ['*', 'nxos_evpn_vni']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_evpn_vni' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_evpn_global
|
||||
@@ -141,6 +150,69 @@
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_acl_interface' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vrf
|
||||
when: "limit_to in ['*', 'nxos_vrf']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vrf' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vrf_interface
|
||||
when: "limit_to in ['*', 'nxos_vrf_interface']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vrf_interface' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vrrp
|
||||
when: "limit_to in ['*', 'nxos_vrrp']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vrrp' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vtp_domain
|
||||
when: "limit_to in ['*', 'nxos_vtp_domain']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vtp_domain' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vtp_password
|
||||
when: "limit_to in ['*', 'nxos_vtp_password']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vtp_password' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vtp_version
|
||||
when: "limit_to in ['*', 'nxos_vtp_version']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vtp_version' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_rollback
|
||||
when: "limit_to in ['*', 'nxos_rollback']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_rollback' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_logging
|
||||
|
||||
@@ -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"
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_rollback/meta/main.yml
Normal file
2
test/integration/targets/nxos_rollback/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_rollback/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_rollback/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_rollback/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_rollback/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_rollback/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_rollback/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 }}"
|
||||
29
test/integration/targets/nxos_rollback/tests/cli/sanity.yaml
Normal file
29
test/integration/targets/nxos_rollback/tests/cli/sanity.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_rollback sanity test"
|
||||
|
||||
- name: delete existing checkpoint file
|
||||
nxos_config: &delete
|
||||
commands:
|
||||
- terminal dont-ask
|
||||
- delete backup.cfg
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Create checkpoint file
|
||||
nxos_rollback:
|
||||
checkpoint_file: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: rollback to the previously created checkpoint file
|
||||
nxos_rollback:
|
||||
rollback_to: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: cleanup checkpoint file
|
||||
nxos_config: *delete
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_rollback sanity test"
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_rollback sanity test"
|
||||
|
||||
- name: delete existing checkpoint file
|
||||
nxos_config: &delete
|
||||
commands:
|
||||
- terminal dont-ask
|
||||
- delete backup.cfg
|
||||
match: none
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Create checkpoint file
|
||||
nxos_rollback:
|
||||
checkpoint_file: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: rollback to the previously created checkpoint file
|
||||
nxos_rollback:
|
||||
rollback_to: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: cleanup checkpoint file
|
||||
nxos_config: *delete
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_rollback sanity test"
|
||||
2
test/integration/targets/nxos_vrf/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_vrf/defaults/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vrf/meta/main.yml
Normal file
2
test/integration/targets/nxos_vrf/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vrf/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vrf/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_vrf/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_vrf/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vrf/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vrf/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 }}"
|
||||
15
test/integration/targets/nxos_vrf/tests/cli/sanity.yaml
Normal file
15
test/integration/targets/nxos_vrf/tests/cli/sanity.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vrf sanity test"
|
||||
|
||||
- name: Ensure ntc VRF exists on switch
|
||||
nxos_vrf:
|
||||
vrf: ntc
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Ensure ntc VRF does not exist on switch
|
||||
nxos_vrf:
|
||||
vrf: ntc
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vrf sanity test"
|
||||
15
test/integration/targets/nxos_vrf/tests/nxapi/sanity.yaml
Normal file
15
test/integration/targets/nxos_vrf/tests/nxapi/sanity.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vrf sanity test"
|
||||
|
||||
- name: Ensure ntc VRF exists on switch
|
||||
nxos_vrf:
|
||||
vrf: ntc
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Ensure ntc VRF does not exist on switch
|
||||
nxos_vrf:
|
||||
vrf: ntc
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vrf sanity test"
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vrf_interface/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vrf_interface/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
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vrf_interface/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 }}"
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vrf_interface sanity test"
|
||||
|
||||
# Select interface for test
|
||||
- set_fact: intname="{{ nxos_int1 }}"
|
||||
|
||||
- block:
|
||||
- name: put interface in L3
|
||||
nxos_config:
|
||||
commands:
|
||||
- no switchport
|
||||
parents:
|
||||
- "interface {{ intname }}"
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Ensure vrf ntc exists on interface
|
||||
nxos_vrf_interface:
|
||||
vrf: ntc
|
||||
interface: "{{ intname }}"
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Ensure ntc VRF does not exist on interface
|
||||
nxos_vrf_interface:
|
||||
vrf: ntc
|
||||
interface: "{{ intname }}"
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
|
||||
always:
|
||||
- name: put interface in default mode
|
||||
nxos_config:
|
||||
lines: "default interface {{ intname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vrf_interface sanity test"
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vrf_interface sanity test"
|
||||
|
||||
# Select interface for test
|
||||
- set_fact: intname="{{ nxos_int1 }}"
|
||||
|
||||
- block:
|
||||
- name: put interface in L3
|
||||
nxos_config:
|
||||
commands:
|
||||
- no switchport
|
||||
parents:
|
||||
- "interface {{ intname }}"
|
||||
match: none
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Ensure vrf ntc exists on interface
|
||||
nxos_vrf_interface:
|
||||
vrf: ntc
|
||||
interface: "{{ intname }}"
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Ensure ntc VRF does not exist on interface
|
||||
nxos_vrf_interface:
|
||||
vrf: ntc
|
||||
interface: "{{ intname }}"
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
always:
|
||||
- name: put interface in default mode
|
||||
nxos_config:
|
||||
lines: "default interface {{ intname }}"
|
||||
provider: "{{ nxapi }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vrf_interface sanity test"
|
||||
2
test/integration/targets/nxos_vrrp/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_vrrp/defaults/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vrrp/meta/main.yml
Normal file
2
test/integration/targets/nxos_vrrp/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vrrp/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vrrp/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_vrrp/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_vrrp/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vrrp/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vrrp/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 }}"
|
||||
72
test/integration/targets/nxos_vrrp/tests/cli/sanity.yaml
Normal file
72
test/integration/targets/nxos_vrrp/tests/cli/sanity.yaml
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vrrp sanity test"
|
||||
|
||||
- block:
|
||||
- name: "Enable interface-vlan"
|
||||
nxos_feature:
|
||||
feature: interface-vlan
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: "Enable vrrp"
|
||||
nxos_feature:
|
||||
feature: vrrp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: "create int vlan 10"
|
||||
nxos_interface:
|
||||
interface: "vlan 10"
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
|
||||
nxos_vrrp:
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Ensure removal of the vrrp group config
|
||||
# vip is required to ensure the user knows what they are removing
|
||||
nxos_vrrp: &remove
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Re-config with more params
|
||||
nxos_vrrp:
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
preempt: false
|
||||
priority: 130
|
||||
authentication: AUTHKEY
|
||||
provider: "{{ cli }}"
|
||||
|
||||
always:
|
||||
- name: remove vrrp
|
||||
nxos_vrrp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable interface-vlan"
|
||||
nxos_config:
|
||||
commands:
|
||||
- no feature interface-vlan
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable vrrp"
|
||||
nxos_feature:
|
||||
feature: vrrp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vrrp sanity test"
|
||||
70
test/integration/targets/nxos_vrrp/tests/nxapi/sanity.yaml
Normal file
70
test/integration/targets/nxos_vrrp/tests/nxapi/sanity.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vrrp sanity test"
|
||||
|
||||
- block:
|
||||
- name: "Enable interface-vlan"
|
||||
nxos_feature:
|
||||
feature: interface-vlan
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: "Enable vrrp"
|
||||
nxos_feature:
|
||||
feature: vrrp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: "create int vlan 10"
|
||||
nxos_config:
|
||||
commands:
|
||||
- interface vlan 10
|
||||
match: none
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
|
||||
nxos_vrrp:
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Ensure removal of the vrrp group config
|
||||
# vip is required to ensure the user knows what they are removing
|
||||
nxos_vrrp: &remove
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: Re-config with more params
|
||||
nxos_vrrp:
|
||||
interface: vlan10
|
||||
group: 100
|
||||
vip: 10.1.100.1
|
||||
preempt: false
|
||||
priority: 130
|
||||
authentication: AUTHKEY
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
always:
|
||||
- name: remove vrrp
|
||||
nxos_vrrp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable interface-vlan"
|
||||
nxos_config:
|
||||
commands:
|
||||
- no feature interface-vlan
|
||||
provider: "{{ nxapi }}"
|
||||
match: none
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable vrrp"
|
||||
nxos_feature:
|
||||
feature: vrrp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vrrp sanity test"
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vtp_domain/meta/main.yml
Normal file
2
test/integration/targets/nxos_vtp_domain/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vtp_domain/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vtp_domain/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_vtp_domain/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_vtp_domain/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vtp_domain/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 }}"
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vtp_domain sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure vtp domain
|
||||
nxos_vtp_domain:
|
||||
domain: ntc
|
||||
provider: "{{ cli }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vtp_domain sanity test"
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vtp_domain sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: configure vtp domain
|
||||
nxos_vtp_domain:
|
||||
domain: ntc
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vtp_domain sanity test"
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vtp_password/meta/main.yml
Normal file
2
test/integration/targets/nxos_vtp_password/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vtp_password/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vtp_password/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
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vtp_password/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 }}"
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vtp_password sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure vtp password
|
||||
nxos_vtp_password:
|
||||
password: ntc
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: remove vtp password
|
||||
nxos_vtp_password:
|
||||
password: ntc
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vtp_password sanity test"
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vtp_password sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: configure vtp password
|
||||
nxos_vtp_password:
|
||||
password: ntc
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: remove vtp password
|
||||
nxos_vtp_password:
|
||||
password: ntc
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vtp_password sanity test"
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vtp_version/meta/main.yml
Normal file
2
test/integration/targets/nxos_vtp_version/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vtp_version/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vtp_version/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
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vtp_version/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 }}"
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_vtp_version sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure vtp version
|
||||
nxos_vtp_version:
|
||||
version: 2
|
||||
provider: "{{ cli }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_vtp_version sanity test"
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_vtp_version sanity test"
|
||||
|
||||
- block:
|
||||
- name: enable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: configure vtp version
|
||||
nxos_vtp_version:
|
||||
version: 2
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
always:
|
||||
- name: disable feature vtp
|
||||
nxos_feature:
|
||||
feature: vtp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_vtp_version sanity test"
|
||||
Reference in New Issue
Block a user