Commit graph

650 commits

Author SHA1 Message Date
Wen Liang
6dfd6485ed ansible-test: Suppress libnmstate import error in network_state.py
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-07-01 12:29:38 +02:00
Rich Megginson
4d21dcd0ac [citest skip] make min_ansible_version a string in meta/main.yml
The Ansible developers say that `min_ansible_version` in meta/main.yml
must be a `string` value like `"2.9"`, not a `float` value like `2.9`.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-06-29 07:07:31 -06:00
Wen Liang
5d167549f3 IfcfgUtil: Remediate connection_seems_active() for controller
For the active bonding/bridge connection, when all the port connection
profiles are brought down firstly, then the operstate of the controller
device will change into "down" automatically, which denotes missing the
carrier for the controller device. However, the connection for the
controller device should still be considered as active as long as
there is any valid IP address configured.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-06-01 10:42:25 -04:00
Wen Liang
f2bd21cd79 CHANGELOG: update changelog for 1.8.0 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-25 10:29:55 -04:00
Wen Liang
e8cdb2bc58 infiniband: Change the default value of p_key into None
The current default `p_key` value is `-1`, which is only useful for the
recognizability with NetworkManager API. NetworkManager chooses the
`-1` as the default pkey value only because the connection should be
created on the physical infiniband interface by default and the
positive pkey value would make the connection created on the virtual
infiniband partition. But NetworkManager should also have represented
the default value as not specifying the pkey property initially.

Therefore, change the default value of `p_key` into `None`.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
be2d0e847c bond: Disable testing infiniband ports in active backup mode
When testing the infiniband ports in active backup mode, certainly the
physical infiniband device is required to be present upfront. Because
the last commit fixes the bug of wrongly checking the existence of
virtual infiniband device and only checks the presence of the infiniband
device when pkey is not explicitly set, the test which testing
infiniband ports in active backup bonding mode will definitely fail
now. To address the issue, remove the testing code now as it is not
significant for testing the bond options, probably the testing code
will be added back to the dedicated infiniband test playbook for
completeness.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
d0bce9ef62 infiniband: Reject the invalid pkey value
The pkey values 0x0000 and 0x8000 are not supported by kernel, raise
an error when the user specifies such a pkey value.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/ulp/ipoib/ipoib_main.c?id=c5eb0a61238dd6faf37f58c9ce61c9980aaffd7a#n2394

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
6927dc39f7 infiniband: Add the integration tests
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
cb3e23ac5d infiniband: Reject the interface name for the ipoib connection
If the `p_key` is specified, then ipoib (IP over Infiniband) connection
will be created. In this case, the interface name must be unset.

NM only allows the user to set the interface name to a fixed value
based on the interface name of the parent and the value of the `p_key`,
for example, if the interface name of the parent is `ib0` and the
`p_key` is `0x000a`, then the `interface_name` for the ipoib connection
must be `ib0.000a` or unset. But this kind of validation in NM is
pointless because it is not useful at all to have the interface name for
the ipoib connection, NM should has also rejected setting the interface
name for the ipoib connection initially.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
6dca796863 infiniband: Fix the bug of wrongly checking whether the device exists
When the `p_key` is specified, the virtual infiniband device should be
created automatically. And activating the connection on the virtual
infiniband device should not require the users to create virtual
infiniband device manually upfront. The previous implementation is
wrong which validating the presence of virtual infiniband device
upfront, as a result, the users have to create the virtual infiniband
device manually in the target system in order to activate the
connection on the virtual infiniband device through the role. This is
an actual bug, the exception raised when the users do not
pre-configured such a virtual infiniband device. To address the
problem, only checking the existence of the device when the `p_key` is
not specified.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Wen Liang
84222cb610 infiniband: Add the setting description
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-19 12:41:35 +02:00
Rich Megginson
bf6215dab8 [citest skip] bump tox-lsr version to 2.11.0; remove py37; add py310
tox-lsr version 2.11.0 has support for collection-requirements.yml,
runqemu improvements, and support for python 3.10

python 3.7 is not used on any supported platform, so remove it

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-05-09 13:21:51 -06:00
Wen Liang
48b1619318 Validate the ip addresses added to the DHCP server
DHCP server certainly needs the IP address configured in order to lease
the address to the client. There is a bug in NM which wrongly removes
all addresses on the unmanaged interface while it should not. To
guarantee the IP address indeed configured for DHCP server, rescue it
via adding conditional loop for configuring IP address to DHCP server.

Notice that this workaround will be removed eventually when NM fixes
the bug.

