Correct issue with invalid ACL ordering

This commit is contained in:
Joshua Boniface 2021-06-13 20:55:15 -04:00
parent 3013973975
commit 9511dc9864
1 changed files with 7 additions and 0 deletions

View File

@ -111,13 +111,20 @@ def getNetworkACLs(zkhandler, vni, _direction):
full_acl_list = []
for direction in directions:
unordered_acl_list = zkhandler.children((f'network.rules.{direction}', vni))
if len(unordered_acl_list) < 1:
continue
ordered_acls = dict()
for acl in unordered_acl_list:
order = zkhandler.read((f'network.rule.{direction}', vni, 'rule.order', acl))
if order is None:
continue
ordered_acls[order] = acl
for order in sorted(ordered_acls.keys()):
rule = zkhandler.read((f'network.rule.{direction}', vni, 'rule.rule', acl))
if rule is None:
continue
full_acl_list.append({'direction': direction, 'order': int(order), 'description': ordered_acls[order], 'rule': rule})
return full_acl_list