Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test case to validate FEC histogram #14661

Merged
merged 24 commits into from
Jan 23, 2025
Merged

Conversation

vvolam
Copy link
Contributor

@vvolam vvolam commented Sep 19, 2024

Description of PR

Summary:
This PR introduces a new test case to verify the FEC histogram on SONiC devices. The test validates the FEC histogram output and checks for errors in critical bins, failing if any errors are detected. This assists in identifying potential transmission issues or signal degradation on the interface.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

The motivation for this PR is to add automated testing for validating the Forward Error Correction (FEC) histogram on interfaces. Monitoring FEC statistics is crucial for ensuring link stability, as high error counts in specific bins can indicate link issues or degradation.

How did you do it?

Test case retrieves FEC histogram data using the show interfaces counters fec-histogram command, validates the output, and checks the error count across various bins. The test fails if the error counts in critical bins (bins 8-15) exceed a defined threshold.

How did you verify/test it?

The test was verified by running it on multiple interfaces with SFP modules present and operational.
Test was verified on "Mellanox-SN4700-O8C48" testbed and "Arista-7060X6-64PE-C256S2" testbed.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

N/A

@vvolam vvolam requested a review from prgeor as a code owner September 19, 2024 17:18
@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/platform_tests/test_intf_fec.py:153:9: E128 continuation line under-indented for visual indent

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@vvolam vvolam requested a review from dgsudharsan September 19, 2024 18:59
@prgeor
Copy link
Contributor

prgeor commented Sep 26, 2024

@vvolam please fix the build error

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/platform_tests/test_intf_fec.py:188:13: F841 local variable 'acceptable_error_threshold' is assigned to but never used
tests/platform_tests/test_intf_fec.py:213:121: E501 line too long (128 > 120 characters)
tests/platform_tests/test_intf_fec.py:217:21: F821 undefined name 'time'
tests/platform_tests/test_intf_fec.py:227:121: E501 line too long (132 > 120 characters)

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/platform_tests/test_intf_fec.py:189:13: F841 local variable 'acceptable_error_threshold' is assigned to but never used

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/platform_tests/test_intf_fec.py:142:5: F841 local variable 'e' is assigned to but never used

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@vvolam
Copy link
Contributor Author

vvolam commented Oct 18, 2024

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vvolam
Copy link
Contributor Author

vvolam commented Oct 22, 2024

@dgsudharsan , @roy-sror could you please review? Thank you.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vvolam vvolam requested a review from Copilot January 10, 2025 19:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

tests/common/platform/interface_utils.py Show resolved Hide resolved
tests/common/platform/interface_utils.py Show resolved Hide resolved
tests/platform_tests/test_intf_fec.py Show resolved Hide resolved
tests/platform_tests/test_intf_fec.py Outdated Show resolved Hide resolved
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

fec = get_fec_oper_mode(duthost, intf['interface'])
if fec == "n/a":
pytest.fail("FEC status is N/A for interface {}".format(intf['interface']))
for intf in interfaces:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvolam some platforms like Arista 7060-x6 does not support fec operational mode yet. can you test there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor yes, that's the reason this test is already skipped on broadcom platform which is at line 51.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvolam we need this to be tested on 7060-x6. FEC histogram does work on TH5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor Tested on Arista 7060x6 platform and enabled the test on that platform. Thank you!

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prgeor prgeor merged commit 7f8faf6 into sonic-net:master Jan 23, 2025
18 checks passed
@vvolam vvolam deleted the fec-histogram branch January 23, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants