diff options
Diffstat (limited to 'tests/integration/targets/vyos_command')
3 files changed, 62 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_command/tasks/main.yaml b/tests/integration/targets/vyos_command/tasks/main.yaml index a3db933e..fb74fa16 100644 --- a/tests/integration/targets/vyos_command/tasks/main.yaml +++ b/tests/integration/targets/vyos_command/tasks/main.yaml @@ -2,3 +2,8 @@ - include: cli.yaml tags: - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') + tags: + - redirection diff --git a/tests/integration/targets/vyos_command/tasks/redirection.yaml b/tests/integration/targets/vyos_command/tasks/redirection.yaml new file mode 100644 index 00000000..5564a3ea --- /dev/null +++ b/tests/integration/targets/vyos_command/tasks/redirection.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all redirection cli test cases + find: + paths: '{{ role_path }}/tests/redirection/cli' + patterns: '{{ testcase }}.yaml' + register: shortname_test_cases + delegate_to: localhost + +- name: set test_items for redirection + set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_command/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_command/tests/redirection/cli/shortname.yaml new file mode 100644 index 00000000..013d1762 --- /dev/null +++ b/tests/integration/targets/vyos_command/tests/redirection/cli/shortname.yaml @@ -0,0 +1,41 @@ +--- +- debug: msg="START cli/shortname.yaml on connection={{ ansible_connection }}" + +- name: get output for single command + register: result + vyos.vyos.command: + commands: show version + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands + register: result + vyos.vyos.command: + commands: + - show version + - show interfaces + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout | length == 2 + +- name: Get output for multiple commands that call less explicitly + register: result + vyos.vyos.command: + commands: + - show hardware cpu detail + - show hardware mem + - show license +- assert: + that: + - result.changed == false + - result.stdout_lines is defined + - result.stdout_lines[2] | length >= 20 + +- debug: msg="END cli/shortname.yaml on connection={{ ansible_connection }}" |