Skip to content

Commit 1494b28

Browse files
authored
[snmp] skip psu fans during test_fan_info (#6265)
What is the motivation for this PR? Submodule update changed fan information in redis database. Changes added 2 psu fans to 4 existing fans to FAN_INFO on Arista platform. According to documentation, FAN_INFO is the source of fan mib entries, PSU_INFO - of psu related entries, meaning tests for checking physical entity mib should be separated for FAN_INFO and PSU_INFO, and PSU entries should not be checked in a fan test (in this case - in test_fan_info) How did you do it? I checked handling of psu related entries in another test created for fan mib entries - test_remove_insert_fan_and_check_fan_info. This test skips psu entries: if 'PSU' in parent_name: continue How did you verify/test it? Run snmp/test_snmp_phy_entity.py::test_fan_info
1 parent 6db9908 commit 1494b28

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/snmp/test_snmp_phy_entity.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,14 @@ def test_fan_info(duthosts, enum_rand_one_per_hwsku_hostname, snmp_physical_enti
277277
entity_info = redis_hgetall(duthost, STATE_DB, entity_info_key)
278278
position = int(entity_info['position_in_parent'])
279279
parent_name = entity_info['parent_name']
280-
if parent_name == CHASSIS_KEY:
280+
if 'PSU' in parent_name:
281+
continue
282+
elif parent_name == CHASSIS_KEY:
281283
parent_oid = MODULE_TYPE_FAN_DRAWER + position * MODULE_INDEX_MULTIPLE
282284
else:
283285
parent_entity_info = redis_hgetall(duthost, STATE_DB, PHYSICAL_ENTITY_KEY_TEMPLATE.format(parent_name))
284286
parent_position = int(parent_entity_info['position_in_parent'])
285-
if 'PSU' in parent_name:
286-
parent_oid = MODULE_TYPE_PSU + parent_position * MODULE_INDEX_MULTIPLE
287-
else:
288-
parent_oid = MODULE_TYPE_FAN_DRAWER + parent_position * MODULE_INDEX_MULTIPLE
287+
parent_oid = MODULE_TYPE_FAN_DRAWER + parent_position * MODULE_INDEX_MULTIPLE
289288
expect_oid = parent_oid + DEVICE_TYPE_FAN + position * DEVICE_INDEX_MULTIPLE
290289
assert expect_oid in snmp_physical_entity_info, 'Cannot find fan {} in physical entity mib'.format(name)
291290
fan_snmp_fact = snmp_physical_entity_info[expect_oid]

0 commit comments

Comments
 (0)