diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-03-12 16:21:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-12 16:21:04 +0200 |
| commit | 02cf8b4d5bd8f2a2b96ff6d2d9df2c3168b2f729 (patch) | |
| tree | e411aba11e46fcab371974f7eeefd3f165400f48 | |
| parent | 37e386bc1dd87435c90718077d40705a740aa8e3 (diff) | |
| parent | 4d6603e150fd2254a8fb8f6d7d2b3369cc8afbd7 (diff) | |
| download | vyos-1x-02cf8b4d5bd8f2a2b96ff6d2d9df2c3168b2f729.tar.gz vyos-1x-02cf8b4d5bd8f2a2b96ff6d2d9df2c3168b2f729.zip | |
Merge pull request #5042 from sever-sever/T8371
T8371: VPP add op-mode command show runtime
| -rw-r--r-- | op-mode-definitions/show_vpp_runtime.xml.in | 17 | ||||
| -rwxr-xr-x | src/op_mode/vpp.py | 24 |
2 files changed, 41 insertions, 0 deletions
diff --git a/op-mode-definitions/show_vpp_runtime.xml.in b/op-mode-definitions/show_vpp_runtime.xml.in new file mode 100644 index 000000000..d0fa61dbb --- /dev/null +++ b/op-mode-definitions/show_vpp_runtime.xml.in @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<interfaceDefinition> + <node name="show"> + <children> + <node name="vpp"> + <children> + <node name="runtime"> + <properties> + <help>Show VPP runtime statistics</help> + </properties> + <command>sudo ${vyos_op_scripts_dir}/vpp.py show_runtime</command> + </node> + </children> + </node> + </children> + </node> +</interfaceDefinition> diff --git a/src/op_mode/vpp.py b/src/op_mode/vpp.py index f108392fb..6ce7eed6e 100755 --- a/src/op_mode/vpp.py +++ b/src/op_mode/vpp.py @@ -344,6 +344,22 @@ class VPPShow: return data.reply + # ----------------------------- + # Runtime table + # ----------------------------- + def _get_runtime_raw(self): + # VPP does not have API call to get this data + data = self.vpp.cli_cmd('show runtime') + return [data.reply] + + def _show_runtime_formatted(self) -> str: + data = self.vpp.cli_cmd('show runtime') + return data.reply + + def runtime(self, raw: bool): + data = self._get_runtime_raw() + return data if raw else self._show_runtime_formatted() + # ----------------------------- # VyOS IPFIX op-mode entries @@ -382,6 +398,14 @@ def show_bridge(raw: bool, ifname: typing.Optional[str] = None): def show_bridge_details(raw: bool, ifname: typing.Optional[str] = None): return VPPShow().bridge_domain_details(raw, ifname) +# ----------------------------- +# show runtime +# ----------------------------- +@vyos.opmode.verify_cli_exists(['vpp']) +def show_runtime(raw: bool): + return VPPShow().runtime(raw) + + if __name__ == '__main__': try: res = vyos.opmode.run(sys.modules[__name__]) |
