diff options
author | Christian Breunig <christian@breunig.cc> | 2023-06-17 19:36:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-17 19:36:31 +0200 |
commit | 335fff215dd9df2c1a0ba38c7de514b660067f7e (patch) | |
tree | 3f91bc120a1dc8aab1f29f4b2f13fc924d3cc90a /python/vyos/qos | |
parent | fb452c77c689f0f24bf9a98eaf2649beffe1df07 (diff) | |
parent | 04bdcbc8c271ef0286518bc8183a0f911beb16d5 (diff) | |
download | vyos-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/qos')
-rw-r--r-- | python/vyos/qos/trafficshaper.py | 12 |
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'] |