diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/configverify.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index e2fffeca7..32129a048 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -23,10 +23,10 @@ from vyos import ConfigError -def verify_bridge_vrf(config): +def verify_vrf(config): """ - Common helper function used by interface implementations to - perform recurring validation of VRF configuration + Common helper function used by interface implementations to perform + recurring validation of VRF configuration. """ from netifaces import interfaces if 'vrf' in config.keys(): @@ -39,7 +39,7 @@ def verify_bridge_vrf(config): 'and bridge "{is_bridge_member}"!'.format(**config)) -def verify_bridge_address(config): +def verify_address(config): """ Common helper function used by interface implementations to perform recurring validation of IP address assignmenr @@ -69,6 +69,10 @@ def verify_source_interface(config): perform recurring validation of the existence of a source-interface required by e.g. peth/MACvlan, MACsec ... """ + from netifaces import interfaces if not 'source_interface' in config.keys(): raise ConfigError('Physical source-interface required for ' 'interface "{ifname}"'.format(**config)) + if not config['source_interface'] in interfaces(): + raise ConfigError(f'Source interface {source_interface} does not ' + f'exist'.format(**config)) |