ansible/test/integration/targets/iosxr_acls/tests/cli/rtt.yaml

86 lines
2.4 KiB
YAML
Raw Normal View History

---
- debug:
msg: "START iosxr_acls round trip integration tests on connection={{ ansible_connection }}"
- block:
- include_tasks: _remove_config.yaml
- name: Apply the provided configuration (base config)
iosxr_acls:
config:
- afi: ipv4
acls:
- name: acl_2
aces:
- sequence: 11
grant: permit
protocol: igmp
source:
host: 198.51.100.130
destination:
any: True
ttl:
eq: 100
- sequence: 12
grant: deny
source:
any: True
destination:
any: True
protocol: icmp
state: merged
register: base_config
- name: Gather interfaces facts
iosxr_facts:
gather_subset:
- "!all"
- "!min"
gather_network_resources:
- acls
- name: Apply the provided configuration (config to be reverted)
iosxr_acls:
config:
- afi: ipv4
acls:
- name: acl_1
aces:
- sequence: 10
grant: permit
source:
any: True
destination:
any: True
protocol: tcp
- name: acl_2
aces:
- sequence: 20
grant: permit
source:
any: True
destination:
any: True
protocol: igmp
state: overridden
register: result
- name: Assert that changes were applied
assert:
that: "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Revert back to base config using facts round trip
iosxr_acls:
config: "{{ ansible_facts['network_resources']['acls'] }}"
state: overridden
register: revert
- name: Assert that config was reverted
assert:
that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
always:
- include_tasks: _remove_config.yaml