https://bugzilla.redhat.com/show_bug.cgi?id=2079642

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-05-05 14:42:00 +02:00
Rich Megginson
3cbb6b24c1 add setup-snapshot.yml used to prepare testing snapshots
When running CI tests, test performance can be improved by creating a
snapshot image to use for the test, pre-installed with packages used by
the role tests.  The CI system can use tests/setup-snapshot.yml to
prepare the snapshot image.  Rather than having a list of packages to
install in multiple places, the code which ensures the facts and
variables is moved to a separate tasks/set_facts.yml so that the setup
playbook can use `tasks_from: set_facts.yml` to get the list of network
packages to install.  NOTE: The network role developers should add
additional packages to setup-snapshot.yml for other packages installed
by other tests.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-04-27 23:01:00 +02:00
Rich Megginson
2b17fe73e9 support playbooks which use gather_facts: false
Some users prefer to use `gather_facts: false` in their playbooks.
However, the network role requires certain ansible_facts to be set.  If
the user wants to use the network role with `gather_facts: false`, the
role will gather the minimum subset of facts required.  If the user does
not want the role to gather facts, the user can either not use the
network role, or ensure that all required facts are in the facts cache.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-04-27 23:01:00 +02:00
Wen Liang
77e47a2476 bond: Test infiniband ports in active-backup mode
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-26 10:41:32 +02:00
Wen Liang
6da2df4ba0 Add support for routing rules
In order to enable the user using the policy routing (e.g. source
routing) or instructing the system which table to look up to determine
the correct route, add support for routing rules.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-21 12:19:26 +02:00
Wen Liang
512d840fc4 Util: Normalize address family value before getting prefix length
Some address family values (e.g. "ipv4" or "ipv6") should not be
considered as bogus value if they can be normalized into
`socket.AF_INET` or `socket.AF_INET6`, it is more tolerant but also
still preserving the capability for rejecting the utterly bogus address
family values.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-21 12:19:26 +02:00
Wen Liang
0234fb3b5a Enable more integration tests in GitHub CI
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-20 15:07:38 +02:00
Wen Liang
fa69298b70 ipv6_disabled: Skip the tests on RHEL-7 or CentOS-7
ip.ipv6_disabled is not supported by the running version of
NetworkManager when testing on RHEL-7 or CentOS-7, therefore, skip the
tests on RHEL-7 or CentOS-7.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-06 10:21:48 +02:00
Wen Liang
59ee08ae02 Reject configuring ipv6 disabled if not supported in NM
In NM, the property `NM_SETTING_IP6_CONFIG_METHOD_DISABLED` is only
supported since NM 1.20, therefore, the role should reject configuring
`ipv6 disabled` if `NM_SETTING_IP6_CONFIG_METHOD_DISABLED` is not
supported by the running version of NM.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-05 16:56:34 +02:00
Wen Liang
da260c85cd fix: class Python26CompatTestCase broken by minor python versions
Extract the version of Python interpreter using the `sys.version` will
break the Python26CompatTestCase class when the Python version is 3.11.

Rather the correct way to compare the Python version is using the
`sys.version_info` or the `platform` module as suggested in Python
official doc, https://docs.python.org/3/library/sys.html#sys.version.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-03-24 17:19:41 +01:00
Wen Liang
8b8492eac6 Bond: Clarify and tests the order of destroying bond
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-03-23 11:40:06 +01:00
Till Maas
ce979cdb18 README: Remove outdated information regarding the ifcfg-rh plugin.
The storage plugin used by NM is an implementation detail that the role
does not care about, since it uses NM via libnm.

Signed-off-by: Till Maas <opensource@till.name>
2022-03-21 14:06:20 +01:00
Rich Megginson
60b92ab7c0 Revert "Add support for Rocky Linux; fix supporting the infiniband ports in active-backup mode"
This reverts commit 7c03e49b10.
2022-03-15 11:03:20 -06:00
Rich Megginson
7c03e49b10 Add support for Rocky Linux; fix supporting the infiniband ports in active-backup mode
# New features

- Add support for Rocky Linux

# Bug fixes

- bond: Fix supporting the infiniband ports in active-backup mode
2022-03-15 11:01:46 -06:00
Wen Liang
dccd5d48d6 CHANGELOG: update changelog for 1.7.1 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-03-15 10:58:27 -06:00
Wen Liang
db4bf873cb Clean up connection profile after running pytest
Running the pytest with nm provider failed in the downstream testing
because the "NM_CONTROLLED=no" appeared in
`/etc/sysconfig/network-scripts/ifcfg-testeth` which caused the veth
`testeth` strictly unmanaged by NetworkManager. To fix it, clean up
such a connection profile at the end when running the pytest.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-03-14 18:27:02 +01:00
Till Maas
d3a7124f07 GitHub CI: Trigger on main branch
The network role is using `main` for the default branch, so this needs
to be used in the workflow definition.

Signed-off-by: Till Maas <opensource@till.name>
2022-03-11 15:55:25 +01:00
Till Maas
83dcfdc346 Contributing: Explain how to install tox_lsr
Signed-off-by: Till Maas <opensource@till.name>
2022-03-11 15:43:51 +01:00
Gris Ge
3a2fe6d13d InfiniBand bond: Fix typo of bond mode active-backup
The correct bond mode is `active-backup` instead of `active_backup`.

Thanks to vpal who found this issue via
https://github.com/linux-system-roles/network/issues/475

