Initial commit

This commit is contained in:
Ansible Core Team
2020-03-09 09:11:07 +00:00
commit aebc1b03fd
4861 changed files with 812621 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
---
testcase: "[^_].*"
test_items: []

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,2 @@
---
- { include: netconf.yaml, tags: ['netconf'] }

View 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

View 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 }}"

View 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 }}"

View 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 }}"