def test_show_chassis_module_midplane_status(duthosts, enum_rand_one_per_hwsku_hostname): """ @summary: Verify output of `show chassis-module midplane-status` """ cmd = " ".join([CMD_SHOW_CHASSIS_MODULE, "midplane-status"]) logger.info("verifying output of cli command {}".format(cmd)) expected_headers = ["Name", "IP-Address", "Reachability"] duthost = duthosts[enum_rand_one_per_hwsku_hostname] output = duthost.command(cmd) res_mid_status = parse_chassis_module(output['stdout_lines'], expected_headers) mod_key = ['line-cards'] skip_mod_list = get_skip_mod_list(duthost, mod_key) for mod_idx in res_mid_status: mod_mid_status = res_mid_status[mod_idx]['Reachability'] if mod_idx in skip_mod_list: pytest_assert( res_mid_status[mod_idx]['Reachability'] == "False", "reachability of line card {} expected false but is {}".format( mod_idx, mod_mid_status)) else: pytest_assert( mod_mid_status == "True", "midplane reachability of line card {} expected true but is {}" .format(mod_idx, mod_mid_status))
def test_show_chassis_module_status(duthosts, enum_rand_one_per_hwsku_hostname): cmd = " ".join([CMD_SHOW_CHASSIS_MODULE, "status"]) logger.info("verifying output of cli command {}".format(cmd)) duthost = duthosts[enum_rand_one_per_hwsku_hostname] exp_headers = [ "Name", "Description", "Physical-Slot", "Oper-Status", "Admin-Status" ] skip_mod_list = get_skip_mod_list(duthost) output = duthost.command(cmd) res = parse_chassis_module(output['stdout_lines'], exp_headers) # by default will assume all modules should be shown online except in skip_module_list for mod_idx in res.keys(): if mod_idx in skip_mod_list: pytest_assert( res[mod_idx]['Oper-Status'] == 'Empty', "Oper-status for slot {} should be Empty but it is {}".format( mod_idx, res[mod_idx]['Oper-Status'])) else: pytest_assert( res[mod_idx]['Oper-Status'] == 'Online', "Oper-status for slot {} should be Online but it is {}".format( mod_idx, res[mod_idx]['Oper-Status']))