summaryrefslogtreecommitdiff
path: root/test/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml
blob: cd4c308d076c615d52f8e2147d1aa2ef7c18d947 (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
58
59
60
61
62
---
- debug:
    msg: "START isoxr_lag_interfaces round trip integration tests on connection={{ ansible_connection }}"

- block:
    - include_tasks: _remove_config.yaml

    - name: Apply the provided configuration (base config)
      iosxr_lag_interfaces:
        config:
          - name: Bundle-Ether10
            members:
              - member: GigabitEthernet0/0/0/1
                mode: passive
            links:
              max_active: 10
              min_active: 2
          
          - name: Bundle-Ether11
            mode: passive
        state: merged
      register: base_config
        
    - name: Gather interfaces facts
      iosxr_facts:
        gather_subset:
          - "!all"
          - "!min"
        gather_network_resources:
          - lag_interfaces

    - name: Apply the provided configuration (config to be reverted)
      iosxr_lag_interfaces:
        config:
          - name: Bundle-Ether10
            members:
              - member: GigabitEthernet0/0/0/9
                mode: active
              - member: GigabitEthernet0/0/0/8
                mode: passive

          - name: Bundle-Ether11
            mode: active
        state: overridden
      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
      iosxr_lag_interfaces:
        config: "{{ ansible_facts['network_resources']['lag_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