Skip to content

Function from platform interface utils (check_interface_information) should be fixed #2647

@yvolynets-mlnx

Description

@yvolynets-mlnx

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions