summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-06-17 19:36:31 +0200
committerGitHub <noreply@github.com>2023-06-17 19:36:31 +0200
commit335fff215dd9df2c1a0ba38c7de514b660067f7e (patch)
tree3f91bc120a1dc8aab1f29f4b2f13fc924d3cc90a /python/vyos
parentfb452c77c689f0f24bf9a98eaf2649beffe1df07 (diff)
parent04bdcbc8c271ef0286518bc8183a0f911beb16d5 (diff)
downloadvyos-1x-335fff215dd9df2c1a0ba38c7de514b660067f7e.tar.gz
vyos-1x-335fff215dd9df2c1a0ba38c7de514b660067f7e.zip
Merge pull request #2046 from sever-sever/T5296
T5296: Fix QoS class bandwidth calculation for auto and percent
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/qos/trafficshaper.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/qos/trafficshaper.py b/python/vyos/qos/trafficshaper.py
index f42f4d022..573283833 100644
--- a/python/vyos/qos/trafficshaper.py
+++ b/python/vyos/qos/trafficshaper.py
@@ -70,7 +70,17 @@ class TrafficShaper(QoSBase):
cls = int(cls)
# bandwidth is a mandatory CLI node
- rate = self._rate_convert(cls_config['bandwidth'])
+ # T5296 if bandwidth 'auto' or 'xx%' get value from config shaper total "bandwidth"
+ # i.e from set shaper test bandwidth '300mbit'
+ # without it, it tries to get value from qos.base /sys/class/net/{self._interface}/speed
+ if cls_config['bandwidth'] == 'auto':
+ rate = self._rate_convert(config['bandwidth'])
+ elif cls_config['bandwidth'].endswith('%'):
+ percent = cls_config['bandwidth'].rstrip('%')
+ rate = self._rate_convert(config['bandwidth']) * int(percent) // 100
+ else:
+ rate = self._rate_convert(cls_config['bandwidth'])
+
burst = cls_config['burst']
quantum = cls_config['codel_quantum']