Skip to content

[Platform API][pytest] Add basic tests for SFP class#1830

Merged
jleveque merged 4 commits intosonic-net:masterfrom
jleveque:add_sfp_tests
Jun 30, 2020
Merged

[Platform API][pytest] Add basic tests for SFP class#1830
jleveque merged 4 commits intosonic-net:masterfrom
jleveque:add_sfp_tests

Conversation

@jleveque
Copy link
Copy Markdown
Contributor

@jleveque jleveque commented Jun 30, 2020

Add a basic test suite for the SFP class of the new platform API, utilizing the platform API HTTP server, including the following functions:

test_get_name
test_get_presence
test_get_model
test_get_serial
test_get_status
test_get_transceiver_info
test_get_transceiver_bulk_status
test_get_transceiver_threshold_info
test_get_reset_status
test_get_rx_los
test_get_tx_fault
test_get_temperature
test_get_voltage
test_get_tx_bias
test_get_rx_power
test_get_tx_power
test_reset
test_tx_disable
test_tx_disable_channel
test_lpmode
test_power_override

Also introduce a new PlatformApiTestBase base class with expect() and assert_expectations() methods to allow for accumulating errors before asserting.

Example test results summary (showing legitimate test failures):

======================================== test session starts ======================================
platform linux2 -- Python 2.7.12, pytest-4.6.5, py-1.8.1, pluggy-0.13.1
ansible: 2.8.7
rootdir: /var/src/Networking-acs-sonic-mgmt/tests, inifile: pytest.ini
plugins: forked-1.1.3, xdist-1.28.0, ansible-2.2.2, repeat-0.8.0
collected 21 items

platform_tests/api/test_sfp.py F.FFF................[100%]

============================================= FAILURES ============================================
...
===================================== short test summary info =====================================
FAILED platform_tests/api/test_sfp.py::TestSfpApi::test_get_name - Failed: Unable to retrieve tr...
FAILED platform_tests/api/test_sfp.py::TestSfpApi::test_get_model - Failed: Unable to retrieve t...
FAILED platform_tests/api/test_sfp.py::TestSfpApi::test_get_serial - Failed: Unable to retrieve ...
FAILED platform_tests/api/test_sfp.py::TestSfpApi::test_get_status - Failed: Unable to retrieve ...
============================== 4 failed, 17 passed in 501.32 seconds ==============================

@jleveque
Copy link
Copy Markdown
Contributor Author

Retest vsimage please

@jleveque jleveque merged commit 9b1cb01 into sonic-net:master Jun 30, 2020
@jleveque jleveque deleted the add_sfp_tests branch June 30, 2020 22:53
jleveque added a commit that referenced this pull request Jul 1, 2020
Add test methods to test the Chassis class methods which are inherited from the DeviceBase class:
```
test_get_name
test_get_presence
test_get_model
test_get_serial
test_get_status
```

Also add the new 'module_ignore_errors=True' to a `wait_for()` call in conftest.py that needs it.

Depends on `PlatformApiTestBase`, which is implemented in #1830
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
sairedis:
*[recorder] Fix incorrect attribute enum value capability query (sonic-net#843) d86b051
*[syncd] Fix fdb flood queue size limit check (sonic-net#863) 3a2af76
*[vslib] implement query for SAI_DEBUG_COUNTER_TYPE enum values (sonic-net#842) 575dcb4 

swss:
*[portsorch] fix errors when moving port from one lag to anoth… a67d8af
*[debugcounterorch] check if counter type is supported before querying… ( 04105a4
*Td2: Reclaim buffer from unused ports (sonic-net#1830) ac7f5cf
*[Dynamic Buffer Calc][202012]Bug fix: Don't create lossless buffer pr… f54b7d0 

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
0dcb2b6 Open record file in append mode (sonic-net#1845)
03ce2ee [vnet/vxlan] Add support of multiple mappers for the VxLAN tunnel (sonic-net#1843)
c5e90ab VOQ: Nexthop for remote VOQ LC should be created on inband OIF. (sonic-net#1823)
834c5c8 Td2: Reclaim buffer from unused ports (sonic-net#1830)
a5ad55c [Dynamic Buffer Calc] Bug fix: Don't create lossless buffer profile for active ports without speed configured (sonic-net#1822)
f50368f [cfgmgr] Update Makefile.am to consume lib zmq (sonic-net#1865)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants