summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml
blob: ff32012a01359a1761ed07f601f05ba7cb96efca (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
---
- debug:
    msg: START vyos_ospf_interfaces replaced integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- include_tasks: _populate.yaml

- block:

    - name: Replace the existing configuration with the provided running configuration
      register: result
      vyos.vyos.vyos_ospf_interfaces: &id001
        config:
          - name: "eth0"
            address_family:
              - afi: "ipv4"
                transmit_delay: 50
                priority: 26
                network: "point-to-point"
              - afi: "ipv6"
                dead_interval: 39
          - name: "bond2"
            address_family:
              - afi: "ipv4"
                transmit_delay: 45
                bandwidth: 70
                authentication:
                  md5_key:
                    key_id: 10
                    key: "1111111111232345"
              - afi: "ipv6"
                passive: true
        state: replaced

    - become: true
      vyos.vyos.vyos_facts:
        gather_network_resources: ospf_interfaces

    - assert:
        that:
          - result.commands|length == 8
          - result.changed == true
          - result.commands|symmetric_difference(replaced.commands) == []
          - result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []

    - name: Replace the existing configuration with the provided running configuration
        (IDEMPOTENT)
      register: result
      vyos.vyos.vyos_ospf_interfaces: *id001

    - name: Assert that the previous task was idempotent
      assert:
        that:
          - result['changed'] == false

  always:

    - include_tasks: _remove_config.yaml