sonic-mgmt
sonic-mgmt copied to clipboard
Reboot dict in Inventory file for platform specific wait and timeout
Description of PR
Current reboot logic has a flat timeout and is more catered towards fixed chassis which has a faster reboot time. This PR is to accommodate distributed chassis and to allow individual platforms to define their own wait and timeout in inventory file.
timeout and wait time can differ under different conditions, so added support to check if there is a testcase/class level definition for them:
For e.g. You can see below, we have generic time defined for cold and warm-reboot, while testcase specific time set for ACL (class level check) and test_reload_configuration_checks which is a test case level check. ACL needs a longer time because it just reboots the box and verifies uptime but doesn't check for critical process state, interface status, so an additional time is added for distributed chassis. test_reload_configuration_checks is a negative test so it needs less time but still the less time should be platform specific.
DUTHOST: plt_reboot_dict: cold: timeout: 300 wait: 600 watchdog: timeout: 300 wait: 600 acl/test_acl.py::TestAclWithReboot: timeout: 300 wait: 600 platform_tests/test_reload_config.py::test_reload_configuration_checks: timeout: 300 wait: 60
This change only applies when the section above is defined in inventory file otherwise the default time is used.
Summary: Fixes # (issue)
Type of change
- [ ] Bug fix
- [x] Testbed and Framework(new/improvement)
- [ ] Test case(new/improvement)
Back port request
- [ ] 201911
- [ ] 202012
- [x] 202205
Approach
What is the motivation for this PR?
Current reboot logic has a flat timeout and is more catered towards fixed chassis which has a faster reboot time. This PR is to accommodate distributed chassis and to allow individual platforms to define their own wait and timeout in inventory file.
How did you do it?
Allow individual platforms to define their own wait and timeout in inventory file.
How did you verify/test it?
Tested on T2 profile
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
FYI @gechiang , @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.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Fixing tests/common/reboot.py
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook
Fixing tests/common/utilities.py
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
...
[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>
As part of platform/hwsku inv file, there's a scenario where 'wait for LC to initialize' to be updated. Is/Would this be part of this PR?
As part of platform/hwsku inv file, there's a scenario where 'wait for LC to initialize' to be updated. Is/Would this be part of this PR?
Yes @shyam77git, this PR takes care of wait.
@vperumal I misread the files changed, it is the latest file version
@vperumal please resolve the conflict.
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/common/reboot.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/common/reboot.py:193:20: E221 multiple spaces before operator
tests/common/reboot.py:231:121: E501 line too long (125 > 120 characters)
tests/common/reboot.py:241:10: E221 multiple spaces before operator
tests/common/reboot.py:291:9: F841 local variable 'e' is assigned to but never used
tests/common/reboot.py:358:121: E501 line too long (121 > 120 characters)
...
[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>
Hi @abdosi, Resolved conflicts. Can you please approve and merge
please resolve the conflict so that we can merge soon.
@abdosi, resolved merge conflicts. Kindly approve and merge