ansible/test/integration/targets/vyos_interfaces/tests/cli/rtt.yaml

79 lines
2.1 KiB
YAML
Raw Normal View History

---
- 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_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_facts:
gather_subset:
- default
gather_network_resources:
- interfaces
- name: Apply the provided configuration (config to be reverted)
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_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