sonic-mgmt
sonic-mgmt copied to clipboard
Add tests to check fabric link status and reachability.
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
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
/azpw run sonic-mgmt
/AzurePipelines run sonic-mgmt
No pipelines are associated with this pull request.
@arlakshm
@jfeng-arista please check on review comments
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
/azpw run Azure.sonic-buildimage
/AzurePipelines run Azure.sonic-buildimage
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.
/azpw run Azure.sonic-mgmt
/AzurePipelines run Azure.sonic-mgmt
Azure Pipelines successfully started running 1 pipeline(s).
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:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>