diff options
author | ansible-zuul[bot] <48994755+ansible-zuul[bot]@users.noreply.github.com> | 2020-05-09 06:37:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 06:37:59 +0000 |
commit | 3aff24d94d039a064090313c2894d7ee1e53fa71 (patch) | |
tree | 2012d12a4e50477cf926de87869df7e91e4c68b8 /tests/integration/targets | |
parent | 6291969bf7dfdbb655cde97124bd6071af2460fa (diff) | |
parent | eb0b2da9decdedffb669f53aeb0517b2b07c6748 (diff) | |
download | vyos-ansible-old-3aff24d94d039a064090313c2894d7ee1e53fa71.tar.gz vyos-ansible-old-3aff24d94d039a064090313c2894d7ee1e53fa71.zip |
Merge pull request #29 from rohitthakur2590/lldp_global_states_added
[VyOS] LLDP global resource module updated with new states
Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests/integration/targets')
6 files changed, 106 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg new file mode 100644 index 0000000..9c9f66c --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg @@ -0,0 +1,3 @@ +set service lldp legacy-protocols 'fdp' +set service lldp legacy-protocols 'cdp' +set service lldp management-address '192.0.2.17' diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml index a197c45..0333fa4 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml @@ -24,3 +24,26 @@ - assert: that: - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Parsed with empty running_config should give appropriate error message + register: result + ignore_errors: true + vyos.vyos.vyos_lldp_global: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + vyos.vyos.vyos_lldp_global: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml new file mode 100644 index 0000000..95e01de --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START vyos_lldp_global gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Gather the provided configuration with the exisiting running configuration + register: result + vyos.vyos.vyos_lldp_global: + config: + state: gathered + + - name: Assert that gathered dicts was correctly generated + assert: + that: + - "{{ populate == result['gathered'] }}" + + always: + + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml new file mode 100644 index 0000000..b9c3abf --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START vyos_lldp_global parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided LLDP global config to agnostic model + register: result + vyos.vyos.vyos_lldp_global: + running_config: "{{ lookup('file', '_parsed_config.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml new file mode 100644 index 0000000..5e9f4c5 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_lldp_global rendered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Structure provided configuration into device specific commands + register: result + vyos.vyos.vyos_lldp_global: + config: + address: 192.0.2.17 + enable: true + legacy_protocols: + - cdp + state: rendered + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ + \ |length == 0 }}" + + always: + + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/vars/main.yaml b/tests/integration/targets/vyos_lldp_global/vars/main.yaml index 81e71be..622b8e4 100644 --- a/tests/integration/targets/vyos_lldp_global/vars/main.yaml +++ b/tests/integration/targets/vyos_lldp_global/vars/main.yaml @@ -31,6 +31,18 @@ replaced: - cdp - edp - sonmp +parsed: + after: + address: 192.0.2.17 + enable: true + legacy_protocols: + - fdp + - cdp +rendered: + commands: + - set service lldp legacy-protocols 'cdp' + - set service lldp + - set service lldp management-address '192.0.2.17' deleted: commands: - delete service lldp management-address |