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

- include_tasks: _remove_config.yaml

- include_tasks: _populate.yaml

- block:
    - name: Replace device configurations of listed ospfv2 routes with provided configurations
      register: result
      vyos.vyos.vyos_ospfv2: &id001
        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.22.22"
          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"
          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: "4"
              area_type:
                stub:
                  default_cost: 20
              network:
                - address: "192.0.2.0/24"
                - address: "192.0.12.0/24"
                - address: "192.0.22.0/24"
                - address: "192.0.32.0/24"
              range:
                - address: "1.1.2.0/24"
                  cost: 10
        state: replaced

    - name: Assert that correct set of commands were generated
      assert:
        that:
          - "{{ replaced['commands'] | symmetric_difference(result['commands'])\
            \ |length == 0 }}"

    - name: Assert that before dicts are correctly generated
      assert:
        that:
          - "{{ populate == result['before'] }}"

    - name: Assert that after dict is correctly generated
      assert:
        that:
          - "{{ replaced['after'] == result['after'] }}"

    - name:
        Replace device configurations of listed ospfv2 routes  with provided configurarions
        (IDEMPOTENT)
      register: result
      vyos.vyos.vyos_ospfv2: *id001

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

    - name: Assert that before dict is correctly generated
      assert:
        that:
          - "{{ replaced['after'] == result['before'] }}"
  always:
    - include_tasks: _remove_config.yaml