nxos: merge nxapi/cli tests - ospf, portchannel, rollback, switchport (#28240)

* refactor nxos_ospf

* refactor nxos_portchannel

* refactor nxos_rollback

* refactor nxos_switchport
pull/26558/merge
David Newswanger 7 years ago committed by Trishna Guha
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,10 +1,20 @@
---
- name: collect all nxapi test cases
- name: collect common nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@ -16,7 +26,7 @@
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
include: "{{ test_case_to_run }} connection={{ nxapi }}"
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,10 +1,20 @@
---
- name: collect all nxapi test cases
- name: collect common nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@ -16,7 +26,7 @@
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
include: "{{ test_case_to_run }} connection={{ nxapi }}"
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,10 +1,20 @@
---
- name: collect all nxapi test cases
- name: collect common nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@ -16,7 +26,7 @@
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
include: "{{ test_case_to_run }} connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

@ -1,5 +1,5 @@
---
- debug: msg="START TRANSPORT:CLI nxos_rollback sanity test"
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_rollback sanity test"
- name: delete existing checkpoint file
nxos_config: &delete
@ -7,23 +7,23 @@
- terminal dont-ask
- delete backup.cfg
match: none
provider: "{{ cli }}"
provider: "{{ connection }}"
ignore_errors: yes
- name: Create checkpoint file
nxos_rollback:
checkpoint_file: backup.cfg
timeout: 300
provider: "{{ cli }}"
provider: "{{ connection }}"
- name: rollback to the previously created checkpoint file
nxos_rollback:
rollback_to: backup.cfg
timeout: 300
provider: "{{ cli }}"
provider: "{{ connection }}"
- name: cleanup checkpoint file
nxos_config: *delete
ignore_errors: yes
- debug: msg="END TRANSPORT:CLI nxos_rollback sanity test"
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_rollback sanity test"

@ -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,10 +1,20 @@
---
- name: collect all nxapi test cases
- name: collect common nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@ -16,7 +26,7 @@
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
include: "{{ test_case_to_run }} connection={{ nxapi }}"
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…
Cancel
Save