diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-12-17 08:29:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 08:29:12 +0100 |
commit | 76cf45917de5ed3a04132029d33a240ebd5877d6 (patch) | |
tree | 07ffee72afccd941a60508ba56b6e65424d96bd0 /src/op_mode/route.py | |
parent | 0c51111829dcd7660fc5405ae6ac651a8b6987b8 (diff) | |
parent | d7a67aa4a7e7bb82a60ad18103abc6b966a2f8b8 (diff) | |
download | vyos-1x-76cf45917de5ed3a04132029d33a240ebd5877d6.tar.gz vyos-1x-76cf45917de5ed3a04132029d33a240ebd5877d6.zip |
Merge branch 'current' into goodnetnick-shloginotp-T4754
Diffstat (limited to 'src/op_mode/route.py')
-rwxr-xr-x | src/op_mode/route.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/op_mode/route.py b/src/op_mode/route.py index e1eee5bbf..d07a34180 100755 --- a/src/op_mode/route.py +++ b/src/op_mode/route.py @@ -54,6 +54,18 @@ frr_command_template = Template(""" {% endif %} """) +def show_summary(raw: bool): + from vyos.util import cmd + + if raw: + from json import loads + + output = cmd(f"vtysh -c 'show ip route summary json'") + return loads(output) + else: + output = cmd(f"vtysh -c 'show ip route summary'") + return output + def show(raw: bool, family: str, net: typing.Optional[str], @@ -83,7 +95,12 @@ def show(raw: bool, if raw: from json import loads - return loads(output) + d = loads(output) + collect = [] + for k,_ in d.items(): + for l in d[k]: + collect.append(l) + return collect else: return output |