mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.9 KiB
YAML
103 lines
2.9 KiB
YAML
---
|
|
- debug:
|
|
msg: "START iosxr_acl_interfaces round trip integration tests on connection={{ ansible_connection }}"
|
|
|
|
- block:
|
|
- include_tasks: _remove_config.yaml
|
|
|
|
- name: Populate the device with ACLs
|
|
iosxr_config:
|
|
lines: |
|
|
ipv4 access-list acl_1
|
|
10 permit ipv4 any any
|
|
ipv4 access-list acl_2
|
|
10 permit ipv4 any any
|
|
ipv4 access-list acl_3
|
|
10 permit ipv4 any any
|
|
ipv6 access-list acl6_1
|
|
10 permit ipv6 any any
|
|
ipv6 access-list acl6_2
|
|
10 permit ipv6 any any
|
|
ipv6 access-list acl6_3
|
|
10 permit ipv6 any any
|
|
|
|
- name: Apply the provided configuration (base config)
|
|
iosxr_acl_interfaces:
|
|
config:
|
|
- name: GigabitEthernet0/0/0/0
|
|
access_groups:
|
|
- afi: ipv4
|
|
acls:
|
|
- name: acl_1
|
|
direction: in
|
|
- name: acl_2
|
|
direction: out
|
|
|
|
- afi: ipv6
|
|
acls:
|
|
- name: acl6_1
|
|
direction: in
|
|
- name: acl6_2
|
|
direction: out
|
|
|
|
- name: GigabitEthernet0/0/0/1
|
|
access_groups:
|
|
- afi: ipv4
|
|
acls:
|
|
- name: acl_1
|
|
direction: out
|
|
state: merged
|
|
|
|
- name: Gather interfaces facts
|
|
iosxr_facts:
|
|
gather_subset:
|
|
- "!all"
|
|
- "!min"
|
|
gather_network_resources:
|
|
- acl_interfaces
|
|
|
|
- name: Apply the provided configuration (config to be reverted)
|
|
iosxr_acl_interfaces:
|
|
config:
|
|
- name: GigabitEthernet0/0/0/1
|
|
access_groups:
|
|
- afi: ipv4
|
|
acls:
|
|
- name: acl_1
|
|
direction: in
|
|
- name: acl_2
|
|
direction: out
|
|
|
|
- afi: ipv6
|
|
acls:
|
|
- name: acl6_1
|
|
direction: in
|
|
- name: acl6_2
|
|
direction: out
|
|
|
|
- name: GigabitEthernet0/0/0/0
|
|
access_groups:
|
|
- afi: ipv4
|
|
acls:
|
|
- name: acl_1
|
|
direction: out
|
|
state: overridden
|
|
register: result
|
|
|
|
- name: Assert that changes were applied
|
|
assert:
|
|
that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}"
|
|
|
|
- name: Revert back to base config using facts round trip
|
|
iosxr_acl_interfaces:
|
|
config: "{{ ansible_facts['network_resources']['acl_interfaces'] }}"
|
|
state: overridden
|
|
register: revert
|
|
|
|
- name: Assert that config was reverted
|
|
assert:
|
|
that: "{{ merged['after'] | symmetric_difference(revert['after']) |length == 0 }}"
|
|
|
|
always:
|
|
- include_tasks: _remove_config.yaml
|