|
|
|
---
|
|
|
|
- debug: msg="START ios_interface cli/intent.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- name: Check intent arguments
|
|
|
|
ios_interface:
|
|
|
|
name: "{{ test_interface }}"
|
|
|
|
state: up
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Check intent arguments (failed condition)
|
|
|
|
ios_interface:
|
|
|
|
name: "{{ test_interface }}"
|
|
|
|
state: down
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'state eq(down)' in result.failed_conditions"
|
|
|
|
|
|
|
|
- name: Config + intent
|
|
|
|
ios_interface:
|
|
|
|
name: "{{ test_interface }}"
|
|
|
|
enabled: False
|
|
|
|
state: down
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Config + intent (fail)
|
|
|
|
ios_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
|
|
|
|
ios_command:
|
|
|
|
commands:
|
|
|
|
- show lldp neighbors
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: show_lldp_neighbors_result
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Check neighbors intent arguments
|
|
|
|
ios_interface:
|
|
|
|
name: Gi0/0
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: netdev
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Check neighbors intent arguments (failed condition)
|
|
|
|
ios_interface:
|
|
|
|
name: Gi0/0
|
|
|
|
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)
|
|
|
|
ios_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: "{{ test_interface }}"
|
|
|
|
enabled: True
|
|
|
|
state: up
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Aggregate neighbors intent (pass)
|
|
|
|
ios_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: Gi0/0
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: netdev
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Aggregate neighbors intent (fail)
|
|
|
|
ios_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: Gi0/0
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: netdev
|
|
|
|
- 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]"
|