summaryrefslogtreecommitdiff
path: root/test/integration/targets/ios_acls/tests/cli/merged.yaml
blob: 4bdc9ed0e0985885a7153f3723899b7e2bbb4f6d (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
---
- debug:
      msg: "START Merged ios_acls state for integration tests on connection={{ ansible_connection }}"

- include_tasks: _remove_config.yaml

- block:
    - name: Merge provided configuration with device configuration
      ios_acls: &merged
        config:
          - afi: ipv4
            acls:
              - name: std_acl
                acl_type: standard
                aces:
                  - grant: deny
                    source:
                      address: 192.0.2.0
                      wildcard_bits: 0.0.0.255
              - name: test_acl
                acl_type: extended
                aces:
                  - grant: deny
                    protocol_options:
                      tcp:
                        fin: true
                    source:
                      address: 192.0.2.0
                      wildcard_bits: 0.0.0.255
                    destination:
                      address: 192.0.3.0
                      wildcard_bits: 0.0.0.255
                      port_protocol:
                        eq: www
                    option:
                      traceroute: true
                    ttl:
                      eq: 10
              - name: 110
                aces:
                  - grant: deny
                    sequence: 10
                    protocol_options:
                      icmp:
                        echo: true
                    source:
                      address: 192.0.2.0
                      wildcard_bits: 0.0.0.255
                    destination:
                      address: 192.0.3.0
                      wildcard_bits: 0.0.0.255
                    dscp: ef
                    ttl:
                      eq: 10
              - name: 123
                aces:
                  - grant: deny
                    protocol_options:
                      tcp:
                        ack: true
                    source:
                      address: 198.51.100.0
                      wildcard_bits: 0.0.0.255
                    destination:
                      address: 198.51.101.0
                      wildcard_bits: 0.0.0.255
                      port_protocol:
                        eq: telnet
                    tos:
                      service_value: 12
                  - grant: deny
                    protocol_options:
                      tcp:
                        ack: true
                    source:
                      address: 192.0.3.0
                      wildcard_bits: 0.0.0.255
                    destination:
                      address: 192.0.4.0
                      wildcard_bits: 0.0.0.255
                      port_protocol:
                        eq: www
                    dscp: ef
                    ttl:
                      lt: 20
          - afi: ipv6
            acls:
              - name: R1_TRAFFIC
                aces:
                  - grant: deny
                    protocol_options:
                      tcp:
                        ack: true
                    source:
                      any: true
                      port_protocol:
                        eq: www
                    destination:
                      any: true
                      port_protocol:
                        eq: telnet
                    dscp: af11
        state: merged
      register: result

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

    - name: Merge provided configuration with device configuration (IDEMPOTENT)
      ios_acls: *merged
      register: result

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

  always:
    - include_tasks: _remove_config.yaml