summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml
blob: e0c4131e1237c82dc9843eff912dd3416d73a087 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- debug:
    msg: START vyos_bgp_address_family rtt integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- include_tasks: _preconfig.yaml

- block:
    - name: Merge the provided configuration with the existing running configuration
      register: baseconfig
      vyos.vyos.vyos_bgp_address_family:
        config:
          as_number: "65536"
          address_family:
            - afi: "ipv6"
              redistribute:
                - protocol: "static"
                  metric: 50
          neighbors:
            - neighbor_address: "203.0.113.5"
              address_family:
                - afi: "ipv6"
                  allowas_in: 4
                  attribute_unchanged:
                    med: true
                  default_originate: "map01"
                  distribute_list:
                    - action: "export"
                      acl: 10
            - neighbor_address: "192.0.2.25"
              address_family:
                - afi: "ipv6"
                  maximum_prefix: 45
                  nexthop_self: true
                  route_map:
                    - action: "export"
                      route_map: "map01"
                    - action: "import"
                      route_map: "map01"
        state: merged

    - vyos.vyos.vyos_facts:
        gather_network_resources: bgp_address_family

    - assert:
        that:
          - baseconfig.commands|length == 9
          - baseconfig.changed == true
          - baseconfig.commands|symmetric_difference(merged.commands) == []
          - baseconfig.after == ansible_facts['network_resources']['bgp_address_family']

    - name: Apply the provided configuration (config to be reverted)
      register: result
      vyos.vyos.vyos_bgp_address_family:
        config:
          as_number: "65536"
          address_family:
            - afi: "ipv6"
              aggregate_address:
                - summary_only: true
                  prefix: "21e0:1:1::/64"
              networks:
                - prefix: "21e0:1:1::/64"
                  route_map: "map01"
          neighbors:
            - address_family:
                - afi: "ipv6"
                  remove_private_as: true
              neighbor_address: "203.0.113.5"

    - name: Revert back to base config using facts round trip
      register: revert
      vyos.vyos.vyos_bgp_address_family:
        config: "{{ ansible_facts['network_resources']['bgp_address_family'] }}"
        state: overridden

    - name: Assert that config was reverted
      assert:
        that: baseconfig.after == revert.after

  always:
    - include_tasks: _remove_config.yaml