OxygenClient

public class OxygenClient
extends Object

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


A class that manages the use of Oxygen client binary to lease or release Oxygen device.

Summary

Fields

public static final sGceDeviceParamsToOxygenMap

Public constructors

OxygenClient(File clientBinary, IRunUtil runUtil)
OxygenClient(File clientBinary)

The constructor of OxygenClient class.

Public methods

void closeLHPConnection(Process p)

Close the connection to the remote oxygenation device with a given Process.

Integer createServerSocket()

Helper to create an unused server socket.

Process createTunnelViaLHP(OxygenClient.LHPTunnelMode mode, String portNumber, String instanceName, String deviceId)

Create an adb or ssh tunnel to a given instance name and assign the endpoint to a device via LHP based on the given tunnel mode.

String getOverrideCvdPath(TestDeviceOptions deviceOptions)

Returns the value of the 'override_cvd_path' argument in the given TestDeviceOptions.

CommandResult leaseDevice(IBuildInfo b, TestDeviceOptions deviceOptions, MultiMap<String, String> attributes)

Attempt to lease a device by calling Oxygen client binary.

CommandResult leaseMultipleDevices( buildInfos, TestDeviceOptions deviceOptions, MultiMap<String, String> attributes)

Attempt to lease multiple devices by calling Oxygen client binary.

Boolean noWaitForBootSpecified(TestDeviceOptions deviceOptions)

Check if no_wait_for_boot is specified in Oxygen lease request

boolean release(GceAvdInfo gceAvdInfo, TestDeviceOptions deviceOptions)

Attempt to release a device by using Oxygen client binary.

Fields

sGceDeviceParamsToOxygenMap

public static final  sGceDeviceParamsToOxygenMap

Public constructors

OxygenClient

public OxygenClient (File clientBinary, 
                IRunUtil runUtil)

Parameters
clientBinary File

runUtil IRunUtil

OxygenClient

public OxygenClient (File clientBinary)

The constructor of OxygenClient class.

Parameters
clientBinary File: the executable Oxygen client binary file.

Public methods

closeLHPConnection

public void closeLHPConnection (Process p)

Close the connection to the remote oxygenation device with a given Process.

Parameters
p Process

createServerSocket

public Integer createServerSocket ()

Helper to create an unused server socket.

Returns
Integer

createTunnelViaLHP

public Process createTunnelViaLHP (OxygenClient.LHPTunnelMode mode, 
                String portNumber, 
                String instanceName, 
                String deviceId)

Create an adb or ssh tunnel to a given instance name and assign the endpoint to a device via LHP based on the given tunnel mode.

Parameters
mode OxygenClient.LHPTunnelMode

portNumber String

instanceName String

deviceId String

Returns
Process Process of the adb over LHP tunnel.

getOverrideCvdPath

public String getOverrideCvdPath (TestDeviceOptions deviceOptions)

Returns the value of the 'override_cvd_path' argument in the given TestDeviceOptions.

Parameters
deviceOptions TestDeviceOptions: TestDeviceOptions

Returns
String the value of 'override_cvd_path', or null if it is not present

leaseDevice

public CommandResult leaseDevice (IBuildInfo b, 
                TestDeviceOptions deviceOptions, 
                MultiMap<String, String> attributes)

Attempt to lease a device by calling Oxygen client binary.

Parameters
b IBuildInfo: IBuildInfo

deviceOptions TestDeviceOptions: TestDeviceOptions

attributes MultiMap: attributes associated with current invocation

Returns
CommandResult a CommandResult that Oxygen binary returned.

leaseMultipleDevices

public CommandResult leaseMultipleDevices ( buildInfos, 
                TestDeviceOptions deviceOptions, 
                MultiMap<String, String> attributes)

Attempt to lease multiple devices by calling Oxygen client binary.

Parameters
buildInfos : ERROR(/List)

deviceOptions TestDeviceOptions: TestDeviceOptions

attributes MultiMap: attributes associated with current invocation

Returns
CommandResult CommandResult that Oxygen binary returned.

noWaitForBootSpecified

public Boolean noWaitForBootSpecified (TestDeviceOptions deviceOptions)

Check if no_wait_for_boot is specified in Oxygen lease request

Parameters
deviceOptions TestDeviceOptions: TestDeviceOptions

Returns
Boolean true if no_wait_for_boot is specified

release

public boolean release (GceAvdInfo gceAvdInfo, 
                TestDeviceOptions deviceOptions)

Attempt to release a device by using Oxygen client binary.

Parameters
gceAvdInfo GceAvdInfo: GceAvdInfo

deviceOptions TestDeviceOptions: TestDeviceOptions

Returns
boolean a boolean which indicate whether the device release is successful.