ansible/test/integration/targets/eos_interface/tests/eapi/basic.yaml
Ganesh Nalawade a3c185bfa8
Add eos_interface module (#34258)
* Add eos_interface module

*  Implementation of eos_interface module
*  Intergration test for eos_interface module
*  Minor fix in eos_l3_interface module
*  Minor fix in ios_interface integration test

* Fix CI issues

* Fix more CI issues
2017-12-28 16:03:50 +05:30

245 lines
6 KiB
YAML

---
- debug: msg="START eos_interface eapi/basic.yaml on connection={{ ansible_connection }}"
- name: Set test interface
set_fact:
test_interface_1: ethernet1
test_interface_2: ethernet2
- name: Configure interface (setup)
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface-1
mtu: 1800
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- name: Configure interface
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface-initial
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"description test-interface-initial" in result.commands'
- name: Confgure interface (idempotent)
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface-initial
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == false'
- name: Confgure interface parameters
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface
mtu: 2000
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"description test-interface" in result.commands'
- '"mtu 2000" in result.commands'
- name: Change interface parameters
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface-1
mtu: 1800
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"description test-interface-1" in result.commands'
- '"mtu 1800" in result.commands'
- name: Disable interface
eos_interface:
name: "{{ test_interface_1 }}"
enabled: False
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"shutdown" in result.commands'
- name: Enable interface
eos_interface:
name: "{{ test_interface_1 }}"
enabled: True
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"no shutdown" in result.commands'
- name: Confgure second interface (setup)
eos_interface:
name: "{{ test_interface_2 }}"
description: test-interface-initial
mtu: 1800
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- name: Add interface aggregate
eos_interface:
aggregate:
- { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 }
- { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 }
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"mtu 2000" in result.commands'
- '"interface {{ test_interface_2 }}" in result.commands'
- '"description test-interface-2" in result.commands'
- '"mtu 2000" in result.commands'
- name: Add interface aggregate (idempotent)
eos_interface:
aggregate:
- { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 }
- { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 }
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == false'
- name: Disable interface aggregate
eos_interface:
aggregate:
- { name: "{{ test_interface_1 }}" }
- { name: "{{ test_interface_2 }}" }
enabled: False
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"shutdown" in result.commands'
- '"interface {{ test_interface_2 }}" in result.commands'
- '"shutdown" in result.commands'
- name: Enable interface aggregate
eos_interface:
aggregate:
- { name: "{{ test_interface_1 }}" }
- { name: "{{ test_interface_2 }}" }
enabled: True
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ test_interface_1 }}" in result.commands'
- '"no shutdown" in result.commands'
- '"interface {{ test_interface_2 }}" in result.commands'
- '"no shutdown" in result.commands'
- name: loopback interface setup
eos_interface:
aggregate:
- name: loopback9
- name: loopback10
state: absent
authorize: yes
provider: "{{ eapi }}"
- name: Create loopback interface aggregate
eos_interface:
aggregate:
- name: loopback9
- name: loopback10
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface loopback9" in result.commands'
- '"interface loopback10" in result.commands'
- name: Delete loopback interface aggregate
eos_interface:
aggregate:
- name: loopback9
- name: loopback10
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"no interface loopback9" in result.commands'
- '"no interface loopback10" in result.commands'
- name: Delete loopback interface aggregate (idempotent)
eos_interface:
aggregate:
- name: loopback9
- name: loopback10
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == false'
- debug: msg="END eos_interface eapi/basic.yaml on connection={{ ansible_connection }}"