Files
ansible/test/integration/targets/junos_command/tests/cli/cli_commmand.yaml
Ganesh Nalawade e40b96ed88 Refactor CLI prompt mode check for network plugins (#63945) (#69210)
* Refactor CLI prompt mode check for network plugins (#63945)

* Refactor CLI prompt mode check for network plugins

*  Move the CLI prompt mode check logic from action plugin
   to the controller side with the cliconf plugins.

*  This refactor also allows the network modules
   to initialise the persistent connection with remote device
   only when it is required.

* Fix review comments

(cherry picked from commit c27e47327f)

* Fix cli context check for network_cli connection (#64697)

* Fix cli context check for network_cli connection

Fixes #64575

*  Check cli context for network_cli connection
   at the start of new task run only.

* Pass task_uuid around to identify start of new task run

* Handle for local connection

(cherry picked from commit ee3f8d28a4)

* 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 recursion

* Update change log

(cherry picked from commit e19b94f43b)
(cherry picked from commit ee3f8d28a4)
(cherry picked from commit e19b94f43b)

devel:
https://github.com/ansible/ansible/pull/63945
https://github.com/ansible/ansible/pull/64697
https://github.com/ansible/ansible/pull/63014

Co-authored-by: Nathaniel Case <ncase@redhat.com>
2020-05-05 21:26:17 -07:00

65 lines
1.3 KiB
YAML

---
- debug:
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- block:
- name: get output for single command
cli_command:
command: show version
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test with prompt and answer
cli_command:
command: "{{ item }}"
prompt:
- "Exit with uncommitted changes"
answer: yes
loop:
- configure
- set system syslog file test any any
- rollback
- exit
register: result
- assert:
that:
- "result.changed == false"
- cli_command:
command: "{{item}}"
prompt:
- "New password"
- "Retype new password"
answer:
- "Test1234"
- "Test1234"
check_all: True
loop:
- "configure"
- "rollback"
- "set system login user ansible_test class operator authentication plain-text-password"
- "commit"
register: result
ignore_errors: True
- assert:
that:
- "'failed' not in result"
- junos_netconf:
register: result
ignore_errors: True
- assert:
that:
- "result.failed == false"
when: ansible_connection == 'network_cli'
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"