mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
||||
@@ -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
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "START ce_mdn_interface presented integration tests on connection={{ ansible_connection }}"
|
||||
# set up default before test
|
||||
- name: clean up default configuration with the exisiting running configuration
|
||||
ce_mdn_interface:
|
||||
lldpenable: disabled
|
||||
mdnstatus: disabled
|
||||
ifname: 10GE1/0/1
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_mdn_interface: &present
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
ifname: 10GE1/0/1
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get mdnInterface config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<mdnInterfaces>
|
||||
<mdnInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<mdnStatus></mdnStatus>
|
||||
</mdnInterface>
|
||||
</mdnInterfaces>
|
||||
</lldp>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Get lldp enabled config by ce_netconf.
|
||||
ce_netconf: &get_config_lldp
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lldpSys>
|
||||
<lldpEnable></lldpEnable>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
/filter>"
|
||||
register: result_xml_lldp
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_mdn_interface: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<mdnStatus>rxOnly</mdnStatus>' in result_xml.end_state.result"
|
||||
- "'<lldpEnable>enabled</lldpEnable>' in result_xml_lldp.end_state.result"
|
||||
|
||||
- name: absent the provided configuration with the exisiting running configuration
|
||||
ce_mdn_interface: &absent
|
||||
lldpenable: disabled
|
||||
mdnstatus: disabled
|
||||
ifname: 10GE1/0/1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: absent the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_mdn_interface: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get mdnInterface config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Get lldp enabled config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml_lldp
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
- "'<mdnStatus>disabled</mdnStatus>' not in result_xml.end_state.result"
|
||||
- "'<lldpEnable>disabled</lldpEnable>' in result_xml_lldp.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
|
||||
- debug:
|
||||
msg: "END ce_mdn_interface resentd integration tests on connection={{ ansible_connection }}"
|
||||
Reference in New Issue
Block a user