mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
The task 56586 is for adding tests against the collection converted format to the tox/travis CI to capture a problem before merging the pr, if any. It'd be helpful to find out bugs in the conversion tool lsr_role2collection.py, as well. The source of this commit is located in linux-system-roles/template. They are synced by auto-maintenance/ sync-template.sh, then manually adjusted to the network role. .travis/runcollection.sh is the test script. tox.ini is modified to run it in the tox/travis CI. The script downloads lsr_role2collection.py, then converts the network role into the conversion format in the working directory .tox. In the collection, it runs a set of tests black, flake8, yamllint, py38 to check the converted result.
23 lines
647 B
Python
23 lines
647 B
Python
# SPDX-License-Identifier: BSD-3-Clause
|
|
""" Support for NetworkManager aka the NM provider """
|
|
|
|
# pylint: disable=import-error, no-name-in-module
|
|
from ansible.module_utils.network_lsr.utils import Util # noqa:E501
|
|
|
|
ETHTOOL_FEATURE_PREFIX = "ETHTOOL_OPTNAME_FEATURE_"
|
|
|
|
|
|
def get_nm_ethtool_feature(name):
|
|
"""
|
|
Translate ethtool feature into Network Manager name
|
|
|
|
:param name: Name of the feature
|
|
:type name: str
|
|
:returns: Name of the feature to be used by `NM.SettingEthtool.set_feature()`
|
|
:rtype: str
|
|
"""
|
|
|
|
name = ETHTOOL_FEATURE_PREFIX + name.upper()
|
|
|
|
feature = getattr(Util.NM(), name, None)
|
|
return feature
|