summaryrefslogtreecommitdiff
path: root/test/integration/targets/iosxr_static_routes/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/iosxr_static_routes/tests')
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml60
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml8
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml124
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml47
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml20
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml141
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml66
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml15
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml76
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml58
-rw-r--r--test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml73
11 files changed, 0 insertions, 688 deletions
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml
deleted file mode 100644
index 1c1d63b1d7..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
----
-- name: Setup
- iosxr_static_routes:
- config:
- - address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.10
- interface: FastEthernet0/0/0/1
- description: "LAB"
- metric: 120
- tag: 10
-
- - interface: FastEthernet0/0/0/5
- track: ip_sla_1
-
- - dest: 192.0.2.32/28
- next_hops:
- - forward_router_address: 192.0.2.11
- admin_distance: 100
-
- - afi: ipv6
- safi: unicast
- routes:
- - dest: 2001:db8:1000::/36
- next_hops:
- - interface: FastEthernet0/0/0/7
- description: "DC"
-
- - interface: FastEthernet0/0/0/8
- forward_router_address: 2001:db8:2000:2::1
-
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.12
- description: "DEV"
- dest_vrf: test_1
-
- - forward_router_address: 192.0.3.24
- interface: GigabitEthernet0/0/0/1
- vrflabel: 2302
-
- - dest: 192.0.2.80/28
- next_hops:
- - interface: FastEthernet0/0/0/2
- forward_router_address: 192.0.2.14
- dest_vrf: test_1
- track: ip_sla_2
- vrflabel: 124
-
- state: merged
- \ No newline at end of file
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml
deleted file mode 100644
index 97d4d48ee2..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-- name: Remove Static Routes
- cli_config:
- config: "{{ lines }}"
- vars:
- lines: |
- no router static
- ignore_errors: yes
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml
deleted file mode 100644
index b6724c13aa..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml
+++ /dev/null
@@ -1,124 +0,0 @@
----
-- debug:
- msg: "Start iosxr_static_routes deleted integration tests ansible_connection={{ ansible_connection }}"
-
-- include_tasks: _remove_config.yaml
-
-- include_tasks: _populate_config.yaml
-
-- block:
- - name: Delete a single next_hop from a destination network
- iosxr_static_routes: &deleted_1
- config:
- - address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.10
- interface: FastEthernet0/0/0/1
- state: deleted
- register: result
-
- - assert:
- that:
- - '"router static" in result.commands'
- - '"address-family ipv4 unicast" in result.commands'
- - '"no 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1" in result.commands'
- - 'result.commands|length == 3'
-
- - name: Delete a single next_hop from a destination network (IDEMPOTENT)
- iosxr_static_routes: *deleted_1
- register: result
-
- - assert: &unchanged
- that:
- - "result.changed == false"
- - "result.commands|length == 0"
-
- - name: Delete a destination network entry
- iosxr_static_routes: &deleted_2
- config:
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- state: deleted
- register: result
-
- - assert:
- that:
- - '"router static" in result.commands'
- - '"vrf DEV_SITE" in result.commands'
- - '"address-family ipv4 unicast" in result.commands'
- - '"no 192.0.2.48/28" in result.commands'
- - "result.commands|length == 4"
-
- - name: Delete a destination network entry (IDEMPOTENT)
- iosxr_static_routes: *deleted_2
- register: result
-
- - assert: *unchanged
-
- - name: Delete all destination network entries under a single AFI
- iosxr_static_routes: &deleted_3
- config:
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- state: deleted
- register: result
-
- - assert:
- that:
- - '"router static" in result.commands'
- - '"vrf DEV_SITE" in result.commands'
- - '"no address-family ipv4 unicast" in result.commands'
- - "result.commands|length == 3"
-
- - name: Delete all destination network entries under a single AFI (IDEMPOTENT)
- iosxr_static_routes: *deleted_3
- register: result
-
- - assert: *unchanged
-
- - include_tasks: _populate_config.yaml
-
- - name: Delete static routes configuration
- iosxr_static_routes: &deleted
- state: deleted
- register: result
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that the correct set of commands were generated
- assert:
- that:
- - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
-
- - name: Assert that the after dicts were correctly generated
- assert:
- that:
- - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}"
-
- - name: Delete all static routes (IDEMPOTENT)
- iosxr_static_routes: *deleted
- register: result
-
- - name: Assert that the previous task was idempotent
- assert: *unchanged
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml
deleted file mode 100644
index fd0625e012..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes empty_config integration tests on connection={{ ansible_connection }}"
-
-- name: Merged with empty config should give appropriate error message
- iosxr_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
- iosxr_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
- iosxr_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
- iosxr_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' \ No newline at end of file
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml
deleted file mode 100644
index 2286b02ad3..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes gathered integration tests on connection={{ ansible_connection }}"
-
-- include_tasks: _remove_config.yaml
-
-- include_tasks: _populate_config.yaml
-
-- block:
- - name: Gather static routes facts from the device using iosxr_static_routes module
- iosxr_static_routes:
- state: gathered
- register: result
-
- - assert:
- that: "{{ replaced['before'] | symmetric_difference(result['gathered']) |length == 0 }}"
-
- always:
- - include_tasks: _remove_config.yaml
-
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml
deleted file mode 100644
index 40eb02f45e..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml
+++ /dev/null
@@ -1,141 +0,0 @@
----
-- debug:
- msg: "START iosxr_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
- iosxr_static_routes: &merged
- config:
- - address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.10
- interface: FastEthernet0/0/0/1
- description: "LAB"
- metric: 120
- tag: 10
-
- - interface: FastEthernet0/0/0/5
- track: ip_sla_1
-
- - dest: 192.0.2.32/28
- next_hops:
- - forward_router_address: 192.0.2.11
- admin_distance: 100
-
- - afi: ipv6
- safi: unicast
- routes:
- - dest: 2001:db8:1000::/36
- next_hops:
- - interface: FastEthernet0/0/0/7
- description: "DC"
-
- - interface: FastEthernet0/0/0/8
- forward_router_address: 2001:db8:2000:2::1
-
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.12
- description: "DEV"
- dest_vrf: test_1
-
- - dest: 192.0.2.80/28
- next_hops:
- - interface: FastEthernet0/0/0/2
- forward_router_address: 192.0.2.14
- dest_vrf: test_1
- track: ip_sla_2
- vrflabel: 124
- 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 }}"
-
- - set_fact:
- diff: "{{ merged['after'] | symmetric_difference(result['after']) }}"
-
- - 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)
- iosxr_static_routes: *merged
- register: result
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - "result['changed'] == false"
- - "result.commands|length == 0"
-
- - name: Assert that before dicts were correctly generated
- assert:
- that:
- - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Update existing configuration using merged
- iosxr_static_routes: &merged_update
- config:
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.12
- vrflabel: 2301
- dest_vrf: test_1
-
- - dest: 192.0.2.80/28
- next_hops:
- - interface: FastEthernet0/0/0/2
- forward_router_address: 192.0.2.14
- dest_vrf: test_1
- description: "rt_test_1"
- register: result
-
- - name: Assert that before dicts were correctly generated
- assert:
- that: "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that correct set of commands were generated
- assert:
- that:
- - "{{ merged['update_commands'] | symmetric_difference(result['commands']) |length == 0 }}"
-
- - name: Assert that after dicts were correctly generated
- assert:
- that: "{{ merged['update_after'] | symmetric_difference(result['after']) |length == 0 }}"
-
- - name: Update existing static_routes configuration using merged (IDEMPOTENT)
- iosxr_static_routes: *merged_update
- register: result
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - "result['changed'] == false"
- - "result.commands|length == 0"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml
deleted file mode 100644
index 44f62efe44..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes overridden integration tests on connection={{ ansible_connection }}"
-
-- include_tasks: _remove_config.yaml
-
-- include_tasks: _populate_config.yaml
-
-- block:
- - name: Overridde all static routes configuration with provided configuration
- iosxr_static_routes: &overridden
- config:
- - vrf: DEV_NEW
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.15
- interface: FastEthernet0/0/0/3
- description: "DEV1"
- - afi: ipv6
- safi: unicast
- routes:
- - dest: 2001:db8:3000::/36
- next_hops:
- - interface: FastEthernet0/0/0/4
- forward_router_address: 2001:db8:2000:2::2
- description: "PROD1"
- track: ip_sla_1
- state: overridden
- register: result
-
- - name: Assert that correct set of commands were generated
- assert:
- that:
- - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
-
- - name: Assert that before dicts are correctly generated
- assert:
- that:
- - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that after dict is correctly generated
- assert:
- that:
- - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
-
- - name: Overridde all static routes configuration with given configuration (IDEMPOTENT)
- iosxr_static_routes: *overridden
- register: result
-
- - name: Assert that task was idempotent
- assert:
- that:
- - "result['changed'] == false"
- - "result.commands|length == 0"
-
- - name: Assert that before dict is correctly generated
- assert:
- that:
- - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml
deleted file mode 100644
index 0932818c51..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes parsed integration tests on connection={{ ansible_connection }}"
-
-- block:
- - name: Use parsed state to convert externally supplied device specific static routes commands to structured format
- iosxr_static_routes:
- running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}"
- state: parsed
- register: result
-
- - assert:
- that: "{{ merged['after'] | symmetric_difference(result['parsed']) |length==0 }}"
-
- \ No newline at end of file
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml
deleted file mode 100644
index f469eb1b2c..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes rendered integration tests on connection={{ ansible_connection }}"
-
-- include_tasks: _remove_config.yaml
-
-- block:
- - name: Use rendered state to convert task input to device specific commands
- iosxr_static_routes:
- config:
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.12
- description: "DEV"
- dest_vrf: test_1
-
- - dest: 192.0.2.80/28
- next_hops:
- - interface: FastEthernet0/0/0/2
- forward_router_address: 192.0.2.14
- dest_vrf: test_1
- track: ip_sla_2
- vrflabel: 124
-
- - address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.10
- interface: FastEthernet0/0/0/1
- description: "LAB"
- metric: 120
- tag: 10
-
- - interface: FastEthernet0/0/0/5
- track: ip_sla_1
-
- - dest: 192.0.2.32/28
- next_hops:
- - forward_router_address: 192.0.2.11
- admin_distance: 100
-
- - afi: ipv6
- safi: unicast
- routes:
- - dest: 2001:db8:1000::/36
- next_hops:
- - interface: FastEthernet0/0/0/7
- description: "DC"
-
- - interface: FastEthernet0/0/0/8
- forward_router_address: 2001:db8:2000:2::1
- state: rendered
- register: result
-
- - assert:
- that: "{{ merged['commands'] | symmetric_difference(result['rendered']) |length==0 }}"
-
- - name: Gather static routes facts from the device and assert that its empty
- iosxr_static_routes:
- state: gathered
- register: result
-
- - name: Make sure that rendered task actually did not make any changes to the device
- assert:
- that: "{{ result['gathered'] == [] }}"
-
- always:
- - include_tasks: _remove_config.yaml \ No newline at end of file
diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml
deleted file mode 100644
index b0f9cf8429..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes replaced integration tests on connection={{ ansible_connection }}"
-
-- include_tasks: _remove_config.yaml
-
-- include_tasks: _populate_config.yaml
-
-- block:
- - name: Replace device configurations of static routes with provided configurations
- iosxr_static_routes: &replaced
- config:
- - vrf: DEV_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.15
- interface: FastEthernet0/0/0/3
- description: "DEV_NEW"
- dest_vrf: dev_test_2
- 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:
- - "{{ replaced['before'] | 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 vrfs/global entry with provided configuration (IDEMPOTENT)
- iosxr_static_routes: *replaced
- register: result
-
- - name: Assert that task was idempotent
- assert:
- that:
- - "result['changed'] == false"
- - "result.commands|length == 0"
-
- - 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/iosxr_static_routes/tests/cli/rtt.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml
deleted file mode 100644
index ccc63bcbd5..0000000000
--- a/test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml
+++ /dev/null
@@ -1,73 +0,0 @@
----
-- debug:
- msg: "START iosxr_static_routes round trip integration tests on connection={{ ansible_connection }}"
-
-- block:
- - include_tasks: _remove_config.yaml
-
- - name: Apply the provided configuration (base config)
- iosxr_static_routes:
- config:
- - address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.15
- admin_distance: 105
- track: ip_sla_2
- - vrf: DEV_SITE
- address_families:
- - afi: ipv6
- safi: unicast
- routes:
- - dest: 2001:db8:3000::/36
- next_hops:
- - forward_router_address: 2001:db8:2000:2::2
- interface: FastEthernet0/0/0/11
- description: PROD1
- state: merged
- register: base_config
-
- - name: Gather interfaces facts
- iosxr_facts:
- gather_subset:
- - "!all"
- - "!min"
- gather_network_resources:
- - static_routes
-
- - name: Apply the provided configuration (config to be reverted)
- iosxr_static_routes:
- config:
- - vrf: TEST_SITE
- address_families:
- - afi: ipv4
- safi: unicast
- routes:
- - dest: 192.0.2.80/28
- next_hops:
- - forward_router_address: 192.0.2.12
- interface: FastEthernet0/0/0/3
- description: "DEV_MOVED"
- dest_vrf: dev_moved
- state: overridden
- 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
- iosxr_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