summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml
blob: 60f96f5e7b37b9fa7ba626347a0730f0e147b116 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
- debug:
    msg: START vyos_ospfv2 round trip integration tests on connection={{ ansible_connection }}

- include_tasks: _remove_config.yaml

- block:
    - name: Apply the provided configuration (base config)
      register: base_config
      vyos.vyos.vyos_ospfv2:
        config:
          log_adjacency_changes: detail
          max_metric:
            router_lsa:
              administrative: true
              on_shutdown: 10
              on_startup: 10
          default_information:
            originate:
              always: true
              metric: 10
              metric_type: 2
              route_map: ingress
          mpls_te:
            enabled: true
            router_address: 192.0.11.11
          auto_cost:
            reference_bandwidth: 2
          neighbor:
            - neighbor_id: 192.0.11.12
              poll_interval: 10
              priority: 2
          redistribute:
            - route_type: bgp
              metric: 10
              metric_type: 2
          passive_interface:
            - eth1
            - eth2
          parameters:
            router_id: 192.0.1.1
            opaque_lsa: true
            rfc1583_compatibility: true
            abr_type: cisco
          areas:
            - area_id: "2"
              area_type:
                normal: true
              authentication: plaintext-password
              shortcut: enable
            - area_id: "3"
              area_type:
                nssa:
                  set: true
            - area_id: "4"
              area_type:
                stub:
                  default_cost: 20
              network:
                - address: 192.0.2.0/24
              range:
                - address: 192.0.3.0/24
                  cost: 10
                - address: 192.0.4.0/24
                  cost: 12
        state: merged

    - name: Gather ospfv2 facts
      vyos.vyos.vyos_facts:
        gather_subset:
          - default
        gather_network_resources:
          - ospfv2

    - name: Apply the provided configuration (config to be reverted)
      register: result
      vyos.vyos.vyos_ospfv2:
        config:
          areas:
            - area_id: "2"
              area_type:
                normal: true
              authentication: plaintext-password
              shortcut: enable
            - area_id: "4"
              area_type:
                stub:
                  default_cost: 20
                  set: true
              network:
                - address: 192.0.12.0/24
                - address: 192.0.2.0/24
                - address: 192.0.22.0/24
                - address: 192.0.32.0/24
              range:
                - address: 1.1.2.0/24
                  cost: 10
          auto_cost:
            reference_bandwidth: 2
          default_information:
            originate:
              always: true
              metric: 10
              metric_type: 2
              route_map: ingress
          log_adjacency_changes: detail
          max_metric:
            router_lsa:
              administrative: true
              on_shutdown: 10
              on_startup: 10
          mpls_te:
            enabled: true
            router_address: 192.0.22.22
          neighbor:
            - neighbor_id: 192.0.11.12
              poll_interval: 10
              priority: 2
          parameters:
            abr_type: cisco
            opaque_lsa: true
            rfc1583_compatibility: true
            router_id: 192.0.1.1
          passive_interface:
            - eth1
          redistribute:
            - metric: 10
              metric_type: 2
              route_type: bgp
        state: replaced

    - name: Assert that changes were applied
      assert:
        that: "{{ round_trip['after'] == result['after'] }}"

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

    - name: Assert that config was reverted
      assert:
        that: "{{ base_config['after'] == revert['after']}}"
  always:
    - include_tasks: _remove_config.yaml