Lines Matching full:host
140 def verify(self, host): argument
142 info = self._load_info(host)
144 self._validate_battery(host, info)
146 def _load_info(self, host): argument
148 info = host.get_power_supply_info()
164 def _validate_battery(self, host, info): argument
165 host_info = host.host_info_store.get()
168 data = {'host': host.hostname, 'model': host_info.model}
183 'host': host.hostname,
197 host.run('ectool chargecontrol normal', ignore_status=True)
200 info = self._load_info(host)
206 'model': host.host_info_store.get().model,
217 metrics_data = {'host': host.hostname,
218 'board': host.host_info_store.get().board}
237 """Confirm that current ChromeOS image on the host is matches
242 cause the next test run on the same host gets an unexpected data and
247 def verify(self, host): argument
248 self._verify_cros_version(host)
249 self._verify_job_repo_url(host)
251 def _verify_cros_version(self, host): argument
252 """Verify that cros-version match version on the host."""
255 label_match = host.verify_cros_version_label()
262 host.hostname, e)
265 raise hosts.AutoservVerifyError('ChromeOS image on the host'
269 def _verify_job_repo_url(self, host): argument
270 """Verify that job_repo_url match version on the host."""
271 info = host.host_info_store.get()
276 os_from_host = host.get_release_builder_path()
278 raise hosts.AutoservVerifyError('ChromeOS image on the host'
285 return 'ChromeOS image on host matches cros_version label'
313 def verify(self, host): argument
318 if not host.is_file_system_writable([testdir]):
334 def verify(self, host): argument
341 output = host.run(command=command, ignore_status=True).stdout
348 output = host.run(command=command, ignore_status=True).stdout
376 def verify(self, host): argument
378 result = host.run('test -f %s' % provisioner.PROVISION_FAILED,
391 """Verify that the host's TPM is in a good state."""
394 def verify(self, host): argument
396 if _is_virtual_machine(host):
397 # We do not forward host TPM / emulated TPM to qemu VMs, so skip
403 status = TpmStatus(host)
421 return 'The host\'s TPM is available and working'
428 def verify(self, host): argument
430 result = host.run('python -c "import json"',
435 search = host.run('which python', ignore_status=True)
444 return 'Python on the host is installed and working'
448 """Verify that the host is not in dev mode."""
451 def verify(self, host): argument
454 info = host.host_info_store.get()
459 result = host.run('crossystem devsw_boot', ignore_status=True).stdout
461 raise hosts.AutoservVerifyError('The host is in dev mode')
466 return 'The host should not be in dev mode'
470 """Verify that the host is set to boot the internal disk by default."""
473 def verify(self, host): argument
475 result = host.run('crossystem dev_default_boot', ignore_status=True)
479 'The host has incorrect dev_default_boot value: %r'
485 return 'The host should have dev_default_boot=disk'
489 """Verify that the host has HWID & serial number."""
492 def verify(self, host): argument
494 info = host.host_info_store.get()
506 host.set_device_repair_state(
510 host_hwid = host.run('crossystem hwid', ignore_status=True).stdout
511 host_serial_number = self._get_serial_number(host, info_serial_number)
514 'Failed to get HWID & Serial Number for host %s' %
515 host.hostname)
521 'host': host.hostname,
534 host.set_device_repair_state(
537 def _get_serial_number(self, host, serial_number): argument
543 @param host CrosHost
544 @param serial_number Serial-number from host-info
546 req = host.run('vpd -g serial_number', ignore_status=True)
551 l1 = host.run('vpd -l', ignore_status=True)
552 l2 = host.run('vpd -l |grep "\"serial_number\"="',
559 host.run(cmd % serial_number, ignore_status=True)
560 host.run('dump_vpd_log --force', ignore_status=True)
562 req = host.run('vpd -g serial_number', ignore_status=True)
565 def _is_applicable(self, host): argument
566 if host.is_satlab():
574 return 'The host should have valid HWID and Serial Number'
607 def verify(self, host): argument
609 if self._get_enrollment_state(host):
614 def _get_enrollment_state(self, host): argument
616 response = host.run('grep "check_enrollment" %s' % self.VPD_CACHE,
627 def _is_applicable(self, host): argument
628 info = host.host_info_store.get()
635 return 'The enrollment state is clean on the host'
653 def verify(self, host): argument
656 result = host.run('crossystem %s' % field, ignore_status=True)
667 def _is_applicable(self, host): argument
668 return cros_firmware._is_firmware_testing_device(host)
681 def verify(self, host): argument
684 status = TpmStatus(host)
696 result = host.run('cryptohome --action=tpm_status')
714 def verify(self, host): argument
718 result = host.run('cryptohome --action=tpm_more_status')
723 result = host.run('cryptohome --action=tpm_attestation_get_ek')
743 def verify(self, host): argument
746 host.run('pgrep ap-controller')
767 def verify(self, host): argument
769 host.run('stop ui && start ui', ignore_status=True, timeout=45)
783 to re-image the host to recover it.
784 If host-info has label 'cr50' then we expect to have GSC tool on the host.
790 def verify(self, host): argument
791 r = host.run(self.VERIFY_GSC_CMD, ignore_status=True, timeout=10)
797 def _is_applicable(self, host): argument
798 host_info = host.host_info_store.get()
801 logging.info('GSC is not on the host.')
817 def verify(self, host): argument
821 usb_dev = host._servo_host._probe_and_validate_usb_dev()
825 host_info = host.host_info_store.get()
829 host.host_info_store.commit(host_info)
848 host.host_info_store.commit(host_info)
850 def _is_applicable(self, host): argument
851 if host.servo:
869 def verify(self, host): argument
871 verifier = audit_verify.VerifyDutStorage(host)
879 host.set_device_needs_replacement()
895 def verify(self, host): argument
899 state = self._get_validator(host).validate()
908 host.set_device_needs_replacement()
910 def _is_applicable(self, host): argument
911 return self._get_validator(host).is_battery_expected()
913 def _get_validator(self, host): argument
915 self._validator = battery_validator.BatteryValidator(host)
924 """Not critical verify to flash servo keyboard for the host.
926 Check if host support servo keyboard and update if firmware is not present.
930 def verify(self, host): argument
933 if flasher.is_image_supported(host):
934 flasher.update(host)
938 'Fail to verify/update servo keyboard map on the host.')
940 def _is_applicable(self, host): argument
941 if host.servo:
951 """Not critical verify to cache NIC mac address for the host on servo.
958 def verify(self, host): argument
961 helper.update_if_needed(host)
965 'Fail to verify/update servo NIC mac address for host.')
967 def _is_applicable(self, host): argument
968 if host.servo:
980 def _collect_logs(self, host): argument
983 local_log_dir = crashcollect.get_crashinfo_dir(host, dirname)
985 crashcollect.get_crashinfo(host, None)
987 def _check_reset_success(self, host): argument
990 if host.wait_up(host.BOOT_TIMEOUT):
991 if host.get_verifier_state('ssh') == hosts.VERIFY_SUCCESS:
998 self._collect_logs(host)
1008 'Host %s is offline after %s.' % (host.hostname, self.tag),
1022 def repair(self, host): argument
1024 repair_utils.require_servo(host, ignore_state=True)
1030 host.servo.sysrq_x()
1037 self._check_reset_success(host)
1049 def repair(self, host): argument
1051 repair_utils.require_servo(host, ignore_state=True)
1052 host.servo.get_power_state_controller().reset()
1053 self._check_reset_success(host)
1055 def _is_applicable(self, host): argument
1056 if host.servo:
1074 def repair(self, host): argument
1077 host.servo.get_power_state_controller().cr50_reset()
1078 self._check_reset_success(host)
1083 if host.servo.main_device_uses_gsc_drv():
1084 host.servo.initialize_dut()
1086 def _is_applicable(self, host): argument
1087 if host.servo:
1088 if host.servo.has_control('cr50_reboot'):
1102 def repair(self, host): argument
1104 host.run('crossystem dev_default_boot=disk', ignore_status=True)
1116 def repair(self, host): argument
1120 host.run('/usr/share/vboot/bin/set_gbb_flags.sh 0',
1122 host.run('crossystem disable_dev_request=1',
1124 super(CrosRebootRepair, self).repair(host)
1129 return 'Reset GBB flags and Reboot the host'
1133 """Repair issue with provisioning labels for the host.
1140 def repair(self, host): argument
1141 afe_utils.clean_provision_labels(host)
1146 return 'Cleanup provisioning labels for the host'
1153 def repair(self, host): argument
1155 host.run('/usr/sbin/update_rw_vpd check_enrollment 0')
1158 tpm_utils.ClearTPMOwnerRequest(host, wait_for_ready=True,
1159 timeout=host.BOOT_TIMEOUT)
1161 def _is_applicable(self, host): argument
1162 info = host.host_info_store.get()
1169 return 'Cleanup enrollment state and reboot the host'
1181 def repair(self, host): argument
1183 image_name = host.get_cros_repair_image_name()
1185 devserver = dev_server.ImageServer.resolve(image_name, host.hostname)
1189 afe_utils.machine_install_and_update_labels(host, update_url)
1194 return 'Re-install the stable build on the host'
1206 def repair(self, host): argument
1208 host.run('echo "fast safe" > '
1210 host.reboot(timeout=host.POWERWASH_BOOT_TIMEOUT, wait=True)
1211 super(PowerWashRepair, self).repair(host)
1216 return 'Powerwash and then re-install the stable build on the host'
1230 def repair(self, host): argument
1233 repair_utils.require_servo(host, ignore_state=True)
1234 image_name = host.get_cros_repair_image_name()
1235 image_name_on_usb = host._servo_host.validate_image_usbkey()
1246 if not need_update_image and host.health_profile:
1247 repair_failed_count = host.health_profile.get_repair_fail_count()
1260 _, update_url = host.stage_image_for_servo()
1261 afe_utils.clean_provision_labels(host)
1263 need_snk = host.require_snk_mode_in_recovery()
1265 host.servo.get_power_state_controller().power_off()
1268 host.install_image_to_servo_usb(image_url=update_url)
1272 self._format_usb_storage(host)
1275 host.servo.get_power_state_controller().power_on()
1282 host.boot_in_recovery_mode(need_snk=need_snk)
1286 host.run_install_image(install_timeout=host.ADMIN_INSTALL_TIMEOUT * 2,
1289 afe_utils.add_provision_labels(host, host.VERSION_PREFIX, image_name)
1291 host_info = host.host_info_store.get()
1295 metrics_data = {'host': host.hostname, 'usb_state': usb_state}
1299 def _format_usb_storage(self, host): argument
1304 usb_path = host.servo.probe_host_usb_dev()
1307 host._servo_host.run(cmd, ignore_status=True)
1318 """Repair a host by resetting it with servo.
1326 def repair(self, host): argument
1328 host.servo.get_power_state_controller().reset()
1329 self._check_reset_success(host)
1331 def _is_applicable(self, host): argument
1332 if not host.servo:
1334 if host.is_marked_for_replacement():
1338 usb_install = host.get_repair_strategy_node('usb')
1355 """Recover FW on the host when host can boot in recovery mode.
1360 If host can boot in recovery mode but fail boot in default mode then
1362 on the host by booting from USB-key.
1365 # Command to update firmware located on host
1369 def repair(self, host): argument
1373 host.servo.switch_usbkey('host')
1374 time.sleep(host.servo.USB_DETECTION_DELAY)
1375 # Power off the DUT as in this case the host will boot
1377 host.servo.get_power_state_controller().power_off()
1382 # Boot host in recovery mode as it is working and verified
1384 need_snk = host.require_snk_mode_in_recovery()
1386 host.boot_in_recovery_mode(need_snk=need_snk)
1387 logging.debug('Host booted in recovery mode')
1389 result = host.run(self._FW_UPDATE_CMD, ignore_status=True)
1393 host.halt()
1406 host.servo.get_power_state_controller().power_off()
1407 host.servo.switch_usbkey('off')
1410 host.servo.set_servo_v4_role('src')
1412 host.servo.get_power_state_controller().reset()
1413 self._check_reset_success(host)
1415 def _is_applicable(self, host): argument
1416 if not host.servo:
1418 if host.is_marked_for_replacement():
1422 usb_install = host.get_repair_strategy_node('usb')
1430 dhp = host.health_profile
1444 return 'Recover FW on the host after USB-install'
1455 def repair(self, host): argument
1457 repair_utils.require_servo(host, ignore_state=True)
1461 host.servo.get_ec_board()
1467 host.servo.get_power_state_controller().reset()
1469 if host.servo.get('battery_is_charging'):
1481 self._set_pd_dualrole(host, 'off')
1482 self._set_pd_dualrole(host, 'on')
1483 self._set_pd_dualrole(host, 'source')
1484 self._set_pd_dualrole(host, 'sink')
1488 host.servo.get_power_state_controller().reset()
1490 if not host.servo.get('battery_is_charging'):
1494 self._check_reset_success(host)
1496 def _set_pd_dualrole(self, host, role): argument
1497 host.servo.set_nocheck('ec_uart_flush', 'off')
1498 host.servo.set_nocheck('ec_uart_cmd', 'pd dualrole %s' % role)
1499 host.servo.set_nocheck('ec_uart_flush', 'on')
1502 def _is_applicable(self, host): argument
1503 if not host._servo_host.is_ec_supported():
1506 host_info = host.host_info_store.get()
1522 def repair(self, host): argument
1524 host.run('rm -f /var/cache/ap/setup-network', ignore_status=True)
1525 host.run('rm -f /home/chronos/.oobe_completed', ignore_status=True)
1526 host.run('rm -f /home/.shadow/.can_attempt_ownership',
1528 host.run('crossystem clear_tpm_owner_request=1', ignore_status=True)
1529 host.reboot()
1541 def repair(self, host): argument
1543 host.cleanup_services()
1668 # the logic to create action/verifier DAG for different host
1743 # to create action/verifier DAG for different host type
1864 def _is_virtual_machine(host): argument
1865 """Determine whether the given |host| is a virtual machine.
1867 @param host: a hosts.Host object.
1868 @returns True if the host is a virtual machine, False otherwise.
1870 output = host.run('cat /proc/cpuinfo | grep "model name"',
1877 """Wrapper for getting cryptohome status from a host."""
1879 def __init__(self, host): argument
1881 self.update(_get_tpm_status(host))
1904 def _get_tpm_status(host): argument
1907 @param host: a hosts.Host object.
1914 output = host.run(