summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/targets/vyos_route_maps/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_route_maps/tasks/cli.yaml19
-rw-r--r--tests/integration/targets/vyos_route_maps/tasks/main.yaml4
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg13
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml23
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/_remove_config.yaml10
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml36
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml60
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml24
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml60
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml56
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml16
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml40
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml56
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml81
-rw-r--r--tests/integration/targets/vyos_route_maps/vars/main.yaml109
-rw-r--r--tests/sanity/ignore-2.10.txt3
-rw-r--r--tests/sanity/ignore-2.11.txt3
-rw-r--r--tests/sanity/ignore-2.12.txt3
-rw-r--r--tests/sanity/ignore-2.9.txt3
-rw-r--r--tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg18
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_route_maps.py589
22 files changed, 1229 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_route_maps/defaults/main.yaml b/tests/integration/targets/vyos_route_maps/defaults/main.yaml
new file mode 100644
index 0000000..852a6be
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: '[^_].*'
+test_items: []
diff --git a/tests/integration/targets/vyos_route_maps/tasks/cli.yaml b/tests/integration/targets/vyos_route_maps/tasks/cli.yaml
new file mode 100644
index 0000000..93eb2fe
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tasks/cli.yaml
@@ -0,0 +1,19 @@
+---
+- name: Collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/cli'
+ patterns: '{{ testcase }}.yaml'
+ use_regex: true
+ register: test_cases
+ delegate_to: localhost
+
+- name: Set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: Run test case (connection=ansible.netcommon.network_cli)
+ include: '{{ test_case_to_run }}'
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
+ with_items: '{{ test_items }}'
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/tests/integration/targets/vyos_route_maps/tasks/main.yaml b/tests/integration/targets/vyos_route_maps/tasks/main.yaml
new file mode 100644
index 0000000..b957d2f
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tasks/main.yaml
@@ -0,0 +1,4 @@
+---
+- include: cli.yaml
+ tags:
+ - network_cli
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg b/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg
new file mode 100644
index 0000000..a4aa4d3
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg
@@ -0,0 +1,13 @@
+set policy route-map test1 rule 1 description test
+set policy route-map test1 rule 1 action permit
+set policy route-map test1 rule 1 continue 2
+set policy route-map test3 rule 1 action permit
+set policy route-map test3 rule 1 set local-preference 4
+set policy route-map test3 rule 1 set metric 5
+set policy route-map test3 rule 1 set metric-type type-1
+set policy route-map test3 rule 1 set origin egp
+set policy route-map test3 rule 1 set originator-id 192.0.2.34
+set policy route-map test3 rule 1 set tag 5
+set policy route-map test3 rule 1 set weight 4
+set policy route-map test3 rule 1 match metric 1
+set policy route-map test3 rule 1 match peer 192.0.2.32 \ No newline at end of file
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml
new file mode 100644
index 0000000..9ef975f
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml
@@ -0,0 +1,23 @@
+---
+- name: setup
+ vyos.vyos.vyos_config:
+ lines:
+ - set policy route-map test2 rule 1 action 'permit'
+ - set policy route-map test2 rule 1 description 'test'
+ - set policy route-map test2 rule 2 action 'permit'
+ - set policy route-map test2 rule 2 on-match goto '4'
+ - set policy route-map test3 rule 1 action 'permit'
+ - set policy route-map test3 rule 1 match metric '1'
+ - set policy route-map test3 rule 1 match peer '192.0.2.32'
+ - set policy route-map test3 rule 1 set community 'internet'
+ - set policy route-map test3 rule 1 set ip-next-hop '192.0.2.33'
+ - set policy route-map test3 rule 1 set local-preference '4'
+ - set policy route-map test3 rule 1 set metric '5'
+ - set policy route-map test3 rule 1 set metric-type 'type-1'
+ - set policy route-map test3 rule 1 set origin 'egp'
+ - set policy route-map test3 rule 1 set originator-id '192.0.2.34'
+ - set policy route-map test3 rule 1 set tag '5'
+ - set policy route-map test3 rule 1 set weight '4'
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/_remove_config.yaml
new file mode 100644
index 0000000..70e9889
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/_remove_config.yaml
@@ -0,0 +1,10 @@
+---
+- name: Remove pre-existing route-maps
+ vyos.vyos.vyos_config:
+ lines:
+ - delete policy route-map test1
+ - delete policy route-map test2
+ - delete policy route-map test3
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml
new file mode 100644
index 0000000..efcb88b
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml
@@ -0,0 +1,36 @@
+---
+- debug:
+ msg: START vyos_route_maps deleted integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Delete the provided configuration
+ register: result
+ vyos.vyos.vyos_route_maps: &id001
+ config:
+ state: deleted
+
+ - assert:
+ that:
+ - result.commands|length == 2
+ - result.changed == true
+ - result.commands|symmetric_difference(deleted.commands) == []
+
+ - name: Delete the existing configuration with the provided running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospf_interfaces: *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_route_maps/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml
new file mode 100644
index 0000000..6d992b8
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml
@@ -0,0 +1,60 @@
+---
+- debug:
+ msg: START vyos_route_maps empty_config integration tests on connection={{
+ ansible_connection }}
+
+- name: Merged with empty config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_route_maps:
+ config:
+ state: merged
+
+- 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
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_route_maps:
+ config:
+ state: replaced
+
+- 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
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_route_maps:
+ config:
+ state: overridden
+
+- 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
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_route_maps:
+ running_config:
+ state: parsed
+
+- 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
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_route_maps:
+ config:
+ state: rendered
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state rendered'
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml
new file mode 100644
index 0000000..b73fe23
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml
@@ -0,0 +1,24 @@
+---
+- debug:
+ msg: START vyos_route_maps gathered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather config from the device in structured format.
+ register: result
+ vyos.vyos.vyos_route_maps:
+ state: gathered
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: route_maps
+
+ - assert:
+ that:
+ - result.changed == false
+ - result.gathered|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml
new file mode 100644
index 0000000..2b86969
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml
@@ -0,0 +1,60 @@
+---
+- debug:
+ msg: START vyos_route_maps merged integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_route_maps: &id001
+ config:
+ - route_map: test1
+ entries:
+ - sequence: 1
+ description: "test"
+ action: permit
+ continue_sequence: 2
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 1
+ peer: 192.0.2.32
+ set:
+ local_preference: 4
+ metric: 5
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 5
+ weight: 4
+ state: merged
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: route_maps
+
+ - assert:
+ that:
+ - result.commands|length == 13
+ - result.changed == true
+ - result.commands|symmetric_difference(merged.commands) == []
+ - result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_route_maps: *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_route_maps/tests/cli/overridden.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml
new file mode 100644
index 0000000..f014cf1
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml
@@ -0,0 +1,56 @@
+---
+- debug:
+ msg: START vyos_route_maps overridden integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Override the existing configuration with the provided running configuration
+ register: result
+ vyos.vyos.vyos_route_maps: &id001
+ config:
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 3
+ peer: 192.0.2.35
+ set:
+ local_preference: 6
+ metric: 4
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 4
+ weight: 4
+ state: overridden
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: route_maps
+
+ - assert:
+ that:
+ - result.commands|length == 8
+ - result.changed == true
+ - result.commands|symmetric_difference(overridden.commands) == []
+ - result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
+
+ - name: Override the existing configuration with the provided running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_route_maps: *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_route_maps/tests/cli/parsed.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml
new file mode 100644
index 0000000..47cb4cc
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml
@@ -0,0 +1,16 @@
+---
+- debug:
+ msg: START vyos_route_maps parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Provide the running configuration for parsing (config to be parsed)
+ become: true
+ register: result
+ vyos.vyos.vyos_route_maps:
+ running_config: "{{ lookup('file', '_parsed.cfg') }}"
+ state: parsed
+
+- assert:
+ that:
+ - result.changed == false
+ - result.parsed|symmetric_difference(merged.after) == []
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml
new file mode 100644
index 0000000..7d194d9
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml
@@ -0,0 +1,40 @@
+---
+- 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_route_maps: &id001
+ config:
+ - route_map: test1
+ entries:
+ - sequence: 1
+ description: "test"
+ action: permit
+ continue_sequence: 2
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 1
+ peer: 192.0.2.32
+ set:
+ local_preference: 4
+ metric: 5
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 5
+ weight: 4
+ state: rendered
+
+ - assert:
+ that:
+ - result.changed == false
+ - result.rendered|symmetric_difference(merged.commands) == []
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml
new file mode 100644
index 0000000..1675ec5
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml
@@ -0,0 +1,56 @@
+---
+- debug:
+ msg: START vyos_route_maps replaced integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Replace the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_route_maps: &id001
+ config:
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 3
+ peer: 192.0.2.35
+ set:
+ local_preference: 6
+ metric: 4
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 4
+ weight: 4
+ state: replaced
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: route_maps
+
+ - assert:
+ that:
+ - result.commands|length == 7
+ - result.changed == true
+ - result.commands|symmetric_difference(replaced.commands) == []
+ - result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
+
+ - name: Replace the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_route_maps: *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_route_maps/tests/cli/rtt.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml
new file mode 100644
index 0000000..2a95f1f
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml
@@ -0,0 +1,81 @@
+---
+- debug:
+ msg: START vyos_route_maps merged integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: baseconfig
+ vyos.vyos.vyos_route_maps:
+ config:
+ - route_map: test1
+ entries:
+ - sequence: 1
+ description: "test"
+ action: permit
+ continue_sequence: 2
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 1
+ peer: 192.0.2.32
+ set:
+ local_preference: 4
+ metric: 5
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 5
+ weight: 4
+ state: merged
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: route_maps
+
+ - assert:
+ that:
+ - baseconfig.commands|length == 13
+ - baseconfig.changed == true
+ - baseconfig.commands|symmetric_difference(merged.commands) == []
+ - baseconfig.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
+
+ - name: Merge the existing configuration with the provided running configuration
+ register: result
+ vyos.vyos.vyos_route_maps:
+ config:
+ - route_map: test2
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 3
+ peer: 192.0.2.35
+ set:
+ local_preference: 6
+ metric: 4
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 4
+ weight: 4
+
+ - name: Revert back to base config using facts round trip
+ become: true
+ register: revert
+ vyos.vyos.vyos_route_maps:
+ config: "{{ ansible_facts['network_resources']['route_maps'] }}"
+ state: overridden
+
+ - name: Assert that config was reverted
+ assert:
+ that: baseconfig.after == revert.after
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_route_maps/vars/main.yaml b/tests/integration/targets/vyos_route_maps/vars/main.yaml
new file mode 100644
index 0000000..5a0d027
--- /dev/null
+++ b/tests/integration/targets/vyos_route_maps/vars/main.yaml
@@ -0,0 +1,109 @@
+---
+merged:
+ commands:
+ - set policy route-map test1 rule 1 description test
+ - set policy route-map test1 rule 1 action permit
+ - set policy route-map test1 rule 1 continue 2
+ - set policy route-map test3 rule 1 action permit
+ - set policy route-map test3 rule 1 set local-preference 4
+ - set policy route-map test3 rule 1 set metric 5
+ - set policy route-map test3 rule 1 set metric-type type-1
+ - set policy route-map test3 rule 1 set origin egp
+ - set policy route-map test3 rule 1 set originator-id 192.0.2.34
+ - set policy route-map test3 rule 1 set tag 5
+ - set policy route-map test3 rule 1 set weight 4
+ - set policy route-map test3 rule 1 match metric 1
+ - set policy route-map test3 rule 1 match peer 192.0.2.32
+
+ after:
+ - route_map: "test3"
+ entries:
+ - sequence: 1
+ action: "permit"
+ match:
+ metric: 1
+ peer: "192.0.2.32"
+ set:
+ local_preference: "4"
+ metric: "5"
+ metric_type: "type-1"
+ origin: egp
+ originator_id: "192.0.2.34"
+ tag: "5"
+ weight: "4"
+ - route_map: "test1"
+ entries:
+ - sequence: 1
+ description: "test"
+ action: "permit"
+ continue_sequence: 2
+
+replaced:
+ commands:
+ - delete policy route-map test3 rule 1 set ip-next-hop 192.0.2.33
+ - set policy route-map test3 rule 1 set local-preference 6
+ - set policy route-map test3 rule 1 set metric 4
+ - set policy route-map test3 rule 1 set tag 4
+ - delete policy route-map test3 rule 1 set community internet
+ - set policy route-map test3 rule 1 match metric 3
+ - set policy route-map test3 rule 1 match peer 192.0.2.35
+
+ after:
+ - route_map: test2
+ entries:
+ - sequence: 1
+ description: "test"
+ action: permit
+ - sequence: 1
+ action: permit
+ on_match:
+ goto: 4
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 3
+ peer: 192.0.2.35
+ set:
+ local_preference: 6
+ metric: 4
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 4
+ weight: 4
+
+overridden:
+ commands:
+ - delete policy route-map test2
+ - delete policy route-map test3 rule 1 set ip-next-hop 192.0.2.33
+ - set policy route-map test3 rule 1 set local-preference 6
+ - set policy route-map test3 rule 1 set metric 4
+ - set policy route-map test3 rule 1 set tag 4
+ - delete policy route-map test3 rule 1 set community internet
+ - set policy route-map test3 rule 1 match metric 3
+ - set policy route-map test3 rule 1 match peer 192.0.2.35
+
+ after:
+ - route_map: test3
+ entries:
+ - sequence: 1
+ action: permit
+ match:
+ metric: 3
+ peer: 192.0.2.35
+ set:
+ local_preference: 6
+ metric: 4
+ metric_type: "type-1"
+ origin: egp
+ originator_id: 192.0.2.34
+ tag: 4
+ weight: 4
+
+deleted:
+ commands:
+ - delete policy route-map test2
+ - delete policy route-map test3
+ after: []
diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt
index a44822b..69f4063 100644
--- a/tests/sanity/ignore-2.10.txt
+++ b/tests/sanity/ignore-2.10.txt
@@ -1,3 +1,6 @@
plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py compile-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py import-2.6!skip
+plugins/modules/vyos_route_maps.py import-2.6!skip
diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt
index a44822b..69f4063 100644
--- a/tests/sanity/ignore-2.11.txt
+++ b/tests/sanity/ignore-2.11.txt
@@ -1,3 +1,6 @@
plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py compile-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py import-2.6!skip
+plugins/modules/vyos_route_maps.py import-2.6!skip
diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt
index a44822b..69f4063 100644
--- a/tests/sanity/ignore-2.12.txt
+++ b/tests/sanity/ignore-2.12.txt
@@ -1,3 +1,6 @@
plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py compile-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py import-2.6!skip
+plugins/modules/vyos_route_maps.py import-2.6!skip
diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt
index 68064bb..7178a20 100644
--- a/tests/sanity/ignore-2.9.txt
+++ b/tests/sanity/ignore-2.9.txt
@@ -13,3 +13,6 @@ plugins/modules/vyos_lldp_interface.py validate-modules:invalid-documentation #
plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py compile-2.6!skip
+plugins/module_utils/network/vyos/config/route_maps/route_maps.py import-2.6!skip
+plugins/modules/vyos_route_maps.py import-2.6!skip
diff --git a/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg b/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg
new file mode 100644
index 0000000..c7fd9ef
--- /dev/null
+++ b/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg
@@ -0,0 +1,18 @@
+set policy route-map test3 rule 1 action 'permit'
+set policy route-map test3 rule 1 match interface 'eth2'
+set policy route-map test3 rule 1 match ipv6 nexthop 'fdda:5cc1:23:4::1f'
+set policy route-map test3 rule 1 match metric '1'
+set policy route-map test3 rule 1 match peer '1.1.1.2'
+set policy route-map test3 rule 1 match rpki 'invalid'
+set policy route-map test3 rule 1 set bgp-extcommunity-rt '22:11'
+set policy route-map test3 rule 1 set community 'internet'
+set policy route-map test3 rule 1 set ipv6-next-hop global 'fdda:5cc1:23:4::1f'
+set policy route-map test3 rule 1 set ip-next-hop '10.20.10.20'
+set policy route-map test3 rule 1 set local-preference '4'
+set policy route-map test3 rule 1 set metric '5'
+set policy route-map test3 rule 1 set metric-type 'type-1'
+set policy route-map test3 rule 1 set origin 'egp'
+set policy route-map test3 rule 1 set originator-id '10.0.2.3'
+set policy route-map test3 rule 1 set src '10.0.2.15'
+set policy route-map test3 rule 1 set tag '5'
+set policy route-map test3 rule 1 set weight '4' \ No newline at end of file
diff --git a/tests/unit/modules/network/vyos/test_vyos_route_maps.py b/tests/unit/modules/network/vyos/test_vyos_route_maps.py
new file mode 100644
index 0000000..17c605e
--- /dev/null
+++ b/tests/unit/modules/network/vyos/test_vyos_route_maps.py
@@ -0,0 +1,589 @@
+# (c) 2021 Red Hat Inc.
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch
+from ansible_collections.vyos.vyos.plugins.modules import vyos_route_maps
+from ansible_collections.vyos.vyos.tests.unit.modules.utils import (
+ set_module_args,
+)
+from .vyos_module import TestVyosModule, load_fixture
+
+
+class TestVyosRouteMapsModule(TestVyosModule):
+
+ module = vyos_route_maps
+
+ def setUp(self):
+ super(TestVyosRouteMapsModule, self).setUp()
+
+ self.mock_get_resource_connection_config = patch(
+ "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"
+ )
+ self.get_resource_connection_config = (
+ self.mock_get_resource_connection_config.start()
+ )
+
+ self.mock_get_resource_connection_facts = patch(
+ "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"
+ )
+ self.get_resource_connection_facts = (
+ self.mock_get_resource_connection_facts.start()
+ )
+
+ self.mock_execute_show_command = patch(
+ "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.route_maps.route_maps.Route_mapsFacts.get_config"
+ )
+
+ self.execute_show_command = self.mock_execute_show_command.start()
+
+ def tearDown(self):
+ super(TestVyosRouteMapsModule, self).tearDown()
+ self.mock_get_resource_connection_config.stop()
+ self.mock_get_resource_connection_facts.stop()
+ self.mock_execute_show_command.stop()
+
+ def load_fixtures(self, commands=None, transport="cli", filename=None):
+ if filename is None:
+ filename = "vyos_route_maps_config.cfg"
+
+ def load_from_file(*args, **kwargs):
+ output = load_fixture(filename)
+ return output
+
+ self.execute_show_command.side_effect = load_from_file
+
+ def test_vyos_route_maps_merged_idempotent(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ metric=1,
+ peer="1.1.1.2",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.20",
+ local_preference=4,
+ metric=5,
+ metric_type="type-1",
+ origin="egp",
+ originator_id="10.0.2.3",
+ src="10.0.2.15",
+ tag=5,
+ weight=4,
+ ),
+ )
+ ],
+ )
+ ],
+ state="merged",
+ )
+ )
+ self.execute_module(changed=False, commands=[])
+
+ def test_route_maps_merged(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test2",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ metric=1,
+ peer="1.1.1.3",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.22",
+ large_community="10:20:21",
+ local_preference=4,
+ metric=5,
+ metric_type="type-2",
+ origin="egp",
+ originator_id="10.0.2.2",
+ src="10.0.2.15",
+ tag=4,
+ weight=4,
+ ),
+ )
+ ],
+ )
+ ],
+ state="merged",
+ )
+ )
+ commands = [
+ "set policy route-map test2 rule 1 action permit",
+ "set policy route-map test2 rule 1 set bgp-extcommunity-rt 22:11",
+ "set policy route-map test2 rule 1 set ip-next-hop 10.20.10.22",
+ "set policy route-map test2 rule 1 set ipv6-next-hop global fdda:5cc1:23:4::1f",
+ "set policy route-map test2 rule 1 set large-community 10:20:21",
+ "set policy route-map test2 rule 1 set local-preference 4",
+ "set policy route-map test2 rule 1 set metric 5",
+ "set policy route-map test2 rule 1 set metric-type type-2",
+ "set policy route-map test2 rule 1 set origin egp",
+ "set policy route-map test2 rule 1 set originator-id 10.0.2.2",
+ "set policy route-map test2 rule 1 set src 10.0.2.15",
+ "set policy route-map test2 rule 1 set tag 4",
+ "set policy route-map test2 rule 1 set weight 4",
+ "set policy route-map test2 rule 1 set community internet",
+ "set policy route-map test2 rule 1 match interface eth2",
+ "set policy route-map test2 rule 1 match metric 1",
+ "set policy route-map test2 rule 1 match peer 1.1.1.3",
+ "set policy route-map test2 rule 1 match ipv6 nexthop fdda:5cc1:23:4::1f",
+ "set policy route-map test2 rule 1 match rpki invalid",
+ ]
+
+ self.execute_module(changed=True, commands=commands)
+
+ def test_route_maps_replaced(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ metric=1,
+ peer="1.1.1.3",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.22",
+ large_community="10:20:21",
+ local_preference=4,
+ metric=5,
+ metric_type="type-2",
+ origin="egp",
+ originator_id="10.0.2.2",
+ src="10.0.2.15",
+ tag=4,
+ weight=4,
+ ),
+ )
+ ],
+ ),
+ ],
+ state="replaced",
+ )
+ )
+ commands = [
+ "delete policy route-map test3 rule 1 match interface eth2",
+ "set policy route-map test3 rule 1 set ip-next-hop 10.20.10.22",
+ "set policy route-map test3 rule 1 set large-community 10:20:21",
+ "set policy route-map test3 rule 1 set metric-type type-2",
+ "set policy route-map test3 rule 1 set originator-id 10.0.2.2",
+ "set policy route-map test3 rule 1 set tag 4",
+ "set policy route-map test3 rule 1 match peer 1.1.1.3",
+ ]
+ self.execute_module(changed=True, commands=commands)
+
+ def test_vyos_route_maps_replaced_idempotent(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ metric=1,
+ peer="1.1.1.2",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.20",
+ local_preference=4,
+ metric=5,
+ metric_type="type-1",
+ origin="egp",
+ originator_id="10.0.2.3",
+ src="10.0.2.15",
+ tag=5,
+ weight=4,
+ ),
+ )
+ ],
+ ),
+ ],
+ state="replaced",
+ )
+ )
+ self.execute_module(changed=False, commands=[])
+
+ def test_route_maps_overridden(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test2",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(rpki="invalid", peer="1.1.1.3"),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.22",
+ large_community="10:20:21",
+ local_preference=4,
+ metric=5,
+ metric_type="type-2",
+ origin="egp",
+ originator_id="10.0.2.2",
+ src="10.0.2.15",
+ tag=4,
+ weight=4,
+ ),
+ )
+ ],
+ )
+ ],
+ state="overridden",
+ )
+ )
+ commands = [
+ "delete policy route-map test3",
+ "set policy route-map test2 rule 1 action permit",
+ "set policy route-map test2 rule 1 set bgp-extcommunity-rt 22:11",
+ "set policy route-map test2 rule 1 set ip-next-hop 10.20.10.22",
+ "set policy route-map test2 rule 1 set ipv6-next-hop global fdda:5cc1:23:4::1f",
+ "set policy route-map test2 rule 1 set large-community 10:20:21",
+ "set policy route-map test2 rule 1 set local-preference 4",
+ "set policy route-map test2 rule 1 set metric 5",
+ "set policy route-map test2 rule 1 set metric-type type-2",
+ "set policy route-map test2 rule 1 set origin egp",
+ "set policy route-map test2 rule 1 set originator-id 10.0.2.2",
+ "set policy route-map test2 rule 1 set src 10.0.2.15",
+ "set policy route-map test2 rule 1 set tag 4",
+ "set policy route-map test2 rule 1 set weight 4",
+ "set policy route-map test2 rule 1 set community internet",
+ "set policy route-map test2 rule 1 match peer 1.1.1.3",
+ "set policy route-map test2 rule 1 match rpki invalid",
+ ]
+ self.execute_module(changed=True, commands=commands)
+
+ def test_vyos_route_maps_overridden_idempotent(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ metric=1,
+ peer="1.1.1.2",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.20",
+ local_preference=4,
+ metric=5,
+ metric_type="type-1",
+ origin="egp",
+ originator_id="10.0.2.3",
+ src="10.0.2.15",
+ tag=5,
+ weight=4,
+ ),
+ )
+ ],
+ ),
+ ],
+ state="overridden",
+ )
+ )
+ self.execute_module(changed=False, commands=[])
+
+ def test_vyos_route_maps_rendered(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ metric=1,
+ peer="1.1.1.2",
+ ipv6=dict(next_hop="fdda:5cc1:23:4::1f"),
+ ),
+ set=dict(
+ ipv6_next_hop=dict(
+ ip_type="global",
+ value="fdda:5cc1:23:4::1f",
+ ),
+ community=dict(value="internet"),
+ bgp_extcommunity_rt="22:11",
+ ip_next_hop="10.20.10.20",
+ local_preference=4,
+ metric=5,
+ metric_type="type-1",
+ origin="egp",
+ originator_id="10.0.2.3",
+ src="10.0.2.15",
+ tag=5,
+ weight=4,
+ ),
+ )
+ ],
+ ),
+ dict(
+ route_map="test1",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ description="test",
+ on_match=dict(next=True),
+ ),
+ dict(
+ sequence=2,
+ action="permit",
+ on_match=dict(goto=4),
+ ),
+ ],
+ ),
+ ],
+ state="rendered",
+ )
+ )
+ rendered_cmds = [
+ "set policy route-map test3 rule 1 action permit",
+ "set policy route-map test3 rule 1 set bgp-extcommunity-rt 22:11",
+ "set policy route-map test3 rule 1 set ip-next-hop 10.20.10.20",
+ "set policy route-map test3 rule 1 set ipv6-next-hop global fdda:5cc1:23:4::1f",
+ "set policy route-map test3 rule 1 set local-preference 4",
+ "set policy route-map test3 rule 1 set metric 5",
+ "set policy route-map test3 rule 1 set metric-type type-1",
+ "set policy route-map test3 rule 1 set origin egp",
+ "set policy route-map test3 rule 1 set originator-id 10.0.2.3",
+ "set policy route-map test3 rule 1 set src 10.0.2.15",
+ "set policy route-map test3 rule 1 set tag 5",
+ "set policy route-map test3 rule 1 set weight 4",
+ "set policy route-map test3 rule 1 set community internet",
+ "set policy route-map test3 rule 1 match interface eth2",
+ "set policy route-map test3 rule 1 match metric 1",
+ "set policy route-map test3 rule 1 match peer 1.1.1.2",
+ "set policy route-map test3 rule 1 match ipv6 nexthop fdda:5cc1:23:4::1f",
+ "set policy route-map test3 rule 1 match rpki invalid",
+ "set policy route-map test1 rule 1 description test",
+ "set policy route-map test1 rule 1 action permit",
+ "set policy route-map test1 rule 1 on-match next",
+ "set policy route-map test1 rule 2 action permit",
+ "set policy route-map test1 rule 2 on-match goto 4",
+ ]
+ result = self.execute_module(changed=False)
+ self.assertEqual(
+ sorted(result["rendered"]),
+ sorted(rendered_cmds),
+ result["rendered"],
+ )
+
+ def test_yos_route_maps_parsed(self):
+
+ parsed_str = (
+ "set policy route-map test3 rule 1 action 'permit'"
+ "\nset policy route-map test3 rule 1 match interface 'eth2'\nset policy route-map test3 rule 1 match ipv6 nexthop"
+ " 'fdda:5cc1:23:4::1f'\nset policy route-map test3 rule 1 match metric '1'\nset policy route-map test3 rule 1 match peer "
+ "'1.1.1.2'\nset policy route-map test3 rule 1 match rpki 'invalid'\nset policy route-map test3 rule 1 set bgp-extcommunity-rt "
+ "'22:11'\nset policy route-map test3 rule 1 set community 'internet'\nset policy route-map test3 rule 1 set ipv6-next-hop global"
+ " 'fdda:5cc1:23:4::1f'\nset policy route-map test3 rule 1 set ip-next-hop '10.20.10.20'\nset policy route-map "
+ "test3 rule 1 set local-preference '4'\nset policy route-map test3 rule 1 set metric '5'\nset policy route-map test3 "
+ "rule 1 set metric-type 'type-1'\nset policy route-map test3 rule 1 set origin 'egp'\nset policy route-map test3 rule 1 set originator-id "
+ "'10.0.2.3'\nset policy route-map test3 rule 1 set src '10.0.2.15'"
+ "\nset policy route-map test3 rule 1 set tag '5'\nset policy route-map test3 rule 1 set weight '4'"
+ )
+ set_module_args(dict(running_config=parsed_str, state="parsed"))
+ result = self.execute_module(changed=False)
+ parsed_list = [
+ {
+ "entries": [
+ {
+ "action": "permit",
+ "match": {
+ "interface": "eth2",
+ "ipv6": {"next_hop": "fdda:5cc1:23:4::1f"},
+ "metric": 1,
+ "peer": "1.1.1.2",
+ "rpki": "invalid",
+ },
+ "sequence": 1,
+ "set": {
+ "bgp_extcommunity_rt": "22:11",
+ "community": {"value": "internet"},
+ "ip_next_hop": "10.20.10.20",
+ "ipv6_next_hop": {
+ "ip_type": "global",
+ "value": "fdda:5cc1:23:4::1f",
+ },
+ "local_preference": "4",
+ "metric": "5",
+ "metric_type": "type-1",
+ "origin": "egp",
+ "originator_id": "10.0.2.3",
+ "src": "10.0.2.15",
+ "tag": "5",
+ "weight": "4",
+ },
+ }
+ ],
+ "route_map": "test3",
+ },
+ ]
+ self.assertEqual(parsed_list, result["parsed"])
+
+ def test_vyos_route_maps_gathered(self):
+ set_module_args(dict(state="gathered"))
+ result = self.execute_module(changed=False)
+ gathered_list = [
+ {
+ "entries": [
+ {
+ "action": "permit",
+ "match": {
+ "interface": "eth2",
+ "ipv6": {"next_hop": "fdda:5cc1:23:4::1f"},
+ "metric": 1,
+ "peer": "1.1.1.2",
+ "rpki": "invalid",
+ },
+ "sequence": 1,
+ "set": {
+ "bgp_extcommunity_rt": "22:11",
+ "community": {"value": "internet"},
+ "ip_next_hop": "10.20.10.20",
+ "ipv6_next_hop": {
+ "ip_type": "global",
+ "value": "fdda:5cc1:23:4::1f",
+ },
+ "local_preference": "4",
+ "metric": "5",
+ "metric_type": "type-1",
+ "origin": "egp",
+ "originator_id": "10.0.2.3",
+ "src": "10.0.2.15",
+ "tag": "5",
+ "weight": "4",
+ },
+ }
+ ],
+ "route_map": "test3",
+ },
+ ]
+ self.assertEqual(gathered_list, result["gathered"])
+
+ def test_vyos_route_maps_deleted(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ route_map="test3",
+ entries=[
+ dict(
+ sequence=1,
+ action="permit",
+ match=dict(
+ rpki="invalid",
+ interface="eth2",
+ ),
+ set=dict(
+ origin="egp",
+ originator_id="10.0.2.3",
+ src="10.0.2.15",
+ tag=5,
+ weight=4,
+ ),
+ )
+ ],
+ ),
+ ],
+ state="deleted",
+ )
+ )
+ commands = ["delete policy route-map test3"]
+ self.execute_module(changed=True, commands=commands)