summaryrefslogtreecommitdiff
path: root/test/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml
blob: d97cf9c4cbbe5fc5c259e3628819093d8d2bdf5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- debug:
    msg: "START vyos_lldp_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_lldp_interfaces:
      config:
        - name: 'eth1'
          location:
            civic_based: 
              country_code: 'US' 
              ca_info:
                - ca_type: 0 
                  ca_value: 'ENGLISH'

      state: merged
    register: base_config

  - name: Gather lldp_interfaces facts
    vyos.vyos.vyos_facts:
      gather_subset:
        - default
      gather_network_resources:
        - lldp_interfaces

  - name: Apply the provided configuration (config to be reverted)
    vyos.vyos.vyos_lldp_interfaces:
      config:
        - name: 'eth2'
          location:
            coordinate_based: 
             altitude: 2200 
             datum: 'WGS84'
             longitude: '222.267255W'
             latitude: '33.524449N'        
      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_lldp_interfaces:
      config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}"
      state: overridden
    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