summaryrefslogtreecommitdiff
path: root/src/migration-scripts/interfaces
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-28 10:14:20 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-28 18:10:08 +0100
commit5574bd672825a87b1983cc135ae2e0bdabbe751b (patch)
tree51172c12b38525028db29a4321b759cb9c6c8773 /src/migration-scripts/interfaces
parentf585fd497ad0daa4cbecd777bb5e8fa6d18f879f (diff)
downloadvyos-1x-5574bd672825a87b1983cc135ae2e0bdabbe751b.tar.gz
vyos-1x-5574bd672825a87b1983cc135ae2e0bdabbe751b.zip
l2tpv3: T3366: migrate local-ip and remote-ip CLI options
Rename CLI options local-ip to source-address and remote-ip to remote to get a consistent CLI experience for the user.
Diffstat (limited to 'src/migration-scripts/interfaces')
-rwxr-xr-xsrc/migration-scripts/interfaces/19-to-2048
1 files changed, 24 insertions, 24 deletions
diff --git a/src/migration-scripts/interfaces/19-to-20 b/src/migration-scripts/interfaces/19-to-20
index ed2780b92..e96663e54 100755
--- a/src/migration-scripts/interfaces/19-to-20
+++ b/src/migration-scripts/interfaces/19-to-20
@@ -28,30 +28,30 @@ if __name__ == '__main__':
config_file = f.read()
config = ConfigTree(config_file)
- base = ['interfaces', 'tunnel']
-
- if not config.exists(base):
- # Nothing to do
- exit(0)
-
- #
- # Migrate "interface tunnel <tunX> encapsulation gre-bridge" to gretap
- # Migrate "interface tunnel <tunX> local-ip" to source-address
- # Migrate "interface tunnel <tunX> remote-ip" to remote
- for interface in config.list_nodes(base):
- encap_path = base + [interface, 'encapsulation']
- if config.exists(encap_path):
- tmp = config.return_value(encap_path)
- if tmp == 'gre-bridge':
- config.set(encap_path, value='gretap')
-
- local_ip_path = base + [interface, 'local-ip']
- if config.exists(local_ip_path):
- config.rename(local_ip_path, 'source-address')
-
- remote_ip_path = base + [interface, 'remote-ip']
- if config.exists(remote_ip_path):
- config.rename(remote_ip_path, 'remote')
+
+ for type in ['tunnel', 'l2tpv3']:
+ base = ['interfaces', type]
+ if not config.exists(base):
+ # Nothing to do
+ continue
+
+ for interface in config.list_nodes(base):
+ # Migrate "interface tunnel <tunX> encapsulation gre-bridge" to gretap
+ encap_path = base + [interface, 'encapsulation']
+ if type == 'tunnel' and config.exists(encap_path):
+ tmp = config.return_value(encap_path)
+ if tmp == 'gre-bridge':
+ config.set(encap_path, value='gretap')
+
+ # Migrate "interface tunnel|l2tpv3 <interface> local-ip" to source-address
+ # Migrate "interface tunnel|l2tpv3 <interface> remote-ip" to remote
+ local_ip_path = base + [interface, 'local-ip']
+ if config.exists(local_ip_path):
+ config.rename(local_ip_path, 'source-address')
+
+ remote_ip_path = base + [interface, 'remote-ip']
+ if config.exists(remote_ip_path):
+ config.rename(remote_ip_path, 'remote')
try:
with open(file_name, 'w') as f: