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 OxygenClient createOxygenClient(File file)

Helper to create an OxygenClient.

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

createOxygenClient

public static OxygenClient createOxygenClient (File file)

Helper to create an OxygenClient.

Parameters
file File: the Oxygen client binary file.

Returns
OxygenClient an OxygenClient class to create CF devices.

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.