diff options
Diffstat (limited to 'test/integration/targets/vyos_static_routes/tests')
15 files changed, 0 insertions, 642 deletions
diff --git a/test/integration/targets/vyos_static_routes/tests/cli/_parsed_config.cfg b/test/integration/targets/vyos_static_routes/tests/cli/_parsed_config.cfg deleted file mode 100644 index b2ecd4e9c0..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/_parsed_config.cfg +++ /dev/null @@ -1,6 +0,0 @@ -set protocols static route 192.0.2.32/28 next-hop '192.0.2.9' -set protocols static route 192.0.2.32/28 next-hop '192.0.2.10' -set protocols static route 192.0.2.32/28 blackhole -set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' -set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2' -set protocols static route6 2001:db8:1000::/36 blackhole distance '2' diff --git a/test/integration/targets/vyos_static_routes/tests/cli/_populate.yaml b/test/integration/targets/vyos_static_routes/tests/cli/_populate.yaml deleted file mode 100644 index c5b02f73eb..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/_populate.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - vars: - lines: | - set protocols static route 192.0.2.32/28 next-hop '192.0.2.10' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.9' - set protocols static route 192.0.2.32/28 blackhole - set protocols static route 192.0.2.32/28 - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2' - set protocols static route6 2001:db8:1000::/36 blackhole distance '2' - set protocols static route6 2001:db8:1000::/36 diff --git a/test/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml b/test/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml deleted file mode 100644 index 026ef4580e..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - delete protocols static route - delete protocols static route6 diff --git a/test/integration/targets/vyos_static_routes/tests/cli/deleted.yaml b/test/integration/targets/vyos_static_routes/tests/cli/deleted.yaml deleted file mode 100644 index b4bad0cc7c..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/deleted.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: - msg: "Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - name: Delete static route based on destiation. - vyos_static_routes: &deleted_dest - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: '192.0.2.32/28' - - afi: 'ipv6' - routes: - - dest: '2001:db8:1000::/36' - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted_dest['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted_dest['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - vyos_static_routes: *deleted_dest - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted_dest['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml b/test/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml deleted file mode 100644 index 3b6c7e017f..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- debug: - msg: "Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - name: Delete static route based on afi. - vyos_static_routes: &deleted_afi - config: - - address_families: - - afi: 'ipv4' - - afi: 'ipv6' - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - vyos_static_routes: *deleted_afi - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml b/test/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml deleted file mode 100644 index 39e3f14413..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: - msg: "Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - name: Delete all the static routes. - vyos_static_routes: &deleted_all - config: - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - vyos_static_routes: *deleted_all - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml b/test/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml deleted file mode 100644 index 976b384e79..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -- debug: - msg: "Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - name: Delete static route based on next_hop. - vyos_static_routes: &deleted_nh - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: '192.0.2.32/28' - next_hops: - - forward_router_address: '192.0.2.9' - - afi: 'ipv6' - routes: - - dest: '2001:db8:1000::/36' - next_hops: - - forward_router_address: '2001:db8:2000:2::1' - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted_nh['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted_nh['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - vyos_static_routes: *deleted_nh - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted_nh['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml b/test/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml deleted file mode 100644 index 96bec582a5..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - vyos_static_routes: - config: - state: merged - register: result - ignore_errors: true - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - vyos_static_routes: - config: - state: replaced - register: result - ignore_errors: true - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - vyos_static_routes: - config: - state: overridden - register: result - ignore_errors: true - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden' - -- name: Parsed with empty running_config should give appropriate error message - vyos_static_routes: - running_config: - state: parsed - register: result - ignore_errors: true - -- assert: - that: - - result.msg == 'value of running_config parameter must not be empty for state parsed' - -- name: Rendered with empty config should give appropriate error message - vyos_static_routes: - config: - state: rendered - register: result - ignore_errors: true - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state rendered' diff --git a/test/integration/targets/vyos_static_routes/tests/cli/gathered.yaml b/test/integration/targets/vyos_static_routes/tests/cli/gathered.yaml deleted file mode 100644 index 58a4279ec2..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/gathered.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes gathered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - vyos_static_routes: &gathered - config: - state: gathered - register: result - - - name: Assert that gathered dicts was correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" - - - name: Gather the existing running configuration (IDEMPOTENT) - vyos_static_routes: *gathered - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/merged.yaml b/test/integration/targets/vyos_static_routes/tests/cli/merged.yaml deleted file mode 100644 index e9399ad77b..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/merged.yaml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - vyos_static_routes: &merged - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - type: 'blackhole' - next_hops: - - forward_router_address: 192.0.2.10 - - forward_router_address: 192.0.2.9 - - address_families: - - afi: 'ipv6' - routes: - - dest: 2001:db8:1000::/36 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - vyos_static_routes: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/overridden.yaml b/test/integration/targets/vyos_static_routes/tests/cli/overridden.yaml deleted file mode 100644 index 9e838d7bcf..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/overridden.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Overrides all device configuration with provided configuration - vyos_static_routes: &overridden - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 198.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.18 - state: overridden - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts were correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overrides all device configuration with provided configurations (IDEMPOTENT) - vyos_static_routes: *overridden - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/parsed.yaml b/test/integration/targets/vyos_static_routes/tests/cli/parsed.yaml deleted file mode 100644 index 18e5781e71..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/parsed.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes parsed integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Gather static_routes facts - vyos_facts: - gather_subset: - - default - gather_network_resources: - - static_routes - register: static_routes_facts - - - name: Provide the running configuration for parsing (config to be parsed) - vyos_static_routes: &parsed - running_config: - "{{ lookup('file', '_parsed_config.cfg') }}" - state: parsed - register: result - - - name: Assert that correct parsing done - assert: - that: "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed']) |length == 0 }}" - - - name: Gather the existing running configuration (IDEMPOTENT) - vyos_static_routes: *parsed - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/rendered.yaml b/test/integration/targets/vyos_static_routes/tests/cli/rendered.yaml deleted file mode 100644 index 80b90ebe5a..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/rendered.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes rendered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Structure provided configuration into device specific commands - vyos_static_routes: &rendered - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - type: 'blackhole' - next_hops: - - forward_router_address: 192.0.2.10 - - forward_router_address: 192.0.2.9 - - address_families: - - afi: 'ipv6' - routes: - - dest: 2001:db8:1000::/36 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 - state: rendered - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - - - name: Structure provided configuration into device specific commands (IDEMPOTENT) - vyos_static_routes: *rendered - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/replaced.yaml b/test/integration/targets/vyos_static_routes/tests/cli/replaced.yaml deleted file mode 100644 index 1daf406945..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/replaced.yaml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace device configurations of listed static routes with provided configurations - vyos_static_routes: &replaced - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 192.0.2.7 - - forward_router_address: 192.0.2.8 - - forward_router_address: 192.0.2.9 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed static routes with provided configurarions (IDEMPOTENT) - vyos_static_routes: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/vyos_static_routes/tests/cli/rtt.yaml b/test/integration/targets/vyos_static_routes/tests/cli/rtt.yaml deleted file mode 100644 index 81ece8b383..0000000000 --- a/test/integration/targets/vyos_static_routes/tests/cli/rtt.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- debug: - msg: "START vyos_static_routes round trip integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Apply the provided configuration (base config) - vyos_static_routes: - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - type: 'blackhole' - next_hops: - - forward_router_address: 192.0.2.10 - - forward_router_address: 192.0.2.9 - - address_families: - - afi: 'ipv6' - routes: - - dest: 2001:db8:1000::/36 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 - - state: merged - register: base_config - - - name: Gather static_routes facts - vyos_facts: - gather_subset: - - default - gather_network_resources: - - static_routes - - - name: Apply the provided configuration (config to be reverted) - vyos_static_routes: - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 192.0.2.7 - - forward_router_address: 192.0.2.8 - - forward_router_address: 192.0.2.9 - state: merged - 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 - vyos_static_routes: - config: "{{ ansible_facts['network_resources']['static_routes'] }}" - 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 |