1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cnos_interface/tests/cli/intent.yaml
Anil Kumar Muraleedharan eab3b02cb3 Refactoring of cnos_interface module like what followed by other vendors (#49927)
* Refactoring of cnos_interface module like what followed by other vendors

* To remove cnos-interface from E326 validation ignore list

* Effect of default parameters impacted UT
2018-12-19 11:38:19 -05:00

140 lines
3.2 KiB
YAML

---
- debug: msg="START cnos_interface cli/intent.yaml on connection={{ ansible_connection }}"
- name: Check intent arguments
cnos_interface:
name: "{{ test_interface }}"
state: down
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.failed == false"
- name: Check intent arguments (failed condition)
cnos_interface:
name: "{{ test_interface }}"
state: up
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'state eq(up)' in result.failed_conditions"
- name: Config + intent
cnos_interface:
name: "{{ test_interface }}"
enabled: False
state: down
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.failed == false"
- name: Config + intent (fail)
cnos_interface:
name: "{{ test_interface }}"
enabled: False
provider: "{{ cli }}"
state: up
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'state eq(up)' in result.failed_conditions"
- name: Register show neighbors detail
cnos_command:
commands:
- show lldp neighbors
provider: "{{ cli }}"
register: show_lldp_neighbors_result
- block:
- name: Check neighbors intent arguments
cnos_interface:
name: Ethernet1/7
neighbors:
- port: Ethernet1/19
host: NE1032
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.failed == false"
- name: Check neighbors intent arguments (failed condition)
cnos_interface:
name: Ethernet1/7
neighbors:
- port: dummy_port
host: dummy_host
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: '"netdev" in show_lldp_neighbors_result.stdout[0]'
- name: Aggregate config + intent (pass)
cnos_interface:
aggregate:
- name: "{{ test_interface }}"
enabled: True
state: down
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == false"
- block:
- name: Aggregate neighbors intent (pass)
cnos_interface:
aggregate:
- name: Ethernet1/7
neighbors:
- port: Ethernet1/19
host: NE1032
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == false"
- name: Aggregate neighbors intent (fail)
cnos_interface:
aggregate:
- name: Ethernet1/7
neighbors:
- port: Ethernet1/19
host: NE1032
- port: dummy_port
host: dummy_host
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: "'netdev' in show_lldp_neighbors_result.stdout[0]"