OxygenUtil

public class OxygenUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.cloud.OxygenUtil


Utility to interact with Oxygen service.

Summary

Public constructors

OxygenUtil()

Default constructor of OxygenUtil

Public methods

static long[] collectDeviceLaunchMetrics(File logDir)

Collect device launcher metrics from vdl_stdout.

static collectErrorSignatures(File logDir)

Collect error signatures from logs.

static String collectOxygenVersion(File logDir)

Collect oxygen version info from oxygeen_version.txt.

void downloadLaunchFailureLogs(TargetSetupError error, ITestLogger logger)

Download error logs from GCS when Oxygen failed to launch a virtual device.

static LogDataType getDefaultLogType(String logFileName)

Determine a log file's log data type based on its name.

static String getRegionFromZoneMeta(String zone)

Retrieves the region from a given zone string.

static String getTargetRegion(TestDeviceOptions deviceOptions)

Retrieves the target region based on the provided device options.

Public constructors

OxygenUtil

public OxygenUtil ()

Default constructor of OxygenUtil

Public methods

collectDeviceLaunchMetrics

public static long[] collectDeviceLaunchMetrics (File logDir)

Collect device launcher metrics from vdl_stdout.

Parameters
logDir File: directory of logs pulled from remote host.

Returns
long[]

collectErrorSignatures

public static  collectErrorSignatures (File logDir)

Collect error signatures from logs.

Parameters
logDir File: directory of logs pulled from remote host.

Returns

collectOxygenVersion

public static String collectOxygenVersion (File logDir)

Collect oxygen version info from oxygeen_version.txt.

Parameters
logDir File: directory of logs pulled from remote host.

Returns
String

downloadLaunchFailureLogs

public void downloadLaunchFailureLogs (TargetSetupError error, 
                ITestLogger logger)

Download error logs from GCS when Oxygen failed to launch a virtual device.

Parameters
error TargetSetupError: TargetSetupError raised when leasing device through Oxygen service.

logger ITestLogger: The ITestLogger where to log the file

getDefaultLogType

public static LogDataType getDefaultLogType (String logFileName)

Determine a log file's log data type based on its name.

Parameters
logFileName String: The remote log file's name.

Returns
LogDataType A LogDataType which the log file associates with. Will return the type UNKNOWN if unable to determine the log data type based on its name.

getRegionFromZoneMeta

public static String getRegionFromZoneMeta (String zone)

Retrieves the region from a given zone string.

Parameters
zone String: The input zone string in the format "projects/12345/zones/us-west12-a".

Returns
String The extracted region string, e.g., "us-west12".

getTargetRegion

public static String getTargetRegion (TestDeviceOptions deviceOptions)

Retrieves the target region based on the provided device options. If the target region is explicitly set in the device options, it returns the specified region. If the target region is not set, it retrieves the region based on the instance's zone.

Parameters
deviceOptions TestDeviceOptions: The TestDeviceOptions object containing device options.

Returns
String The target region.