mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add nxos_igmp IT (#28020)
This commit is contained in:
parent
b74300b657
commit
065c80c081
8 changed files with 108 additions and 0 deletions
2
test/integration/targets/nxos_igmp/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_igmp/defaults/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_igmp/meta/main.yml
Normal file
2
test/integration/targets/nxos_igmp/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_igmp/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_igmp/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
|
7
test/integration/targets/nxos_igmp/tasks/main.yaml
Normal file
7
test/integration/targets/nxos_igmp/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Use block to ensure that both cli and nxapi tests
|
||||
# will run even if there are failures or errors.
|
||||
- block:
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
always:
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
28
test/integration/targets/nxos_igmp/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_igmp/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 }}"
|
4
test/integration/targets/nxos_igmp/tests/cli/sanity.yaml
Normal file
4
test/integration/targets/nxos_igmp/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml
|
46
test/integration/targets/nxos_igmp/tests/common/sanity.yaml
Normal file
46
test/integration/targets/nxos_igmp/tests/common/sanity.yaml
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp sanity test"
|
||||
|
||||
- block:
|
||||
|
||||
- name: Configure igmp with non-default values
|
||||
nxos_igmp: &non-default
|
||||
flush_routes: true
|
||||
enforce_rtr_alert: true
|
||||
restart: false
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence - Configure igmp interface with non-default values"
|
||||
nxos_igmp: *non-default
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Configure igmp with default values
|
||||
nxos_igmp: &default
|
||||
state: default
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence - Configure igmp with default values"
|
||||
nxos_igmp: *default
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: Configure igmp with default values
|
||||
nxos_igmp: *default
|
||||
register: result
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp sanity test"
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml
|
Loading…
Reference in a new issue