mirror of https://github.com/ansible/ansible.git
Add test for reboot & wait_for_connection on EOS & IOS (#63014)
* Add test for reboot & wait_for_connection * Add test for ios * Collection-proof block test * Add junos test * Don't try to evaluate cli context unless using the connection * Prevent infinite recursionpull/66258/head
parent
40394ed671
commit
e19b94f43b
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- cli_command:
|
||||||
|
command: reload power
|
||||||
|
prompt:
|
||||||
|
- "yes/no/cancel/diff]"
|
||||||
|
- "confirm]"
|
||||||
|
answer:
|
||||||
|
- "no"
|
||||||
|
- ""
|
||||||
|
check_all: yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- wait_for_connection:
|
||||||
|
delay: 20
|
||||||
|
sleep: 10
|
||||||
|
|
||||||
|
- cli_command:
|
||||||
|
command: show version
|
||||||
|
when: ansible_connection.endswith("network_cli")
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- cli_command:
|
||||||
|
command: reload
|
||||||
|
prompt:
|
||||||
|
- "yes/no"
|
||||||
|
- "confirm"
|
||||||
|
answer:
|
||||||
|
- "no"
|
||||||
|
- "y"
|
||||||
|
check_all: yes
|
||||||
|
|
||||||
|
- wait_for_connection:
|
||||||
|
delay: 20
|
||||||
|
sleep: 10
|
||||||
|
|
||||||
|
- cli_command:
|
||||||
|
command: show version
|
||||||
|
when: ansible_connection.endswith("network_cli")
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
- name: collect cli test cases
|
||||||
|
find:
|
||||||
|
paths: "{{ role_path }}/tests/cli"
|
||||||
|
patterns: "{{ testcase }}.yaml"
|
||||||
|
connection: local
|
||||||
|
register: test_cases
|
||||||
|
|
||||||
|
- name: set test_items
|
||||||
|
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||||
|
|
||||||
|
- name: run test case (connection=network_cli)
|
||||||
|
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||||
|
with_items: "{{ test_items }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: test_case_to_run
|
||||||
@ -1,2 +1,3 @@
|
|||||||
---
|
---
|
||||||
|
- { include: cli.yaml, tags: ['cli'] }
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
- { include: netconf.yaml, tags: ['netconf'] }
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- cli_command:
|
||||||
|
command: request system reboot
|
||||||
|
prompt:
|
||||||
|
- Reboot the system?
|
||||||
|
answer:
|
||||||
|
- y
|
||||||
|
|
||||||
|
- wait_for_connection:
|
||||||
|
delay: 20
|
||||||
|
sleep: 10
|
||||||
|
|
||||||
|
- cli_command:
|
||||||
|
command: show version
|
||||||
Loading…
Reference in New Issue