summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-ethernet.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-08 18:18:42 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-08 18:18:42 +0100
commit43a9441cb80a14fff791bbd89e88a3c2ac99e3ab (patch)
tree2bf9c09fab5c95efa73fc2f7601890466fa9b99f /src/conf_mode/interfaces-ethernet.py
parent13a58d38b3dc8065a8ba71904e143e3d69aab638 (diff)
parent23f55c4bcbe5475ed98d57cf54b645ef0c2cc1a8 (diff)
downloadvyos-1x-43a9441cb80a14fff791bbd89e88a3c2ac99e3ab.tar.gz
vyos-1x-43a9441cb80a14fff791bbd89e88a3c2ac99e3ab.zip
Merge branch 'current' of github.com:vyos/vyos-1x into equuleus
* 'current' of github.com:vyos/vyos-1x: (30 commits) smoketest: dummy: fix indent smoketest: bridge: bond: enable ip subsystem tests smoketest: interfaces: dhcpv6pd final fix smoketest: ethernet: fix link-speed loop test Debian: add build-dependency on python3-jinja2 smoketest: ethernet: verify() speed/duplex must both be auto or discrete smoketest: interfaces: report skipped tests smoketest: ethernet: bugfixes for dhcpc6 and unknown interfaces Debian: add python3-psutil build dependency smoketest: ethernet: check for error on non existing interface vyos.configverify: provide generic helper to check for interface existence smoketest: interfaces: fix dhcpv6 pd testcase when using multiple interfaces login: radius: T3192: migrate to get_config_dict() ssh: T2635: harden Jinja2 template and daemon startup ssh: T2635: change sshd_config path to /run/sshd login: radius: T3192: support IPv6 server(s) and source-address xml: include: provide generic include for disable node xml: radius: T3192: split individual nodes to discrete includes bgp: T2174: verify() existence of route-map and prefix-list smoketest: interfaces: test dhcpv6 pd sla-id auto increment ...
Diffstat (limited to 'src/conf_mode/interfaces-ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index bc102826f..e7f0cd6a5 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -23,13 +23,13 @@ from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configverify import verify_address
from vyos.configverify import verify_dhcpv6
+from vyos.configverify import verify_eapol
from vyos.configverify import verify_interface_exists
+from vyos.configverify import verify_mirror
from vyos.configverify import verify_mtu
from vyos.configverify import verify_mtu_ipv6
from vyos.configverify import verify_vlan_config
from vyos.configverify import verify_vrf
-from vyos.configverify import verify_eapol
-from vyos.configverify import verify_mirror
from vyos.ifconfig import EthernetIf
from vyos.template import render
from vyos.util import call
@@ -59,15 +59,13 @@ def verify(ethernet):
if 'deleted' in ethernet:
return None
- verify_interface_exists(ethernet)
-
- if ethernet.get('speed', None) == 'auto':
- if ethernet.get('duplex', None) != 'auto':
- raise ConfigError('If speed is hardcoded, duplex must be hardcoded, too')
+ ifname = ethernet['ifname']
+ verify_interface_exists(ifname)
- if ethernet.get('duplex', None) == 'auto':
- if ethernet.get('speed', None) != 'auto':
- raise ConfigError('If duplex is hardcoded, speed must be hardcoded, too')
+ # No need to check speed and duplex keys as both have default values.
+ if ((ethernet['speed'] == 'auto' and ethernet['duplex'] != 'auto') or
+ (ethernet['speed'] != 'auto' and ethernet['duplex'] == 'auto')):
+ raise ConfigError('Speed/Duplex missmatch. Must be both auto or manually configured')
verify_mtu(ethernet)
verify_mtu_ipv6(ethernet)
@@ -77,7 +75,6 @@ def verify(ethernet):
verify_eapol(ethernet)
verify_mirror(ethernet)
- ifname = ethernet['ifname']
# verify offloading capabilities
if 'offload' in ethernet and 'rps' in ethernet['offload']:
if not os.path.exists(f'/sys/class/net/{ifname}/queues/rx-0/rps_cpus'):