summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-ethernet.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-15 18:41:07 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-15 18:41:07 +0100
commit3b8e691566bd12e931f57ac8e6a0a22dadc39da3 (patch)
tree393af3f6f8584e3ca9548667850d5aa3d1f65255 /src/conf_mode/interfaces-ethernet.py
parentc776d43101dea36ec72e3b20dff314c9ad1e7079 (diff)
downloadvyos-1x-3b8e691566bd12e931f57ac8e6a0a22dadc39da3.tar.gz
vyos-1x-3b8e691566bd12e931f57ac8e6a0a22dadc39da3.zip
ethernet: T2119: check if physical interface exists
Diffstat (limited to 'src/conf_mode/interfaces-ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 6d779c94c..ba3a5e8c8 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -238,6 +238,9 @@ def verify(eth):
if eth['deleted']:
return None
+ if eth['intf'] not in interfaces():
+ raise ConfigError(f"Interface ethernet {eth['intf']} does not exist")
+
if eth['speed'] == 'auto':
if eth['duplex'] != 'auto':
raise ConfigError('If speed is hardcoded, duplex must be hardcoded, too')
@@ -260,7 +263,7 @@ def verify(eth):
bond_member = conf.return_values('interfaces bonding ' + bond + ' member interface')
if eth['intf'] in bond_member:
if eth['address']:
- raise ConfigError('Can not assign address to interface {} which is a member of {}'.format(eth['intf'], bond))
+ raise ConfigError(f"Can not assign address to interface {eth['intf']} which is a member of {bond}")
# use common function to verify VLAN configuration
verify_vlan_config(eth)