summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_bgp_global/tests/cli/merged.yaml
blob: 8a09c015917ace851ffad56c84a16ad0e86227cc (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
63
64
65
66
67
68
69
70
71
---
- debug:
    msg: START vyos_bgp_global merged integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- include_tasks: _preconfig.yaml

- block:

    - name: Merge the provided configuration with the exisiting running configuration
      register: result
      vyos.vyos.vyos_bgp_global: &id001
        config:
          as_number: "65536"
          aggregate_address:
            - prefix: "203.0.113.0/24"
              as_set: true
            - prefix: "192.0.2.0/24"
              summary_only: true
          network:
            - address: "192.1.13.0/24"
              backdoor: true
          redistribute:
            - protocol: "kernel"
              metric: 45
            - protocol: "connected"
              route_map: "map01"
          maximum_paths:
            - path: "ebgp"
              count: 20
            - path: "ibgp"
              count: 55
          timers:
            keepalive: 35
          bgp_params:
            bestpath:
              as_path: "confed"
              compare_routerid: true
            default:
              no_ipv4_unicast: true
            router_id: "192.1.2.9"
        state: merged

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

    - assert:
        that:
          - result.commands|length == 12
          - result.changed == true
          - result.commands|symmetric_difference(merged.commands) == []
          - result.after == ansible_facts['network_resources']['bgp_global']
          - result.before == {}
          - result.after == merged.after

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

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

  always:

    - include_tasks: _remove_config.yaml