summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-30 17:20:26 +0200
committerChristian Poessinger <christian@poessinger.com>2020-07-01 19:06:56 +0200
commit9afc69f83f5e6f44751c3d6c546ea7614baff41c (patch)
treeb1120fdfb2257037f3ba323a3550d7ee9dd787bf
parent65fa21f5e79114fa861d99eae154baad35ce2f11 (diff)
downloadvyos-1x-9afc69f83f5e6f44751c3d6c546ea7614baff41c.tar.gz
vyos-1x-9afc69f83f5e6f44751c3d6c546ea7614baff41c.zip
ifconfig: T2653: use better names for vyos.configverify functions
-rw-r--r--python/vyos/configverify.py9
-rwxr-xr-xsrc/conf_mode/interfaces-dummy.py8
-rwxr-xr-xsrc/conf_mode/interfaces-macsec.py8
-rwxr-xr-xsrc/conf_mode/interfaces-pppoe.py4
-rwxr-xr-xsrc/conf_mode/interfaces-wirelessmodem.py4
5 files changed, 17 insertions, 16 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 528428e03..32129a048 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -23,22 +23,23 @@
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():
if config['vrf'] not in interfaces():
raise ConfigError('VRF "{vrf}" does not exist'.format(**config))
+
if 'is_bridge_member' in config.keys():
raise ConfigError(
'Interface "{ifname}" cannot be both a member of VRF "{vrf}" '
'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
diff --git a/src/conf_mode/interfaces-dummy.py b/src/conf_mode/interfaces-dummy.py
index a8093ffa5..1877bc3f7 100755
--- a/src/conf_mode/interfaces-dummy.py
+++ b/src/conf_mode/interfaces-dummy.py
@@ -19,8 +19,8 @@ import os
from sys import exit
from vyos.config import Config
-from vyos.configverify import verify_bridge_vrf
-from vyos.configverify import verify_bridge_address
+from vyos.configverify import verify_vrf
+from vyos.configverify import verify_address
from vyos.configverify import verify_bridge_delete
from vyos.ifconfig import DummyIf
from vyos.validate import is_member
@@ -61,8 +61,8 @@ def verify(dummy):
verify_bridge_delete(dummy)
return None
- verify_bridge_vrf(dummy)
- verify_bridge_address(dummy)
+ verify_vrf(dummy)
+ verify_address(dummy)
return None
diff --git a/src/conf_mode/interfaces-macsec.py b/src/conf_mode/interfaces-macsec.py
index 6f4e90169..2f14b6a92 100755
--- a/src/conf_mode/interfaces-macsec.py
+++ b/src/conf_mode/interfaces-macsec.py
@@ -25,8 +25,8 @@ from vyos.ifconfig import MACsecIf
from vyos.template import render
from vyos.util import call
from vyos.validate import is_member
-from vyos.configverify import verify_bridge_vrf
-from vyos.configverify import verify_bridge_address
+from vyos.configverify import verify_vrf
+from vyos.configverify import verify_address
from vyos.configverify import verify_bridge_delete
from vyos.configverify import verify_source_interface
from vyos.xml import defaults
@@ -86,8 +86,8 @@ def verify(macsec):
return None
verify_source_interface(macsec)
- verify_bridge_vrf(macsec)
- verify_bridge_address(macsec)
+ verify_vrf(macsec)
+ verify_address(macsec)
if not (('security' in macsec.keys()) and
('cipher' in macsec['security'].keys())):
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py
index 503a263f8..1194ceb89 100755
--- a/src/conf_mode/interfaces-pppoe.py
+++ b/src/conf_mode/interfaces-pppoe.py
@@ -24,7 +24,7 @@ from netifaces import interfaces
from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.configverify import verify_source_interface
-from vyos.configverify import verify_bridge_vrf
+from vyos.configverify import verify_vrf
from vyos.template import render
from vyos.util import call
from vyos.xml import defaults
@@ -71,7 +71,7 @@ def verify(pppoe):
return None
verify_source_interface(pppoe)
- verify_bridge_vrf(pppoe)
+ verify_vrf(pppoe)
if {'connect_on_demand', 'vrf'} <= set(pppoe):
raise ConfigError('On-demand dialing and VRF can not be used at the same time')
diff --git a/src/conf_mode/interfaces-wirelessmodem.py b/src/conf_mode/interfaces-wirelessmodem.py
index 57f39760b..49a036104 100755
--- a/src/conf_mode/interfaces-wirelessmodem.py
+++ b/src/conf_mode/interfaces-wirelessmodem.py
@@ -21,7 +21,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import dict_merge
-from vyos.configverify import verify_bridge_vrf
+from vyos.configverify import verify_vrf
from vyos.template import render
from vyos.util import call
from vyos.xml import defaults
@@ -92,7 +92,7 @@ def verify(wwan):
if not os.path.exists(find_device_file(wwan['device'])):
raise ConfigError('Device "{device}" does not exist'.format(**wwan))
- verify_bridge_vrf(wwan)
+ verify_vrf(wwan)
return None