mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-28 13:33:57 +00:00
add support for ansible-core 2.11 ansible-lint, ansible-test
Add support for using latest ansible-lint and ansible-test with ansible-core 2.11. There are a few new warnings that need to be addressed or suppressed. One of the changes is to add `# noqa ignore-errors` to the places in the role where `ignore_errors: true` is used. In general, it is not a good idea to use `ignore_errors: true` - instead, it is better to capture the result of the command using a `register`, then use `failed_when`. Or, if that is not possible, use a `block`/`rescue` for more complex error handling. However, in the case where the network role is using `ignore_errors: true` in test code, it is acceptable. see https://ansible-lint.readthedocs.io/en/latest/default_rules.html#ignore-errors Another change is to have all tasks have a valid `name:`. This is explained at https://ansible-lint.readthedocs.io/en/latest/default_rules.html#unnamed-task Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
parent
c0f6038082
commit
db10fc2035
44 changed files with 269 additions and 111 deletions
|
|
@ -3,3 +3,6 @@ skip_list:
|
|||
- '106' # Role name does not match ^[a-z][a-z0-9_]+$ pattern
|
||||
- '303' # Using command rather than module
|
||||
- '403' # Package installs should not use latest
|
||||
- var-naming # allow tests to use var names with Capital Letters
|
||||
warn_list:
|
||||
- load-failure # allow include_tasks with tasks/ directory
|
||||
|
|
|
|||
36
.github/run_test.sh
vendored
36
.github/run_test.sh
vendored
|
|
@ -1,11 +1,13 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TEST_SOURCE_DIR="/network-role"
|
||||
C8S_CONTAINER_IMAGE="quay.io/linux-system-roles/c8s-network-role"
|
||||
C8_CONTAINER_IMAGE="quay.io/linux-system-roles/c8-network-role"
|
||||
PODMAN_OPTS="--systemd=true --privileged"
|
||||
|
||||
read -d '' TEST_FILES << EOF
|
||||
read -r -d '' TEST_FILES << EOF || :
|
||||
tests_802_1x_nm.yml
|
||||
tests_bond_nm.yml
|
||||
tests_auto_gateway_nm.yml
|
||||
|
|
@ -57,8 +59,9 @@ case $OS_TYPE in
|
|||
;;
|
||||
esac
|
||||
|
||||
CONTAINER_ID=`podman run -d $PODMAN_OPTS \
|
||||
-v $PROJECT_PATH:$TEST_SOURCE_DIR $CONTAINER_IMAGE`
|
||||
# shellcheck disable=SC2086
|
||||
CONTAINER_ID=$(podman run -d $PODMAN_OPTS \
|
||||
-v "$PROJECT_PATH":$TEST_SOURCE_DIR $CONTAINER_IMAGE)
|
||||
|
||||
if [ -z "$CONTAINER_ID" ];then
|
||||
echo "Failed to start container"
|
||||
|
|
@ -66,49 +69,46 @@ if [ -z "$CONTAINER_ID" ];then
|
|||
fi
|
||||
|
||||
function clean_up {
|
||||
podman rm -f $CONTAINER_ID || true
|
||||
podman rm -f "$CONTAINER_ID" || true
|
||||
}
|
||||
|
||||
if [ -z "$DEBUG" ];then
|
||||
if [ -z "${DEBUG:-}" ];then
|
||||
trap clean_up ERR EXIT
|
||||
fi
|
||||
|
||||
# Ensure we quit on first failure
|
||||
set -e
|
||||
|
||||
# Ensure we are testing the latest packages and ignore upgrade failure
|
||||
sudo podman exec -i $CONTAINER_ID /bin/bash -c 'dnf upgrade -y' || true
|
||||
sudo podman exec -i "$CONTAINER_ID" /bin/bash -c 'dnf upgrade -y' || true
|
||||
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'while ! systemctl is-active dbus; do sleep 1; done'
|
||||
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c 'sysctl -w net.ipv6.conf.all.disable_ipv6=0'
|
||||
|
||||
sudo podman exec -i $CONTAINER_ID \
|
||||
sudo podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl start systemd-udevd;
|
||||
while ! systemctl is-active systemd-udevd; do sleep 1; done'
|
||||
|
||||
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl restart NetworkManager;
|
||||
while ! systemctl is-active NetworkManager; do sleep 1; done'
|
||||
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl restart sshd;
|
||||
while ! systemctl is-active sshd; do sleep 1; done'
|
||||
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'cat /dev/zero | ssh-keygen -q -N "";
|
||||
cp -v /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys'
|
||||
|
||||
for test_file in $TEST_FILES; do
|
||||
podman exec -i $CONTAINER_ID \
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
"cd $TEST_SOURCE_DIR;
|
||||
env ANSIBLE_HOST_KEY_CHECKING=False \
|
||||
|
|
@ -116,7 +116,7 @@ for test_file in $TEST_FILES; do
|
|||
./tests/$test_file"
|
||||
done
|
||||
|
||||
if [ -n "$DEBUG" ];then
|
||||
podman exec -it $CONTAINER_ID bash
|
||||
if [ -n "${DEBUG:-}" ];then
|
||||
podman exec -it "$CONTAINER_ID" bash
|
||||
clean_up
|
||||
fi
|
||||
|
|
|
|||
70
.sanity-ansible-ignore-2.11.txt
Normal file
70
.sanity-ansible-ignore-2.11.txt
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
plugins/module_utils/network_lsr/nm/__init__.py empty-init!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/__init__.py import-3.9!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/active_connection.py import-3.9!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/client.py import-3.9!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/connection.py import-3.9!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/error.py import-3.9!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-2.6!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-2.7!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-3.5!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-3.6!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-3.7!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-3.8!skip
|
||||
plugins/module_utils/network_lsr/nm/provider.py import-3.9!skip
|
||||
plugins/modules/network_connections.py validate-modules:doc-default-does-not-match-spec
|
||||
plugins/modules/network_connections.py validate-modules:doc-required-mismatch
|
||||
plugins/modules/network_connections.py validate-modules:missing-examples
|
||||
plugins/modules/network_connections.py validate-modules:missing-gplv3-license
|
||||
plugins/modules/network_connections.py validate-modules:module-invalid-version-added
|
||||
plugins/modules/network_connections.py validate-modules:no-default-for-required-parameter
|
||||
plugins/modules/network_connections.py validate-modules:parameter-list-no-elements
|
||||
plugins/modules/network_connections.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/network_connections.py validate-modules:undocumented-parameter
|
||||
tests/network/covstats shebang!skip
|
||||
tests/network/ensure_provider_tests.py compile-2.6!skip
|
||||
tests/network/ensure_provider_tests.py compile-2.7!skip
|
||||
tests/network/ensure_provider_tests.py compile-3.5!skip
|
||||
tests/network/ensure_provider_tests.py future-import-boilerplate!skip
|
||||
tests/network/ensure_provider_tests.py metaclass-boilerplate!skip
|
||||
tests/network/ensure_provider_tests.py shebang!skip
|
||||
tests/network/get_coverage.sh shebang!skip
|
||||
tests/network/get_total_coverage.sh shebang!skip
|
||||
tests/network/integration/conftest.py future-import-boilerplate!skip
|
||||
tests/network/integration/conftest.py metaclass-boilerplate!skip
|
||||
tests/network/integration/test_ethernet.py future-import-boilerplate!skip
|
||||
tests/network/integration/test_ethernet.py metaclass-boilerplate!skip
|
||||
tests/network/merge_coverage.sh shebang!skip
|
||||
tests/network/unit/test_network_connections.py future-import-boilerplate!skip
|
||||
tests/network/unit/test_network_connections.py metaclass-boilerplate!skip
|
||||
tests/network/unit/test_nm_provider.py future-import-boilerplate!skip
|
||||
tests/network/unit/test_nm_provider.py metaclass-boilerplate!skip
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC1091
|
||||
# shellcheck disable=SC1091
|
||||
. "$LSR_SCRIPTDIR/utils.sh"
|
||||
|
||||
# Write your custom commands here that should be run when `tox -e custom`:
|
||||
|
|
|
|||
|
|
@ -112,8 +112,10 @@
|
|||
modules_parent_and_dir.stdout_lines[1] ~ ':' ~ _rundir.path
|
||||
}}"
|
||||
|
||||
- debug:
|
||||
- name: Show _lsr_python_path
|
||||
debug:
|
||||
msg: path {{ _lsr_python_path }}
|
||||
|
||||
- name: "ls -alrtFR {{ _rundir.path }}"
|
||||
command: ls -alrtFR {{ _rundir.path }}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: original_ethtool_coalesce
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -46,7 +47,8 @@
|
|||
TEST: I can set rx-frames and adaptive-tx.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -63,7 +65,7 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: ethtool_coalesce
|
||||
- name:
|
||||
- name: Show ethtool_coalesce output
|
||||
debug:
|
||||
var: ethtool_coalesce.stdout_lines
|
||||
- name: Assert device coalesce
|
||||
|
|
@ -78,7 +80,8 @@
|
|||
- name: "TEST: I can reset coalesce to their original value."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
- name: "TEST: 802.1x profile with private key password and ca cert"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -36,7 +37,8 @@
|
|||
ca_cert: /etc/pki/tls/cacert.pem
|
||||
- name: "TEST: I can ping the EAP server"
|
||||
command: ping -c1 203.0.113.1
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -55,7 +57,8 @@
|
|||
mode: 0644
|
||||
- name: Update ca trust
|
||||
command: update-ca-trust
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -79,7 +82,8 @@
|
|||
domain_suffix_match: example.com
|
||||
- name: "TEST: I can ping the EAP server"
|
||||
command: ping -c1 203.0.113.1
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
TEST: I can configure an interface with auto_gateway enabled
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -58,14 +59,15 @@
|
|||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: "{{ interface }}"
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
|
|
@ -76,7 +78,8 @@
|
|||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: present
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -120,14 +123,15 @@
|
|||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: "{{ interface }}"
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@
|
|||
- name: "TEST Add Bond with 2 ports"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -80,7 +81,8 @@
|
|||
delay: 2
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
- name: "TEST Add Bond with 2 ports using deprecated 'master' argument"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -76,7 +77,8 @@
|
|||
delay: 2
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
profile: "{{ interface }}"
|
||||
network_provider: nm
|
||||
pre_tasks:
|
||||
- debug:
|
||||
- name: Show test banner
|
||||
debug:
|
||||
msg: Inside states tests
|
||||
- include_tasks: tasks/show_interfaces.yml
|
||||
- include_tasks: tasks/assert_device_absent.yml
|
||||
|
|
@ -24,7 +25,8 @@
|
|||
name: dbus-tools
|
||||
state: present
|
||||
# create test profile
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_provider: initscripts
|
||||
|
|
@ -60,7 +62,8 @@
|
|||
- name: get NM dbus objects
|
||||
command: busctl --system tree --list org.freedesktop.NetworkManager
|
||||
register: nm_dbus_objects
|
||||
- debug:
|
||||
- name: Show nm_dbus_objects
|
||||
debug:
|
||||
var: nm_dbus_objects
|
||||
- name: Assert that no checkpoints are left
|
||||
assert:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_dummy.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
state: present
|
||||
- include_tasks: tasks/assert_device_present.yml
|
||||
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -64,7 +65,8 @@
|
|||
msg: "The PCI address is not removed"
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show inside ethernet tests
|
||||
debug:
|
||||
msg: Inside ethernet tests
|
||||
- debug:
|
||||
- name: Show network_provider
|
||||
debug:
|
||||
var: network_provider
|
||||
|
||||
- name: Test configuring ethernet devices
|
||||
|
|
@ -42,7 +44,8 @@
|
|||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show network_provider
|
||||
debug:
|
||||
var: network_provider
|
||||
|
||||
# FIXME: assert profile present
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
interface: testnic1
|
||||
type: veth
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_ethtool_coalesce.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
@ -28,7 +29,8 @@
|
|||
TEST: I can create a profile without any coalescing option.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -66,7 +68,8 @@
|
|||
TEST: I can set rx-frames.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -106,7 +109,8 @@
|
|||
- name: "TEST: I can clear coalescing options"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -142,7 +146,8 @@
|
|||
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
interface: testnic1
|
||||
type: veth
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_ethtool_features.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
@ -32,7 +33,8 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: original_ethtool_features
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -55,7 +57,8 @@
|
|||
TEST: I can disable gro and tx-tcp-segmentation and enable gso.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -73,7 +76,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
- name:
|
||||
- name: Show ethtool_features
|
||||
debug:
|
||||
var: ethtool_features.stdout_lines
|
||||
- name: Assert device features
|
||||
|
|
@ -94,7 +97,8 @@
|
|||
TEST: I can enable tx_tcp_segmentation (using underscores).
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -110,7 +114,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
- name:
|
||||
- name: Show ethtool_features
|
||||
debug:
|
||||
var: ethtool_features.stdout_lines
|
||||
- name: Assert device features
|
||||
|
|
@ -156,14 +160,16 @@
|
|||
- name: Check failure
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
- assert:
|
||||
- name: Assert that the result is failure
|
||||
assert:
|
||||
that: __network_connections_result.failed
|
||||
|
||||
|
||||
- name: "TEST: I can reset features to their original value."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -185,7 +191,8 @@
|
|||
network_provider == 'nm'
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
interface: testnic1
|
||||
type: veth
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_ethtool_ring.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
@ -28,7 +29,8 @@
|
|||
TEST: I can create a profile without any ring option.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -66,7 +68,8 @@
|
|||
TEST: I can set rx.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -144,7 +147,8 @@
|
|||
- name: "TEST: I can clear ring options"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -180,7 +184,8 @@
|
|||
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
TEST: I can configure an interface with static ipv6 config
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
- name: Get ip address information
|
||||
command: "ip addr show {{ interface }}"
|
||||
register: ip_addr
|
||||
- name:
|
||||
- name: Show ip_addr
|
||||
debug:
|
||||
var: ip_addr.stdout
|
||||
- name: Assert ipv6 addresses are correctly set
|
||||
|
|
@ -60,7 +61,7 @@
|
|||
- name: Get ipv6 routes
|
||||
command: "ip -6 route"
|
||||
register: ipv6_route
|
||||
- name:
|
||||
- name: Show ipv6_route
|
||||
debug:
|
||||
var: ipv6_route.stdout
|
||||
- name: Assert default ipv6 route is set
|
||||
|
|
@ -77,14 +78,15 @@
|
|||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: "{{ interface }}"
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
state: present
|
||||
- include_tasks: tasks/assert_device_present.yml
|
||||
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_states.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
profile: "{{ interface }}"
|
||||
network_provider: nm
|
||||
pre_tasks:
|
||||
- debug:
|
||||
- name: Show test banner
|
||||
debug:
|
||||
msg: Inside states tests
|
||||
- include_tasks: tasks/show_interfaces.yml
|
||||
- include_tasks: tasks/assert_device_absent.yml
|
||||
|
|
@ -19,7 +20,8 @@
|
|||
tasks:
|
||||
- block:
|
||||
# create test profile
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -46,7 +48,8 @@
|
|||
auto6: false
|
||||
ignore_errors: true
|
||||
register: test_module_run
|
||||
- debug:
|
||||
- name: Show test_module_run
|
||||
debug:
|
||||
var: test_module_run
|
||||
- name: Assert that reapply is found in log output
|
||||
assert:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_states.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
- name: Show playbook name
|
||||
debug:
|
||||
msg: "this is: playbooks/tests_team.yml"
|
||||
tags:
|
||||
- always
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
TEST: I can configure the MTU for a vlan interface without autoconnect.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -51,7 +52,8 @@
|
|||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -61,7 +63,7 @@
|
|||
- name: "{{ vlan_interface }}"
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
- name: "TEST: wireless connection with WPA-PSK"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_allow_restart: true
|
||||
|
|
@ -38,7 +39,8 @@
|
|||
ssid: "mock_wifi"
|
||||
key_mgmt: "wpa-psk"
|
||||
password: "p@55w0rD"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -48,7 +50,8 @@
|
|||
- name: "TEST: wireless connection with 802.1x TLS-EAP"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_allow_restart: true
|
||||
|
|
@ -75,7 +78,8 @@
|
|||
ca_cert: /etc/pki/tls/cacert.pem
|
||||
always:
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
- name: "TEST: wireless connection with OWE"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_allow_restart: true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- shell: |
|
||||
- name: Cleanup profile and device
|
||||
shell: |
|
||||
nmcli con delete {{ interface }}
|
||||
nmcli con load /etc/sysconfig/network-scripts/ifcfg-{{ interface }}
|
||||
rm -f /etc/sysconfig/network-scripts/ifcfg-{{ interface }}
|
||||
ip link del {{ interface }}
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
changed_when: false
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- debug:
|
||||
- name: Show result
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -11,6 +12,7 @@
|
|||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- debug:
|
||||
- name: Show result
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
ip:
|
||||
address:
|
||||
- "192.0.2.42/30"
|
||||
- debug:
|
||||
- name: Show result
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- debug:
|
||||
- name: Show result
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
...
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
# We need to add iptables rule to allow dhcp request
|
||||
iptables -I INPUT -i testbr -p udp --dport 67:68 --sport 67:68 -j ACCEPT
|
||||
|
||||
# Add {{dhcp_interface1}}, {{dhcp_interface2}} peers into the testbr
|
||||
# Add {{ dhcp_interface1 }}, {{ dhcp_interface2 }} peers into the testbr
|
||||
brctl addif testbr {{ dhcp_interface1 }}p
|
||||
brctl addif testbr {{ dhcp_interface2 }}p
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
---
|
||||
- name: remove test interface if necessary
|
||||
command: "ip link del {{ interface }}"
|
||||
ignore_errors: true
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
changed_when: false
|
||||
...
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
command: nmcli d set {{ interface }} managed true
|
||||
# The varible for `network_provider` is not exists yet,
|
||||
# just ignore error for initscripts
|
||||
ignore_errors: yes
|
||||
ignore_errors: yes # noqa ignore-errors
|
||||
when: "type == 'veth' and state == 'present'"
|
||||
|
||||
- name: Delete veth interface {{ interface }}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -12,7 +13,8 @@
|
|||
ip:
|
||||
address: 192.0.2.1/24
|
||||
network_provider: initscripts
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections: []
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
- name: Include network role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
debug:
|
||||
msg: "########## {{ lsr_description }} ##########"
|
||||
|
||||
- debug:
|
||||
- name: Show item
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
- lsr_description
|
||||
|
|
@ -52,7 +53,8 @@
|
|||
debug:
|
||||
msg: "!!!!! Failure in test '{{ lsr_description }}' !!!!!"
|
||||
|
||||
- debug:
|
||||
- name: Show item that failed
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop: "{{ lsr_fail_debug | default([]) }}"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include: get_current_interfaces.yml
|
||||
- debug:
|
||||
- name: Show current_interfaces
|
||||
debug:
|
||||
msg: "current_interfaces: {{ current_interfaces }}"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@
|
|||
register: __network_NM_NVR
|
||||
changed_when: false
|
||||
- block:
|
||||
- import_role:
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
|
|
@ -77,7 +78,8 @@
|
|||
fail:
|
||||
msg: after test
|
||||
rescue:
|
||||
- debug:
|
||||
- name: Show failed item
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
with_items:
|
||||
- ansible_failed_result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue