diff --git a/tests/integration/targets/vyos_vrf/tests/cli/overridden.yaml b/tests/integration/targets/vyos_vrf/tests/cli/overridden.yaml index 13cb0891..81cd9735 100644 --- a/tests/integration/targets/vyos_vrf/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_vrf/tests/cli/overridden.yaml @@ -1,40 +1,50 @@ --- - debug: msg: START vyos_vrf overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_vrf: &id001 config: instances: - name: "vrf-blue" description: "blue-vrf" disable: true table_id: 103 vni: 1002 + - name: "vrf-pink" + description: "pink-vrf" + table_id: 111 + vni: 1111 + protocols: + bgp: + as_number: 65005 + neighbor: + - address: 192.0.2.1 + remote_as: 65002 state: overridden - vyos.vyos.vyos_facts: gather_network_resources: vrf - assert: that: # - result.commands|length == 8 - result.changed == true - result.commands|symmetric_difference(overridden.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['vrf']) == [] - name: Override the existing configuration with the provided 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/tests/cli/rendered.yaml b/tests/integration/targets/vyos_vrf/tests/cli/rendered.yaml index b72ec23c..17163654 100644 --- a/tests/integration/targets/vyos_vrf/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_vrf/tests/cli/rendered.yaml @@ -1,42 +1,133 @@ --- - debug: msg: START vyos_route_maps rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_vrf: config: bind_to_all: true instances: - name: vrf-green description: green-vrf disabled: true table_id: 105 vni: 1000 + protocols: + bgp: + as_number: 65000 + neighbor: + - address: 192.0.2.1 + remote_as: 65002 + - address: "1.1.1.3" + passive: true + remote_as: 400 + ospf: + log_adjacency_changes: detail + max_metric: + router_lsa: + administrative: true + on_shutdown: 10 + on_startup: 10 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + mpls_te: + router_address: 192.0.11.12 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + parameters: + router_id: 192.0.1.1 + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: "2" + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: "3" + area_type: + nssa: + set: true + - 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 + - area_id: "3" + range: + - address: 2001:db40::/32 + parameters: + router_id: 192.0.2.10 + redistribute: + - route_type: bgp + 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" - name: vrf-amber description: amber-vrf disable: false table_id: 111 vni: 1001 address_family: - afi: ipv4 disable_forwarding: true route_maps: - rm_name: rm1 protocol: kernel - rm_name: rm1 protocol: ospf - afi: ipv6 nht_no_resolve_via_default: false state: rendered - assert: that: - result.changed == false - result.rendered|symmetric_difference(rendered.commands) == [] always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml b/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml index 790d485b..f5aad738 100644 --- a/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_vrf/tests/cli/replaced.yaml @@ -1,47 +1,54 @@ --- - 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" + protocols: + ospf: + default_information: + originate: + always: true + metric: 20 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 2927d7a2..045414b5 100644 --- a/tests/integration/targets/vyos_vrf/vars/main.yaml +++ b/tests/integration/targets/vyos_vrf/vars/main.yaml @@ -1,211 +1,270 @@ --- 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 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'