[portstat, intfstat] update rates and utilization#817
[portstat, intfstat] update rates and utilization#817mykolaf wants to merge 9 commits intosonic-net:masterfrom
Conversation
There was a problem hiding this comment.
what will be command to check RIF Counters ?
Has this been verified if RIF is both Over Port-Channel and VLAN ?
There was a problem hiding this comment.
The command to check RIF counters is show interface counters rif .
scripts/portstat
Outdated
There was a problem hiding this comment.
Is the O/P of show interface counters remains same (backward compatible ) after these changes ? Is there any difference ?
There was a problem hiding this comment.
There is no difference in how the output looks,
one difference in behavior is that clear command will not affect the rates&utilization. Still clears the counters.
|
This pull request introduces 2 alerts when merging de7c8588372de20b3f1d042b979fc513ac840b44 into a87173b - view on LGTM.com new alerts:
|
|
Please fix LGTM new alerts. In reply to: 640825246 |
|
This pull request introduces 10 alerts when merging a1806b533ea2c14459e19dcf630faa1c0033a96d into d2c997c - view on LGTM.com new alerts:
|
|
This pull request introduces 3 alerts when merging 45ea09182dc6b310350db47f7c4cf733bd4646c3 into 1ddd3f2 - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging 42a3a941050c2e99946f9dece87aa78e5cb7e44f into 1ddd3f2 - view on LGTM.com new alerts:
|
|
retest this please |
|
@abdosi anything else needed to approve this PR? |
|
@abdosi can we merge this? |
|
@mykolaf can this be merged or this is pending on another PR? |
|
@abdosi, could you please help to have this PR merged? |
This comment has been minimized.
This comment has been minimized.
2 similar comments
|
retest this please |
|
retest this please |
lguohan
left a comment
There was a problem hiding this comment.
since there is new feature is added, need unit test to cover the new feature.
Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
…o rates Conflicts: scripts/portstat
|
This pull request introduces 2 alerts when merging 3b46b03 into 13bd06b - view on LGTM.com new alerts:
|
* Fix review comments Signed-off-by: Volodymyr Samotiy <[email protected]>
|
retest this please |
|
looks like the unit test are failing, can you folks check? |
|
retest this please |
2 similar comments
|
retest this please |
|
retest this please |
…o rates Conflicts: scripts/intfstat scripts/portstat utilities_common/netstat.py
66cf477
|
This pull request introduces 1 alert when merging 66cf477 into 25e17de - view on LGTM.com new alerts:
|
* Fix "wrong number of args" issue after merge from upstream Signed-off-by: Volodymyr Samotiy <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@lguohan can you please review and approve? we currently have a mismatch between the CLI and the way the rates are calculated by the lua script. |
|
can you check the pr check failure? |
Signed-off-by: Vadym Hlushko <[email protected]>
|
@dgsudharsan can you please also review? |
|
@lguohan can you please review following the fixes provided? |
| cntr.tx_p_err)) | ||
| old_cntr = NStats._make([0] * len(nstat_fields)) | ||
|
|
||
| rates = ratestat_dict.get(key, RateStats._make([STATUS_NA]*len(ratestat_fields))) |
There was a problem hiding this comment.
I don't think ratestat_dict is defined anywhere else in the file. Is there a missing piece of code?
| STATUS_NA = 'N/A' | ||
| PORT_RATE = 40 | ||
|
|
||
| rates_key_list = [ 'RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL' ] |
There was a problem hiding this comment.
I don't think these should be declared in this file. This needs to go inside portstat and rifstat respectively. This file is meant to be like a library for various formatting APIs
| """ | ||
| Get the Intf speed | ||
| """ | ||
| full_table_id = PORT_STATUS_TABLE_PREFIX + port_name |
There was a problem hiding this comment.
PORT_STATUS_TABLE_PREFIX doesn't seem to be defined anywhere. Missing code?
| """ | ||
| full_table_id = PORT_STATUS_TABLE_PREFIX + port_name | ||
| admin_state = self.db.get(self.db.APPL_DB, full_table_id, PORT_ADMIN_STATUS_FIELD) | ||
| oper_state = self.db.get(self.db.APPL_DB, full_table_id, PORT_OPER_STATUS_FIELD) |
There was a problem hiding this comment.
PORT_OPER_STATUS_FIELD doesn't seem to be defined anywhere. Missing code?
| if admin_state is None or oper_state is None: | ||
| return STATUS_NA | ||
| elif admin_state.upper() == PORT_STATUS_VALUE_DOWN: | ||
| return PORT_STATE_DISABLED | ||
| elif admin_state.upper() == PORT_STATUS_VALUE_UP and oper_state.upper() == PORT_STATUS_VALUE_UP: | ||
| return PORT_STATE_UP | ||
| elif admin_state.upper() == PORT_STATUS_VALUE_UP and oper_state.upper() == PORT_STATUS_VALUE_DOWN: | ||
| return PORT_STATE_DOWN | ||
| else: |
There was a problem hiding this comment.
Please check all the variables used there. They don't seem to be defined.
| else: | ||
| return STATUS_NA | ||
|
|
||
| def get_intf_speed(self, port_name): |
There was a problem hiding this comment.
This API is not called anywhere. Why is this API needed
There was a problem hiding this comment.
Please also check why get_intf_state is needed. I don't see it called anywhere
| assert result.exit_code == 0 | ||
| result = runner.invoke(show.cli.commands["interfaces"].commands["counters"].commands["rif"], []) | ||
| print(result.stdout) | ||
| expected = ["Ethernet20 0 0.00 B/s 0.00/s 0 0 0.00 B/s 0.00/s 0", |
There was a problem hiding this comment.
Can you please include the new output in the test rather than just removing the expected here? I believe it's required to validate the output format
| 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.
This assumes the port speed to be Gbps. Though most of the devices have lowest speed as 1 Gbps. I don't think it's a good design here. If SONiC is planned to be used for management and other low capacity devices in the future this will become a bug for ports less than 1Gbps. I would rather prefer logic using the port speed to determine the factor to divide rather than blindly assuming Gbps
There was a problem hiding this comment.
Could you please describe the suggested approach in more detail?
There was a problem hiding this comment.
I believe port speed can be used to figure out if it is in Gbps or Mbps. By default I believe speed is in Mbps (eg 40G is 40000)
|
Closing since there is new PR #1750 with the same changes + some fixes and rebased code. |
According to HLD
Depends on sonic-swws-common #330
- What I did
Update the logic for port rates and utilization
- How I did it
- How to verify it
- 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)