Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruchip16 committed Oct 25, 2024
1 parent 902fdfc commit 227afd3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Remove acls
vars:
lines:
"no ipv4 access-list acl_1\nno ipv4 access-list acl_2\nno ipv4 access-list acl_3\nno ipv4 access-list acl_3\nno ipv6 access-list acl6_1\nno ipv6 access-list\
"no ipv4 access-list acl_1\nno ipv4 access-list acl_2\nno ipv4 access-list acl_3\nno ipv4 access-list acl_3\nno ipv4 access-list test_acl\nno ipv6 access-list acl6_1\nno ipv6 access-list\
\ acl6_2\nno ipv6 access-list acl6_3\n"
ignore_errors: true
ansible.netcommon.cli_config:
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
destination:
any: true
protocol: icmp
- name: test_acl
aces:
- sequence: 40
remark: "Deny MARTIANS"
- sequence: 60
line: "deny ipv4 10.0.0.0 0.255.255.255 any"
state: replaced

- name: Assert that correct set of commands were generated
Expand All @@ -55,8 +61,7 @@
- name: Assert that task was idempotent
ansible.builtin.assert:
that:
- result['changed'] == false
- result.commands|length == 0
- result.commands|length == 2

- name: Assert that before dict is correctly generated
ansible.builtin.assert:
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/targets/iosxr_acls/vars/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ replaced:
- no 10
- 11 permit igmp host 198.51.100.130 any ttl eq 100
- 12 deny icmp any any
- ipv4 access-list test_acl
- 40 remark Deny MARTIANS
- 60 deny ipv4 10.0.0.0 0.255.255.255 any
after:
- acls:
- aces:
Expand Down Expand Up @@ -146,6 +149,18 @@ replaced:
source:
any: true
name: acl_2
- aces:
- remark: Deny MARTIANS
sequence: 40
- destination:
any: true
grant: deny
protocol: ipv4
sequence: 60
source:
address: 10.0.0.0
wildcard_bits: 0.255.255.255
name: test_acl
afi: ipv4
- acls:
- aces:
Expand Down

0 comments on commit 227afd3

Please sign in to comment.