summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_lldp_global/tests/cli
diff options
context:
space:
mode:
authoransible-zuul[bot] <48994755+ansible-zuul[bot]@users.noreply.github.com>2020-01-16 18:56:16 +0000
committerGitHub <noreply@github.com>2020-01-16 18:56:16 +0000
commit03addce56012d4bd360e18612d2eb3af04d8f01a (patch)
tree9cf59872c2ddc7e99595db4f47c72a7ce08b6c10 /tests/integration/targets/vyos_lldp_global/tests/cli
parentd31b74ba6c74a6e3cdebd80b9eb5272aeb9b0fb4 (diff)
parent6b6166151faa3d811ae0ec3010a89e518a26287b (diff)
downloadvyos-ansible-collection-03addce56012d4bd360e18612d2eb3af04d8f01a.tar.gz
vyos-ansible-collection-03addce56012d4bd360e18612d2eb3af04d8f01a.zip
Merge pull request #59 from CaptTrews/master
Updated from network content collector Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests/integration/targets/vyos_lldp_global/tests/cli')
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml10
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml10
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml17
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml11
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml24
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml26
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml22
7 files changed, 65 insertions, 55 deletions
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml
index 088aa7b..e439242 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml
@@ -1,9 +1,7 @@
---
- name: Setup
- network.cli.cli_config:
- config: "{{ lines }}"
vars:
- lines: |
- set service lldp
- set service lldp legacy-protocols 'cdp'
- set service lldp management-address '192.0.2.17'
+ lines: "set service lldp\nset service lldp legacy-protocols 'cdp'\nset service\
+ \ lldp management-address '192.0.2.17'\n"
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml
index b000a94..b823449 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml
@@ -1,9 +1,7 @@
---
- name: Remove Config
- network.cli.cli_config:
- config: "{{ lines }}"
vars:
- lines: |
- delete service lldp legacy-protocols
- delete service lldp management-address
- delete service lldp
+ lines: "delete service lldp legacy-protocols\ndelete service lldp management-address\n\
+ delete service lldp\n"
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml
index 8017e93..f4c6cbc 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml
@@ -1,15 +1,17 @@
---
- debug:
- msg: "Start vyos_lldp_global deleted integration tests ansible_connection={{ ansible_connection }}"
+ msg: Start vyos_lldp_global deleted integration tests ansible_connection={{
+ ansible_connection }}
- include_tasks: _populate.yaml
- block:
+
- name: Delete attributes of LLDP service.
- vyos.vyos.vyos_lldp_global: &deleted
+ register: result
+ vyos.vyos.vyos_lldp_global: &id001
config:
state: deleted
- register: result
- name: Assert that the before dicts were correctly generated
assert:
@@ -19,7 +21,8 @@
- name: Assert that the correct set of commands were generated
assert:
that:
- - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+ - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
- name: Assert that the after dicts were correctly generated
assert:
@@ -27,18 +30,18 @@
- "{{ deleted['after'] == result['after']}}"
- name: Delete attributes of given interfaces (IDEMPOTENT)
- vyos.vyos.vyos_lldp_global: *deleted
register: result
+ vyos.vyos.vyos_lldp_global: *id001
- name: Assert that the previous task was idempotent
assert:
that:
- - "result.changed == false"
+ - result.changed == false
- name: Assert that the before dicts were correctly generated
assert:
that:
- "{{ deleted['after'] == result['before'] }}"
-
always:
+
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
index 05609b6..a197c45 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
@@ -1,24 +1,25 @@
---
- debug:
- msg: "START vyos_lldp_global empty_config integration tests on connection={{ ansible_connection }}"
+ msg: START vyos_lldp_global 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_lldp_global:
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
+ register: result
+ ignore_errors: true
vyos.vyos.vyos_lldp_global:
config:
state: replaced
- register: result
- ignore_errors: true
- assert:
that:
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml
index a17bd61..aeabc9f 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml
@@ -1,21 +1,23 @@
---
- debug:
- msg: "START vyos_lldp_global merged integration tests on connection={{ ansible_connection }}"
+ msg: START vyos_lldp_global merged 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.vyos.vyos_lldp_global: &merged
+ register: result
+ vyos.vyos.vyos_lldp_global: &id001
config:
legacy_protocols:
- - 'fdp'
- - 'cdp'
+ - fdp
+ - cdp
address: 192.0.2.11
state: merged
- register: result
- name: Assert that before dicts were correctly generated
assert:
@@ -24,26 +26,28 @@
- name: Assert that correct set of commands were generated
assert:
that:
- - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+ - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
- name: Assert that after dicts was correctly generated
assert:
that:
- "{{ merged['after'] == result['after'] }}"
- - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
- vyos.vyos.vyos_lldp_global: *merged
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
register: result
+ vyos.vyos.vyos_lldp_global: *id001
- name: Assert that the previous task was idempotent
assert:
that:
- - "result['changed'] == false"
+ - result['changed'] == false
- name: Assert that before dicts were correctly generated
assert:
that:
- "{{ merged['after'] == result['before'] }}"
-
always:
+
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml
index 371e7f3..9a833f5 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml
@@ -1,27 +1,30 @@
---
- debug:
- msg: "START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }}"
+ msg: START vyos_lldp_global replaced integration tests on connection={{ ansible_connection
+ }}
- include_tasks: _remove_config.yaml
- include_tasks: _populate.yaml
- block:
+
- name: Replace device configurations of LLDP service with provided configurations
- vyos.vyos.vyos_lldp_global: &replaced
+ register: result
+ vyos.vyos.vyos_lldp_global: &id001
config:
legacy_protocols:
- - 'edp'
- - 'sonmp'
- - 'cdp'
+ - edp
+ - sonmp
+ - cdp
address: 192.0.2.14
state: replaced
- register: result
- name: Assert that correct set of commands were generated
assert:
that:
- - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+ - "{{ replaced['commands'] | symmetric_difference(result['commands'])\
+ \ |length == 0 }}"
- name: Assert that before dicts are correctly generated
assert:
@@ -33,19 +36,20 @@
that:
- "{{ replaced['after'] == result['after'] }}"
- - name: Replace device configurations of LLDP service with provided configurarions (IDEMPOTENT)
- vyos.vyos.vyos_lldp_global: *replaced
+ - name: Replace device configurations of LLDP service with provided configurarions
+ (IDEMPOTENT)
register: result
+ vyos.vyos.vyos_lldp_global: *id001
- name: Assert that task was idempotent
assert:
that:
- - "result['changed'] == false"
+ - result['changed'] == false
- name: Assert that before dict is correctly generated
assert:
that:
- "{{ replaced['after'] == result['before'] }}"
-
always:
+
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml
index 02902bc..2e8284f 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml
@@ -1,19 +1,21 @@
---
- debug:
- msg: "START vyos_lldp_global round trip integration tests on connection={{ ansible_connection }}"
+ msg: START vyos_lldp_global round trip integration tests on connection={{ ansible_connection
+ }}
- include_tasks: _remove_config.yaml
- block:
+
- name: Apply the provided configuration (base config)
+ register: base_config
vyos.vyos.vyos_lldp_global:
config:
legacy_protocols:
- - 'fdp'
- - 'cdp'
+ - fdp
+ - cdp
address: 192.0.2.11
state: merged
- register: base_config
- name: Gather vyos_lldp_global facts
vyos.vyos.vyos_facts:
@@ -23,29 +25,29 @@
- lldp_global
- name: Apply the provided configuration (config to be reverted)
+ register: result
vyos.vyos.vyos_lldp_global:
config:
legacy_protocols:
- - 'edp'
- - 'sonmp'
- - 'cdp'
+ - edp
+ - sonmp
+ - cdp
address: 192.0.2.14
state: merged
- register: result
- name: Assert that changes were applied
assert:
that: "{{ round_trip['after'] == result['after'] }}"
- name: Revert back to base config using facts round trip
+ register: revert
vyos.vyos.vyos_lldp_global:
config: "{{ ansible_facts['network_resources']['lldp_global'] }}"
state: replaced
- register: revert
- name: Assert that config was reverted
assert:
that: "{{ base_config['after'] == revert['after'] }}"
-
always:
+
- include_tasks: _remove_config.yaml