sonic-utilities
sonic-utilities copied to clipboard
portstat gives traceback when the counters exceed 10^14
Description
When the interface counters exceed 10^14, the portstat utility gives traceback. So the "show interface counter" gives the traceback.
Traceback (most recent call last):
File "/usr/local/bin/portstat", line 675, in <module>
main()
File "/usr/local/bin/portstat", line 635, in main
cnstat_dict, ratestat_dict = portstat.get_cnstat_dict()
File "/usr/local/bin/portstat", line 151, in get_cnstat_dict
self.collect_stat()
File "/usr/local/lib/python3.9/dist-packages/utilities_common/multi_asic.py", line 157, in wrapped_run_on_all_asics
func(self, *args, **kwargs)
File "/usr/local/bin/portstat", line 161, in collect_stat
cnstat_dict, ratestat_dict = self.get_cnstat()
File "/usr/local/bin/portstat", line 215, in get_cnstat
cnstat_dict[port] = get_counters(port)
File "/usr/local/bin/portstat", line 182, in get_counters
fields[pos] = str(int(fields[pos]) + int(fvs[counter_name]))
ValueError: invalid literal for int() with base 10: '1.5530548686308e+14'
root@yy39top-lc4:/home/cisco#
Steps to reproduce the issue
- Run trafffic in the DUT interface enough to raise the counter values to above 10^14.
- Run any command that reads the counters: "show inter counter", "sonic-clear counter", "portstat"
- All of them give traceback.
Describe the results you received
Pls see the description.
Describe the results you expected
We need the output to show the counter values instead of traceback.
Additional information you deem important (e.g. issue happens only occasionally)
Output of show version
The version of the DUT doesn't seem to matter.