Skip to content

Commit

Permalink
add changes
Browse files Browse the repository at this point in the history
Signed-off-by: Vaibhav Dahiya <vdahiya@microsoft.com>
  • Loading branch information
vdahiya12 committed Sep 9, 2024
1 parent 6bed7b7 commit 59490ed
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
1 change: 0 additions & 1 deletion doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4951,7 +4951,6 @@ BIN12: 0
BIN13: 0
BIN14: 0
BIN15: 0
BIN16: 0
```
Expand Down
17 changes: 11 additions & 6 deletions show/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,18 @@ def fetch_fec_histogram(port_oid_map, target_port):
asic_db_kvp = counter_db.get_all(counter_db.COUNTERS_DB, 'COUNTERS:{}'.format(port_oid))

if asic_db_kvp is not None:
# Capture and display only the relevant FEC codeword errors
fec_errors = {f'BIN{i}': asic_db_kvp.get
(f'SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S{i}', '0') for i in range(17)}
fec_errors = {f'BIN{i}': asic_db_kvp.get(f'SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S{i}', '0') for i in range(16)}

# Prepare the data for tabulation
table_data = [(bin_label, error_value) for bin_label, error_value in fec_errors.items()]

# Define headers
headers = ["Symbol Errors Per Codeword", "Codewords"]

# Print FEC histogram using tabulate
click.echo(tabulate(table_data, headers=headers, tablefmt="plain"))


# Print FEC histogram
for bin_label, error_value in fec_errors.items():
click.echo(f'{bin_label}: {error_value}')
else:
click.echo('No kvp found in ASIC DB for port {}, exiting'.format(target_port), err=True)
raise click.Abort()
Expand Down
3 changes: 1 addition & 2 deletions tests/mock_tables/counters_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,7 @@
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S12": "0",
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S13": "0",
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S14": "0",
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S15": "0",
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S16": "0"
"SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S15": "0"
},
"COUNTERS:oid:0x1000000000013": {
"SAI_PORT_STAT_IF_IN_UCAST_PKTS": "4",
Expand Down
35 changes: 18 additions & 17 deletions tests/portstat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,24 @@
"""

intf_fec_counters_fec_hist = """\
BIN0: 1000000
BIN1: 900000
BIN2: 800000
BIN3: 700000
BIN4: 600000
BIN5: 500000
BIN6: 400000
BIN7: 300000
BIN8: 0
BIN9: 0
BIN10: 0
BIN11: 0
BIN12: 0
BIN13: 0
BIN14: 0
BIN15: 0
BIN16: 0
Symbol Errors Per Codeword Codewords
-------------------------- ---------
BIN0: 1000000
BIN1: 900000
BIN2: 800000
BIN3: 700000
BIN4: 600000
BIN5: 500000
BIN6: 400000
BIN7: 300000
BIN8: 0
BIN9: 0
BIN10: 0
BIN11: 0
BIN12: 0
BIN13: 0
BIN14: 0
BIN15: 0
"""

intf_fec_counters_period = """\
Expand Down

0 comments on commit 59490ed

Please sign in to comment.