diff options
Diffstat (limited to 'test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml')
-rw-r--r-- | test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml b/test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml new file mode 100644 index 0000000..3ec4d3d --- /dev/null +++ b/test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: "START vyos_interfaces round trip integration tests on connection={{ ansible_connection }}" + +- include_tasks: _remove_config.yaml + +- block: + - name: Apply the provided configuration (base config) + vyos.vyos.vyos_interfaces: + config: + - name: eth0 + enabled: true + duplex: "auto" + speed: "auto" + + - name: eth1 + description: "Interface - 1" + mtu: 1500 + vifs: + - vlan_id: 100 + description: "Eth1 - VIF 100" + mtu: 200 + + - vlan_id: 101 + enabled: false + + - name: eth2 + description: "Interface - 2" + enabled: true + mtu: 900 + state: merged + register: base_config + + - name: Gather interfaces facts + vyos.vyos.vyos_facts: + gather_subset: + - default + gather_network_resources: + - interfaces + + - name: Apply the provided configuration (config to be reverted) + vyos.vyos.vyos_interfaces: + config: + - name: eth1 + description: "Interface 1 - Description (WILL BE REVERTED)" + mtu: 1200 + vifs: + - vlan_id: 100 + description: "Eth1 - VIF 100 (WILL BE REVERTED)" + mtu: 400 + + - vlan_id: 101 + description: "Eth1 - VIF 101 (WILL BE REMOVED)" + enabled: true + + - name: eth2 + description: "Interface 2 (ADMIN DOWN) (WILL BE REVERTED)" + mtu: 600 + enabled: false + state: merged + register: result + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" + + - name: Revert back to base config using facts round trip + vyos.vyos.vyos_interfaces: + config: "{{ ansible_facts['network_resources']['interfaces'] }}" + state: replaced + register: revert + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" + + always: + - include_tasks: _remove_config.yaml |