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

- include_tasks: _remove_config.yaml

- include_tasks: _populate.yaml

- block:

    - name: Replace  the provided configuration with the exisiting running configuration
      register: result
      vyos.vyos.vyos_route_maps: &id001
        config:
          - route_map: test3
            entries:
              - sequence: 1
                action: permit
                match:
                  metric: 3
                  peer: 192.0.2.35
                set:
                  local_preference: 6
                  metric: 4
                  metric_type: "type-1"
                  origin: egp
                  originator_id: 192.0.2.34
                  tag: 4
                  weight: 4
        state: replaced

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

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

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

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

  always:

    - include_tasks: _remove_config.yaml