2017-12-28 11:33:50 +01:00
|
|
|
---
|
|
|
|
- debug: msg="START eos_interface cli/intent.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- name: Set test interface
|
|
|
|
set_fact:
|
|
|
|
test_interface_1: ethernet1
|
|
|
|
test_interface_2: ethernet2
|
|
|
|
|
|
|
|
- name: Check intent arguments
|
|
|
|
eos_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
|
|
|
state: up
|
|
|
|
tx_rate: ge(0)
|
|
|
|
rx_rate: ge(0)
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Check intent arguments (failed condition)
|
|
|
|
eos_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
|
|
|
state: down
|
|
|
|
tx_rate: gt(0)
|
|
|
|
rx_rate: lt(0)
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
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
|
|
|
|
eos_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
|
|
|
enabled: False
|
|
|
|
state: down
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Config + intent (fail)
|
|
|
|
eos_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
|
|
|
enabled: False
|
|
|
|
state: up
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'state eq(up)' in result.failed_conditions"
|
|
|
|
|
|
|
|
- name: Register show neighbors detail
|
|
|
|
eos_command:
|
|
|
|
commands:
|
|
|
|
- show lldp neighbors management1
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: show_lldp_neighbors_result
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Check neighbors intent arguments
|
|
|
|
eos_interface:
|
|
|
|
name: management1
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: an-vyos-02
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Check neighbors intent arguments (failed condition)
|
|
|
|
eos_interface:
|
|
|
|
name: management1
|
|
|
|
neighbors:
|
|
|
|
- port: dummy_port
|
|
|
|
host: dummy_host
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'host dummy_host' in result.failed_conditions"
|
|
|
|
- "'port dummy_port' in result.failed_conditions"
|
|
|
|
when: '"an-vyos-02" in show_lldp_neighbors_result.stdout[0]'
|
|
|
|
|
|
|
|
- name: Aggregate config + intent (pass)
|
|
|
|
eos_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: "{{ test_interface_1 }}"
|
|
|
|
enabled: True
|
|
|
|
state: up
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Aggregate neighbors intent (pass)
|
|
|
|
eos_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: management1
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: an-vyos-02
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
|
|
|
- name: Aggregate neighbors intent (fail)
|
|
|
|
eos_interface:
|
|
|
|
aggregate:
|
|
|
|
- name: management1
|
|
|
|
neighbors:
|
|
|
|
- port: eth0
|
|
|
|
host: an-vyos-02
|
|
|
|
- port: dummy_port
|
|
|
|
host: dummy_host
|
|
|
|
ignore_errors: yes
|
2018-01-05 16:16:04 +01:00
|
|
|
become: yes
|
2017-12-28 11:33:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'host dummy_host' in result.failed_conditions"
|
|
|
|
- "'port dummy_port' in result.failed_conditions"
|
|
|
|
when: "'an-vyos-02' in show_lldp_neighbors_result.stdout[0]"
|