ansible/test/integration/targets/ce_lldp/tests/netconf/absent.yaml
Xu Yuandong 39c92310b4 Add a new module ce_lldp to manage Link Layer Discovery Protocol(LLDP) (#63395)
* new module ce_lldp

* update for shippable

* update for shippable

* update for shipabble

* update

* merge confilcts

* add integration test.

* update for shippable.

* update for bad-whitespace

* update for shippable

* update for shippable

* update for shippable

* update license.

* update for typo.
2019-10-18 13:15:42 +01:00

108 lines
3.7 KiB
YAML

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