Lenovo cnos lldp (#52568)

* To add new module cnos_lldp.
This commit is contained in:
Anil Kumar Muraleedharan
2019-02-21 04:00:09 +05:30
committed by Nathaniel Case
parent 8a0347ac7a
commit c9fea2b74b
7 changed files with 316 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# No Lenovo Switch simulator yet, so not enabled
unsupported

View File

@@ -0,0 +1,2 @@
---
testcase: "*"

View File

@@ -0,0 +1,22 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
delegate_to: localhost
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View File

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

View File

@@ -0,0 +1,44 @@
---
- debug: msg="START cnos_lldp cli/basic.yaml on connection={{ ansible_connection }}"
- name: Enable LLDP service
cnos_lldp:
state: present
register: result
- assert:
that:
- 'result.changed == true'
- '"lldp receive" in result.commands'
- '"lldp transmit" in result.commands'
- name: Enable LLDP service again (idempotent)
cnos_lldp:
state: present
register: result
- assert:
that:
- 'result.changed == true'
- name: Disable LLDP service
cnos_lldp:
state: absent
register: result
- assert:
that:
- 'result.changed == true'
- '"no lldp receive" in result.commands'
- '"no lldp transmit" in result.commands'
- name: Disable LLDP service (idempotent)
cnos_lldp:
state: absent
register: result
- assert:
that:
- 'result.changed == true'
- debug: msg="END cnos_lldp cli/basic.yaml on connection={{ ansible_connection }}"