diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-15 13:57:31 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-20 21:28:53 +0200 |
commit | 1978abbe9d35571bbf57695f04f4a89550a35b1f (patch) | |
tree | f15269f4fb7bd40ae0fa47bbfd566f4ed918799e | |
parent | 4c2db299625fb3275df12d3174b64428112f3756 (diff) | |
download | vyos-1x-1978abbe9d35571bbf57695f04f4a89550a35b1f.tar.gz vyos-1x-1978abbe9d35571bbf57695f04f4a89550a35b1f.zip |
Python/ifconfig: T1557: add ethernet interface get_driver_name()
-rw-r--r-- | python/vyos/ifconfig.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 398f2ee8f..de53f8b25 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1076,6 +1076,14 @@ class EthernetIf(VLANIf): def remove(self): raise OSError('Ethernet interfaces can not be removed') + def get_driver_name(self): + """ + Return the driver name used by NIC. Some NICs don't support all + features e.g. changing link-speed, duplex + """ + link = os.readlink('/sys/class/net/{}/device/driver/module'.format(self._ifname)) + return os.path.basename(link) + def set_flow_control(self, enable): """ Changes the pause parameters of the specified Ethernet device. |