Signed-off-by: Gris Ge <fge@redhat.com>
2022-03-11 07:04:19 +01:00
Cong Luo
dfcd294552 add Rocky Linux support
Signed-off-by: Cong Luo <c.luo@fz-juelich.de>
2022-03-08 12:22:52 +01:00
Rich Megginson
c377f993c6 use pgrep instead of pidof; ensure packages exist
The tests are giving failures that are unfortunately being ignored.
One of which is that pidof is not available by default on all platforms,
and on some platforms is not available at all (el7).  Same with sysctl.

There are a couple of fixes:
* run the large embedded test `shell` with `set -euo pipefail` to
trigger script errors to be handled.
* install the procps or procps-ng package which provides the tools
such as pgrep, pkill, sysctl, etc.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-03-01 08:36:20 +08:00
Noriko Hosoi
79b39792e4 System Roles should consistently use ansible_managed in configuration files it manages
bz#2044640

The network role create an ifcfg file for initscripts. The file
used to append a comment "# this file was created by ansible".
This patch replaces the proprietary string with the ansible
standard {{ ansible_managed }} to adjust to the other system
roles.

For the implementation, it borrowed the method from kernel_settings,
getting the ansible managed comment using the get_ansible_managed.j2
template and pass the comment to network_connections which is added
to the ifcfg file.

In case network_provider is nm, the comment is not added to the
ifcfg file as the file is not managed by Ansible.

Note: the required parameter name to pass the ansible managed comment
to the network_connection module is "__header".

Do not use get_ansible_managed.j2 in the test scripts, but use a
hardcoded ansible managed comment to simplify the tests.

tests/tasks/get_profile_stat.yml: replace the '=' style with the YAML
notation in set_fact.

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2022-02-25 06:10:42 +08:00
Wen Liang
61423ed36f Fix hostapd package installation error
The hostapd package was moved from EPEL to CentOS Stream and therefore
is not available anymore on EPEL, which made the installation failed.
To fix it, install the hostapd via CentOS Stream in order to run
managed host testing in RHEL-8.5.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-21 21:51:38 +01:00
Rich Megginson
a029152e16 use tox-lsr version 2.10.1
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-02-21 21:20:04 +01:00
Till Maas
cf04059fc8 test: Use new py26 environment
Signed-off-by: Till Maas <opensource@till.name>
2022-02-18 09:57:46 +01:00
Till Maas
d400cadfe4 pytest: Remove PyYAML dependency
This does not seem to be needed anymore.

Signed-off-by: Till Maas <opensource@till.name>
2022-02-18 09:57:46 +01:00
Wen Liang
f2760ab059 CHANGELOG: update changelog for 1.7.0 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-15 14:58:58 +01:00
Wen Liang
59be618857 Support more bond options
In order to enable user to flexibly control the network transmission
over the bonded interface, support all the bond options which are
currently supported by NetworkManager.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-11 23:40:34 +01:00
Wen Liang
fde69e0758 Disable all initscripts provider tests on Fedora
The initscripts provider tests are unstable on Fedora and users are not
using the initscripts on Fedora, therefore, disable all initscripts
provider tests on Fedora.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-11 21:59:35 +01:00
Till Maas
a4267e4e91 GitHub CI: Exclude unsupported tests
To ensure that new tests are going to be tested by the CI, only exclude
tests that are not supported instead of only included the supported
ones.

Signed-off-by: Till Maas <opensource@till.name>
2022-02-09 23:40:43 +08:00
Rich Megginson
206c354b7e [citest skip] bump tox-lsr version to 2.9.1
Signed-off-by: Rich Megginson <rmeggins@redhat.com>

The new tox-lsr also requires the use of `{toxinidir}` for the
local config file paths.
2022-02-07 18:58:27 -07:00
Gris Ge
0e3d480de7 CI: Enable CentOS 9 stream integration test
Signed-off-by: Gris Ge <fge@redhat.com>
2022-02-05 19:25:09 +01:00
Fernando Fernandez Mancera
2ebc8b5022 tests: do not run test_switch_provider on CentOS/RHEL 9
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2022-02-05 07:15:54 +01:00
Till Maas
ac33851552 Contributing: Update IRC information
Signed-off-by: Till Maas <opensource@till.name>
2022-02-04 18:33:39 +01:00
Till Maas
adf4192e38 Contributing: Fix spelling
Signed-off-by: Till Maas <opensource@till.name>
2022-02-04 18:33:39 +01:00
Till Maas
9d8a280b8a README: Clarify the name setting
Signed-off-by: Till Maas <opensource@till.name>
2022-02-04 18:14:52 +01:00
Wen Liang
2307969aef Remove CentOS8 GitHub actions CI Tests
As CentOS8 is already EOL, remove CentOS8 CI integration tests.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-04 09:23:58 +01:00
Wen Liang
62b0be6091 CHANGELOG: update changelog for 1.6.0 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-02-04 09:07:56 +01:00