sonic-utilities
sonic-utilities copied to clipboard
portstat overflow: Convert to float first from exponent notation before input to int()
fixes sonic-net/sonic-buildimage#20407,
What I did
Typecast the exponential notation to float before being input to int() function.
How to verify it
- Run traffic on any dataport so that the counters exceed 10^14.
- After that run the sonic commands that use use portstat.
Previous command output (if the output of a command-line utility has changed)
Traceback was seen, as shown in sonic-net/sonic-buildimage#20407 .
New command output (if the output of a command-line utility has changed)
It prints the output correctly:
root@yy39top-lc4:/home/cisco# show int count
IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL TX_ERR TX_DRP TX_OVR
----------- ------- ----------------- ------------- --------- -------- --------------- -------- ------- ------------ --------- -------- -------- --------
Ethernet0 U 1,405,887,650,456 38113.57 MB/s 76.23% 0 13 0 4,841 2247.54 KB/s 0.00% 0 3 0
Ethernet8 X 0 0.00 B/s 0.00% 0 0 0 0 0.00 B/s 0.00% 0 0 0
Hi @abdosi , @cyw233 , please review.
adding @auspham for viz
Hi @rraghav-cisco this is the same fix as https://github.com/sonic-net/sonic-utilities/pull/3538/files where @qiluo-msft suspect that this issue happened before. I suspect it happened already while converting counter from SAI apis
Hi @rraghav-cisco this is the same fix as https://github.com/sonic-net/sonic-utilities/pull/3538/files where @qiluo-msft suspect that this issue happened before. I suspect it happened already while converting counter from SAI apis
@auspham : Pls close either one of them, as needed.
@rraghav-cisco, this will only fix the show utilities command, the scientific notation however will still be there in the database which will be a problem for other components.
I have updated cisco jira ticket to look into this
Hi @yejianquan, could you please help reviewing this change from CISCO and if we can merge it in to unblock this testcase?
@auspham please resolve the conflicts
This PR can be closed. Issue is fixed by https://github.com/sonic-net/sonic-utilities/pull/3596
Handled and completed in another PR: https://github.com/sonic-net/sonic-utilities/pull/3596 Closing this PR.