From 8ec01967813a3db0dc446c63cde7ba26c5ab53db Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 30 May 2019 09:41:52 +0200 Subject: [PATCH] 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. --- tests/ensure_non_running_provider.py | 8 +++- tests/playbooks/tests_vlan_mtu.yml | 62 ++++++++++++++++++++++++++++ tests/tests_vlan_mtu_initscripts.yml | 12 ++++++ tests/tests_vlan_mtu_nm.yml | 13 ++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/playbooks/tests_vlan_mtu.yml create mode 100644 tests/tests_vlan_mtu_initscripts.yml create mode 100644 tests/tests_vlan_mtu_nm.yml diff --git a/tests/ensure_non_running_provider.py b/tests/ensure_non_running_provider.py index 0925797..37df6d9 100755 --- a/tests/ensure_non_running_provider.py +++ b/tests/ensure_non_running_provider.py @@ -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 diff --git a/tests/playbooks/tests_vlan_mtu.yml b/tests/playbooks/tests_vlan_mtu.yml new file mode 100644 index 0000000..d0cc75c --- /dev/null +++ b/tests/playbooks/tests_vlan_mtu.yml @@ -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 diff --git a/tests/tests_vlan_mtu_initscripts.yml b/tests/tests_vlan_mtu_initscripts.yml new file mode 100644 index 0000000..e6cac29 --- /dev/null +++ b/tests/tests_vlan_mtu_initscripts.yml @@ -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 diff --git a/tests/tests_vlan_mtu_nm.yml b/tests/tests_vlan_mtu_nm.yml new file mode 100644 index 0000000..22fdc32 --- /dev/null +++ b/tests/tests_vlan_mtu_nm.yml @@ -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'