1#!/usr/bin/env python 2# 3# Copyright 2016 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16"""This module holds constants used by the driver.""" 17BRANCH_PREFIX = "git_" 18BUILD_TARGET_MAPPING = { 19 # TODO: Add aosp goldfish targets and internal cf targets to vendor code 20 # base. 21 "aosp_phone": "aosp_cf_x86_phone-userdebug", 22 "aosp_tablet": "aosp_cf_x86_tablet-userdebug", 23} 24SPEC_NAMES = { 25 "nexus5", "nexus6", "nexus7_2012", "nexus7_2013", "nexus9", "nexus10" 26} 27 28DEFAULT_SERIAL_PORT = 1 29LOGCAT_SERIAL_PORT = 2 30 31# Remote image parameters 32BUILD_TARGET = "build_target" 33BUILD_BRANCH = "build_branch" 34BUILD_ID = "build_id" 35 36# AVD types 37TYPE_CHEEPS = "cheeps" 38TYPE_CF = "cuttlefish" 39TYPE_GCE = "gce" 40TYPE_GF = "goldfish" 41 42# Image types 43IMAGE_SRC_REMOTE = "remote_image" 44IMAGE_SRC_LOCAL = "local_image" 45 46# AVD types in build target 47AVD_TYPES_MAPPING = { 48 TYPE_GCE: "gce", 49 TYPE_CF: "cf", 50 TYPE_GF: "sdk", 51 # Cheeps uses the cheets target. 52 TYPE_CHEEPS: "cheets", 53} 54 55# Instance types 56INSTANCE_TYPE_REMOTE = "remote" 57INSTANCE_TYPE_LOCAL = "local" 58 59# Flavor types 60FLAVOR_PHONE = "phone" 61FLAVOR_AUTO = "auto" 62FLAVOR_WEAR = "wear" 63FLAVOR_TV = "tv" 64FLAVOR_IOT = "iot" 65FLAVOR_TABLET = "tablet" 66FLAVOR_TABLET_3G = "tablet_3g" 67ALL_FLAVORS = [ 68 FLAVOR_PHONE, FLAVOR_AUTO, FLAVOR_WEAR, FLAVOR_TV, FLAVOR_IOT, 69 FLAVOR_TABLET, FLAVOR_TABLET_3G 70] 71 72# HW Property 73HW_ALIAS_CPUS = "cpu" 74HW_ALIAS_RESOLUTION = "resolution" 75HW_ALIAS_DPI = "dpi" 76HW_ALIAS_MEMORY = "memory" 77HW_ALIAS_DISK = "disk" 78HW_PROPERTIES_CMD_EXAMPLE = ( 79 " %s:2,%s:1280x700,%s:160,%s:2g,%s:2g" % 80 (HW_ALIAS_CPUS, 81 HW_ALIAS_RESOLUTION, 82 HW_ALIAS_DPI, 83 HW_ALIAS_MEMORY, 84 HW_ALIAS_DISK) 85) 86HW_PROPERTIES = [HW_ALIAS_CPUS, HW_ALIAS_RESOLUTION, HW_ALIAS_DPI, 87 HW_ALIAS_MEMORY, HW_ALIAS_DISK] 88HW_X_RES = "x_res" 89HW_Y_RES = "y_res" 90 91USER_ANSWER_YES = {"y", "yes", "Y"} 92 93# Cuttlefish groups 94LIST_CF_USER_GROUPS = ["kvm", "cvdnetwork"] 95 96ADB_PORT = "adb_port" 97VNC_PORT = "vnc_port" 98# For cuttlefish remote instances 99CF_ADB_PORT = 6520 100CF_VNC_PORT = 6444 101# For cheeps remote instances 102CHEEPS_ADB_PORT = 9222 103CHEEPS_VNC_PORT = 5900 104# For gce_x86_phones remote instances 105GCE_ADB_PORT = 5555 106GCE_VNC_PORT = 6444 107# For goldfish remote instances 108GF_ADB_PORT = 5555 109GF_VNC_PORT = 6444 110 111COMMAND_PS = ["ps", "aux"] 112CMD_LAUNCH_CVD = "launch_cvd" 113CMD_STOP_CVD = "stop_cvd" 114ENV_ANDROID_BUILD_TOP = "ANDROID_BUILD_TOP" 115ENV_ANDROID_HOST_OUT = "ANDROID_HOST_OUT" 116ENV_BUILD_TARGET = "TARGET_PRODUCT" 117 118LOCALHOST = "127.0.0.1" 119LOCALHOST_ADB_SERIAL = LOCALHOST + ":%d" 120 121SSH_BIN = "ssh" 122ADB_BIN = "adb" 123 124LABEL_CREATE_BY = "created_by" 125 126# for list and delete cmd 127INS_KEY_NAME = "name" 128INS_KEY_FULLNAME = "full_name" 129INS_KEY_STATUS = "status" 130INS_KEY_DISPLAY = "display" 131INS_KEY_IP = "ip" 132INS_KEY_ADB = "adb" 133INS_KEY_VNC = "vnc" 134INS_KEY_CREATETIME = "creationTimestamp" 135INS_KEY_AVD_TYPE = "avd_type" 136INS_KEY_AVD_FLAVOR = "flavor" 137INS_KEY_IS_LOCAL = "remote" 138INS_STATUS_RUNNING = "RUNNING" 139LOCAL_INS_NAME = "local-instance" 140 141TEMP_ARTIFACTS_FOLDER = "acloud_image_artifacts" 142TOOL_NAME = "acloud" 143EXIT_BY_USER = 1 144EXIT_BY_ERROR = -99 145