-
Notifications
You must be signed in to change notification settings - Fork 1k
Function from platform interface utils (check_interface_information) should be fixed #2647
Description
Description
There is a function in tests/common/platform/interface_utils.py:
def check_interface_information(dut, interfaces):
if not all_transceivers_detected(dut, interfaces):
logging.info("Not all transceivers are detected")
return False
if not check_interface_status(dut, interfaces):
logging.info("Not all interfaces are up")
return False
return True
It was observed that this function returns True even if empty dictionary is passed as 'interfaces' parameter.
If for some reason empty dictionary will be specified, this functions will return True, however it will not check nothing, and as result test case will PASS without doing any of validation.
Affected test cases:
test_reboot.py
test_reload_config.py
test_sequential_restart.py
Usually 'check_interface_information' in tests is used like this:
wait_until(300, 20, check_interface_information, duthost, interfaces)
check_interface_information -> calls:
all_transceivers_detected(dut, interfaces)
check_interface_status(dut, interfaces)
However both of those functions will return True even for empty interfaces dictionary:
all_transceivers_detected(duthost, {}) -> True
check_interface_status(duthost, {}) -> True
It means that 'check_interface_information' will return True for empty 'interfaces' dictionary and it will not represent correct current DUT state, which can cause test case to PASS with hiding real issue.
Issue was observed when 'conn_graph_facts["device_conn"][duthost.hostname]' returns empty interfaces list from 'lab_connection_graph.xml' in 'test_reload_config.py'