mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Initial commit
This commit is contained in:
3
tests/integration/targets/ce_lldp/defaults/main.yaml
Normal file
3
tests/integration/targets/ce_lldp/defaults/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
||||
1
tests/integration/targets/ce_lldp/meta/main.yml
Normal file
1
tests/integration/targets/ce_lldp/meta/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
2
tests/integration/targets/ce_lldp/tasks/main.yaml
Normal file
2
tests/integration/targets/ce_lldp/tasks/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
||||
17
tests/integration/targets/ce_lldp/tasks/netconf.yaml
Normal file
17
tests/integration/targets/ce_lldp/tasks/netconf.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
108
tests/integration/targets/ce_lldp/tests/netconf/absent.yaml
Normal file
108
tests/integration/targets/ce_lldp/tests/netconf/absent.yaml
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "START ce_lldp absent integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
|
||||
- name: present the provided configuration befor absent
|
||||
ce_lldp:
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
# There should be some configuration(LLDP) on host befor absent
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "'lldp enable' in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' in result_display.stdout[0]"
|
||||
- "'lldp restart 3' in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' in result_display.stdout[0]"
|
||||
|
||||
- name: absent the provided configuration with the exisiting running configuration
|
||||
ce_lldp: &absent
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'lldp enable' not in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' not in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' not in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' not in result_display.stdout[0]"
|
||||
- "'lldp restart 3' not in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' not in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' not in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' not in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' not in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' not in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' not in result_display.stdout[0]"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lldp: *absent
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lldp absent integration tests on connection={{ ansible_connection }}"
|
||||
20
tests/integration/targets/ce_lldp/tests/netconf/clean.yaml
Normal file
20
tests/integration/targets/ce_lldp/tests/netconf/clean.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "Start ce_lldp deleted remove interface config ansible_connection={{ ansible_connection }}"
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
# After the global LLDP function is disabled, all LLDP configuration restore defaults except the LLDP alarm function.
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- undo lldp enable
|
||||
- lldp mdn disable
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- debug:
|
||||
msg: "End ce_lldp deleted remove interface config ansible_connection={{ ansible_connection }}"
|
||||
66
tests/integration/targets/ce_lldp/tests/netconf/present.yaml
Normal file
66
tests/integration/targets/ce_lldp/tests/netconf/present.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "START ce_lldp merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
|
||||
- include_tasks: cleanup.yaml
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_lldp: &merged
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'lldp enable' in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' in result_display.stdout[0]"
|
||||
- "'lldp restart 3' in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' in result_display.stdout[0]"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lldp: *merged
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- include_tasks: cleanup.yaml
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lldp merged integration tests on connection={{ ansible_connection }}"
|
||||
Reference in New Issue
Block a user