summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-11-24 17:06:28 +0200
committerGitHub <noreply@github.com>2022-11-24 17:06:28 +0200
commitccc0f71690f3300e32ce954444ece89010a2d51c (patch)
treeccafce021bbb8dde6c62203e4991c74f405a4b19 /src
parent39394976aeb64bbe1d1e8fe3047af7a28f3f1dda (diff)
parent43062d0b338a5aad7e3b158d1c83e0a4472b1420 (diff)
downloadvyos-1x-ccc0f71690f3300e32ce954444ece89010a2d51c.tar.gz
vyos-1x-ccc0f71690f3300e32ce954444ece89010a2d51c.zip
Merge pull request #1676 from dmbaturin/T4837-route-summary
T4837: expose "show ip route summary" in the op mode API
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/route.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/op_mode/route.py b/src/op_mode/route.py
index d11b00ba0..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],