diff options
author | Ganesh Nalawade <ganesh634@gmail.com> | 2020-06-20 03:35:43 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-19 22:05:43 +0000 |
commit | 4e3215a6c468ba0ac45bc01e8b1727b104dfdd56 (patch) | |
tree | 799936fae6f7fff0bf922bf5af2561c4f71a7434 /tests/integration/targets/vyos_facts | |
parent | 04d6824f87023ec59dfed5eacb7684b024b15f32 (diff) | |
download | vyos-ansible-old-4e3215a6c468ba0ac45bc01e8b1727b104dfdd56.tar.gz vyos-ansible-old-4e3215a6c468ba0ac45bc01e8b1727b104dfdd56.zip |
Add basic testcase for shortname testing (#35)
Add basic testcase for shortname testing
Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests/integration/targets/vyos_facts')
3 files changed, 63 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_facts/tasks/main.yaml b/tests/integration/targets/vyos_facts/tasks/main.yaml index a3db933..fb74fa1 100644 --- a/tests/integration/targets/vyos_facts/tasks/main.yaml +++ b/tests/integration/targets/vyos_facts/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_facts/tasks/redirection.yaml b/tests/integration/targets/vyos_facts/tasks/redirection.yaml new file mode 100644 index 0000000..5564a3e --- /dev/null +++ b/tests/integration/targets/vyos_facts/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_facts/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml new file mode 100644 index 0000000..05399f1 --- /dev/null +++ b/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml @@ -0,0 +1,42 @@ +--- +- name: get host name + register: vyos_host + vyos.vyos.command: + commands: + - show host name + +- name: get version info + register: vyos_version + vyos.vyos.command: + commands: + - show version + +- name: collect all facts from the device + register: result + vyos.vyos.facts: + gather_subset: all + +- name: check that hostname is present + assert: + that: + - result.ansible_facts.ansible_net_hostname == vyos_host.stdout[0] + +- name: check that subsets are present + assert: + that: + - "'neighbors' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - "'config' in result.ansible_facts.ansible_net_gather_subset" + +- name: check that version info is present + assert: + that: + - result.ansible_facts.ansible_net_version in vyos_version.stdout_lines[0][0] + - result.ansible_facts.ansible_net_model in vyos_version.stdout_lines[0][9] + - result.ansible_facts.ansible_net_serialnum in vyos_version.stdout_lines[0][10] + +- name: check that config info is present + assert: + that: + - result.ansible_facts.ansible_net_commits is defined + - result.ansible_facts.ansible_net_config is defined |