Commit cdf78e3
authored
Converting legacy platform tests for a T2 chassis, adding validation of values to tests, and refactor test_sfp into smaller tests (#2965)
Summary:
The following modifications are made to some of the legacy platform tests:
- conftest.py:
- Some of the platform tests run only on a supervisor card for a chassis.
So, needed to change rand_one_dut_hostname to enum_dut_supervisor_hostname.
However, in a multi-dut testbed that has no supervisor card (like DualTor),
we would raise an exception that no supervisor card is present. Instead,
we will now just return the first dut in the testbed.
- Modified generate_params_supervisor_hostname function for this behavior.
- test_xcvr_info_in_db.py:
- Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend
node instead of rand_one_dut_hostname that could give us a supervisor card.
- test_sfp:
- Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend
node instead of rand_one_dut_hostname
- Some of the new platforms don't support sfputils. So, added a check based
on the presence of file /usr/share/sonic/device/<platform>/plugins/spfutil.py"
If the file is not present, then we assume that sfputils is not supported.
In this case, we don't do sfputils related steps in test_check_sfp_status_and_configure_sfp test.
and skip test_check_sfp_low_power_mode test.
- test_show_platform.py:
- Use enum_rand_one_per_hwsku_frontend_hostname to run tests against frontend
node instead of rand_one_dut_hostname
- test_show_platform_summary:
- Added validation of fields in 'show platform summary' based on values in the inventory if defined.
- hwsku - based on 'hwsku' variable in the inventory
- platform - based on 'sonic_hw_platform' variable in the inventory
- asic - based on 'asic_type' variable in the inventory
- asic count - based on 'num_asics' variable in the inventory
- test_show_syseeprom:
- Validate values against 'syseeprom_info' dictionary if defined in the inventory
- test_show_platform_psustatus:
- Validate that atleast one of the PSU's shows status as OK.
- test_show_platform_fan:
- Validate that atleast one of the fans shows status as OK.
Approach
What is the motivation for this PR?
Need to run the legacy platform tests against a T2 chassis. However, some of the tests would run only on supervisor card, while others would run only on frontend nodes (linecards).
So, need to convert these tests to use the enum_* fixtures for dut selection, rather than rand_one_dut_hostname.
Also, we need to add some validation of the commands based on some variables that are defined in the inventory file - similar to the new PMON API validation.
How did you do it?
The following modifications are made to some of the legacy platform tests:
conftest.py:
Some of the platform tests run only on a supervisor card for a chassis. So, needed to change rand_one_dut_hostname to enum_dut_supervisor_hostname. However, in a multi-dut testbed that has no supervisor card (like DualTor), we would raise an exception that no supervisor card is present. Instead, we will now just return the first dut in the testbed.
Modified generate_params_supervisor_hostname function for this behavior.
test_xcvr_info_in_db.py:
Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend node instead of rand_one_dut_hostname that could give us a supervisor card.
test_sfp:
Broke into 3 smaller test for the 3 modules being tested
sfpshow
sfputil
show interface transceiver
These tests were added as a directory 'sfp' under platform_tests
In these tests:
Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend node instead of rand_one_dut_hostname
Added validation of 'sfpshow presence' and 'sfpshow eeprom'.
test_show_platform.py:
Use enum_rand_one_per_hwsku_frontend_hostname to run tests against frontend node instead of rand_one_dut_hostname
test_show_platform_summary:
Added validation of fields in 'show platform summary' based on values in the inventory if defined.
hwsku - based on 'hwsku' variable in the inventory
platform - based on 'sonic_hw_platform' variable in the inventory
asic - based on 'asic_type' variable in the inventory
asic count - based on 'num_asics' variable in the inventory
test_show_syseeprom:
Validate values against 'syseeprom_info' dictionary if defined in the inventory
test_show_platform_psustatus:
Validate that atleast one of the PSU's shows status as OK.
test_show_platform_fan:
Validate that atleast one of the fans shows status as OK.
How did you verify/test it?
Validated the modified tests against a chassis and also a pizza box.1 parent 6b43806 commit cdf78e3
9 files changed
Lines changed: 388 additions & 203 deletions
File tree
- tests
- platform_tests
- cli
- sfp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
661 | | - | |
662 | | - | |
| 661 | + | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| |||
Large diffs are not rendered by default.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments