mirror of https://github.com/ansible/ansible.git
nxos: merge nxapi/cli tests - ospf, portchannel, rollback, switchport (#28240)
* refactor nxos_ospf * refactor nxos_portchannel * refactor nxos_rollback * refactor nxos_switchportpull/26558/merge
parent
f2c34d51f2
commit
c810a62db9
@ -1,15 +1,25 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
- name: collect common cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: collect cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: cli_cases
|
||||
|
||||
- set_fact:
|
||||
test_cases:
|
||||
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
include: "{{ test_case_to_run }} connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_ospf/tests/common/sanity.yaml
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_ospf/tests/common/sanity.yaml
|
@ -1,15 +1,25 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
- name: collect common cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: collect cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: cli_cases
|
||||
|
||||
- set_fact:
|
||||
test_cases:
|
||||
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
include: "{{ test_case_to_run }} connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"
|
@ -1,15 +1,25 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
- name: collect common cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: collect cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: cli_cases
|
||||
|
||||
- set_fact:
|
||||
test_cases:
|
||||
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
include: "{{ test_case_to_run }} connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
- 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"
|
@ -1,15 +1,25 @@
|
||||
---
|
||||
- name: collect all cli test cases
|
||||
- name: collect common cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: collect cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: cli_cases
|
||||
|
||||
- set_fact:
|
||||
test_cases:
|
||||
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
include: "{{ test_case_to_run }} connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_switchport/tests/common/sanity.yaml
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_switchport/tests/common/sanity.yaml
|
Loading…
Reference in New Issue