GceManager
public class GceManager
extends Object
java.lang.Object | |
↳ | com.android.tradefed.device.cloud.GceManager |
Assistant qui gère les appels GCE pour démarrer/arrêter et collecter les journaux de GCE.
Résumé
Des champs | |
---|---|
public static final String | GCE_HOSTNAME_KEY |
public static final String | GCE_INSTANCE_CLEANED_KEY |
public static final String | GCE_INSTANCE_NAME_KEY
|
Constructeurs publics | |
---|---|
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo) Cteur | |
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, testResourceBuildInfos) GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, testResourceBuildInfos) Ce constructeur est obsolète. Utilisez d'autres constructeurs, nous les gardons temporairement pour des raisons de compatibilité ascendante. | |
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost) Ctor, variante qui peut être utilisée pour fournir le nom de l'instance GCE à utiliser directement. |
Méthodes publiques | |
---|---|
static boolean | AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname) Acloud réel s'exécute pour arrêter le périphérique virtuel. |
void | cleanUp () |
static File | getBugreportzWithSsh ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) Obtenez un rapport de bug de l'appareil en utilisant ssh pour éviter tout problème potentiel de connexion adb. |
static String | getInstanceSerialLog ( GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil) Lit le contenu actuel du journal série de l'instance Gce Avd. |
static File | getNestedDeviceSshBugreportz ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) Obtenez un rapport de bug via ssh pour une instance imbriquée. |
static void | logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type) Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le. |
static void | logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName) Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le. |
void | logSerialOutput ( GceAvdInfo infos, ITestLogger logger) Enregistrez la sortie série d'un périphérique décrit par |
static CommandResult | remoteSshCommandExecution ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command) Exécutez la commande à distance via ssh sur une instance. |
boolean | shutdownGce () Arrêtez l'instance Gce associée à |
GceAvdInfo | startGce () |
GceAvdInfo | startGce (String ipDevice, MultiMap<String, String> attributes) Tentative de démarrage d'une instance gce |
Méthodes protégées | |
---|---|
buildGceCmd (File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes) Générez et renvoyez la commande pour lancer GCE. | |
String | extractInstanceName (String bootupLogs) Récupérez le nom de l'instance dans les journaux de démarrage de gce. |
Des champs
GCE_HOSTNAME_KEY
public static final String GCE_HOSTNAME_KEY
GCE_INSTANCE_CLEANED_KEY
public static final String GCE_INSTANCE_CLEANED_KEY
GCE_INSTANCE_NAME_KEY
public static final String GCE_INSTANCE_NAME_KEY
Constructeurs publics
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)
Cteur
Paramètres | |
---|---|
deviceDesc | DeviceDescriptor : Le DeviceDescriptor qui sera associé au périphérique GCE. |
deviceOptions | TestDeviceOptions : Un TestDeviceOptions associé à l’appareil. |
buildInfo | IBuildInfo : Un IBuildInfo décrivant le build gce à démarrer. |
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,testResourceBuildInfos)
Ce constructeur est obsolète.
Utilisez d'autres constructeurs, nous les gardons temporairement pour des raisons de compatibilité ascendante.
Paramètres | |
---|---|
deviceDesc | DeviceDescriptor |
deviceOptions | TestDeviceOptions |
buildInfo | IBuildInfo |
testResourceBuildInfos |
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor, variante qui peut être utilisée pour fournir le nom de l'instance GCE à utiliser directement.
Paramètres | |
---|---|
deviceDesc | DeviceDescriptor : Le DeviceDescriptor qui sera associé au périphérique GCE. |
deviceOptions | TestDeviceOptions : Un TestDeviceOptions associé au périphérique |
buildInfo | IBuildInfo : Un IBuildInfo décrivant le build gce à démarrer. |
gceInstanceName | String : Le nom de l'instance à utiliser. |
gceHost | String : Le nom d'hôte ou l'adresse IP de l'instance à utiliser. |
Méthodes publiques
AcloudArrêt
public static boolean AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname)
Acloud réel s'exécute pour arrêter le périphérique virtuel.
Paramètres | |
---|---|
options | TestDeviceOptions : Les TestDeviceOptions pour les options Acloud |
runUtil | IRunUtil : L' IRunUtil pour exécuter Acloud |
instanceName | String : L'instance à arrêter. |
hostname | String : nom d'hôte de l'instance, utilisé uniquement pour la seiche Oxygen. |
Retour | |
---|---|
boolean | Vrai en cas de succès |
nettoyer
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un rapport de bug de l'appareil en utilisant ssh pour éviter tout problème potentiel de connexion adb.
Paramètres | |
---|---|
gceAvd | GceAvdInfo : Le GceAvdInfo qui décrit le périphérique. |
options | TestDeviceOptions : un TestDeviceOptions décrivant les options de périphérique à utiliser pour le périphérique GCE. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
Retour | |
---|---|
File | Un fichier pointant vers le rapport de bug zip, ou null si un problème est survenu. |
getInstanceSerialLog
public static String getInstanceSerialLog (GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil)
Lit le contenu actuel du journal série de l'instance Gce Avd.
Paramètres | |
---|---|
infos | GceAvdInfo : Le GceAvdInfo décrivant l'instance. |
avdConfigFile | File : le fichier de configuration avd |
jsonKeyFile | File : le fichier de clé json du compte de service. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
Retour | |
---|---|
String | La sortie du journal série ou null en cas de problème. |
getNestedDeviceSshBugreportz
public static File getNestedDeviceSshBugreportz (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un rapport de bug via ssh pour une instance imbriquée. Cela nécessite de demander l'adb dans l'instance virtuelle imbriquée.
Paramètres | |
---|---|
gceAvd | GceAvdInfo : Le GceAvdInfo qui décrit le périphérique. |
options | TestDeviceOptions : un TestDeviceOptions décrivant les options de périphérique à utiliser pour le périphérique GCE. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
Retour | |
---|---|
File | Un fichier pointant vers le rapport de bug zip, ou null si un problème est survenu. |
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le.
Paramètres | |
---|---|
logger | ITestLogger : l' ITestLogger où enregistrer le fichier. |
gceAvd | GceAvdInfo : Le GceAvdInfo qui décrit le périphérique. |
options | TestDeviceOptions : un TestDeviceOptions décrivant les options de périphérique à utiliser pour le périphérique GCE. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
remoteFilePath | String : Le chemin distant où trouver le fichier. |
type | LogDataType : le LogDataType du fichier journalisé. |
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le.
Paramètres | |
---|---|
logger | ITestLogger : l' ITestLogger où enregistrer le fichier. |
gceAvd | GceAvdInfo : Le GceAvdInfo qui décrit le périphérique. |
options | TestDeviceOptions : un TestDeviceOptions décrivant les options de périphérique à utiliser pour le périphérique GCE. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
remoteFilePath | String : Le chemin distant où trouver le fichier. |
type | LogDataType : le LogDataType du fichier journalisé. |
baseName | String : Le nom de base à utiliser pour enregistrer le fichier. Si nul, le nom de fichier réel sera utilisé. |
logSerialOutput
public void logSerialOutput (GceAvdInfo infos, ITestLogger logger)
Enregistrez la sortie série d'un périphérique décrit par GceAvdInfo
.
Paramètres | |
---|---|
infos | GceAvdInfo : Le GceAvdInfo décrivant l'instance. |
logger | ITestLogger : l' ITestLogger où enregistrer le journal série. |
RemoteSshCommandExecution
public static CommandResult remoteSshCommandExecution (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)
Exécutez la commande à distance via ssh sur une instance.
Paramètres | |
---|---|
gceAvd | GceAvdInfo : Le GceAvdInfo qui décrit le périphérique. |
options | TestDeviceOptions : un TestDeviceOptions décrivant les options de périphérique à utiliser pour le périphérique GCE. |
runUtil | IRunUtil : un IRunUtil pour exécuter des commandes. |
timeoutMs | long : Le délai d'attente en millisecondes pour la commande. 0 signifie pas de délai d'attente. |
command | String : La commande distante à exécuter. |
Retour | |
---|---|
CommandResult | CommandResult contenant le résultat de l'exécution. |
arrêtGce
public boolean shutdownGce ()
Arrêtez l'instance Gce associée à startGce()
.
Retour | |
---|---|
boolean | renvoie true si l'arrêt de gce a été demandé comme non bloquant. |
démarrerGce
public GceAvdInfo startGce (String ipDevice, MultiMap<String, String> attributes)
Tentative de démarrage d'une instance gce
Paramètres | |
---|---|
ipDevice | String : l'adresse IP initiale de l'instance GCE dans laquelle exécuter AVD, null si non applicable |
attributes | MultiMap : attributs associés à l'invocation en cours, utilisés pour transmettre les informations applicables à l'instance GCE à ajouter en tant que métadonnées de la VM |
Retour | |
---|---|
GceAvdInfo | un GceAvdInfo décrivant l'instance GCE. Il pourrait s'agir d'une instance BOOT_FAIL. |
Jetés | |
---|---|
TargetSetupError |
Méthodes protégées
buildGceCmd
protectedbuildGceCmd (File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes)
Générez et renvoyez la commande pour lancer GCE. Exposé pour les tests.
Paramètres | |
---|---|
reportFile | File |
b | IBuildInfo |
ipDevice | String |
attributes | MultiMap |
Retour | |
---|---|
extraireNomInstance
protected String extractInstanceName (String bootupLogs)
Récupérez le nom de l'instance dans les journaux de démarrage de gce. Recherchez le 'nom' : 'gce-
Paramètres | |
---|---|
bootupLogs | String |
Retour | |
---|---|
String |