summaryrefslogtreecommitdiff
path: root/python/vyos/ethtool.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-10 16:46:55 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-10 16:46:55 +0200
commit07840977834816b69fa3b366817d90f44b5dc7a7 (patch)
tree7a1f755135e6a15993dcf4c4216fd181a74ef286 /python/vyos/ethtool.py
parent1572edd2cef355710d1129907d3e49451a6c31d4 (diff)
downloadvyos-1x-07840977834816b69fa3b366817d90f44b5dc7a7.tar.gz
vyos-1x-07840977834816b69fa3b366817d90f44b5dc7a7.zip
ethernet: T3802: use only one implementation for get_driver_name()
Move the two implementations to get the driver name of a NIC from ethernet.py and ethtool.py to only ethtool.py.
Diffstat (limited to 'python/vyos/ethtool.py')
-rw-r--r--python/vyos/ethtool.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 7e46969cf..4efc3a234 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -134,6 +134,12 @@ class Ethtool:
# ['Autonegotiate:', 'on']
self._flow_control_enabled = out.splitlines()[1].split()[-1]
+ def get_auto_negotiation(self):
+ return self._auto_negotiation
+
+ def get_driver_name(self):
+ return self._driver_name
+
def _get_generic(self, feature):
"""
Generic method to read self._features and return a tuple for feature
@@ -189,7 +195,7 @@ class Ethtool:
if duplex not in ['full', 'half']:
raise ValueError(f'Value "{duplex}" for duplex is invalid!')
- if self._driver_name in ['vmxnet3', 'virtio_net', 'xen_netfront']:
+ if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
return False
if speed in self._speed_duplex:
@@ -199,7 +205,7 @@ class Ethtool:
def check_flow_control(self):
""" Check if the NIC supports flow-control """
- if self._driver_name in ['vmxnet3', 'virtio_net', 'xen_netfront']:
+ if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
return False
return self._flow_control
@@ -208,6 +214,3 @@ class Ethtool:
raise ValueError('Interface does not support changing '\
'flow-control settings!')
return self._flow_control_enabled
-
- def get_auto_negotiation(self):
- return self._auto_negotiation