summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_lldp_interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/targets/vyos_lldp_interfaces')
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tasks/main.yaml5
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml16
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml54
3 files changed, 75 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tasks/main.yaml b/tests/integration/targets/vyos_lldp_interfaces/tasks/main.yaml
index a3db933..fb74fa1 100644
--- a/tests/integration/targets/vyos_lldp_interfaces/tasks/main.yaml
+++ b/tests/integration/targets/vyos_lldp_interfaces/tasks/main.yaml
@@ -2,3 +2,8 @@
- include: cli.yaml
tags:
- cli
+
+- include: redirection.yaml
+ when: ansible_version.full is version('2.10.0', '>=')
+ tags:
+ - redirection
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml
new file mode 100644
index 0000000..5564a3e
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml
@@ -0,0 +1,16 @@
+---
+- name: collect all redirection cli test cases
+ find:
+ paths: '{{ role_path }}/tests/redirection/cli'
+ patterns: '{{ testcase }}.yaml'
+ register: shortname_test_cases
+ delegate_to: localhost
+
+- name: set test_items for redirection
+ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}"
+
+- name: run test case (connection=ansible.netcommon.network_cli)
+ include: '{{ test_case_to_run }} 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_lldp_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml
new file mode 100644
index 0000000..f43a8e8
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml
@@ -0,0 +1,54 @@
+---
+- debug:
+ msg: START shortaname integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate_intf.yaml
+
+- block:
+ - name: Overrides all device configuration with provided configuration
+ register: result
+ vyos.vyos.lldp_interfaces: &id001
+ config:
+
+ - name: eth2
+ location:
+ elin: 0000000911
+ state: overridden
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ populate_intf | 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)
+ register: result
+ vyos.vyos.lldp_interfaces: *id001
+
+ - 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