mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Add vyos_lldp and vyos_lldp_interface modules (#26753)
* Add vyos_lldp and vyos_lldp_interface modules * Fix module docstring issue * Fix bogus aggregate reference * Add vyos_lldp integration tests * Add vyos_lldp_interface integration tests * Remove unused import for run_commands * Add VyOS net_lldp integration tests * Remove junos and netconf from net_lldp integration tests * Add net_lldp_interface integration tests * Correct CLI filtering tests for VyOS * Fix pep8 issues * Fix more pep8 issues
This commit is contained in:
committed by
GitHub
parent
4b3d6dfa8a
commit
af4dc6d0eb
@@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
- include: "{{ role_path }}/tests/vyos/basic.yaml"
|
||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
|
||||
@@ -0,0 +1,165 @@
|
||||
---
|
||||
- name: Make sure LLDP is not running before tests
|
||||
vyos_config:
|
||||
lines: delete service lldp
|
||||
|
||||
- name: Create LLDP configuration
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"set service lldp interface eth1" in result.commands'
|
||||
|
||||
- name: Create LLDP configuration again (idempotent)
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Disable LLDP configuration
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: disabled
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"set service lldp interface eth1 disable" in result.commands'
|
||||
|
||||
- name: Disable LLDP configuration again (idempotent)
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: disabled
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Enable LLDP configuration
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: enabled
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"delete service lldp interface eth1 disable" in result.commands'
|
||||
|
||||
- name: Enable LLDP configuration again (idempotent)
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: enabled
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Delete LLDP configuration
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"delete service lldp interface eth1" in result.commands'
|
||||
|
||||
- name: Delete LLDP configuration again (idempotent)
|
||||
net_lldp_interface:
|
||||
name: eth1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Create aggregate of LLDP interface configurations
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2 }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"set service lldp interface eth1" in result.commands'
|
||||
- '"set service lldp interface eth2" in result.commands'
|
||||
|
||||
- name: Create aggregate of LLDP interface configurations again (idempotent)
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2 }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Override LLDP interface configuration on aggregate
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2, state: disabled }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"set service lldp interface eth2 disable" in result.commands'
|
||||
|
||||
- name: Override LLDP interface configuration on aggregate again (idempotent)
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2, state: disabled }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Delete aggregate of LLDP interface configurations
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2 }
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"delete service lldp interface eth1" in result.commands'
|
||||
- '"delete service lldp interface eth2" in result.commands'
|
||||
|
||||
- name: Delete aggregate of LLDP interface configurations (idempotent)
|
||||
net_lldp_interface:
|
||||
aggregate:
|
||||
- { name: eth1 }
|
||||
- { name: eth2 }
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
Reference in New Issue
Block a user