summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-03-29 08:00:33 +0200
committerGitHub <noreply@github.com>2023-03-29 08:00:33 +0200
commit454a49dfc1e2c08f72e9f9ae9a4a90818be76ae3 (patch)
treecdcbfaa6e046e3b0c9f41561b5e68e58c1839dde /src
parent1221bfa29ee8b081cb6d958c914f0a8ac847bc3a (diff)
parenta1c9c36c917a23d4cc3d5a9bbdd92c18829679b7 (diff)
downloadvyos-1x-454a49dfc1e2c08f72e9f9ae9a4a90818be76ae3.tar.gz
vyos-1x-454a49dfc1e2c08f72e9f9ae9a4a90818be76ae3.zip
Merge pull request #1916 from jestabro/clear-counters
interfaces: T4885: add 'clear interfaces counters' to op-mode
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/interfaces.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/op_mode/interfaces.py b/src/op_mode/interfaces.py
index 7d04ec4e3..dd87b5901 100755
--- a/src/op_mode/interfaces.py
+++ b/src/op_mode/interfaces.py
@@ -406,6 +406,18 @@ def show_counters(raw: bool, intf_name: typing.Optional[str],
return data
return _format_show_counters(data)
+def clear_counters(intf_name: typing.Optional[str],
+ intf_type: typing.Optional[str],
+ vif: bool, vrrp: bool):
+ for interface in filtered_interfaces(intf_name, intf_type, vif, vrrp):
+ interface.operational.clear_counters()
+
+def reset_counters(intf_name: typing.Optional[str],
+ intf_type: typing.Optional[str],
+ vif: bool, vrrp: bool):
+ for interface in filtered_interfaces(intf_name, intf_type, vif, vrrp):
+ interface.operational.reset_counters()
+
if __name__ == '__main__':
try:
res = vyos.opmode.run(sys.modules[__name__])