Skip to content

[T2 Logical Chassis] Enhanced platform_tests/test_thermal_state_db.py to handle logical chassis by skipping thermal sensors that are not part of the logical chassis#7563

Merged
gechiang merged 6 commits intosonic-net:masterfrom
gechiang:master
Mar 2, 2023

Conversation

@gechiang
Copy link
Contributor

Description of PR

To support T2 Logical chassis (classify set of LCs and SUPs as a logical chassis where not all physically inserted LCs though belong to the same physical chassis belong to the same logical chassis), this platform_tests/test_thermal_state_db.py when testing the "test_thermal_global_state_db()" it was counting all the thermal sensor info for all the physical LCs and SUP. This breaks the logical chassis testing where not all the physically inserted LCs should be used for the test.

This PR is to ensure that when it reads from the global state DB for the thermal sensor data, it will properly skip over those thermal sensors that does not belong to the logical chassis based on the new skip_module field "thermals" specified in the inventory file. This way the test will be able to handle logical chassis correctly.

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

To allow logical chassis to be tested correctly.

How did you do it?

Verified the test run on logical chassis and ensure the test is functioning correctly with this change.

How did you verify/test it?

  1. Tried without adding the "thermals" in the inventory skip_module list and observe the test failed at the actual/expected count validation where the actual was greater than expected due to one LC ws not suppose to be counted.
  2. Tried again by specifying the correct "thermals" in the inventory skip_module list and observe the test passes successfully.
  3. ried again by specifying extra "thermals" in the inventory skip_module list and observe the test failed due to actual/expected count validation failed due tosomething that was expected to be there is missing from the gobal state DB.

Any platform specific information?

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

Documentation

…ermal info in global state DB should not be counted in the test_thermal_global_state_db() since it is logically not part of the logical chassis that ie being run
@gechiang gechiang requested a review from sujinmkang as a code owner February 24, 2023 03:49
@gechiang gechiang requested review from SuvarnaMeenakshi, abdosi and rlhui and removed request for sujinmkang February 24, 2023 03:50
@wangxin
Copy link
Collaborator

wangxin commented Feb 24, 2023

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...........................................(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_thermal_state_db.py:73:121: E501 line too long (161 > 120 characters)
tests/platform_tests/test_thermal_state_db.py:103:9: E265 block comment should start with '# '
tests/platform_tests/test_thermal_state_db.py:105:24: W601 .has_key() is deprecated, use 'in'

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
Copy link
Collaborator

wangxin commented Feb 24, 2023

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/platform_tests/test_thermal_state_db.py

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_thermal_state_db.py:74:121: E501 line too long (123 > 120 characters)

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
Copy link
Collaborator

wangxin commented Feb 24, 2023

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/platform_tests/test_thermal_state_db.py

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_thermal_state_db.py:74:15: E128 continuation line under-indented for visual indent

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
Copy link
Collaborator

wangxin commented Feb 24, 2023

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/platform_tests/test_thermal_state_db.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed

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>

Copy link
Contributor

@abdosi abdosi left a comment

Choose a reason for hiding this comment

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

LGTM

@gechiang gechiang merged commit 3f06562 into sonic-net:master Mar 2, 2023
wangxin pushed a commit that referenced this pull request Mar 6, 2023
… to handle logical chassis by skipping thermal sensors that are not part of the logical chassis (#7563)

* To support Logical Chassis that has physical LC inserted but their Thermal info in global state DB should not be counted in the test_thermal_global_state_db() since it is logically not part of the logical chassis that is being run
* Expanding skip_module with "thermals" that can also be specified to be skipped.
* Fixed the pre-commit check flagged issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants