Lines Matching refs:AFE
17 * The DUTs are not necessarily in the AFE database. DUTs that
34 * If the DUT isn't in the AFE database, add it.
108 """Exception when there is no servo port stored in the AFE."""
173 def _update_build(afe, report_log, arguments):
180 * The stable test version currently in the AFE database.
196 @param afe AFE object for RPC calls.
202 # Gather the current AFE and Omaha version settings, and report them
204 cros_version_map = afe.get_stable_version_map(afe.CROS_IMAGE_TYPE)
205 fw_version_map = afe.get_stable_version_map(afe.FIRMWARE_IMAGE_TYPE)
209 report_log.write('AFE version is %s.\n' % afe_cros)
211 report_log.write('AFE firmware is %s.\n' % afe_fw)
234 # `fw_version` is our new target firmware. Call the AFE back with
257 def _create_host(hostname, afe, afe_host):
260 This host object is used to update AFE label information for the DUT, but
265 @param afe A frontend.AFE object.
266 @param afe_host AFE Host object for the DUT.
271 'host_info_store': afe_store.AfeStore(hostname, afe),
277 """Lock a host in the AFE, and report whether it succeeded.
282 @param afe_host AFE Host instance to be locked.
297 """Unlock a host in the AFE, and report whether it succeeded.
302 @param afe_host AFE Host instance to be unlocked.
315 def _update_host_attributes(afe, hostname, host_attrs):
318 @param afe AFE object for RPC calls.
325 afe.set_host_attribute(servo_host.SERVO_HOST_ATTR,
328 afe.set_host_attribute(servo_host.SERVO_PORT_ATTR,
332 afe.set_host_attribute(servo_host.SERVO_SERIAL_ATTR,
355 def _wait_for_idle(afe, host_id):
358 Poll the host with the given `host_id` via `afe`, waiting for it
361 @param afe AFE object for RPC calls.
365 afe_host = afe.get_hosts(id=host_id)[0]
372 def _ensure_host_idle(afe, afe_host):
379 @param afe AFE object for RPC calls.
394 afe = frontend.AFE(server=afe_host.shard)
395 afe_host = afe.get_hosts(id=afe_host.id)[0]
398 afe.run('abort_special_tasks', host_id=afe_host.id, is_active=1)
399 return not retry.timeout(_wait_for_idle, (afe, afe_host.id),
403 def _get_afe_host(afe, hostname, host_attrs, arguments):
404 """Get an AFE Host object for the given host.
412 @param afe AFE object for RPC calls.
422 hostlist = afe.get_hosts([hostname])
431 if not _ensure_host_idle(afe, afe_host):
439 _update_host_attributes(afe, hostname, host_attrs)
441 afe_host = afe.create_host(hostname,
444 _update_host_attributes(afe, hostname, host_attrs)
447 # supplied board/model matches the AFE information.
451 afe_host = afe.get_hosts([hostname])[0]
462 board in AFE.
485 to the AFE.
541 def _install_and_update_afe(afe, hostname, host_attrs, arguments):
542 """Perform all installation and AFE updates.
549 If installation succeeds, make sure the DUT is in the AFE,
552 @param afe AFE object for RPC calls.
558 afe_host, unlock_on_failure = _get_afe_host(afe, hostname, host_attrs,
562 host = _create_host(hostname, afe, afe_host)
568 platform_labels = afe.get_labels(
572 new_labels = afe.get_labels(name=platform)
574 afe.create_label(platform, platform=True)
597 stored in the AFE.
605 # the AFE frontend may print 'FAILED RPC CALL' (boo, hiss). We
608 # we make any AFE calls. Note that this is reasonable because we're
616 afe = frontend.AFE(server=arguments.web)
618 _install_and_update_afe(afe, hostname,
651 def _report_results(afe, report_log, hostnames, results):
658 @param afe AFE object for RPC calls.
674 afe.repair_hosts(hostnames=successful_hosts)
675 for h in afe.get_hosts(hostnames=successful_hosts):
715 def _get_used_servo_ports(servo_hostname, afe):
720 @param afe: AFE instance.
725 host_list = afe.get_hosts_by_attribute(
728 afe_host = afe.get_hosts(hostname=host)
736 def _get_free_servo_port(servo_hostname, used_servo_ports, afe):
743 @param afe: AFE instance.
757 # If we haven't checked this servo host yet, check the AFE if other duts
760 used_ports = _get_used_servo_ports(servo_hostname, afe)
778 def _get_afe_servo_port(host_info, afe):
780 Get the servo port from the afe if it matches the same servo host hostname.
788 port host attribute in the AFE for the given host.
790 afe_hosts = afe.get_hosts(hostname=host_info.hostname)
805 def _get_host_attributes(host_info_list, afe):
821 # If the host already has an entry in the AFE that matches the same
825 host_info, afe)
829 afe)
837 @param host: hosts.CrosHost object. This object need not have an AFE
879 afe = frontend.AFE(server=arguments.web)
883 current_build = _update_build(afe, report_log, arguments)
884 host_attr_dict = _get_host_attributes(arguments.host_info_list, afe)
889 _report_results(afe, report_log, arguments.hostnames, results_list)