Skip to content

[RIF] Change rif_rates.lua script to calculate rates correctly#1848

Merged
prsunny merged 1 commit intosonic-net:masterfrom
noaOrMlnx:rif_rates_script_fix
Aug 18, 2021
Merged

[RIF] Change rif_rates.lua script to calculate rates correctly#1848
prsunny merged 1 commit intosonic-net:masterfrom
noaOrMlnx:rif_rates_script_fix

Conversation

@noaOrMlnx
Copy link
Collaborator

@noaOrMlnx noaOrMlnx commented Aug 3, 2021

Signed-off-by: noaOrMlnx noaor@nvidia.com
What I did
Change rif_rates.lua and port_rates.lua scripts to calculate rates properly - rates_table_names table should be updated after each iteration and not only once.

Why I did it
Fix issue - sonic-net/sonic-buildimage#8392

How I verified it
Checked that when sending traffic, the output of 'show interfaces counters rif' and the rates appear in RATES table, counter db are close.

admin@sonic:~$ show interfaces counters rif -p 5
The rates are calculated within 5 seconds period
    IFACE    RX_OK     RX_BPS    RX_PPS    RX_ERR    TX_OK    TX_BPS    TX_PPS    TX_ERR
---------  -------  ---------  --------  --------  -------  --------  --------  --------
Ethernet0        5  83.90 B/s    1.00/s         1        0  0.00 B/s    0.00/s         0
127.0.0.1:6379[2]> hgetall RATES:oid:0x6000000000d9d
 1) "SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last"
 2) "3948"
 3) "SAI_ROUTER_INTERFACE_STAT_IN_PACKETS_last"
 4) "47"
 5) "SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS_last"
 6) "0"
 7) "SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS_last"
 8) "0"
 9) "RX_BPS"
10) "77.634107320096575"
11) "RX_PPS"
12) "0.92421556333448329"
13) "TX_BPS"
14) "0"
15) "TX_PPS"
16) "0"

before the change:

admin@sonic:~$ show interfaces  counters rif -p 5
The rates are calculated within 5 seconds period
     IFACE    RX_OK       RX_BPS     RX_PPS    RX_ERR    TX_OK    TX_BPS    TX_PPS    TX_ERR
----------  -------  -----------  ---------  --------  -------  --------  --------  --------
Ethernet0        0     0.00 B/s     0.00/s         0        0  0.00 B/s    0.00/s         0
Ethernet28   29,894  501.05 KB/s  5964.85/s         1        0  0.00 B/s    0.00/s         0
127.0.0.1:6379[2]> hgetall "RATES:oid:0x6000000000517"
1) "SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last"
2) "17856552"
3) "SAI_ROUTER_INTERFACE_STAT_IN_PACKETS_last"
4) "212578"
5) "SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS_last"
6) "0"
7) "SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS_last"
8) "0"
9) "RX_BPS"
10) "67.774654124880783"
11) "RX_PPS"
12) "0.80684145386762807"
13) "TX_BPS"
14) "0"
15) "TX_PPS"
16) "0"

Details if related

@noaOrMlnx noaOrMlnx requested a review from prsunny as a code owner August 3, 2021 12:40
@noaOrMlnx
Copy link
Collaborator Author

/azpw run

@noaOrMlnx noaOrMlnx force-pushed the rif_rates_script_fix branch from 87f4465 to 56de582 Compare August 4, 2021 14:19
@prsunny
Copy link
Collaborator

prsunny commented Aug 6, 2021

It will be helpful if you can explain the fix. Like what was the output before and what got changed

@noaOrMlnx
Copy link
Collaborator Author

@prsunny Done

prsunny
prsunny previously approved these changes Aug 11, 2021
@prsunny
Copy link
Collaborator

prsunny commented Aug 11, 2021

@dgsudharsan to sign-off

dgsudharsan
dgsudharsan previously approved these changes Aug 12, 2021
@noaOrMlnx noaOrMlnx dismissed stale reviews from dgsudharsan and prsunny via 90b87cc August 12, 2021 11:27
@noaOrMlnx noaOrMlnx force-pushed the rif_rates_script_fix branch from 56de582 to 90b87cc Compare August 12, 2021 11:27
@prsunny
Copy link
Collaborator

prsunny commented Aug 12, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny merged commit ed867b1 into sonic-net:master Aug 18, 2021
qiluo-msft pushed a commit that referenced this pull request Aug 19, 2021
…rrect (#1848)

Change rif_rates.lua and port_rates.lua scripts to calculate rates properly - rates_table_names table should be updated after each iteration and not only once.
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Aug 26, 2021
In order to include the following commits: 
d29a49a 2021-08-25 [ACL] Match TCP protocol while matching TCP_FLAG (sonic-net/sonic-swss#1854) 
2569ad9 2021-08-25 Fix sFlow sampling-rate and admin-state (sonic-net/sonic-swss#1728) 
8908a8f 2021-08-19 Change rif_rates.lua and port_rates.lua scripts to calculate rates correct (sonic-net/sonic-swss#1848) 
b42c2fb 2021-08-19 [VS Test] Skip flaky tests (sonic-net/sonic-swss#1875)
judyjoseph pushed a commit that referenced this pull request Aug 26, 2021
…rrect (#1848)

Change rif_rates.lua and port_rates.lua scripts to calculate rates properly - rates_table_names table should be updated after each iteration and not only once.
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
…rrect (sonic-net#1848)

Change rif_rates.lua and port_rates.lua scripts to calculate rates properly - rates_table_names table should be updated after each iteration and not only once.
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
…rrect (sonic-net#1848)

Change rif_rates.lua and port_rates.lua scripts to calculate rates properly - rates_table_names table should be updated after each iteration and not only once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants