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 index 4eedf01..9c9f66c 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg @@ -1,2 +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/parsed.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml index 173e3a6..b9c3abf 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml @@ -1,33 +1,15 @@ --- - debug: msg: START vyos_lldp_global parsed integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - - name: Gather lldp_global facts - register: lldp_global_facts - vyos.vyos.vyos_facts: - gather_subset: - - default - gather_network_resources: - - lldp_global - - - name: Provide the running configuration for parsing (config to be parsed) - register: result - vyos.vyos.vyos_lldp_global: - running_config: "{{ lookup('file', '_parsed_config.cfg') }}" - state: parsed - - - name: Assert that correct parsing done - assert: - that: "{{ ansible_facts['network_resources']['lldp_global'] == result['parsed']\ - \ }}" - - always: - - - include_tasks: _remove_config.yaml +- 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 index 620fb78..5e9f4c5 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml @@ -1,30 +1,28 @@ --- - debug: msg: START vyos_lldp_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml -- include_tasks: _populate.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 fb4b31e..622b8e4 100644 --- a/tests/integration/targets/vyos_lldp_global/vars/main.yaml +++ b/tests/integration/targets/vyos_lldp_global/vars/main.yaml @@ -1,53 +1,60 @@ --- merged: before: address: 192.0.2.17 enable: true legacy_protocols: - cdp commands: - set service lldp management-address '192.0.2.11' - set service lldp legacy-protocols 'fdp' after: address: 192.0.2.11 enable: true legacy_protocols: - cdp - fdp populate: address: 192.0.2.17 enable: true legacy_protocols: - cdp replaced: commands: - set service lldp legacy-protocols 'edp' - set service lldp legacy-protocols 'sonmp' - set service lldp management-address '192.0.2.14' after: address: 192.0.2.14 enable: true legacy_protocols: - 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 - delete service lldp legacy-protocols after: enable: true round_trip: after: address: 192.0.2.14 enable: true legacy_protocols: - cdp - edp - fdp - sonmp