summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/incidental_vyos_lldp_interfaces/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/incidental_vyos_lldp_interfaces/tests')
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate.yaml14
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate_intf.yaml10
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_remove_config.yaml8
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/deleted.yaml46
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/empty_config.yaml36
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/merged.yaml58
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/overridden.yaml49
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/replaced.yaml63
-rw-r--r--test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/rtt.yaml57
9 files changed, 341 insertions, 0 deletions
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate.yaml
new file mode 100644
index 0000000..3acded6
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate.yaml
@@ -0,0 +1,14 @@
+---
+- name: Setup
+ ansible.netcommon.cli_config:
+ config: "{{ lines }}"
+ vars:
+ lines: |
+ set service lldp interface eth1
+ set service lldp interface eth1 location civic-based country-code US
+ set service lldp interface eth1 location civic-based ca-type 0 ca-value ENGLISH
+ set service lldp interface eth2
+ set service lldp interface eth2 location coordinate-based latitude 33.524449N
+ set service lldp interface eth2 location coordinate-based altitude 2200
+ set service lldp interface eth2 location coordinate-based datum WGS84
+ set service lldp interface eth2 location coordinate-based longitude 222.267255W
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate_intf.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate_intf.yaml
new file mode 100644
index 0000000..c7ab1ae
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_populate_intf.yaml
@@ -0,0 +1,10 @@
+---
+- name: Setup
+ ansible.netcommon.cli_config:
+ config: "{{ lines }}"
+ vars:
+ lines: |
+ set service lldp interface eth2
+ set service lldp interface eth2 location civic-based country-code US
+ set service lldp interface eth2 location civic-based ca-type 0 ca-value ENGLISH
+ set service lldp interface eth2 disable
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_remove_config.yaml
new file mode 100644
index 0000000..1b1a3b3
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/_remove_config.yaml
@@ -0,0 +1,8 @@
+---
+- name: Remove Config
+ ansible.netcommon.cli_config:
+ config: "{{ lines }}"
+ vars:
+ lines: |
+ delete service lldp interface
+ delete service lldp
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/deleted.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/deleted.yaml
new file mode 100644
index 0000000..7b2d53a
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/deleted.yaml
@@ -0,0 +1,46 @@
+---
+- debug:
+ msg: "Start vyos_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }}"
+
+- include_tasks: _populate.yaml
+
+- block:
+ - name: Delete attributes of given LLDP interfaces.
+ vyos.vyos.vyos_lldp_interfaces: &deleted
+ config:
+ - name: 'eth1'
+ - name: 'eth2'
+ state: deleted
+ register: result
+
+ - name: Assert that the before dicts were correctly generated
+ assert:
+ that:
+ - "{{ populate | 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 attributes of given interfaces (IDEMPOTENT)
+ vyos.vyos.vyos_lldp_interfaces: *deleted
+ register: result
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - "result.changed == false"
+ - "result.commands|length == 0"
+
+ - 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/incidental_vyos_lldp_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/empty_config.yaml
new file mode 100644
index 0000000..44c0b89
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/empty_config.yaml
@@ -0,0 +1,36 @@
+---
+- debug:
+ msg: "START vyos_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }}"
+
+- name: Merged with empty config should give appropriate error message
+ vyos.vyos.vyos_lldp_interfaces:
+ 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
+ vyos.vyos.vyos_lldp_interfaces:
+ 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
+ vyos.vyos.vyos_lldp_interfaces:
+ config:
+ state: overridden
+ register: result
+ ignore_errors: true
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state overridden'
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/merged.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/merged.yaml
new file mode 100644
index 0000000..bf968b2
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/merged.yaml
@@ -0,0 +1,58 @@
+---
+- debug:
+ msg: "START vyos_lldp_interfaces merged integration tests on connection={{ ansible_connection }}"
+
+- include_tasks: _remove_config.yaml
+
+- block:
+ - name: Merge the provided configuration with the exisiting running configuration
+ vyos.vyos.vyos_lldp_interfaces: &merged
+ config:
+ - name: 'eth1'
+ location:
+ civic_based:
+ country_code: 'US'
+ ca_info:
+ - ca_type: 0
+ ca_value: 'ENGLISH'
+
+ - name: 'eth2'
+ location:
+ coordinate_based:
+ altitude: 2200
+ datum: 'WGS84'
+ longitude: '222.267255W'
+ latitude: '33.524449N'
+ 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 }}"
+
+ - 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)
+ vyos.vyos.vyos_lldp_interfaces: *merged
+ register: result
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - "result['changed'] == false"
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
+
+ always:
+ - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/overridden.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/overridden.yaml
new file mode 100644
index 0000000..8cf038c
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/overridden.yaml
@@ -0,0 +1,49 @@
+---
+- debug:
+ msg: "START vyos_lldp_interfaces overridden 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
+ vyos.vyos.vyos_lldp_interfaces: &overridden
+ config:
+ - name: 'eth2'
+ location:
+ elin: '0000000911'
+ state: overridden
+ register: result
+
+ - 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)
+ vyos.vyos.vyos_lldp_interfaces: *overridden
+ register: result
+
+ - 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
diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/replaced.yaml
new file mode 100644
index 0000000..17acf06
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/replaced.yaml
@@ -0,0 +1,63 @@
+---
+- debug:
+ msg: "START vyos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }}"
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+ - name: Replace device configurations of listed LLDP interfaces with provided configurations
+ vyos.vyos.vyos_lldp_interfaces: &replaced
+ config:
+ - name: 'eth2'
+ enable: false
+ location:
+ civic_based:
+ country_code: 'US'
+ ca_info:
+ - ca_type: 0
+ ca_value: 'ENGLISH'
+
+ - name: 'eth1'
+ enable: false
+ location:
+ coordinate_based:
+ altitude: 2200
+ datum: 'WGS84'
+ longitude: '222.267255W'
+ latitude: '33.524449N'
+ 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:
+ - "{{ populate | 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 LLDP interfaces with provided configurarions (IDEMPOTENT)
+ vyos.vyos.vyos_lldp_interfaces: *replaced
+ register: result
+
+ - name: Assert that task was idempotent
+ assert:
+ that:
+ - "result['changed'] == false"
+
+ - 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/incidental_vyos_lldp_interfaces/tests/cli/rtt.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/rtt.yaml
new file mode 100644
index 0000000..4d4cf82
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tests/cli/rtt.yaml
@@ -0,0 +1,57 @@
+---
+- debug:
+ msg: "START vyos_lldp_interfaces round trip integration tests on connection={{ ansible_connection }}"
+
+- include_tasks: _remove_config.yaml
+
+- block:
+ - name: Apply the provided configuration (base config)
+ vyos.vyos.vyos_lldp_interfaces:
+ config:
+ - name: 'eth1'
+ location:
+ civic_based:
+ country_code: 'US'
+ ca_info:
+ - ca_type: 0
+ ca_value: 'ENGLISH'
+
+ state: merged
+ register: base_config
+
+ - name: Gather lldp_interfaces facts
+ vyos.vyos.vyos_facts:
+ gather_subset:
+ - default
+ gather_network_resources:
+ - lldp_interfaces
+
+ - name: Apply the provided configuration (config to be reverted)
+ vyos.vyos.vyos_lldp_interfaces:
+ config:
+ - name: 'eth2'
+ location:
+ coordinate_based:
+ altitude: 2200
+ datum: 'WGS84'
+ longitude: '222.267255W'
+ latitude: '33.524449N'
+ state: merged
+ 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
+ vyos.vyos.vyos_lldp_interfaces:
+ config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}"
+ 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