Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/ensure_provider_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
"playbooks/tests_infiniband.yml": {},
"playbooks/tests_ipv6_disabled.yml": {},
"playbooks/tests_ipv6_dns_search.yml": {},
"playbooks/tests_mac_address_match.yml": {},
"playbooks/tests_mac_address_match.yml": {
MINIMUM_VERSION: "'1.18.0'",
"comment": "# needs any old version of NM",
},
"playbooks/tests_provider.yml": {
MINIMUM_VERSION: "'1.20.0'",
"comment": "# NetworKmanager 1.20.0 added support for forgetting profiles",
Expand Down
5 changes: 5 additions & 0 deletions tests/playbooks/tests_mac_address_match.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
tags:
- always

- name: Ensure NetworkManager is running
service:
name: NetworkManager
state: started

- name: Install ethtool (test dependency)
package:
name: ethtool
Expand Down
56 changes: 55 additions & 1 deletion tests/tasks/find+remove_profile.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,64 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Get connection profile for '{{ interface }}'
command: "nmcli -g GENERAL.CONNECTION device show {{ interface }}"
shell:
executable: /bin/bash
cmd: |
set -euo pipefail
connection="$(nmcli -g GENERAL.CONNECTION device show {{ interface | quote }})" || :
if [ -z "$connection" ]; then
nmcli device connect {{ interface | quote }} 1>&2
fi
nmcli -g GENERAL.CONNECTION device show {{ interface | quote }}
register: connection_name
changed_when: false

- name: Debug
shell: |
set -x
exec 1>&2
systemctl status NetworkManager || :
nmcli || :
nmcli device status || :
nmcli device show || :
nmcli connection show || :
nmcli connection show '{{ interface }}' || :
ip a
echo connection_name: {{ connection_name | to_nice_json | quote }} || :
ls -alrtF /etc/sysconfig/network-scripts || :
for file in /etc/sysconfig/network-scripts/ifcfg-*; do
if [ -f "$file" ]; then
echo "file: $file"
cat "$file" || :
fi
done
cat /etc/NetworkManager/NetworkManager.conf || :
find /etc/NetworkManager -type f -ls || :
for file in /etc/NetworkManager/system-connections/*.nmconnection; do
if [ -f "$file" ]; then
echo "file: $file"
cat "$file" || :
fi
done
for file in /etc/NetworkManager/conf.d/*; do
if [ -f "$file" ]; then
echo "file: $file"
cat "$file" || :
fi
done
find /usr/lib/NetworkManager -type f -ls || :
for file in /usr/lib/NetworkManager/conf.d/*; do
if [ -f "$file" ]; then
echo "file: $file"
cat "$file" || :
fi
done
NetworkManager --print-config
journalctl -u NetworkManager || :
changed_when: false
when: connection_name is failed or connection_name.stdout | length == 0
failed_when: connection_name is failed or connection_name.stdout | length == 0

- name: Bring down and delete the connection profile for '{{ interface }}'
include_role:
name: linux-system-roles.network
Expand Down
22 changes: 22 additions & 0 deletions tests/tests_mac_address_match_nm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,32 @@
tags:
- always

- name: Install NetworkManager and get NetworkManager version
when:
- ansible_distribution_major_version != '6'
tags:
- always
block:
- name: Install NetworkManager
package:
name: NetworkManager
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
- name: Get package info
package_facts:
- name: Get NetworkManager version
set_fact:
networkmanager_version: "{{
ansible_facts.packages['NetworkManager'][0]['version'] }}"


# The test requires or should run with NetworkManager, therefore it cannot run
# on RHEL/CentOS 6
# needs any old version of NM
- name: Import the playbook 'playbooks/tests_mac_address_match.yml'
import_playbook: playbooks/tests_mac_address_match.yml
when:
- ansible_distribution_major_version != '6'

- networkmanager_version is version('1.18.0', '>=')
Loading