2017-08-15 13:50:28 +00:00
|
|
|
---
|
2017-12-20 14:03:29 +00:00
|
|
|
- debug: msg="START ios_interface cli/intent.yaml on connection={{ ansible_connection }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
|
|
|
|
- name: Check intent arguments
|
|
|
|
ios_interface:
|
2017-10-25 10:44:25 +00:00
|
|
|
name: "{{ test_interface }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
state: up
|
|
|
|
tx_rate: ge(0)
|
2017-12-05 09:41:49 +00:00
|
|
|
rx_rate: ge(0)
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Check intent arguments (failed condition)
|
|
|
|
ios_interface:
|
2017-10-25 10:44:25 +00:00
|
|
|
name: "{{ test_interface }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
state: down
|
|
|
|
tx_rate: gt(0)
|
|
|
|
rx_rate: lt(0)
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'state eq(down)' in result.failed_conditions"
|
|
|
|
- "'tx_rate gt(0)' in result.failed_conditions"
|
|
|
|
- "'rx_rate lt(0)' in result.failed_conditions"
|
|
|
|
|
|
|
|
- name: Config + intent
|
|
|
|
ios_interface:
|
2017-10-25 10:44:25 +00:00
|
|
|
name: "{{ test_interface }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
enabled: False
|
|
|
|
state: down
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Config + intent (fail)
|
|
|
|
ios_interface:
|
2017-10-25 10:44:25 +00:00
|
|
|
name: "{{ test_interface }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
enabled: False
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-08-15 13:50:28 +00:00
|
|
|
state: up
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'state eq(up)' in result.failed_conditions"
|
|
|
|
|
2017-10-10 19:26:47 +00:00
|
|
|
- name: Register show neighbors detail
|
|
|
|
ios_command:
|
|
|
|
commands:
|
|
|
|
- show lldp neighbors
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
register: show_lldp_neighbors_result
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Check neighbors intent arguments
|
|
|
|
ios_interface:
|
|
|
|
name: Gi0/0
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: netdev
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
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
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'host dummy_host' in result.failed_conditions"
|
|
|
|
- "'port dummy_port' in result.failed_conditions"
|
2017-12-28 10:33:50 +00:00
|
|
|
when: '"netdev" in show_lldp_neighbors_result.stdout[0]'
|
2017-09-06 04:45:02 +00:00
|
|
|
|
2017-08-15 13:50:28 +00:00
|
|
|
- name: Aggregate config + intent (pass)
|
|
|
|
ios_interface:
|
|
|
|
aggregate:
|
2017-10-25 10:44:25 +00:00
|
|
|
- name: "{{ test_interface }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
enabled: True
|
|
|
|
state: up
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-09-06 04:45:02 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
2017-10-10 19:26:47 +00:00
|
|
|
- block:
|
|
|
|
- name: Aggregate neighbors intent (pass)
|
|
|
|
ios_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: Gi0/0
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: netdev
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
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
|
2018-02-02 14:50:15 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-10-10 19:26:47 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'host dummy_host' in result.failed_conditions"
|
|
|
|
- "'port dummy_port' in result.failed_conditions"
|
2017-12-28 10:33:50 +00:00
|
|
|
when: "'netdev' in show_lldp_neighbors_result.stdout[0]"
|