mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
---
|
||||
testcase: "*"
|
||||
test_items: []
|
||||
16
tests/integration/targets/exos_command/tasks/cli.yaml
Normal file
16
tests/integration/targets/exos_command/tasks/cli.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: collect all common test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
delegate_to: localhost
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test cases (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
16
tests/integration/targets/exos_command/tasks/httpapi.yaml
Normal file
16
tests/integration/targets/exos_command/tasks/httpapi.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: collect all common test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
delegate_to: localhost
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test cases (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=httpapi"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
3
tests/integration/targets/exos_command/tasks/main.yaml
Normal file
3
tests/integration/targets/exos_command/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- {include: cli.yaml, tags: ['cli']}
|
||||
- {include: httpapi.yaml, tags: ['httpapi']}
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- debug: msg="START common/multiple.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run multiple commands on remote nodes
|
||||
exos_command:
|
||||
commands:
|
||||
- show version
|
||||
- show ports no-refresh
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END common/multiple.yaml on connection={{ ansible_connection }}"
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- debug: msg="START common/prompt.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run command that requires answering a prompt
|
||||
exos_command:
|
||||
commands:
|
||||
- command: 'clear license-info'
|
||||
prompt: 'Are you sure.*'
|
||||
answer: 'Yes'
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END common/prompt.yaml on connection={{ ansible_connection }}"
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- debug: msg="START common/single.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run show version on remote devices
|
||||
exos_command:
|
||||
commands: show version
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END common/single.yaml on connection={{ ansible_connection }}"
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- debug: msg="START common/waitfor.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run show version and check to see if output contains ExtremeXOS
|
||||
exos_command:
|
||||
commands: show version
|
||||
wait_for: result[0] contains ExtremeXOS
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END common/waitfor.yaml on connection={{ ansible_connection }}"
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- debug: msg="START common/waitfor_multiple.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run multiple commands and evaluate the output
|
||||
exos_command:
|
||||
commands:
|
||||
- show version
|
||||
- show ports no-refresh
|
||||
wait_for:
|
||||
- result[0] contains ExtremeXOS
|
||||
- result[1] contains 20
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
|
||||
- debug: msg="END common/waitfor_multiple.yaml on connection={{ ansible_connection }}"
|
||||
Reference in New Issue
Block a user