Skip to content

Commit d77c411

Browse files
lyndonsiaolguohan
authored andcommitted
[netstat]: Fix for negative output values of counters after clear counters operation (sonic-net#697)
Immediately after a clear counter operation, the difference between new counter and old counter is negative. Returning 0 in this situation
1 parent fc324f2 commit d77c411

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

utilities_common/netstat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def ns_diff(newstr, oldstr):
1313
return STATUS_NA
1414
else:
1515
new, old = int(newstr), int(oldstr)
16-
return '{:,}'.format(new - old)
16+
return '{:,}'.format(max(0, new - old))
1717

1818
def ns_brate(newstr, oldstr, delta):
1919
"""

0 commit comments

Comments
 (0)