From 7d04bfbcc74e062b80b337753e7018a6af81e70c Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Tue, 14 Apr 2020 17:10:20 +0100 Subject: op_mode: T2223: two cosmetic change and bug fix --- python/vyos/ifconfig/operational.py | 2 +- src/op_mode/show_interfaces.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/vyos/ifconfig/operational.py b/python/vyos/ifconfig/operational.py index 5a292f90b..d585c1873 100644 --- a/python/vyos/ifconfig/operational.py +++ b/python/vyos/ifconfig/operational.py @@ -142,7 +142,7 @@ class Operational(Control): stats[k] = int(v) return stats except IOError: - return stats + return no_stats def clear_counters(self, counters=None): clear = self._stats_all if counters is None else [] diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py index c5d4c8ac6..8b6690b7d 100755 --- a/src/op_mode/show_interfaces.py +++ b/src/op_mode/show_interfaces.py @@ -20,7 +20,6 @@ import re import sys import datetime import argparse -from subprocess import Popen, PIPE, STDOUT import netifaces from vyos.ifconfig import Section @@ -87,7 +86,7 @@ def split_text(text, used=0): text: the string to split used: number of characted already used in the screen """ - returned = Popen('stty size', stdout=PIPE, stderr=STDOUT, shell=True).communicate()[0].strip().split() + returned = cmd('stty size') if len(returned) == 2: rows, columns = [int(_) for _ in returned] else: @@ -240,7 +239,9 @@ def run_clear_intf(intf, iftypes, vif, vrrp): @register('reset') def run_reset_intf(intf, iftypes, vif, vrrp): - os.remove() + for interface in filtered_interfaces(ifnames, iftypes, vif, vrrp): + interface = Interface(ifname, create=False, debug=False) + interface.operational.reset_counters() if __name__ == '__main__': -- cgit v1.2.3