mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-28 13:33:57 +00:00
That is the following errors are fixed.
'206' # Variables should have spaces before and after: {{ var_name }}
'208' # File permissions unset or incorrect
'301' # Commands should not change things if nothing needs doing
'305' # Use shell only when shell functionality is required
'502' # All tasks should be named
'601' # Don't compare to literal True/False
'602' # Don't compare to empty string
RHELPLAN-73471
Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
200 lines
6.6 KiB
YAML
200 lines
6.6 KiB
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
---
|
|
- hosts: all
|
|
vars:
|
|
interface: testnic1
|
|
type: veth
|
|
tasks:
|
|
- debug:
|
|
msg: "this is: playbooks/tests_ethtool_features.yml"
|
|
tags:
|
|
- always
|
|
|
|
- name: "INIT: Ethtool feeatures tests"
|
|
debug:
|
|
msg: "##################################################"
|
|
- include_tasks: tasks/show_interfaces.yml
|
|
- include_tasks: tasks/manage_test_interface.yml
|
|
vars:
|
|
state: present
|
|
- include_tasks: tasks/assert_device_present.yml
|
|
- name: Install ethtool (test dependency)
|
|
package:
|
|
name: ethtool
|
|
state: present
|
|
|
|
|
|
- block:
|
|
- name: >-
|
|
TEST: I can create a profile without changing the ethtool features.
|
|
debug:
|
|
msg: "##################################################"
|
|
- name: Get current device features
|
|
command: "ethtool --show-features {{ interface }}"
|
|
register: original_ethtool_features
|
|
- import_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
- name: Get current device features
|
|
command: "ethtool --show-features {{ interface }}"
|
|
register: ethtool_features
|
|
- name: "ASSERT: The profile does not change the ethtool features"
|
|
assert:
|
|
that:
|
|
- original_ethtool_features.stdout == ethtool_features.stdout
|
|
|
|
|
|
- name: >-
|
|
TEST: I can disable gro and tx-tcp-segmentation and enable gso.
|
|
debug:
|
|
msg: "##################################################"
|
|
- import_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
ethtool:
|
|
features:
|
|
gro: "no"
|
|
gso: "yes"
|
|
tx-tcp-segmentation: "no"
|
|
- name: Get current device features
|
|
command: "ethtool --show-features {{ interface }}"
|
|
register: ethtool_features
|
|
- name:
|
|
debug:
|
|
var: ethtool_features.stdout_lines
|
|
- name: Assert device features
|
|
assert:
|
|
that:
|
|
- >-
|
|
'generic-receive-offload: off' in
|
|
ethtool_features.stdout_lines
|
|
- >-
|
|
'generic-segmentation-offload: on' in
|
|
ethtool_features.stdout_lines
|
|
- >-
|
|
'tx-tcp-segmentation: off' in
|
|
ethtool_features.stdout_lines | map('trim')
|
|
|
|
|
|
- name: >-
|
|
TEST: I can enable tx_tcp_segmentation (using underscores).
|
|
debug:
|
|
msg: "##################################################"
|
|
- import_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
ethtool:
|
|
features:
|
|
tx_tcp_segmentation: "yes"
|
|
- name: Get current device features
|
|
command: "ethtool --show-features {{ interface }}"
|
|
register: ethtool_features
|
|
- name:
|
|
debug:
|
|
var: ethtool_features.stdout_lines
|
|
- name: Assert device features
|
|
assert:
|
|
that:
|
|
- >-
|
|
'tx-tcp-segmentation: on' in
|
|
ethtool_features.stdout_lines | map('trim')
|
|
|
|
|
|
- name: I cannot change tx_tcp_segmentation and tx-tcp-segmentation at
|
|
the same time.
|
|
block:
|
|
- name: >-
|
|
TEST: Change feature with both underscores and dashes.
|
|
debug:
|
|
msg: "##################################################"
|
|
- network_connections:
|
|
provider: "{{ network_provider | mandatory }}"
|
|
connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
ethtool:
|
|
features:
|
|
tx_tcp_segmentation: "no"
|
|
tx-tcp-segmentation: "no"
|
|
register: __network_connections_result
|
|
rescue:
|
|
- name: Show network_connections result
|
|
debug:
|
|
var: __network_connections_result
|
|
- assert:
|
|
that:
|
|
- '{{ "fatal error: configuration error:
|
|
connections[0].ethtool.features: duplicate key
|
|
''tx_tcp_segmentation''" in
|
|
__network_connections_result.msg }}'
|
|
always:
|
|
- name: Check failure
|
|
debug:
|
|
var: __network_connections_result
|
|
- assert:
|
|
that: __network_connections_result.failed
|
|
|
|
|
|
- name: "TEST: I can reset features to their original value."
|
|
debug:
|
|
msg: "##################################################"
|
|
- import_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
- name: Get current device features
|
|
command: "ethtool --show-features {{ interface }}"
|
|
register: ethtool_features
|
|
# Resetting the ethtools only works with NetworkManager
|
|
- name: "ASSERT: The profile does not change the ethtool features"
|
|
assert:
|
|
that:
|
|
- original_ethtool_features.stdout == ethtool_features.stdout
|
|
when:
|
|
network_provider == 'nm'
|
|
always:
|
|
- block:
|
|
- import_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
persistent_state: absent
|
|
state: down
|
|
ignore_errors: true
|
|
- include_tasks: tasks/manage_test_interface.yml
|
|
vars:
|
|
state: absent
|
|
tags:
|
|
- "tests::cleanup"
|