diff options
author | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-07 18:35:01 +0530 |
---|---|---|
committer | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-07 18:35:01 +0530 |
commit | 622294ebf8acee14f4f8f9041cea14f66c13b643 (patch) | |
tree | c36d85a5e97077bb46aa315d8a7a31458261d481 /tests/integration | |
parent | aea790205c4a83c278cc60252a61c2b632e01a98 (diff) | |
download | vyos-ansible-old-622294ebf8acee14f4f8f9041cea14f66c13b643.tar.gz vyos-ansible-old-622294ebf8acee14f4f8f9041cea14f66c13b643.zip |
parsed test updated
Signed-off-by: Rohit Thakur <rohitthakur2590@outlook.com>
Diffstat (limited to 'tests/integration')
3 files changed, 39 insertions, 40 deletions
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg index 577e206..e5c3fc7 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg @@ -1,15 +1,12 @@ -set interfaces ethernet eth0 address 'dhcp' -set interfaces ethernet eth0 duplex 'auto' -set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19' -set interfaces ethernet eth0 smp_affinity 'auto' -set interfaces ethernet eth0 speed 'auto' -set interfaces ethernet eth1 description 'Configured by Ansible' +set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1' set interfaces ethernet eth1 duplex 'auto' +set interfaces ethernet eth1 hw-id '08:00:27:da:67:43' set interfaces ethernet eth1 mtu '1500' set interfaces ethernet eth1 speed 'auto' -set interfaces ethernet eth1 vif 200 description 'VIF - 200' -set interfaces ethernet eth2 description 'Configured by Ansible' -set interfaces ethernet eth2 duplex 'auto' -set interfaces ethernet eth2 mtu '1500' -set interfaces ethernet eth2 speed 'auto' -set interfaces ethernet eth2 vif 200 description 'VIF - 200' +set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100' +set interfaces ethernet eth1 vif 100 mtu '400' +set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101' +set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)' +set interfaces ethernet eth2 'disable' +set interfaces ethernet eth2 hw-id '08:00:27:d8:70:b0' +set interfaces ethernet eth2 mtu '600' diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml index 9c46fc1..a44fc2f 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml @@ -3,32 +3,14 @@ msg: START vyos_interfaces parsed integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml +- name: Parse externally provided interfaces config to agnostic model + register: result + vyos.vyos.vyos_interfaces: + running_config: "{{ lookup('file', '_parsed_config.cfg') }}" + state: parsed -- include_tasks: _populate.yaml - -- block: - - - name: Gather interfaces facts - register: interfaces_facts - vyos.vyos.vyos_facts: - gather_subset: - - default - gather_network_resources: - - interfaces - - - name: Provide the running configuration for parsing (config to be parsed) - register: result - vyos.vyos.vyos_interfaces: - running_config: "{{ lookup('file', '_parsed_config.cfg') }}" - state: parsed - - debug: - msg: "{{ ansible_facts['network_resources']['interfaces'] }}" - - name: Assert that correct parsing done - assert: - that: "{{ ansible_facts['network_resources']['interfaces'] | symmetric_difference(result['parsed'])\ - \ |length == 0 }}" - - always: - - - include_tasks: _remove_config.yaml +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" diff --git a/tests/integration/targets/vyos_interfaces/vars/main.yaml b/tests/integration/targets/vyos_interfaces/vars/main.yaml index 4c8307e..84a8bf0 100644 --- a/tests/integration/targets/vyos_interfaces/vars/main.yaml +++ b/tests/integration/targets/vyos_interfaces/vars/main.yaml @@ -104,6 +104,26 @@ replaced: enabled: true duplex: auto speed: auto +parsed: + after: + - name: eth1 + description: Configured by Ansible - Interface 1 + mtu: 1500 + speed: auto + duplex: auto + enabled: true + vifs: + - vlan_id: 100 + description: Eth1 - VIF 100 + mtu: 400 + enabled: true + - vlan_id: 101 + description: Eth1 - VIF 101 + enabled: true + - name: eth2 + description: Configured by Ansible - Interface 2 (ADMIN DOWN) + mtu: 600 + enabled: false overridden: commands: - delete interfaces ethernet eth1 description |