tests: Test setting the MTU of VLAN interfaces

Test setting the MTU interfaces. This needs autoconnect:false for now,
possibly because of a bug in NetworkManager.
This commit is contained in:
Till Maas 2019-05-30 09:41:52 +02:00
parent 5fa8ac9c2c
commit 8ec0196781
4 changed files with 94 additions and 1 deletions

View file

@ -13,7 +13,13 @@ import yaml
OTHER_PROVIDER_SUFFIX = "_other_provider.yml"
IGNORE = ["tests_unit.yml", "tests_helpers-and-asserts.yml", "tests_states.yml"]
IGNORE = [
"tests_helpers-and-asserts.yml",
"tests_states.yml",
"tests_unit.yml",
"tests_vlan_mtu_initscripts.yml",
"tests_vlan_mtu_nm.yml",
]
OTHER_PLAYBOOK = """
# SPDX-License-Identifier: BSD-3-Clause

View file

@ -0,0 +1,62 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- hosts: all
vars:
type: veth
interface: lsr101
vlan_interface: lsr101.90
tasks:
- include_tasks: tasks/show-interfaces.yml
- include_tasks: tasks/manage-test-interface.yml
vars:
state: present
- include_tasks: tasks/assert-device_present.yml
- name: "TEST: I can configure the MTU for a vlan interface without autoconnect."
import_role:
name: linux-system-roles.network
vars:
network_connections:
- name: "{{ interface }}"
type: ethernet
state: up
mtu: 1492
autoconnect: false
ip:
dhcp4: false
auto6: false
- name: "{{ vlan_interface }}"
parent: "{{ interface }}"
type: vlan
vlan_id: 90
mtu: 1280
state: up
autoconnect: false
ip:
dhcp4: false
auto6: false
- include_tasks: tasks/assert-device_present.yml
vars:
interface: "{{ vlan_interface }}"
- include_tasks: tasks/assert-profile_present.yml
vars:
profile: "{{ item }}"
loop:
- "{{ interface }}"
- "{{ vlan_interface }}"
- name: "CLEANUP: remove profiles"
import_role:
name: linux-system-roles.network
vars:
network_connections:
- name: "{{ interface }}"
persistent_state: absent
state: down
- name: "{{ vlan_interface }}"
persistent_state: absent
state: down
ignore_errors: true
- include_tasks: tasks/manage-test-interface.yml
vars:
state: absent

View file

@ -0,0 +1,12 @@
---
# empty playbook to gather facts for import_playbook when clause
- hosts: all
vars:
network_provider: initscripts
# workaround for: https://github.com/ansible/ansible/issues/27973
# There is no way in Ansible to abort a playbook hosts with specific OS
# releases Therefore we include the playbook with the tests only if the hosts
# would support it.
# The test requires NetworkManager, therefore it cannot run on RHEL 6 or CentOS 6.
- import_playbook: playbooks/tests_vlan_mtu.yml

View file

@ -0,0 +1,13 @@
---
# empty playbook to gather facts for import_playbook when clause
- hosts: all
vars:
network_provider: nm
# workaround for: https://github.com/ansible/ansible/issues/27973
# There is no way in Ansible to abort a playbook hosts with specific OS
# releases Therefore we include the playbook with the tests only if the hosts
# would support it.
# The test requires NetworkManager, therefore it cannot run on RHEL 6 or CentOS 6.
- import_playbook: playbooks/tests_vlan_mtu.yml
when: ansible_distribution_major_version != '6'