From 9964b04e0aba8b8e50509faa9aef5ce079a8733b Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 28 Mar 2023 13:53:55 -0500 Subject: interfaces: T4885: add clear/reset_counters to op-mode script --- src/op_mode/interfaces.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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__]) -- cgit v1.2.3