sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

Add tests to check fabric link status and reachability.

Open jfeng-arista opened this issue 2 years ago • 7 comments

Description of PR

Summary: Fixes # Add tests to check fabric link status and fabric link reachability.

Type of change

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

Back port request

  • [ ] 201911
  • [ ] 202012
  • [ ] 202205

Approach

What is the motivation for this PR?

This PR adds test cases of checking fabric links.

How did you do it?

These test cases will compare the following two sets of data on a chassis:

  • Expected fabric link status and fabric link reachability information
  • Current fabric link status and reachability

How did you verify/test it?

The new voq tests read the information stored in /voq/fabric_data/ as expected value to check the fabric link status and fabric link reachability information in a system. If the information on the system is different than expected ones, the test will fail.

Any platform specific information?

The expected fabric link status /reachability information that stored in /voq/fabric_data/ is specific to SKU. Each type of cards should have its own expected data in this path.

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

The new tests only runs on t2 systems.

Documentation

The related document is at https://github.com/sonic-net/sonic-mgmt/pull/5678

jfeng-arista avatar Oct 25 '22 19:10 jfeng-arista

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/voq/test_voq_fabric_status_all.py

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/templates/minigraph_meta.j2

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

azure-pipelines[bot] avatar Oct 25 '22 19:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/voq/test_voq_fabric_status_all.py

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/templates/minigraph_meta.j2

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

azure-pipelines[bot] avatar Oct 25 '22 23:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/voq/test_voq_fabric_status_all.py

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/templates/minigraph_meta.j2

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

azure-pipelines[bot] avatar Oct 26 '22 00:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Passed
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing ansible/templates/minigraph_meta.j2

check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/voq/test_voq_fabric_status_all.py:80:17: E265 block comment should start with '# '

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>

azure-pipelines[bot] avatar Oct 26 '22 01:10 azure-pipelines[bot]

/azpw run sonic-mgmt

jfeng-arista avatar Nov 01 '22 17:11 jfeng-arista

/AzurePipelines run sonic-mgmt

mssonicbld avatar Nov 01 '22 17:11 mssonicbld

No pipelines are associated with this pull request.

azure-pipelines[bot] avatar Nov 01 '22 17:11 azure-pipelines[bot]

@arlakshm

kenneth-arista avatar Dec 06 '22 06:12 kenneth-arista

@jfeng-arista please check on review comments

abdosi avatar Mar 01 '23 19:03 abdosi

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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

tests/voq/test_fabric_reach.py:17:1: E302 expected 2 blank lines, found 1
tests/voq/test_fabric_reach.py:20:9: E225 missing whitespace around operator
tests/voq/test_voq_fabric_status_all.py:74:37: W601 .has_key() is deprecated, use 'in'
tests/voq/test_voq_fabric_status_all.py:76:43: W601 .has_key() is deprecated, use 'in'
tests/voq/test_voq_fabric_status_all.py:81:17: E265 block comment should start with '# '
tests/voq/test_voq_fabric_status_all.py:89:42: E203 whitespace before ':'
tests/voq/test_voq_fabric_status_all.py:92:62: E203 whitespace before ':'
tests/voq/test_voq_fabric_status_all.py:119:40: W601 .has_key() is deprecated, use 'in'
tests/voq/test_voq_fabric_status_all.py:121:46: W601 .has_key() is deprecated, use 'in'
tests/voq/test_voq_fabric_status_all.py:125:24: E114 indentation is not a multiple of 4 (comment)
tests/voq/test_voq_fabric_status_all.py:126:24: E111 indentation is not a multiple of 4

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>

wangxin avatar Mar 07 '23 00:03 wangxin

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/voq/test_voq_fabric_status_all.py

fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

tests/voq/test_voq_fabric_status_all.py: failed parsing with CPython 3.8.10:

Traceback (most recent call last):
File "/home/AzDevOps/.cache/pre-commit/repobc4tzgch/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
ast.parse(f.read(), filename=filename)
File "/usr/lib/python3.8/ast.py", line 47, in parse
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

wangxin avatar Mar 07 '23 01:03 wangxin

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

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

tests/voq/test_voq_fabric_status_all.py: failed parsing with CPython 3.8.10:

Traceback (most recent call last):
File "/home/AzDevOps/.cache/pre-commit/repo3a0_z9hz/py_env-python3/lib/python3.8/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
ast.parse(f.read(), filename=filename)
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "tests/voq/test_voq_fabric_status_all.py", line 74
if asic not in referenceData
^
SyntaxError: invalid syntax
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

wangxin avatar Mar 07 '23 01:03 wangxin

/azpw run Azure.sonic-buildimage

jfeng-arista avatar Mar 07 '23 18:03 jfeng-arista

/AzurePipelines run Azure.sonic-buildimage

mssonicbld avatar Mar 07 '23 18:03 mssonicbld

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

azure-pipelines[bot] avatar Mar 07 '23 18:03 azure-pipelines[bot]

/azpw run Azure.sonic-mgmt

jfeng-arista avatar Mar 07 '23 18:03 jfeng-arista

/AzurePipelines run Azure.sonic-mgmt

mssonicbld avatar Mar 07 '23 18:03 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Mar 07 '23 18:03 azure-pipelines[bot]

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...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/voq/test_fabric_reach.py:17:1: E302 expected 2 blank lines, found 1
tests/voq/test_fabric_reach.py:41:1: E302 expected 2 blank lines, found 1
tests/voq/test_fabric_reach.py:58:1: E302 expected 2 blank lines, found 1
tests/voq/test_voq_fabric_status_all.py:20:1: E302 expected 2 blank lines, found 1

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 avatar May 02 '23 16:05 mssonicbld