mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
23 lines
672 B
Python
23 lines
672 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
|
|
|
|
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().replace("-", "_")
|
|
|
|
feature = getattr(Util.NM(), name, None)
|
|
return feature
|