summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/ethernet.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig/ethernet.py')
-rw-r--r--python/vyos/ifconfig/ethernet.py32
1 files changed, 23 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 30e3a3bef..b3e652409 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -16,17 +16,35 @@
import os
import re
-from vyos.ifconfig.vlan import VLANIf
+from vyos.ifconfig.interface import Interface
+from vyos.ifconfig.vlan import VLAN
from vyos.validate import *
-class EthernetIf(VLANIf):
+@Interface.register
+@VLAN.enable
+class EthernetIf(Interface):
"""
Abstraction of a Linux Ethernet Interface
"""
- _command_set = {**VLANIf._command_set, **{
+ default = {
+ 'type': 'ethernet',
+ }
+ definition = {
+ **Interface.definition,
+ **{
+ 'section': 'ethernet',
+ 'prefixes': ['lan', 'eth', 'eno', 'ens', 'enp', 'enx'],
+ 'bondable': True,
+ 'broadcast': True,
+ 'bridgeable': True,
+ }
+ }
+
+
+ _command_set = {**Interface._command_set, **{
'gro': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'shellcmd': '/sbin/ethtool -K {ifname} gro {value}',
@@ -49,10 +67,6 @@ class EthernetIf(VLANIf):
},
}}
- default = {
- 'type': 'ethernet',
- }
-
def _delete(self):
# Ethernet interfaces can not be removed
pass
@@ -90,7 +104,7 @@ class EthernetIf(VLANIf):
if enable not in ['on', 'off']:
raise ValueError("Value out of range")
- if self.get_driver_name() in ['vmxnet3', 'virtio_net']:
+ if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
self._debug_msg('{} driver does not support changing flow control settings!'
.format(self.get_driver_name()))
return
@@ -142,7 +156,7 @@ class EthernetIf(VLANIf):
if duplex not in ['auto', 'full', 'half']:
raise ValueError("Value out of range (duplex)")
- if self.get_driver_name() in ['vmxnet3', 'virtio_net']:
+ if self.get_driver_name() in ['vmxnet3', 'virtio_net', 'xen_netfront']:
self._debug_msg('{} driver does not support changing speed/duplex settings!'
.format(self.get_driver_name()))
return