[portstat, intfstat] added rates and utilization#1750
[portstat, intfstat] added rates and utilization#1750qiluo-msft merged 1 commit intosonic-net:masterfrom
Conversation
|
@dgsudharsan could you please review? |
|
This pull request introduces 1 alert when merging b784d50 into 30907c4 - view on LGTM.com new alerts:
|
e70e851 to
6358537
Compare
| return "{:.2f}".format(float(rate))+'/s' | ||
|
|
||
| def format_util(brate, port_rate=PORT_RATE): | ||
| """ |
There was a problem hiding this comment.
Can we avoid assuming PORTE_RATE=40 here? I believe there are multitude of speeds and If speed in unavailable in config_db.json I am ok with displaying rate as N/A rather than using 40.
There was a problem hiding this comment.
already fixed
utilities_common/netstat.py
Outdated
| if brate == STATUS_NA: | ||
| return STATUS_NA | ||
| else: | ||
| util = brate/(float(port_rate)*1024*1024*1024/8.0)*100 |
There was a problem hiding this comment.
Should we assume that speed is always in Gbps? I believe here we convert it from Mbps to Gpbs and pass it on here. But in future if we have a system which has deployment less than 1Gpbs this logic will fail. Instead I propose to use the default measurement unit used in the port table (Mbps) and modify the calculation accordingly here.
There was a problem hiding this comment.
already fixed
057ff86 to
6358537
Compare
d289f07 to
0f60ccc
Compare
|
@lguohan could you please merge? |
|
@ganglyu, @dgsudharsan could you please approve? |
f32bd91
02c7265 to
f32bd91
Compare
Signed-off-by: Vadym Hlushko <[email protected]>
f32bd91 to
44976ea
Compare
|
@ganglyu, @dgsudharsan could you please review and approve again, because there were some merge conflicts? |
|
@liat-grozovik could you please help to merge? |
|
This commit could not be cleanly cherry-pick to 202012. Please submit another PR. |
#### What I did Backport the [pull/1750](#1750) to `202012` branch Depends on [sonic-swss-common/pull/330](sonic-net/sonic-swss-common#330) According to [HLD](https://github.com/Azure/SONiC/blob/master/doc/rates-and-utilization/Rates_and_utilization_HLD.md) added calculation of rates and utilization columns to the `portstat` and `intfstat` scripts output #### How I did it Modified the `portstat` and `intfstat` scripts #### How to verify it Added UT
#### What I did Depends on [sonic-swss-common/pull/330](sonic-net/sonic-swss-common#330) According to [HLD](https://github.com/Azure/SONiC/blob/master/doc/rates-and-utilization/Rates_and_utilization_HLD.md) added calculation of rates and utilization columns to the `portstat` and `intfstat` scripts output #### How I did it Modified the `portstat` and `intfstat` scripts #### How to verify it Added UT #### Previous command output (if the output of a command-line utility has changed) ``` admin@sonic:~$ 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 X 0 N/A N/A 0 0 N/A 0 N/A N/A 0 0 N/A Ethernet2 U 287 N/A N/A 0 0 N/A 818 N/A N/A 0 0 N/A Ethernet4 U 380 N/A N/A 0 0 N/A 858 N/A N/A 0 0 N/A Ethernet6 U 286 N/A N/A 0 0 N/A 850 N/A N/A 0 0 N/A ``` #### New command output (if the output of a command-line utility has changed) ``` admin@sonic:~$ 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 X 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% 0 0 N/A Ethernet2 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% 0 0 N/A Ethernet4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% 0 0 N/A Ethernet6 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% 0 0 N/A ```
What I did
Depends on sonic-swss-common/pull/330
According to HLD added calculation of rates and utilization columns to the
portstatandintfstatscripts outputHow I did it
Modified the
portstatandintfstatscriptsHow to verify it
Added UT
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)