ansible/test/integration/targets/eos_interface/tests/eapi/basic.yaml
Nathaniel Case 20f93816d6
Fix eapi tests to use become (#40838)
* Return the expected prompt character based on become status

* Update eos_banner tests for eapi

* Update eos_config tests for eapi

* Update eos_facts tests for eapi

* Update eos_interface tests for eapi

* Update eos_l3_interface tests for eapi

* Update eos_lldp tests for eapi

* Update eos_logging tests for eapi

* Update eos_smoke tests for eapi

* Update eos_system tests for eapi
2018-05-29 14:18:03 -04:00

229 lines
5.5 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
become: yes
register: result
- name: Configure interface
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface-initial
state: present
become: yes
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
become: yes
register: result
- assert:
that:
- 'result.changed == false'
- name: Confgure interface parameters
eos_interface:
name: "{{ test_interface_1 }}"
description: test-interface
mtu: 2000
state: present
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
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
become: yes
- name: Create loopback interface aggregate
eos_interface:
aggregate:
- name: loopback9
- name: loopback10
state: present
become: yes
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
become: yes
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
become: yes
register: result
- assert:
that:
- 'result.changed == false'
- debug: msg="END eos_interface eapi/basic.yaml on connection={{ ansible_connection }}"