diff --git a/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml b/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml index f5aad738..68d3e450 100644 --- a/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml @@ -1,54 +1,56 @@ --- - debug: msg: START vyos_vrf replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Replace the provided configuration with the existing running configuration register: result vyos.vyos.vyos_vrf: &id001 config: instances: - name: "vrf-blue" description: "blue-vrf" disable: true table_id: 100 vni: 1000 - name: "vrf-red" description: "Vermillion_VRF" disable: false table_id: 101 vni: 1011 address_family: - afi: "ipv6" nht_no_resolve_via_default: false - name: "vrf-pink" + table_id: 111 protocols: ospf: default_information: originate: always: true metric: 20 + metric_type: 1 state: replaced - vyos.vyos.vyos_facts: gather_network_resources: vrf - assert: that: - result.changed == true - result.commands|symmetric_difference(replaced.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['vrf']) == [] - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_vrf: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_vrf/vars/main.yaml b/tests/integration/targets/vyos_vrf/vars/main.yaml index 045414b5..d6ac455e 100644 --- a/tests/integration/targets/vyos_vrf/vars/main.yaml +++ b/tests/integration/targets/vyos_vrf/vars/main.yaml @@ -1,270 +1,282 @@ --- merged: before: bind_to_all: true instances: - name: "vrf-blue" description: "blue-vrf" disable: false table_id: 100 vni: 1000 - name: "vrf-red" description: "red-vrf" disable: true table_id: 101 vni: 1001 address_family: - afi: "ipv4" disable_forwarding: true route_maps: - rm_name: "rm1" protocol: "kernel" - rm_name: "rm1" protocol: "rip" - afi: "ipv6" nht_no_resolve_via_default: true - name: "vrf-green" description: "green-vrf" table_id: 110 vni: 1010 protocols: ospf: areas: - area_id: "4" area_type: stub: default_cost: 20 network: - address: 192.0.2.0/24 range: - address: 192.0.3.0/24 cost: 10 - address: 192.0.4.0/24 cost: 12 ospfv3: areas: - area_id: "2" export_list: export1 import_list: import1 range: - address: 2001:db10::/32 - address: 2001:db20::/32 - address: 2001:db30::/32 static: - address_families: - afi: ipv4 routes: - dest: "192.0.2.0/24" blackhole_config: distance: 10 next_hops: - forward_router_address: "203.0.113.1" - forward_router_address: "203.0.113.2" - afi: ipv6 routes: - dest: "2001:db8::/32" blackhole_config: distance: 20 next_hops: - forward_router_address: "2001:db8::1" commands: - set vrf name vrf-green table 110 - set vrf name vrf-green vni 1010 - set vrf name vrf-green description green-vrf - set vrf name vrf-pink protocols bgp system-as 65005 - set vrf name vrf-pink protocols bgp neighbor 192.0.5.1 remote-as 65012 after: bind_to_all: true instances: - name: "vrf-blue" description: "blue-vrf" disable: false table_id: 100 vni: 1000 - name: "vrf-red" description: "red-vrf" disable: true table_id: 101 vni: 1001 address_family: - afi: "ipv4" disable_forwarding: true route_maps: - rm_name: "rm1" protocol: "kernel" - rm_name: "rm1" protocol: "rip" - afi: "ipv6" nht_no_resolve_via_default: true - name: "vrf-green" description: "green-vrf" table_id: 110 vni: 1010 replaced: commands: - delete vrf bind-to-all - set vrf name vrf-blue disable - set vrf name vrf-red vni 1011 - set vrf name vrf-red description Vermillion_VRF - delete vrf name vrf-red disable - delete vrf name vrf-red ipv6 nht no-resolve-via-default + - delete vrf name vrf-pink vni 1111 + - delete vrf name vrf-pink description pink-vrf + - delete vrf name vrf-pink protocols ospf log-adjacency-changes 'detail' + - delete vrf name vrf-pink protocols ospf auto-cost + - delete vrf name vrf-pink protocols ospf max-metric + - delete vrf name vrf-pink protocols ospf mpls-te + - delete vrf name vrf-pink protocols ospf area + - delete vrf name vrf-pink protocols ospf parameters + - delete vrf name vrf-pink protocols ospf neighbor + - delete vrf name vrf-pink protocols ospf redistribute + - set vrf name vrf-pink protocols ospf default-information originate metric 20 + - set vrf name vrf-pink protocols ospf default-information originate metric-type 1 after: [] overridden: commands: - delete vrf name vrf-blue - commit - delete vrf name vrf-pink - commit - set vrf name vrf-blue table 103 - set vrf name vrf-blue vni 1002 - set vrf name vrf-blue description blue-vrf - set vrf name vrf-blue disable - set vrf name vrf-pink table 111 - set vrf name vrf-pink vni 1111 - set vrf name vrf-pink description pink-vrf - set vrf name vrf-pink protocols bgp system-as 65005 - set vrf name vrf-pink protocols bgp neighbor 192.0.2.1 remote-as 65002 - delete vrf bind-to-all after: [] deleted: commands: - delete vrf after: [] rendered: commands: - set vrf bind-to-all - set vrf name vrf-green table 105 - set vrf name vrf-green vni 1000 - set vrf name vrf-green description green-vrf - set vrf name vrf-green disable - set vrf name vrf-green protocols bgp system-as 65000 - set vrf name vrf-green protocols bgp neighbor 192.0.2.1 remote-as 65002 - set vrf name vrf-green protocols bgp neighbor 1.1.1.3 passive - set vrf name vrf-green protocols bgp neighbor 1.1.1.3 remote-as 400 - set vrf name vrf-green protocols ospf log-adjacency-changes 'detail' - set vrf name vrf-green protocols ospf max-metric router-lsa administrative - set vrf name vrf-green protocols ospf max-metric router-lsa on-shutdown 10 - set vrf name vrf-green protocols ospf max-metric router-lsa on-startup 10 - set vrf name vrf-green protocols ospf default-information originate always - set vrf name vrf-green protocols ospf default-information originate metric 10 - set vrf name vrf-green protocols ospf default-information originate metric-type 2 - set vrf name vrf-green protocols ospf mpls-te router-address '192.0.11.12' - set vrf name vrf-green protocols ospf auto-cost reference-bandwidth '2' - set vrf name vrf-green protocols ospf neighbor 192.0.11.12 - set vrf name vrf-green protocols ospf neighbor 192.0.11.12 poll-interval 10 - set vrf name vrf-green protocols ospf neighbor 192.0.11.12 priority 2 - set vrf name vrf-green protocols ospf redistribute bgp - set vrf name vrf-green protocols ospf redistribute bgp metric 10 - set vrf name vrf-green protocols ospf redistribute bgp metric-type 2 - set vrf name vrf-green protocols ospf parameters router-id '192.0.1.1' - set vrf name vrf-green protocols ospf parameters rfc1583-compatibility - set vrf name vrf-green protocols ospf parameters abr-type 'cisco' - set vrf name vrf-green protocols ospf area '2' - set vrf name vrf-green protocols ospf area 2 area-type normal - set vrf name vrf-green protocols ospf area 2 authentication plaintext-password - set vrf name vrf-green protocols ospf area 2 shortcut enable - set vrf name vrf-green protocols ospf area '3' - set vrf name vrf-green protocols ospf area 3 area-type nssa - set vrf name vrf-green protocols ospf area '4' - set vrf name vrf-green protocols ospf area 4 area-type stub default-cost 20 - set vrf name vrf-green protocols ospf area 4 network 192.0.2.0/24 - set vrf name vrf-green protocols ospf area 4 range 192.0.3.0/24 - set vrf name vrf-green protocols ospf area 4 range 192.0.3.0/24 cost 10 - set vrf name vrf-green protocols ospf area 4 range 192.0.4.0/24 - set vrf name vrf-green protocols ospf area 4 range 192.0.4.0/24 cost 12 - set vrf name vrf-green protocols ospfv3 area '2' - set vrf name vrf-green protocols ospfv3 area 2 export-list export1 - set vrf name vrf-green protocols ospfv3 area 2 import-list import1 - set vrf name vrf-green protocols ospfv3 area 2 range 2001:db10::/32 - set vrf name vrf-green protocols ospfv3 area 2 range 2001:db20::/32 - set vrf name vrf-green protocols ospfv3 area 2 range 2001:db30::/32 - set vrf name vrf-green protocols ospfv3 area '3' - set vrf name vrf-green protocols ospfv3 area 3 range 2001:db40::/32 - set vrf name vrf-green protocols ospfv3 parameters router-id '192.0.2.10' - set vrf name vrf-green protocols ospfv3 redistribute bgp - set vrf name vrf-green protocols static route 192.0.2.0/24 - set vrf name vrf-green protocols static route 192.0.2.0/24 blackhole distance '10' - set vrf name vrf-green protocols static route 192.0.2.0/24 next-hop '203.0.113.1' - set vrf name vrf-green protocols static route 192.0.2.0/24 next-hop '203.0.113.2' - set vrf name vrf-green protocols static route6 2001:db8::/32 - set vrf name vrf-green protocols static route6 2001:db8::/32 blackhole distance '20' - set vrf name vrf-green protocols static route6 2001:db8::/32 next-hop '2001:db8::1' - set vrf name vrf-amber table 111 - set vrf name vrf-amber vni 1001 - set vrf name vrf-amber description amber-vrf - set vrf name vrf-amber ip protocol kernel route-map rm1 - set vrf name vrf-amber ip protocol ospf route-map rm1 - set vrf name vrf-amber ip disable-forwarding populate_config: - set vrf bind-to-all - set vrf name vrf-blue description 'blue-vrf' - set vrf name vrf-blue table '100' - set vrf name vrf-blue vni '1000' - set vrf name vrf-red description 'red-vrf' - set vrf name vrf-red disable - set vrf name vrf-red ip disable-forwarding - set vrf name vrf-red ip protocol kernel route-map 'rm1' - set vrf name vrf-red ip protocol rip route-map 'rm1' - set vrf name vrf-red ipv6 nht no-resolve-via-default - set vrf name vrf-red table '101' - set vrf name vrf-red vni '1001' - set vrf name vrf-pink table 111 - set vrf name vrf-pink vni 1111 - set vrf name vrf-pink description pink-vrf - set vrf name vrf-pink protocols bgp system-as 65000 - set vrf name vrf-pink protocols bgp neighbor 192.0.2.1 remote-as 65002 - set vrf name vrf-pink protocols bgp neighbor 1.1.1.3 passive - set vrf name vrf-pink protocols bgp neighbor 1.1.1.3 remote-as 400 - set vrf name vrf-pink protocols ospf log-adjacency-changes 'detail' - set vrf name vrf-pink protocols ospf max-metric router-lsa administrative - set vrf name vrf-pink protocols ospf max-metric router-lsa on-shutdown 10 - set vrf name vrf-pink protocols ospf max-metric router-lsa on-startup 10 - set vrf name vrf-pink protocols ospf default-information originate always - set vrf name vrf-pink protocols ospf default-information originate metric 10 - set vrf name vrf-pink protocols ospf default-information originate metric-type 2 - set vrf name vrf-pink protocols ospf mpls-te router-address '192.0.11.12' - set vrf name vrf-pink protocols ospf auto-cost reference-bandwidth '2' - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12 - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12 poll-interval 10 - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12 priority 2 - set vrf name vrf-pink protocols ospf redistribute bgp - set vrf name vrf-pink protocols ospf redistribute bgp metric 10 - set vrf name vrf-pink protocols ospf redistribute bgp metric-type 2 - set vrf name vrf-pink protocols ospf parameters router-id '192.0.1.1' - set vrf name vrf-pink protocols ospf parameters rfc1583-compatibility - set vrf name vrf-pink protocols ospf parameters abr-type 'cisco' - set vrf name vrf-pink protocols ospf area '2' - set vrf name vrf-pink protocols ospf area 2 area-type normal - set vrf name vrf-pink protocols ospf area 2 authentication plaintext-password - set vrf name vrf-pink protocols ospf area 2 shortcut enable - set vrf name vrf-pink protocols ospf area '3' - set vrf name vrf-pink protocols ospf area 3 area-type nssa - set vrf name vrf-pink protocols ospf area '4' - set vrf name vrf-pink protocols ospf area 4 area-type stub default-cost 20 - set vrf name vrf-pink protocols ospf area 4 network 192.0.2.0/24 - set vrf name vrf-pink protocols ospf area 4 range 192.0.3.0/24 - set vrf name vrf-pink protocols ospf area 4 range 192.0.3.0/24 cost 10 - set vrf name vrf-pink protocols ospf area 4 range 192.0.4.0/24 - set vrf name vrf-pink protocols ospf area 4 range 192.0.4.0/24 cost 12 - set vrf name vrf-pink protocols ospfv3 area '2' - set vrf name vrf-pink protocols ospfv3 area 2 export-list export1 - set vrf name vrf-pink protocols ospfv3 area 2 import-list import1 - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db10::/32 - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db20::/32 - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db30::/32 - set vrf name vrf-pink protocols ospfv3 area '3' - set vrf name vrf-pink protocols ospfv3 area 3 range 2001:db40::/32 - set vrf name vrf-pink protocols ospfv3 parameters router-id '192.0.2.10' - set vrf name vrf-pink protocols ospfv3 redistribute bgp - set vrf name vrf-pink protocols static route 192.0.2.0/24 - set vrf name vrf-pink protocols static route 192.0.2.0/24 blackhole distance '10' - set vrf name vrf-pink protocols static route 192.0.2.0/24 next-hop '203.0.113.1' - set vrf name vrf-pink protocols static route 192.0.2.0/24 next-hop '203.0.113.2' - set vrf name vrf-pink protocols static route6 2001:db8::/32 - set vrf name vrf-pink protocols static route6 2001:db8::/32 blackhole distance '20' - set vrf name vrf-pink protocols static route6 2001:db8::/32 next-hop '2001:db8::1'