Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5649,11 +5649,11 @@ The "fec-stats" subcommand is used to disply the interface fec related statistic
- Example:
```
admin@ctd615:~$ show interfaces counters fec-stats
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
----------- ------- ---------- ------------ ---------------- ------------- -------------- ---------------
Ethernet0 U 0 0 0 1.48e-20 0.00e+00 1.78e-16
Ethernet8 U 0 0 0 1.98e-19 0.00e+00 1.67e-14
Ethernet16 U 0 0 0 1.77e-20 0.00e+00 1.37e-13
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX FEC_FLR FEC_FLR_PREDICTED
----------- ------- ---------- ------------ ---------------- ------------- -------------- --------------- --------- -------------------
Ethernet0 U 0 0 0 1.48e-20 0.00e+00 1.78e-16 0 0
Ethernet8 U 0 0 0 1.98e-19 0.00e+00 1.67e-14 0 0
Ethernet16 U 0 0 0 1.77e-20 0.00e+00 1.37e-13 0 0
```

The "trim" subcommand is used to display the interface packet trimming related statistic.
Expand Down
12 changes: 6 additions & 6 deletions tests/portstat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
""" # noqa: E501

intf_fec_counters = """\
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX
--------- ------- ---------- ------------ ---------------- ------------- -------------- -----------------
Ethernet0 D 130,402 3 4 N/A N/A N/A
Ethernet4 N/A 110,412 1 0 N/A N/A N/A
Ethernet8 N/A 100,317 0 0 N/A N/A N/A
Ethernet9 N/A 0 0 0 N/A N/A N/A
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR FEC_PRE_BER FEC_POST_BER FEC_PRE_BER_MAX FEC_FLR FEC_FLR_PREDICTED
--------- ------- ---------- ------------ ---------------- ------------- -------------- ----------------- --------- -------------------
Ethernet0 D 130,402 3 4 N/A N/A N/A N/A N/A
Ethernet4 N/A 110,412 1 0 N/A N/A N/A N/A N/A
Ethernet8 N/A 100,317 0 0 N/A N/A N/A N/A N/A
Ethernet9 N/A 0 0 0 N/A N/A N/A N/A N/A
"""

intf_fec_counters_nonzero = """\
Expand Down
11 changes: 11 additions & 0 deletions utilities_common/netstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ def format_fec_ber(rate):
else:
return "{:.2e}".format(float(rate))

def format_fec_flr(rate):
"""
Show the flr rate.
"""
if rate == STATUS_NA:
return STATUS_NA
elif rate == 0:
return "0"
else:
return "{:.2e}".format(float(rate))


def format_util(brate, port_rate):
"""
Expand Down
19 changes: 12 additions & 7 deletions utilities_common/portstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import utilities_common.multi_asic as multi_asic_util
from utilities_common.netstat import ns_diff, table_as_json, format_brate, format_prate, \
format_util, format_number_with_comma, format_util_directly, \
format_fec_ber
format_fec_ber, format_fec_flr

"""
The order and count of statistics mentioned below needs to be in sync with the values in portstat script
Expand All @@ -36,14 +36,14 @@
'TX_OK', 'TX_BPS', 'TX_UTIL', 'TX_ERR', 'TX_DRP', 'TX_OVR']
header_errors_only = ['IFACE', 'STATE', 'RX_ERR', 'RX_DRP', 'RX_OVR', 'TX_ERR', 'TX_DRP', 'TX_OVR']
header_fec_only = ['IFACE', 'STATE', 'FEC_CORR', 'FEC_UNCORR', 'FEC_SYMBOL_ERR', 'FEC_PRE_BER',
'FEC_POST_BER', 'FEC_PRE_BER_MAX']
'FEC_POST_BER', 'FEC_PRE_BER_MAX', 'FLR(O)', 'FLR(P)']
header_rates_only = ['IFACE', 'STATE', 'RX_OK', 'RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_OK', 'TX_BPS', 'TX_PPS', 'TX_UTIL']
header_trim_only = ['IFACE', 'STATE', 'TRIM_PKTS', 'TRIM_TX_PKTS', 'TRIM_DRP_PKTS']

rates_key_list = ['RX_BPS', 'RX_PPS', 'RX_UTIL', 'TX_BPS', 'TX_PPS', 'TX_UTIL', 'FEC_PRE_BER',
'FEC_POST_BER', 'FEC_PRE_BER_MAX']
'FEC_POST_BER', 'FEC_PRE_BER_MAX', 'FEC_FLR', 'FEC_FLR_PREDICTED']
ratestat_fields = ("rx_bps", "rx_pps", "rx_util", "tx_bps", "tx_pps", "tx_util", "fec_pre_ber", "fec_post_ber",
"fec_pre_ber_max")
"fec_pre_ber_max", "fec_flr", "fec_flr_predicted")
RateStats = namedtuple("RateStats", ratestat_fields)

"""
Expand Down Expand Up @@ -248,11 +248,14 @@ def collect_stat_from_lc(self):
fec_pre_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_pre_ber")
fec_post_ber = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_post_ber")
fec_pre_ber_max = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_pre_ber_max")
fec_flr = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_flr")
fec_flr_predicted = self.db.get(self.db.CHASSIS_STATE_DB, key, "fec_flr_predicted")
port_alias = key.split("|")[-1]
cnstat_dict[port_alias] = NStats._make([rx_ok, rx_err, rx_drop, rx_ovr, tx_ok, tx_err, tx_drop, tx_ovr] +
[STATUS_NA] * (len(NStats._fields) - 8))._asdict()
ratestat_dict[port_alias] = RateStats._make([rx_bps, rx_pps, rx_util, tx_bps,
tx_pps, tx_util, fec_pre_ber, fec_post_ber, fec_pre_ber_max])
tx_pps, tx_util, fec_pre_ber, fec_post_ber, fec_pre_ber_max,
fec_flr, fec_flr_predicted])
self.cnstat_dict.update(cnstat_dict)
self.ratestat_dict.update(ratestat_dict)

Expand Down Expand Up @@ -333,7 +336,7 @@ def get_rates(table_id):
"""
Get the rates from specific table.
"""
fields = ["0", "0", "0", "0", "0", "0", "0", "0", "0"]
fields = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
for pos, name in enumerate(rates_key_list):
full_table_id = RATES_TABLE_PREFIX + table_id
counter_data = self.db.get(self.db.COUNTERS_DB, full_table_id, name)
Expand Down Expand Up @@ -637,7 +640,9 @@ def cnstat_diff_print(self, cnstat_new_dict, cnstat_old_dict,
ns_diff(cntr['fec_symbol_err'], old_cntr['fec_symbol_err']),
format_fec_ber(rates.fec_pre_ber),
format_fec_ber(rates.fec_post_ber),
format_fec_ber(rates.fec_pre_ber_max)))
format_fec_ber(rates.fec_pre_ber_max),
format_fec_flr(rates.fec_flr),
format_fec_flr(rates.fec_flr_predicted)))
elif rates_only:
header = header_rates_only

Expand Down
Loading