summaryrefslogtreecommitdiff
path: root/src/migration-scripts/qos
diff options
context:
space:
mode:
Diffstat (limited to 'src/migration-scripts/qos')
-rwxr-xr-xsrc/migration-scripts/qos/1-to-242
1 files changed, 6 insertions, 36 deletions
diff --git a/src/migration-scripts/qos/1-to-2 b/src/migration-scripts/qos/1-to-2
index 6f4c08a50..41026cbd6 100755
--- a/src/migration-scripts/qos/1-to-2
+++ b/src/migration-scripts/qos/1-to-2
@@ -98,49 +98,19 @@ config.set(['qos'])
config.copy(base, ['qos', 'policy'])
config.delete(base)
-# TODO
-# - remove burst from network emulator
-
-def change_cli_bandwidth(config, path):
- if config.exists(path + ['bandwidth']):
- bw = config.return_value(path + ['bandwidth'])
- if bw.endswith('%'):
- bw = bandwidth_percent_to_val(interface, bw.rstrip('%'))
- config.set(path + ['bandwidth'], value=bw)
- return
-
# Now map the interface policy binding to the new CLI syntax
+if len(iface_config):
+ config.set(['qos', 'interface'])
+ config.set_tag(['qos', 'interface'])
+
for interface, interface_config in iface_config.items():
+ config.set(['qos', 'interface', interface])
+ config.set_tag(['qos', 'interface', interface])
if 'ingress' in interface_config:
config.set(['qos', 'interface', interface, 'ingress'], value=interface_config['ingress'])
if 'egress' in interface_config:
config.set(['qos', 'interface', interface, 'egress'], value=interface_config['egress'])
- # QoS policy <-> interface binding is now established - we now can adjust some
- # CLI values like bandwidth in percent
- for direction in ['ingress', 'egress']:
- if direction not in interface_config:
- continue
- # Convert % bandwidth values to absolute values
- for policy in config.list_nodes(['qos', 'policy']):
- for policy_name in config.list_nodes(['qos', 'policy', policy]):
- if policy_name == interface_config[direction]:
- policy_base = ['qos', 'policy', policy, policy_name]
- # This is for the toplevel bandwidth node on a policy
- change_cli_bandwidth(config, policy_base)
-
- # This is for class based bandwidth value
- if config.exists(policy_base + ['class']):
- for cls in config.list_nodes(policy_base + ['class']):
- cls_base = policy_base + ['class', cls]
- change_cli_bandwidth(config, cls_base)
-
- # This is for the bandwidth value specified under the
- # policy "default" tree
- if config.exists(policy_base + ['default']):
- default_base = policy_base + ['default']
- change_cli_bandwidth(config, default_base)
-
# Remove "burst" CLI node from network emulator
netem_base = ['qos', 'policy', 'network-emulator']
if config.exists(netem_base):