Skip to content

Commit 0f8ac9b

Browse files
authored
Added MAX pre-fec_ber for FEC counter (sonic-net#4027)
* Added MAX pre-fec_ber for FEC counter * Fix indentation
1 parent 732dc09 commit 0f8ac9b

3 files changed

Lines changed: 33 additions & 28 deletions

File tree

doc/Command-Reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5268,11 +5268,11 @@ The "fec-stats" subcommand is used to disply the interface fec related statistic
52685268
- Example:
52695269
```
52705270
admin@ctd615:~$ show interfaces counters fec-stats
5271-
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER
5272-
----------- ------- ---------- ------------ ---------------- ------------- --------------
5273-
Ethernet0 U 0 0 0 1.48e-20 0.00e+00
5274-
Ethernet8 U 0 0 0 1.98e-19 0.00e+00
5275-
Ethernet16 U 0 0 0 1.77e-20 0.00e+00
5271+
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
5272+
----------- ------- ---------- ------------ ---------------- ------------- -------------- ---------------
5273+
Ethernet0 U 0 0 0 1.48e-20 0.00e+00 1.78e-16
5274+
Ethernet8 U 0 0 0 1.98e-19 0.00e+00 1.67e-14
5275+
Ethernet16 U 0 0 0 1.77e-20 0.00e+00 1.37e-13
52765276
```
52775277

52785278
The "trim" subcommand is used to display the interface packet trimming related statistic.

tests/portstat_test.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@
4545
""" # noqa: E501
4646

4747
intf_fec_counters = """\
48-
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER
49-
--------- ------- ---------- ------------ ---------------- ------------- --------------
50-
Ethernet0 D 130,402 3 4 N/A N/A
51-
Ethernet4 N/A 110,412 1 0 N/A N/A
52-
Ethernet8 N/A 100,317 0 0 N/A N/A
53-
Ethernet9 N/A 0 0 0 N/A N/A
48+
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
49+
--------- ------- ---------- ------------ ---------------- ------------- -------------- -----------------
50+
Ethernet0 D 130,402 3 4 N/A N/A N/A
51+
Ethernet4 N/A 110,412 1 0 N/A N/A N/A
52+
Ethernet8 N/A 100,317 0 0 N/A N/A N/A
53+
Ethernet9 N/A 0 0 0 N/A N/A N/A
5454
"""
5555

5656
intf_fec_counters_nonzero = """\
57-
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER
58-
--------- ------- ---------- ------------ ---------------- ------------- --------------
59-
Ethernet0 D 130,402 3 4 N/A N/A
60-
Ethernet4 N/A 110,412 1 0 N/A N/A
61-
Ethernet8 N/A 100,317 0 0 N/A N/A
57+
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
58+
--------- ------- ---------- ------------ ---------------- ------------- -------------- -----------------
59+
Ethernet0 D 130,402 3 4 N/A N/A N/A
60+
Ethernet4 N/A 110,412 1 0 N/A N/A N/A
61+
Ethernet8 N/A 100,317 0 0 N/A N/A N/A
6262
"""
6363

6464
intf_fec_counters_fec_hist = """\
@@ -84,12 +84,12 @@
8484

8585
intf_fec_counters_period = """\
8686
The rates are calculated within 3 seconds period
87-
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER
88-
--------- ------- ---------- ------------ ---------------- ------------- --------------
89-
Ethernet0 D 0 0 0 N/A N/A
90-
Ethernet4 N/A 0 0 0 N/A N/A
91-
Ethernet8 N/A 0 0 0 N/A N/A
92-
Ethernet9 N/A 0 0 0 N/A N/A
87+
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
88+
--------- ------- ---------- ------------ ---------------- ------------- -------------- -----------------
89+
Ethernet0 D 0 0 0 N/A N/A N/A
90+
Ethernet4 N/A 0 0 0 N/A N/A N/A
91+
Ethernet8 N/A 0 0 0 N/A N/A N/A
92+
Ethernet9 N/A 0 0 0 N/A N/A N/A
9393
"""
9494

9595
intf_counters_period = """\

utilities_common/portstat.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@
3535
header_std = ['IFACE', 'STATE', 'RX_OK', 'RX_BPS', 'RX_UTIL', 'RX_ERR', 'RX_DRP', 'RX_OVR',
3636
'TX_OK', 'TX_BPS', 'TX_UTIL', 'TX_ERR', 'TX_DRP', 'TX_OVR']
3737
header_errors_only = ['IFACE', 'STATE', 'RX_ERR', 'RX_DRP', 'RX_OVR', 'TX_ERR', 'TX_DRP', 'TX_OVR']
38-
header_fec_only = ['IFACE', 'STATE', 'FEC_CORR', 'FEC_UNCORR', 'FEC_SYMBOL_ERR', 'FEC_PRE_BER', 'FEC_POST_BER']
38+
header_fec_only = ['IFACE', 'STATE', 'FEC_CORR', 'FEC_UNCORR', 'FEC_SYMBOL_ERR', 'FEC_PRE_BER',
39+
'FEC_POST_BER', 'FEC_PRE_BER_MAX']
3940
header_rates_only = ['IFACE', 'STATE', 'RX_OK', 'RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_OK', 'TX_BPS', 'TX_PPS', 'TX_UTIL']
4041
header_trim_only = ['IFACE', 'STATE', 'TRIM_PKTS', 'TRIM_TX_PKTS', 'TRIM_DRP_PKTS']
4142

42-
rates_key_list = ['RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL', 'FEC_PRE_BER', 'FEC_POST_BER']
43-
ratestat_fields = ("rx_bps", "rx_pps", "rx_util", "tx_bps", "tx_pps", "tx_util", "fec_pre_ber", "fec_post_ber")
43+
rates_key_list = ['RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL', 'FEC_PRE_BER',
44+
'FEC_POST_BER', 'FEC_PRE_BER_MAX']
45+
ratestat_fields = ("rx_bps", "rx_pps", "rx_util", "tx_bps", "tx_pps", "tx_util", "fec_pre_ber", "fec_post_ber",
46+
"fec_pre_ber_max")
4447
RateStats = namedtuple("RateStats", ratestat_fields)
4548

4649
"""
@@ -244,11 +247,12 @@ def collect_stat_from_lc(self):
244247
tx_ovr = self.db.get(self.db.CHASSIS_STATE_DB, key, "tx_ovr")
245248
fec_pre_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_pre_ber")
246249
fec_post_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_post_ber")
250+
fec_pre_ber_max = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_pre_ber_max")
247251
port_alias = key.split("|")[-1]
248252
cnstat_dict[port_alias] = NStats._make([rx_ok, rx_err, rx_drop, rx_ovr, tx_ok, tx_err, tx_drop, tx_ovr] +
249253
[STATUS_NA] * (len(NStats._fields) - 8))._asdict()
250254
ratestat_dict[port_alias] = RateStats._make([rx_bps, rx_pps, rx_util, tx_bps,
251-
tx_pps, tx_util, fec_pre_ber, fec_post_ber])
255+
tx_pps, tx_util, fec_pre_ber, fec_post_ber, fec_pre_ber_max])
252256
self.cnstat_dict.update(cnstat_dict)
253257
self.ratestat_dict.update(ratestat_dict)
254258

@@ -329,7 +333,7 @@ def get_rates(table_id):
329333
"""
330334
Get the rates from specific table.
331335
"""
332-
fields = ["0", "0", "0", "0", "0", "0", "0", "0"]
336+
fields = ["0", "0", "0", "0", "0", "0", "0", "0", "0"]
333337
for pos, name in enumerate(rates_key_list):
334338
full_table_id = RATES_TABLE_PREFIX + table_id
335339
counter_data = self.db.get(self.db.COUNTERS_DB, full_table_id, name)
@@ -632,7 +636,8 @@ def cnstat_diff_print(self, cnstat_new_dict, cnstat_old_dict,
632636
ns_diff(cntr['fec_uncorr'], old_cntr['fec_uncorr']),
633637
ns_diff(cntr['fec_symbol_err'], old_cntr['fec_symbol_err']),
634638
format_fec_ber(rates.fec_pre_ber),
635-
format_fec_ber(rates.fec_post_ber)))
639+
format_fec_ber(rates.fec_post_ber),
640+
format_fec_ber(rates.fec_pre_ber_max)))
636641
elif rates_only:
637642
header = header_rates_only
638643

0 commit comments

Comments
 (0)