Skip to content

Commit

Permalink
replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
roverflow committed Nov 21, 2024
1 parent c53130d commit 021e406
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
- ansible.builtin.debug:
msg: START replaced nxos_vrf_address_family state for integration tests on connection={{ ansible_connection }}

- ansible.builtin.include_tasks: _populate_config.yaml

- block:
- name: Replace the provided configuration with the existing running configuration
register: result
cisco.nxos.nxos_vrf_address_family: &id001
config:
- name: VRF1
address_families:
- afi: ipv6
safi: unicast
route_target:
- export: 65512:200
maximum:
max_routes: 500
max_route_options:
threshold:
threshold_value: 60
reinstall_threshold: 80
export:
- map: "22"
- vrf:
allow_vpn: true
map_import: "44"
- vrf:
allow_vpn: true
- name: temp
address_families:
- afi: ipv4
safi: unicast
route_target:
- import: 65512:200
maximum:
max_routes: 1000
export:
- map: "26"
- vrf:
allow_vpn: true
map_import: "46"
state: replaced

- name: Assert that correct set of commands were generated
ansible.builtin.assert:
that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) | length == 0 }}"

- name: Assert that before dict is correctly generated
ansible.builtin.assert:
that:
- "{{ replaced['before'] == result['before'] }}"

- name: Assert that after dict is correctly generated
ansible.builtin.assert:
that:
- replaced['after'] == result['after']

- name: Replaced provided VRF global configuration (idempotent)
register: result
cisco.nxos.nxos_vrf_address_family: *id001
- name: Assert that task was idempotent
ansible.builtin.assert:
that:
- result['changed'] == false
always:
- ansible.builtin.include_tasks: _remove_config.yaml
64 changes: 64 additions & 0 deletions tests/integration/targets/nxos_vrf_address_family/vars/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,67 @@ parsed:
safi: unicast
route_target:
- import: 554832:500
replaced:
commands:
- vrf context VRF1
- address-family ipv4 unicast
- no route-target import 64512:200
- address-family ipv6 unicast
- maximum routes 500 60 reinstall 80
- no route-target import 554832:500
- route-target export 65512:200
- export map 22
- export vrf default map 44 allow-vpn
- export vrf allow-vpn
- vrf context temp
- address-family ipv4 unicast
- maximum routes 1000
- route-target import 65512:200
- export map 26
- export vrf default map 46 allow-vpn
before:
- address_families:
- afi: ipv4
route_target:
- import: 64512:200
safi: unicast
- afi: ipv6
route_target:
- import: 554832:500
safi: unicast
name: VRF1
after:
- address_families:
- afi: ipv4
safi: unicast
- afi: ipv6
export:
- map: "22"
- vrf:
allow_vpn: true
map_import: "44"
- vrf:
allow_vpn: true
maximum:
max_route_options:
threshold:
reinstall_threshold: 80
threshold_value: 60
max_routes: 500
route_target:
- export: 65512:200
safi: unicast
name: VRF1
- address_families:
- afi: ipv4
export:
- map: "26"
- vrf:
allow_vpn: true
map_import: "46"
maximum:
max_routes: 1000
route_target:
- import: 65512:200
safi: unicast
name: temp

0 comments on commit 021e406

Please sign in to comment.