summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml
blob: aae010b645edca858ab4d6cc5d51fad6195f6e98 (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
---
- ansible.builtin.debug:
    msg: START Replaced ios_acls state for integration tests on connection={{ ansible_connection }}

- ansible.builtin.include_tasks: _remove_config.yaml

- ansible.builtin.include_tasks: _populate_config.yaml

- block:
    - name: Replaces device configuration of listed interfaces with provided configuration
      register: result
      cisco.ios.ios_acls: &id001
        config:
          - afi: ipv4
            acls:
              - name: 110
                aces:
                  - grant: deny
                    protocol: tcp
                    protocol_options:
                      tcp:
                        syn: true
                    sequence: 10
                    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
                    dscp: ef
                    ttl:
                      eq: 10
              - name: 123
                aces:
                  - grant: deny
                    sequence: 10
                    protocol: tcp
                    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
              - name: 150
                aces:
                  - grant: deny
                    sequence: 20
                    protocol: tcp
                    protocol_options:
                      tcp:
                        syn: true
                    source:
                      address: 198.51.100.0
                      wildcard_bits: 0.0.0.255
                      port_protocol:
                        eq: telnet
                    destination:
                      address: 198.51.110.0
                      wildcard_bits: 0.0.0.255
                      port_protocol:
                        eq: telnet
                    dscp: ef
                    ttl:
                      eq: 10
        state: replaced

    - ansible.builtin.assert:
        that:
          - result.commands|length == 7
          - result.changed == true
          - result.commands|symmetric_difference(replaced.commands) == []

    - name: Replaces device configuration of listed interfaces with provided configuration (idempotent)
      register: result
      cisco.ios.ios_acls: *id001
    - name: Assert that task was idempotent
      ansible.builtin.assert:
        that:
          - result.commands|length == 0
          - result['changed'] == false

    - ansible.builtin.include_tasks: _remove_config.yaml

    - ansible.builtin.include_tasks: _populate_config.yaml

    - name: Replaces device configuration of ACL with provided configuration
      register: result
      cisco.ios.ios_acls: &id002
        config:
          - afi: ipv4
            acls:
              - name: test_acl
                acl_type: standard
                aces:
                  - grant: deny
                    sequence: 10
                    source:
                      address: 198.51.100.0
                      wildcard_bits: 0.0.0.255
        state: replaced

    - ansible.builtin.assert:
        that:
          - result.commands|length == 3
          - result.changed == true
          - result.commands|symmetric_difference(replaced_changetype.commands) == []

    - name: Replaces device configuration of ACL with provided configuration (idempotent)
      register: result
      cisco.ios.ios_acls: *id002
    - name: Assert that task was idempotent
      ansible.builtin.assert:
        that:
          - result.commands|length == 0
          - result['changed'] == false
  always:
    - ansible.builtin.include_tasks: _remove_config.yaml