summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interface-dummy.py19
-rwxr-xr-xsrc/migration-scripts/interfaces/0-to-126
2 files changed, 24 insertions, 21 deletions
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interface-dummy.py
index 8c939ce95..c7c5ac99c 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interface-dummy.py
@@ -20,8 +20,6 @@ import os
import sys
import copy
-import vyos.configinterface as VyIfconfig
-
from vyos.interfaceconfig import Interface
from vyos.config import Config
from vyos import ConfigError
@@ -86,20 +84,23 @@ def generate(dummy):
def apply(dummy):
# Remove dummy interface
if dummy['deleted']:
- VyIfconfig.remove_interface(dummy['intf'])
+ Interface(dummy['intf']).remove_interface()
else:
# Interface will only be added if it yet does not exist
- VyIfconfig.add_interface('dummy', dummy['intf'])
+ Interface(dummy['intf'], 'dummy')
# update interface description used e.g. within SNMP
- VyIfconfig.set_description(dummy['intf'], dummy['description'])
+ if dummy['description']:
+ Interface(dummy['intf']).ifalias = dummy['description']
# Configure interface address(es)
- for addr in dummy['address_remove']:
- VyIfconfig.remove_interface_address(dummy['intf'], addr)
+ if len(dummy['address_remove']) > 0:
+ Interface(dummy['intf']).del_addr(dummy['address_remove'])
- for addr in dummy['address']:
- VyIfconfig.add_interface_address(dummy['intf'], addr)
+ if len(dummy['address']) > 0:
+ # delete already existing addreses from list
+ addresess = diff(dummy['address'], Interface(dummy['intf']).get_addr(1))
+ Interface(dummy['intf']).add_addr(addresess)
if dummy['disable']:
Interface(dummy['intf']).linkstate = 'down'
diff --git a/src/migration-scripts/interfaces/0-to-1 b/src/migration-scripts/interfaces/0-to-1
index 38f2bd8f5..96e18b5d5 100755
--- a/src/migration-scripts/interfaces/0-to-1
+++ b/src/migration-scripts/interfaces/0-to-1
@@ -30,20 +30,22 @@ else:
#
for br in config.list_nodes(base):
# STP: check if enabled
- stp_val = config.return_value(base + [br, 'stp'])
- # STP: delete node with old syntax
- config.delete(base + [br, 'stp'])
- # STP: set new node - if enabled
- if stp_val == "true":
- config.set(base + [br, 'stp'], value=None)
+ if config.exists(base + [br, 'stp']):
+ stp_val = config.return_value(base + [br, 'stp'])
+ # STP: delete node with old syntax
+ config.delete(base + [br, 'stp'])
+ # STP: set new node - if enabled
+ if stp_val == "true":
+ config.set(base + [br, 'stp'], value=None)
# igmp-snooping: check if enabled
- igmp_val = config.return_value(base + [br, 'igmp-snooping', 'querier'])
- # igmp-snooping: delete node with old syntax
- config.delete(base + [br, 'igmp-snooping', 'querier'])
- # igmp-snooping: set new node - if enabled
- if igmp_val == "enable":
- config.set(base + [br, 'igmp', 'querier'], value=None)
+ if config.exists(base + [br, 'igmp-snooping', 'querier']):
+ igmp_val = config.return_value(base + [br, 'igmp-snooping', 'querier'])
+ # igmp-snooping: delete node with old syntax
+ config.delete(base + [br, 'igmp-snooping', 'querier'])
+ # igmp-snooping: set new node - if enabled
+ if igmp_val == "enable":
+ config.set(base + [br, 'igmp', 'querier'], value=None)
#
# move interface based bridge-group to actual bridge (de-nest)