diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-07 23:41:33 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-07 23:41:33 +0100 |
commit | 7a95aa238ba4d6743be645ffa3baef0e69251926 (patch) | |
tree | d40d9098f6b5bd27c82297077c0cf4bca0b690c8 /src/conf_mode/interfaces-ethernet.py | |
parent | 551ae04df7f6ce8a6cdbdf9712b4eea5d9e0c2f3 (diff) | |
download | vyos-1x-7a95aa238ba4d6743be645ffa3baef0e69251926.tar.gz vyos-1x-7a95aa238ba4d6743be645ffa3baef0e69251926.zip |
smoketest: ethernet: verify() speed/duplex must both be auto or discrete
Diffstat (limited to 'src/conf_mode/interfaces-ethernet.py')
-rwxr-xr-x | src/conf_mode/interfaces-ethernet.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index 0a904c592..e7f0cd6a5 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -62,13 +62,10 @@ def verify(ethernet): ifname = ethernet['ifname'] verify_interface_exists(ifname) - if ethernet.get('speed', None) == 'auto': - if ethernet.get('duplex', None) != 'auto': - raise ConfigError('If speed is hardcoded, duplex must be hardcoded, too') - - 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) |