|
11 | 11 | from utilities_common import constants
|
12 | 12 | import utilities_common.multi_asic as multi_asic_util
|
13 | 13 | from utilities_common.netstat import ns_diff, table_as_json, format_brate, format_prate, \
|
14 |
| - format_util, format_number_with_comma, format_util_directly |
| 14 | + format_util, format_number_with_comma, format_util_directly, \ |
| 15 | + format_fec_ber |
15 | 16 |
|
16 | 17 | """
|
17 | 18 | The order and count of statistics mentioned below needs to be in sync with the values in portstat script
|
|
32 | 33 | header_std = ['IFACE', 'STATE', 'RX_OK', 'RX_BPS', 'RX_UTIL', 'RX_ERR', 'RX_DRP', 'RX_OVR',
|
33 | 34 | 'TX_OK', 'TX_BPS', 'TX_UTIL', 'TX_ERR', 'TX_DRP', 'TX_OVR']
|
34 | 35 | header_errors_only = ['IFACE', 'STATE', 'RX_ERR', 'RX_DRP', 'RX_OVR', 'TX_ERR', 'TX_DRP', 'TX_OVR']
|
35 |
| -header_fec_only = ['IFACE', 'STATE', 'FEC_CORR', 'FEC_UNCORR', 'FEC_SYMBOL_ERR'] |
| 36 | +header_fec_only = ['IFACE', 'STATE', 'FEC_CORR', 'FEC_UNCORR', 'FEC_SYMBOL_ERR', 'FEC_PRE_BER', 'FEC_POST_BER'] |
36 | 37 | header_rates_only = ['IFACE', 'STATE', 'RX_OK', 'RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_OK', 'TX_BPS', 'TX_PPS', 'TX_UTIL']
|
37 | 38 |
|
38 |
| -rates_key_list = ['RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL'] |
39 |
| -ratestat_fields = ("rx_bps", "rx_pps", "rx_util", "tx_bps", "tx_pps", "tx_util") |
| 39 | +rates_key_list = ['RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL', 'FEC_PRE_BER', 'FEC_POST_BER'] |
| 40 | +ratestat_fields = ("rx_bps", "rx_pps", "rx_util", "tx_bps", "tx_pps", "tx_util", "fec_pre_ber", "fec_post_ber") |
40 | 41 | RateStats = namedtuple("RateStats", ratestat_fields)
|
41 | 42 |
|
42 | 43 | """
|
@@ -194,10 +195,13 @@ def collect_stat_from_lc(self):
|
194 | 195 | tx_err = self.db.get(self.db.CHASSIS_STATE_DB, key, "tx_err")
|
195 | 196 | tx_drop = self.db.get(self.db.CHASSIS_STATE_DB, key, "tx_drop")
|
196 | 197 | tx_ovr = self.db.get(self.db.CHASSIS_STATE_DB, key, "tx_ovr")
|
| 198 | + fec_pre_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_pre_ber") |
| 199 | + fec_post_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_post_ber") |
197 | 200 | port_alias = key.split("|")[-1]
|
198 | 201 | cnstat_dict[port_alias] = NStats._make([rx_ok, rx_err, rx_drop, rx_ovr, tx_ok, tx_err, tx_drop, tx_ovr] +
|
199 | 202 | [STATUS_NA] * (len(NStats._fields) - 8))._asdict()
|
200 |
| - ratestat_dict[port_alias] = RateStats._make([rx_bps, rx_pps, rx_util, tx_bps, tx_pps, tx_util]) |
| 203 | + ratestat_dict[port_alias] = RateStats._make([rx_bps, rx_pps, rx_util, tx_bps, |
| 204 | + tx_pps, tx_util, fec_pre_ber, fec_post_ber]) |
201 | 205 | self.cnstat_dict.update(cnstat_dict)
|
202 | 206 | self.ratestat_dict.update(ratestat_dict)
|
203 | 207 |
|
@@ -238,7 +242,7 @@ def get_rates(table_id):
|
238 | 242 | """
|
239 | 243 | Get the rates from specific table.
|
240 | 244 | """
|
241 |
| - fields = ["0", "0", "0", "0", "0", "0"] |
| 245 | + fields = ["0", "0", "0", "0", "0", "0", "0", "0"] |
242 | 246 | for pos, name in enumerate(rates_key_list):
|
243 | 247 | full_table_id = RATES_TABLE_PREFIX + table_id
|
244 | 248 | counter_data = self.db.get(self.db.COUNTERS_DB, full_table_id, name)
|
@@ -363,7 +367,9 @@ def cnstat_print(self, cnstat_dict, ratestat_dict, intf_list, use_json, print_al
|
363 | 367 | table.append((key, self.get_port_state(key),
|
364 | 368 | format_number_with_comma(data['fec_corr']),
|
365 | 369 | format_number_with_comma(data['fec_uncorr']),
|
366 |
| - format_number_with_comma(data['fec_symbol_err']))) |
| 370 | + format_number_with_comma(data['fec_symbol_err']), |
| 371 | + format_fec_ber(rates.fec_pre_ber), |
| 372 | + format_fec_ber(rates.fec_post_ber))) |
367 | 373 | elif rates_only:
|
368 | 374 | header = header_rates_only
|
369 | 375 | table.append((key, self.get_port_state(key),
|
|
0 commit comments