[snmp] Add test cases for SONiC physical entity MIB feature#2379
[snmp] Add test cases for SONiC physical entity MIB feature#2379qiluo-msft merged 14 commits intosonic-net:masterfrom
Conversation
|
retest vsimage please |
|
retest this please |
|
can you please add the test to kvmtest.sh? |
Done. |
|
retest vsimage please |
2 similar comments
|
retest vsimage please |
|
retest vsimage please |
|
retest vsimage please |
|
@Junchao-Mellanox kindly reminder that this feature will go only to master towards 202012. |
|
Hi @liat-grozovik , we can do this in sonic-tool. In sonic-tool, we can disable cases according to the image branch name. So once we merge this test case to our local repo, we need add the case to sonic-tool and disable it on 201911 branch in snmp.cases file. |
|
retest vsimage please |
1 similar comment
|
retest vsimage please |
|
retest this please |
|
retest vsimage please |
3 similar comments
|
retest vsimage please |
|
retest vsimage please |
|
retest vsimage please |
|
retest vsimage please |
tests/snmp/test_snmp_phy_entity.py
Outdated
| SENSOR_TYPE_PORT_TX_BIAS + 4, | ||
| SENSOR_TYPE_VOLTAGE] | ||
|
|
||
| # Redis Constants |
There was a problem hiding this comment.
Redis [](start = 2, length = 5)
Suggest remove Redis #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
| assert fan_snmp_fact['entPhysMfgName'] == '' | ||
| assert fan_snmp_fact['entPhysModelName'] == '' if is_null_str(fan_info['model']) else fan_info['model'] | ||
| assert fan_snmp_fact['entPhysIsFRU'] == REPLACEABLE if fan_info[ | ||
| 'is_replaceable'] == 'True' else NOT_REPLACEABLE |
There was a problem hiding this comment.
'is_replaceable' [](start = 67, length = 16)
Line breaking at a weird position. #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
| """ | ||
| keys = redis_get_keys(duthost, STATE_DB, PSU_KEY_TEMPLATE.format('*')) | ||
| if not keys: | ||
| pytest.skip('PSU information not exists in DB, skipping this test') |
There was a problem hiding this comment.
not exists [](start = 37, length = 10)
does not exist #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
| """ | ||
| keys = redis_get_keys(duthost, STATE_DB, PSU_KEY_TEMPLATE.format('*')) | ||
| if not keys: | ||
| pytest.skip('PSU information not exists in DB, skipping this test') |
There was a problem hiding this comment.
pytest.skip [](start = 8, length = 11)
There are many pytest.skip(). Seems are a valid failure case.
Do you skip just for backward-compatible? If yes, I think this is not a good method. #Closed
There was a problem hiding this comment.
I skip this for vsimage test. I found this testcase will be ran in vsimage, and there is no PSU information in DB.
There was a problem hiding this comment.
You can mark the test case like below to specify that this test case is only applicable for physical testbed, not for vsimage.
@pytest.mark.device_type('physical')
def test_xxx
tests/snmp/test_snmp_phy_entity.py
Outdated
| assert sensor_snmp_fact['entPhysContainedIn'] == psu_oid | ||
| assert sensor_snmp_fact['entPhysClass'] == PHYSICAL_CLASS_SENSOR | ||
| assert sensor_snmp_fact['entPhyParentRelPos'] == sensor_tuple[1] | ||
| assert sensor_snmp_fact['entPhysName'] == '{} for {}'.format(sensor_tuple[0], psu_name) |
There was a problem hiding this comment.
'{} for {}'.format(sensor_tuple[0], psu_name) [](start = 50, length = 45)
Appear twice, use a variable? #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
| for item in psu_status: | ||
| if not item['psu_on']: | ||
| psu_controller.turn_on_psu(item["psu_id"]) | ||
| time.sleep(5) |
There was a problem hiding this comment.
time.sleep(5) [](start = 12, length = 13)
What if no sleep? #Closed
There was a problem hiding this comment.
The PSU may take a few seconds to power on, so I add a sleep here, this code is similar with some test cases in platform tests.
There was a problem hiding this comment.
tests/snmp/test_snmp_phy_entity.py
Outdated
| :param pattern: Redis key pattern | ||
| :return: A list of key name in string | ||
| """ | ||
| cmd = 'redis-cli --raw -n {} KEYS \"{}\"'.format(db_id, pattern) |
There was a problem hiding this comment.
redis-cli [](start = 11, length = 9)
redis-cli will not aware of multi-DB or multi-namespace. Use sonic-db-cli #Closed
|
Hi @wangxin , it seems the test was not skipped in vsimage after adding the pytest mark. I see following error in the test result: |
|
If all the test cases in this test script need physical testbed, then it should not be added to the list in |
…l physical entites such as fan, PSU
…aemon] advance submodule head (sonic-net#11652) linkmgrd: * 17240f1 2022-08-02 | [active-active] Update unhealthy label definition (sonic-net#102) (HEAD -> 202205, github/202205) [Jing Zhang] * 99a7b4b 2022-07-28 | Update the definition of healthy label (sonic-net#99) [Jing Zhang] * 551144b 2022-08-08 | [Active-Standby]Remove unnecessary `handleMuxWaitTimeout` logs (sonic-net#100) [Jing Zhang] utilities: * 8cbbe4f 2022-08-08 | [crm] add checking for CRM interval range (sonic-net#2293) (HEAD -> 202205, github/202205) [Andriy Yurkiv] * 7dac7a7 2022-08-03 | Fix version in db_migrator for `PORT_QOS_MAP|global` (#2289) [bingwang-ms] * e14f0c9 2022-08-03 | Add override testcase to verify removal (#2288) [jingwenxie] * 61ea21d 2022-07-29 | [watermarkstat] Fix CLI script for unconfigured PG counters (sonic-net#2239) [Nazarii Hnydyn] * e206e2d 2022-05-19 | [portconfig] Allow to configure interface mtu for physical ports only [Sudharsan Dhamal Gopalarathnam] * 9751479 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#2285) [Liu Shilong] * 218b175 2022-07-29 | [202205][counters] Keep counters cache in a single directory (sonic-net#2280) [Stepan Blyshchak] swss: * d772a70 2022-08-09 | [muxorch] return true if the nbr IP is in the skip_neighbors list (sonic-net#2407) (HEAD -> 202205) [Nikola Dancejic] * a3ac275 2022-08-08 | [EVPN]Modified tunnel creation logic when creating tunnel in VRF-VNI map creation flow (sonic-net#2404) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam] * 67c1376 2022-08-09 | [QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min (sonic-net#2379) [Stephen Sun] * 0295a35 2022-07-21 | [Buffer Orch] Support removing buffer port profile list (sonic-net#2371) [Stephen Sun] * 450e9ec 2022-07-07 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#2357) [Qi Luo] * c1c1147 2022-06-02 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#2308) [Qi Luo] swss-common: * 749cd6f 2022-07-21 | Fix PING database command not backward compatible with python version issue. (sonic-net#650) (HEAD -> 202205) [Hua Liu] * 4fa7484 2022-06-27 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#640) [Qi Luo] * 4d0dc7a 2022-06-23 | [sonic-cli] Fix sonic-db-cli output format not backward compatible with python version issue. (sonic-net#631) [Hua Liu] * c5573fe 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#628) [Qi Luo] * 0ade483 2022-08-02 | Add docker-mux related table names (sonic-net#627) [Jing Zhang] * 675d793 2022-05-26 | Re-write sonic-db-cli with c++ for sonic startup performance issue (sonic-net#607) [Hua Liu] * 1155773 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#661) (github/202205) [Liu Shilong] sairedis: * c62a453 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#1057) (HEAD -> 202205) [Qi Luo] * 8be9292 2022-07-20 | [syncd] Remove error message when tryTranslateVidToRid fails (sonic-net#1048) [Kamil Cudnik] * eb552ee 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#1099) (github/202205) [Liu Shilong] platform-daemon: * d150229 2022-08-11 | Correct the peer forwarding state table (sonic-net#281) (HEAD -> 202205) [Longxiang Lyu] * 9507e6c 2022-08-10 | [ycabled] remove some spurious logs (sonic-net#282) (HEAD -> 202205) [vdahiya12] Signed-off-by: Ying Xie <[email protected]>
…rm-common] advance submodule head (sonic-net#12492) linkmgrd: * d7d6635 2022-10-21 | Fix link prober state event report twice issue (sonic-net#149) (HEAD -> 202205) [Longxiang Lyu] * 0ef3296 2022-10-21 | [active-active] Add support to send/handle mux probe request (sonic-net#147) [Longxiang Lyu] * a66fa34 2022-10-17 | [active-active] Fix config reload (sonic-net#145) [Longxiang Lyu] * 7e1c820 2022-10-11 | [Active-Standby] avoid posting mux metrics event when receiving unsolicited mux state notification (sonic-net#142) [Jing Zhang] * 237cfd2 2022-10-07 | [Active-Active] Update default route shutdown heartbeat logic (sonic-net#141) [Jing Zhang] utilities: * 415d30e 2022-10-23 | [techsupport] Adding FRR EVPN dumps (sonic-net#2442) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam] * b3ffe45 2022-10-21 | [show][muxcable] add support for show mux firmware version all (sonic-net#2441) [vdahiya12] * 7d68534 2022-10-19 | [app_ext] [auto-ts] Add available_mem_threshold option (sonic-net#2423) [Vivek] * 52b9c16 2022-10-07 | [muxcable][config] add CLI support for mux mode detach (sonic-net#2425) [Jing Zhang] * 14646ff 2022-10-10 | [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' (sonic-net#2386) [Andriy Yurkiv] * dffcc53 2022-10-11 | Add a subcommand to display a hexdump of transceiver EEPROM page (sonic-net#2379) [mihirpat1] * 86175c2 2022-10-17 | [chassis]Add fabric counter cli commands (sonic-net#1860) [Maxime Lorrillere] swss: * 6fe0afd 2022-10-25 | [portsorch] remove port OID from saiOidToAlias map on port deletion (sonic-net#2483) (HEAD -> 202205, github/202205) [Stepan Blyshchak] * 7290d66 2022-10-07 | [vlanmgr] Disable `arp_evict_nocarrier` for vlan host intf (sonic-net#2469) [Longxiang Lyu] * d074001 2022-10-05 | [chassis][voq]Collect counters for fabric links (sonic-net#1944) [Maxime Lorrillere] * 3a0353a 2022-10-18 | [counters][202205] Improve performance by polling only configured ports buffer queue/pg counters (sonic-net#2474) [Vadym Hlushko] * 2feb39d 2022-10-14 | [202205] [crm] Fix issue with continues EXCEEDED and CLEAR logs for ACL group/table counters (sonic-net#2482) [Volodymyr Samotiy] sairedis: * 326b630 2022-10-21 | [gbsyncd] Add asic db prefix for channel NOTIFICATIONS (sonic-net#1129) (HEAD -> 202205) [Junhua Zhai] platform-daemon: * 6dbda9b 2022-10-25 | [ycabled] fix no port/state returned by grpc server (sonic-net#308) (HEAD -> 202205) [vdahiya12] * 3d1228a 2022-10-20 | Fix xcvrd to support 400G ZR optic (sonic-net#293) [Bohan Yang] platform-common: * c04d710 2022-09-29 | Read CMIS data path state duration (sonic-net#312) (HEAD -> 202205) [Bohan Yang] Signed-off-by: Ying Xie <[email protected]> Signed-off-by: Ying Xie <[email protected]>
Description of PR
Summary:
Add test cases for SONiC physical entity MIB feature
Type of change
Approach
What is the motivation for this PR?
There is no regression test case for physical entity MIB before, and we create a few new test cases to cover the existing/new MIB objects.
How did you do it?
How did you verify/test it?
Run the new regression test cases
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation