Skip to content
Merged
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
34 changes: 33 additions & 1 deletion tests/platform_tests/test_intf_fec.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
SUPPORTED_PLATFORMS = [
"mlnx_msn",
"8101_32fh",
"8111_32eh"
"8111_32eh",
"arista"
]

SUPPORTED_SPEEDS = [
Expand All @@ -35,6 +36,9 @@ def test_verify_fec_oper_mode(duthosts, enum_rand_one_per_hwsku_frontend_hostnam
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]

if "broadcom" in duthost.facts.get('platform_asic'):
pytest.skip("Skipping this test on platforms with Broadcom ASICs")

logging.info("Get output of '{}'".format("show interface status"))
intf_status = duthost.show_and_parse("show interface status")

Expand Down Expand Up @@ -63,6 +67,9 @@ def test_config_fec_oper_mode(duthosts, enum_rand_one_per_hwsku_frontend_hostnam
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]

if "broadcom" in duthost.facts.get('platform_asic'):
pytest.skip("Skipping this test on platforms with Broadcom ASICs")

logging.info("Get output of '{}'".format("show interface status"))
intf_status = duthost.show_and_parse("show interface status")

Expand Down Expand Up @@ -119,6 +126,17 @@ def test_verify_fec_stats_counters(duthosts, enum_rand_one_per_hwsku_frontend_ho
logging.info("Get output of 'show interfaces counters fec-stats'")
intf_status = duthost.show_and_parse("show interfaces counters fec-stats")

def skip_ber_counters_test(intf_status: dict) -> bool:
"""
Check whether the BER fields (Pre-FEC and Post-FEC BER)
exists in the "show interfaces counters fec-stats"
CLI output
"""
if intf_status.get('fec_pre_ber') is None or intf_status.get('fec_post_ber') is None:
pytest.fail("Pre-FEC and Port-FEC BER fields missing on interface. intf_status: {}".format(intf_status))
return True
return False

for intf in intf_status:
intf_name = intf['iface']
speed = get_interface_speed(duthost, intf_name)
Expand Down Expand Up @@ -147,3 +165,17 @@ def test_verify_fec_stats_counters(duthosts, enum_rand_one_per_hwsku_frontend_ho
if fec_symbol_err_int > fec_corr_int:
pytest.fail("FEC symbol errors:{} are higher than FEC correctable errors:{} for interface {}"
.format(intf_name, fec_symbol_err_int, fec_corr_int))

if skip_ber_counters_test(intf):
continue
fec_pre_ber = intf.get('fec_pre_ber', '').lower()
fec_post_ber = intf.get('fec_post_ber', '').lower()
try:
if fec_pre_ber != "n/a":
float(fec_pre_ber)
if fec_post_ber != "n/a":
float(fec_post_ber)
except ValueError:
pytest.fail("Pre-FEC and Post-FEC BER are not valid floats for interface {}, \
fec_pre_ber: {} fec_post_ber: {}"
.format(intf_name, fec_pre_ber, fec_post_ber))