Commit e2838b9
Initialize the last fec ber computed values if not found (sonic-net#3621)
<!--
Please make sure you have read and understood the contribution guildlines:
https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md
1. Make sure your commit includes a signature generted with `git commit -s`
2. Make sure your commit title follows the correct format: [component]: description
3. Make sure your commit message contains enough details about the change and related tests
4. Make sure your pull request adds related reviewers, asignees, labels
Please also provide the following information in this pull request:
-->
**What I did**
`SAI_PORT_STAT_IF_FEC_CORRECTED_BITS_last` and `SAI_PORT_STAT_IF_FEC_NOT_CORRECTABLE_FARMES_last` counter values could be NOT present in redis, so initialize these values to ZERO
**Why I did it**
To prevent following error seen during warm boot
```
root@sonic:/# redis-cli --eval ./usr/share/swss/port_rates.lua oid:0x100000000000a , 2 COUNTERS 10
(error) ERR user_script:204: attempt to concatenate local 'fec_corr_bits_last' (a boolean value) script: b46cd0b446729aab6bbd20e0d4aa977e3da8f5f1, on @user_script:204.
root@sonic:/# redis-cli --eval ./usr/share/swss/port_rates.lua oid:0x100000000000a , 2 COUNTERS 10
(error) ERR user_script:204: attempt to concatenate local 'fec_corr_bits_last' (a boolean value) script: b46cd0b446729aab6bbd20e0d4aa977e3da8f5f1, on @user_script:204.
root@sonic:/# redis-cli --eval ./usr/share/swss/port_rates.lua oid:0x100000000000a , 2 COUNTERS 10
(error) ERR user_script:206: attempt to perform arithmetic on local 'fec_corr_bits_last' (a boolean value) script: cb98161ae9433f9bf8265cffd7d2eaaf6ac9282f, on @user_script:206.
root@sonic:/#
```
**How I verified it**
After fix the last computer FEC ber values are stored in redis DB
```
root@sonic:/# redis-cli --eval ./usr/share/swss/port_rates.lua oid:0x100000000000a , 2 COUNTERS 10
1) "0.18"
2) "0.82"
3) "10"
4) "DONE"
root@str2-7050cx3-acs-14:/# redis-cli -n 2 hgetall "RATES:oid:0x100000000000a"
1) "SAI_PORT_STAT_IF_IN_UCAST_PKTS_last"
2) "0"
3) "SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS_last"
4) "0"
5) "SAI_PORT_STAT_IF_OUT_UCAST_PKTS_last"
6) "0"
7) "SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS_last"
8) "0"
9) "SAI_PORT_STAT_IF_IN_OCTETS_last"
10) "0"
11) "SAI_PORT_STAT_IF_OUT_OCTETS_last"
12) "0"
13) "RX_BPS"
14) "0"
15) "RX_PPS"
16) "0"
17) "TX_BPS"
18) "0"
19) "TX_PPS"
20) "0"
21) "SAI_PORT_STAT_IF_FEC_CORRECTED_BITS_last"
22) "0"
23) "SAI_PORT_STAT_IF_FEC_NOT_CORRECTABLE_FARMES_last"
24) "0"
25) "FEC_PRE_BER"
26) "0"
27) "FEC_POST_BER"
28) "0"
root@str2-7050cx3-acs-14:/#
```
**Details if related**1 parent c24374c commit e2838b9
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
210 | | - | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| |||
0 commit comments