summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_lldp
diff options
context:
space:
mode:
authoransible-zuul[bot] <48994755+ansible-zuul[bot]@users.noreply.github.com>2019-08-29 15:43:15 +0000
committerGitHub <noreply@github.com>2019-08-29 15:43:15 +0000
commit48d1619005ec30ba3b433161161a692c5a56a90e (patch)
tree2d9a958c135c5ec4cad86650e8f7d7ef173d33c2 /tests/integration/targets/vyos_lldp
parent59af486ab07108815ad1774205959fa8287d6e53 (diff)
parentae8514ce0289ee2096a3a9f54be6a4654153c880 (diff)
downloadvyos.vyos-48d1619005ec30ba3b433161161a692c5a56a90e.tar.gz
vyos.vyos-48d1619005ec30ba3b433161161a692c5a56a90e.zip
Merge pull request #29 from CaptTrews/ansible/collections-sync
Updated from network content collector Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests/integration/targets/vyos_lldp')
-rw-r--r--tests/integration/targets/vyos_lldp/aliases1
-rw-r--r--tests/integration/targets/vyos_lldp/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_lldp/tasks/cli.yaml22
-rw-r--r--tests/integration/targets/vyos_lldp/tasks/main.yaml2
-rw-r--r--tests/integration/targets/vyos_lldp/tests/cli/basic.yaml44
-rw-r--r--tests/integration/targets/vyos_lldp/tests/cli/net_lldp.yaml25
6 files changed, 97 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_lldp/aliases b/tests/integration/targets/vyos_lldp/aliases
new file mode 100644
index 00000000..539d9574
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/aliases
@@ -0,0 +1 @@
+shippable/network
diff --git a/tests/integration/targets/vyos_lldp/defaults/main.yaml b/tests/integration/targets/vyos_lldp/defaults/main.yaml
new file mode 100644
index 00000000..9ef5ba51
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: "*"
+test_items: []
diff --git a/tests/integration/targets/vyos_lldp/tasks/cli.yaml b/tests/integration/targets/vyos_lldp/tasks/cli.yaml
new file mode 100644
index 00000000..890d3acf
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/tasks/cli.yaml
@@ -0,0 +1,22 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
+ 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=network_cli)
+ include: "{{ test_case_to_run }} ansible_connection=network_cli"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
+
+- name: run test case (connection=local)
+ include: "{{ test_case_to_run }} ansible_connection=local"
+ with_first_found: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/tests/integration/targets/vyos_lldp/tasks/main.yaml b/tests/integration/targets/vyos_lldp/tasks/main.yaml
new file mode 100644
index 00000000..415c99d8
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/tasks/main.yaml
@@ -0,0 +1,2 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
diff --git a/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml b/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml
new file mode 100644
index 00000000..badd3a97
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml
@@ -0,0 +1,44 @@
+---
+- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
+
+- name: Make sure LLDP is not running before tests
+ vyos.vyos.vyos_config:
+ lines: delete service lldp
+
+- name: Enable LLDP service
+ vyos.vyos.vyos_lldp:
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set service lldp" in result.commands'
+
+- name: Enable LLDP service again (idempotent)
+ vyos.vyos.vyos_lldp:
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Disable LLDP service
+ vyos.vyos.vyos_lldp:
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"delete service lldp" in result.commands'
+
+- name:
+ vyos.vyos.vyos_lldp:
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
diff --git a/tests/integration/targets/vyos_lldp/tests/cli/net_lldp.yaml b/tests/integration/targets/vyos_lldp/tests/cli/net_lldp.yaml
new file mode 100644
index 00000000..e68d5a62
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp/tests/cli/net_lldp.yaml
@@ -0,0 +1,25 @@
+---
+- debug: msg="START vyos cli/net_lldp.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Make sure LLDP is not running - setup
+ vyos.vyos.vyos_config:
+ lines: delete service lldp
+
+- name: Enable LLDP service using platform agnostic module
+ net_lldp:
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set service lldp" in result.commands'
+
+- name: Make sure LLDP is not running - teardown
+ vyos.vyos.vyos_config:
+ lines: delete service lldp
+
+- debug: msg="END vyos cli/net_lldp.yaml on connection={{ ansible_connection }}"