summaryrefslogtreecommitdiff
path: root/src/migration-scripts/vrf
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-07-12 18:38:14 +0200
committerChristian Poessinger <christian@poessinger.com>2021-07-12 18:38:41 +0200
commit73e58b7d000c92608b263f2f52b60d21d741db04 (patch)
treee14805092de42a01f5bcbbfd60b7f1231234a1ba /src/migration-scripts/vrf
parent2f3043ffce8a2556d12b3193df7fd3cdc9fdad09 (diff)
downloadvyos-1x-73e58b7d000c92608b263f2f52b60d21d741db04.tar.gz
vyos-1x-73e58b7d000c92608b263f2f52b60d21d741db04.zip
vrf: route: static: T2450: we also need to migrate the interface based routes
Previously during migration if one had used interface routes, the VRF based ones got not migrated. The following "old" VyOS 1.3 configuration did not get migrated: set protocols static interface-route 10.20.0.0/24 next-hop-interface eth2 next-hop-vrf 'blue' set protocols static interface-route 10.30.0.0/24 next-hop-interface br10 next-hop-vrf 'red' set protocols vrf blue static interface-route 10.0.0.0/24 next-hop-interface eth1 next-hop-vrf 'default' set protocols vrf red static interface-route 10.0.0.0/24 next-hop-interface eth1 next-hop-vrf 'default' set vrf name blue table '3000' set vrf name mgmt table '1000' set vrf name red table '2000' It must get migrated to: set protocols static route 10.20.0.0/24 interface eth2 vrf 'blue' set protocols static route 10.30.0.0/24 interface br10 vrf 'red' set vrf name blue protocols static route 10.0.0.0/24 interface eth1 vrf 'default' set vrf name blue table '3000' set vrf name mgmt table '1000' set vrf name red protocols static route 10.0.0.0/24 interface eth1 vrf 'default' set vrf name red table '2000'
Diffstat (limited to 'src/migration-scripts/vrf')
-rwxr-xr-xsrc/migration-scripts/vrf/0-to-110
-rwxr-xr-xsrc/migration-scripts/vrf/1-to-21
2 files changed, 11 insertions, 0 deletions
diff --git a/src/migration-scripts/vrf/0-to-1 b/src/migration-scripts/vrf/0-to-1
index 29b2fab74..2b41ef3c7 100755
--- a/src/migration-scripts/vrf/0-to-1
+++ b/src/migration-scripts/vrf/0-to-1
@@ -91,6 +91,16 @@ for vrf in config.list_nodes(base):
if config.exists(vrf_path):
config.rename(vrf_path, 'vrf')
+ next_hop = route_path + [route, 'interface']
+ if config.exists(next_hop):
+ for interface in config.list_nodes(next_hop):
+ interface_path = next_hop + [interface, 'next-hop-interface']
+ if config.exists(interface_path):
+ config.rename(interface_path, 'interface')
+ vrf_path = next_hop + [interface, 'next-hop-vrf']
+ if config.exists(vrf_path):
+ config.rename(vrf_path, 'vrf')
+
#
# Cleanup nodes inside route6
#
diff --git a/src/migration-scripts/vrf/1-to-2 b/src/migration-scripts/vrf/1-to-2
index 20128e957..9bc704e02 100755
--- a/src/migration-scripts/vrf/1-to-2
+++ b/src/migration-scripts/vrf/1-to-2
@@ -49,6 +49,7 @@ for vrf in config.list_nodes(base):
new_static_base = vrf_base + [vrf, 'protocols']
config.set(new_static_base)
config.copy(static_base, new_static_base + ['static'])
+ config.set_tag(new_static_base + ['static', 'route'])
# Now delete the old configuration
config.delete(base)