summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-geneve.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-05-07 00:50:44 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-05-07 00:50:44 +0100
commit367094ff1764116089c9359e1e949db781a4a0da (patch)
treecf3135162c8a57af652f027805d1d4a9d63cbca0 /src/conf_mode/interfaces-geneve.py
parente9516e73796bbbda1be76e3f8b5d83cd84070830 (diff)
parented22334321d3b6f27b5d695a4f984257b909f78b (diff)
downloadvyos-1x-367094ff1764116089c9359e1e949db781a4a0da.tar.gz
vyos-1x-367094ff1764116089c9359e1e949db781a4a0da.zip
debug: T1230: add time information to saved debug logs
Diffstat (limited to 'src/conf_mode/interfaces-geneve.py')
-rwxr-xr-xsrc/conf_mode/interfaces-geneve.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/conf_mode/interfaces-geneve.py b/src/conf_mode/interfaces-geneve.py
index 708a64474..e4109a221 100755
--- a/src/conf_mode/interfaces-geneve.py
+++ b/src/conf_mode/interfaces-geneve.py
@@ -22,7 +22,7 @@ from netifaces import interfaces
from vyos.config import Config
from vyos.ifconfig import GeneveIf
-from vyos.validate import is_bridge_member
+from vyos.validate import is_member
from vyos import ConfigError
default_config_data = {
@@ -49,11 +49,12 @@ def get_config():
geneve['intf'] = os.environ['VYOS_TAGNODE_VALUE']
+ # check if interface is member if a bridge
+ geneve['is_bridge_member'] = is_member(conf, geneve['intf'], 'bridge')
+
# Check if interface has been removed
if not conf.exists('interfaces geneve ' + geneve['intf']):
geneve['deleted'] = True
- # check if interface is member if a bridge
- geneve['is_bridge_member'] = is_bridge_member(conf, geneve['intf'])
return geneve
# set new configuration level
@@ -97,12 +98,17 @@ def get_config():
def verify(geneve):
if geneve['deleted']:
if geneve['is_bridge_member']:
- interface = geneve['intf']
- bridge = geneve['is_bridge_member']
- raise ConfigError(f'Interface "{interface}" can not be deleted as it belongs to bridge "{bridge}"!')
+ raise ConfigError((
+ f'Cannot delete interface "{geneve["intf"]}" as it is a '
+ f'member of bridge "{geneve["is_bridge_member"]}"!'))
return None
+ if geneve['is_bridge_member'] and geneve['address']:
+ raise ConfigError((
+ f'Cannot assign address to interface "{geneve["intf"]}" '
+ f'as it is a member of bridge "{geneve["is_bridge_member"]}"!'))
+
if not geneve['remote']:
raise ConfigError('GENEVE remote must be configured')
@@ -158,6 +164,10 @@ def apply(geneve):
if not geneve['disable']:
g.set_admin_state('up')
+ # re-add ourselves to any bridge we might have fallen out of
+ if geneve['is_bridge_member']:
+ g.add_to_bridge(geneve['is_bridge_member'])
+
return None