summaryrefslogtreecommitdiff
path: root/test/integration/targets/ios_static_routes/tests/cli/overridden.yaml
blob: 02b6acb6a872c69afc87ef069dc1b8c739eba61c (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
---
- debug:
      msg: "START Overridden ios_static_routes state for integration tests on connection={{ ansible_connection }}"

- include_tasks: _remove_config.yaml

- include_tasks: _intial_setup_config.yaml

- block:
    - name: Override device configuration of all interfaces with provided configuration
      ios_static_routes: &overridden
        config:
          - vrf: ansible_temp_vrf
            address_families:
            - afi: ipv4
              routes:
              - dest: 192.0.2.0/24
                next_hops:
                - forward_router_address: 192.0.2.1
                  name: override_vrf
                  tag: 50
                  track: 150
          - address_families:
            - afi: ipv4
              routes:
              - dest: 198.51.100.0/24
                next_hops:
                - forward_router_address: 198.51.101.3
                  name: override_route
            - afi: ipv6
              routes:
              - dest: 2001:DB8:0:3::/64
                next_hops:
                - forward_router_address: 2001:DB8:0:3::2
                  name: override_v6
                  tag: 175
        state: overridden
      register: result

    - assert:
        that:
          - "result.commands|length == 8"
          - "result.changed == true"
          - "result.commands|symmetric_difference(overridden.commands) == []"

    - name: Override device configuration of all interfaces with provided configuration (IDEMPOTENT)
      ios_static_routes: *overridden
      register: result

    - name: Assert that task was idempotent
      assert:
        that:
          - "result.commands|length == 0"
          - "result['changed'] == false"

  always:
    - include_tasks: _populate_config.yaml
    - include_tasks: _remove_config.yaml