def restart_service_and_check(localhost, dut, service, interfaces): """ Restart specified service and check platform status """ logging.info("Restart the %s service" % service) dut.command("sudo systemctl restart %s" % service) logging.info("Wait until all critical services are fully started") wait_critical_processes(dut) logging.info("Wait some time for all the transceivers to be detected") pytest_assert( wait_until(300, 20, check_interface_information, dut, interfaces), "Not all interface information are detected within 300 seconds") logging.info("Check transceiver status") check_transceiver_basic(dut, interfaces) if dut.facts["asic_type"] in ["mellanox"]: from .mellanox.check_hw_mgmt_service import check_hw_management_service from .mellanox.check_sysfs import check_sysfs logging.info("Check the hw-management service") check_hw_management_service(dut) logging.info("Check sysfs") check_sysfs(dut) logging.info("Check that critical processes are healthy for 60 seconds") check_critical_processes(dut, 60)
def teardown_module(duthost, conn_graph_facts): yield logging.info("Tearing down: to make sure all the critical services, interfaces and transceivers are good") interfaces = conn_graph_facts["device_conn"] check_critical_processes(duthost, watch_secs=10) check_interfaces_and_services(duthost, interfaces)
def teardown_module(duthosts, enum_rand_one_per_hwsku_hostname, conn_graph_facts, xcvr_skip_list): duthost = duthosts[enum_rand_one_per_hwsku_hostname] yield logging.info("Tearing down: to make sure all the critical services, interfaces and transceivers are good") interfaces = conn_graph_facts["device_conn"][duthost.hostname] check_critical_processes(duthost, watch_secs=10) check_interfaces_and_services(duthost, interfaces, xcvr_skip_list)
def teardown_module(duthosts, rand_one_dut_hostname): duthost = duthosts[rand_one_dut_hostname] yield daemon_status, daemon_pid = duthost.get_pmon_daemon_status(daemon_name) if daemon_status is not "RUNNING": duthost.start_pmon_daemon(daemon_name) time.sleep(10) logger.info("Tearing down: to make sure all the critical services, interfaces and transceivers are good") check_critical_processes(duthost, watch_secs=10)
def restart_service_and_check(localhost, dut, enum_frontend_asic_index, service, interfaces, xcvr_skip_list): """ Restart specified service and check platform status """ logging.info("Restart the %s service on asic %s" % (service, enum_frontend_asic_index)) asichost = dut.asic_instance(enum_frontend_asic_index) service_name = asichost.get_docker_name(service) dut.command("sudo systemctl restart {}".format(service_name)) for container in dut.get_default_critical_services_list(): if is_service_hiting_start_limit(dut, container) is True: logging.info( "{} hits start limit and clear reset-failed flag".format( container)) dut.shell( "sudo systemctl reset-failed {}.service".format(container)) dut.shell("sudo systemctl start {}.service".format(container)) logging.info("Wait until all critical services are fully started") wait_critical_processes(dut) logging.info("Wait some time for all the transceivers to be detected") pytest_assert( wait_until(300, 20, check_interface_information, dut, enum_frontend_asic_index, interfaces, xcvr_skip_list), "Not all interface information are detected within 300 seconds") logging.info("Check transceiver status on asic %s" % enum_frontend_asic_index) check_transceiver_basic(dut, enum_frontend_asic_index, interfaces, xcvr_skip_list) if dut.facts["asic_type"] in ["mellanox"]: from .mellanox.check_hw_mgmt_service import check_hw_management_service from .mellanox.check_sysfs import check_sysfs logging.info("Check the hw-management service") check_hw_management_service(dut) logging.info("Check sysfs") check_sysfs(dut) logging.info("Check that critical processes are healthy for 60 seconds") check_critical_processes(dut, 60)