diff options
| -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__]) |
