-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[intfstat] Fix logic in RIF counters to print right stats #1732
Conversation
@liat-grozovik FYI. |
scripts/intfstat
Outdated
pickle.dump(cnstat_dict, open(cnstat_fqn_file, 'wb')) | ||
except IOError as e: | ||
sys.exit(e.errno) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are making the general file upto date, can you please explain the need for the interface specific file? In my opinion one file should be good enough to save stats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another feature we need to take into consideration - tag_name.
If a user wants to clear counters with a certain tag, we need to keep stats in this tag file.
so I removed the interface name in file which is indeed unneeded, but changed the logic in the script to not brake tag_name logic.
87b158c
to
57400af
Compare
/azpw run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add UT to this file.https://github.com/Azure/sonic-utilities/blob/master/tests/intfstat_test.py ?
57400af
to
7247566
Compare
7247566
to
fb202ba
Compare
*when deleting for a certain interface, add the info to the general file. *when querying for a certain interface, check the general file as well.
*when deleting for a certain interface, add the info to the general file. *when querying for a certain interface, check the general file as well.
…627) 7041400 [config reload] Call systemctl reset-failed for snmp,telemetry,mgmt-framework services (sonic-net#1773) (sonic-net#1786) 399d370 Fix logic in RIF counters print (sonic-net#1732) 8329544 [vnet_route_check] don't hardcode prefix length of /24 (sonic-net#1756) 193b028 [neighbor-advertiser] delete the tunnel maps appropriately (sonic-net#1663) 2c82bcf [neighbor_advertiser] Use existing tunnel if present for creating tunnel mappings (sonic-net#1589) 8e22960 [202012][Config] Update config command of Kdump. (sonic-net#1778) be3e5c6 [show][config] cli refactor for muxcable with abstract class implementation from vendors (sonic-net#1722) (sonic-net#1782)
What I did
Fix logic in scripts/intfstat file.
Before the change:
If a user cleared all counters using
sonic-clear rifcounters
command and then queried for rif counters with a certain interface (e.g.show interfaces counters rif Ethernet0
), the user would see the older stats. meaning the clear was not performed.The reason for this is that when we do sonic-clear rifcounters, the counters are not really being cleared, but current stats are saved into a file, and in the next counters query, it will calculate the diff between current counters and the saved counters.
If the clear was performed in general (without an interface name), it's saved to a general file (e.g. 0).
If the clear was performed for a certain interface, it's saved to an interface file (e.g. 0-Ethernet0).
so when we clear in one method and then query for the other, we can receive the info from the wrong file and display different stats.
Fix issue - sonic-net/sonic-buildimage#8394
How I did it
Add the logic:
when deleting for a certain interface, add the info to the general file.
when querying for a certain interface, check the general file as well.
How to verify it
send traffic to interface
check general rif table (
show interfaces counters rif
)clear general rifcounters (
sonic-clear rifcounters
)check that the specific interface table is also updated (
show interfaces counters rif Ethernet0
)send traffic to interface
clear interface table (
sonic-clear rifcounters Ethernet0
)check that general table is updated as well (
show interfaces counters rif
)Previous command output (if the output of a command-line utility has changed)
N/A
New command output (if the output of a command-line utility has changed)
N/A