summaryrefslogtreecommitdiff
path: root/src/migration-scripts/firewall
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-09-05 14:43:08 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-09-13 11:59:12 +0200
commit30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe (patch)
treeca9b4d04f2245870a44ee73592ee0e1d7b85c40d /src/migration-scripts/firewall
parent24e5529be7b5a28868a666dabae0a1d61e6a5c15 (diff)
downloadvyos-1x-30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe.tar.gz
vyos-1x-30945f39d6d1f0fdba34ce1c2d887a1a6823ecbe.zip
zone-policy: T2199: Migrate zone-policy to firewall node
Diffstat (limited to 'src/migration-scripts/firewall')
-rwxr-xr-xsrc/migration-scripts/firewall/7-to-812
1 files changed, 11 insertions, 1 deletions
diff --git a/src/migration-scripts/firewall/7-to-8 b/src/migration-scripts/firewall/7-to-8
index 6929e20a5..ce527acf5 100755
--- a/src/migration-scripts/firewall/7-to-8
+++ b/src/migration-scripts/firewall/7-to-8
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# T2199: Migrate interface firewall nodes to firewall interfaces <ifname> <direction> name/ipv6-name <name>
+# T2199: Migrate zone-policy to firewall node
import re
@@ -34,9 +35,10 @@ with open(file_name, 'r') as f:
config_file = f.read()
base = ['firewall']
+zone_base = ['zone-policy']
config = ConfigTree(config_file)
-if not config.exists(base):
+if not config.exists(base) and not config.exists(zone_base):
# Nothing to do
exit(0)
@@ -80,6 +82,14 @@ for iftype in config.list_nodes(['interfaces']):
for vifc in config.list_nodes(['interfaces', iftype, ifname, 'vif-s', vifs, 'vif-c']):
migrate_interface(config, iftype, ifname, vifs=vifs, vifc=vifc)
+if config.exists(zone_base + ['zone']):
+ config.set(['firewall', 'zone'])
+ config.set_tag(['firewall', 'zone'])
+
+ for zone in config.list_nodes(zone_base + ['zone']):
+ config.copy(zone_base + ['zone', zone], ['firewall', 'zone', zone])
+ config.delete(zone_base)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())