Implement chainlib cli for traffic script

This commit is contained in:
Louis Holbrook
2021-08-25 09:33:23 +00:00
parent f0b4c42c68
commit 3bf92e7a8a
9 changed files with 57 additions and 45 deletions

View File

@@ -140,8 +140,11 @@ class TrafficRouter:
for k in keys:
if len(k) > 8 and k[:8] == 'TRAFFIC_':
v = int(dct.get(k))
self.add(k[8:].lower(), v)
logg.debug('found traffic item {} weight {}'.format(k, v))
if v == 0:
logg.debug('skipping traffic item {} with weight {}'.format(k, v))
else:
logg.debug('found traffic item {} weight {}'.format(k, v))
self.add(k[8:].lower(), v)
# TODO: This will not work well with big networks. The provisioner should use lazy loading and LRU instead.