summaryrefslogtreecommitdiff
path: root/src/op_mode/interfaces.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-03-28 13:53:55 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-03-28 13:53:55 -0500
commit9964b04e0aba8b8e50509faa9aef5ce079a8733b (patch)
treed8f4eaffaa8c98500e252b913845aed088f1cf5e /src/op_mode/interfaces.py
parent3d4e0e070e84581d4eb28cb623c019c30daf85f4 (diff)
downloadvyos-1x-9964b04e0aba8b8e50509faa9aef5ce079a8733b.tar.gz
vyos-1x-9964b04e0aba8b8e50509faa9aef5ce079a8733b.zip
interfaces: T4885: add clear/reset_counters to op-mode script
Diffstat (limited to 'src/op_mode/interfaces.py')
-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__])