You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/eos_interface/tests/cli/basic.yaml

230 lines
5.5 KiB
YAML

---
- debug: msg="START eos_interface cli/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 cli/basic.yaml on connection={{ ansible_connection }}"