summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-02-11 08:31:53 +0100
committerChristian Breunig <christian@breunig.cc>2023-02-11 08:32:19 +0100
commit4a4b25cba424347e2d114b37b079c31441fc011e (patch)
tree05a5b60167156d21124edd9839ca54880c330534 /src
parent847434e1e34ea66c41a0c77ff22321452fbe5f7b (diff)
downloadvyos-1x-4a4b25cba424347e2d114b37b079c31441fc011e.tar.gz
vyos-1x-4a4b25cba424347e2d114b37b079c31441fc011e.zip
qos: T4284: migration script must ensure bandwidth is converted to lower case
tc acccepts the bandwidth value/unit pairs as lowercase - so does the VyOS CLI validator work, too.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/migration-scripts/qos/1-to-222
1 files changed, 22 insertions, 0 deletions
diff --git a/src/migration-scripts/qos/1-to-2 b/src/migration-scripts/qos/1-to-2
index 41026cbd6..14d3a6e0a 100755
--- a/src/migration-scripts/qos/1-to-2
+++ b/src/migration-scripts/qos/1-to-2
@@ -118,6 +118,28 @@ if config.exists(netem_base):
if config.exists(netem_base + [policy_name, 'burst']):
config.delete(netem_base + [policy_name, 'burst'])
+# Change bandwidth unit MBit -> mbit as tc only supports mbit
+base = ['qos', 'policy']
+if config.exists(base):
+ for policy_type in config.list_nodes(base):
+ for policy in config.list_nodes(base + [policy_type]):
+ policy_base = base + [policy_type, policy]
+ if config.exists(policy_base + ['bandwidth']):
+ tmp = config.return_value(policy_base + ['bandwidth'])
+ config.set(policy_base + ['bandwidth'], value=tmp.lower())
+
+ if config.exists(policy_base + ['class']):
+ for cls in config.list_nodes(policy_base + ['class']):
+ cls_base = policy_base + ['class', cls]
+ if config.exists(cls_base + ['bandwidth']):
+ tmp = config.return_value(cls_base + ['bandwidth'])
+ config.set(cls_base + ['bandwidth'], value=tmp.lower())
+
+ if config.exists(policy_base + ['default', 'bandwidth']):
+ if config.exists(policy_base + ['default', 'bandwidth']):
+ tmp = config.return_value(policy_base + ['default', 'bandwidth'])
+ config.set(policy_base + ['default', 'bandwidth'], value=tmp.lower())
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())