dut_services

package
v0.0.0-...-d996d1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DUTServicesImpl

type DUTServicesImpl struct {
	// contains filtered or unexported fields
}

DUTServicesImpl implement details of IDUTServices

func (*DUTServicesImpl) GetBoard

func (d *DUTServicesImpl) GetBoard(ctx context.Context, IP string) (string, error)

GetBoard get the DUT's board from `lsb-release`

func (*DUTServicesImpl) GetCCDStatus

func (d *DUTServicesImpl) GetCCDStatus(ctx context.Context, address string) (string, error)

GetCCDStatus gets the CCD status from the given IP address. If it the command return empty string, we set it `Unknown` status.

func (*DUTServicesImpl) GetConnectedIPs

func (d *DUTServicesImpl) GetConnectedIPs(ctx context.Context) ([]Device, error)

GetConnectedIPs get the connected IPs from `dnsmasq.lease` and then check the IPs are alive.

func (*DUTServicesImpl) GetGSCSerialAndServoUSBCount

func (d *DUTServicesImpl) GetGSCSerialAndServoUSBCount(ctx context.Context, IP string) (*GSCInfo, error)

GetGSCSerialAndServoUSBCount returns the cr50/ti50 usb connector serial number for the given IP

func (*DUTServicesImpl) GetModel

func (d *DUTServicesImpl) GetModel(ctx context.Context, IP string) (string, error)

GetModel get the DUT's model from `cros_config / test-label` / `cros_config / name`

func (*DUTServicesImpl) GetServoSerial

func (d *DUTServicesImpl) GetServoSerial(ctx context.Context, IP string, usbDevices []enumeration.USBDevice) (bool, string, error)

GetServoSerial returns the Servo serial number for the given IP

func (*DUTServicesImpl) GetUSBDevicePaths

func (d *DUTServicesImpl) GetUSBDevicePaths(ctx context.Context) ([]enumeration.USBDevice, error)

GetUSBDevicePaths returns all the USBDevices instance of plugged devices

func (*DUTServicesImpl) RunCommandOnIP

func (d *DUTServicesImpl) RunCommandOnIP(ctx context.Context, IP string, cmd string) (*models.SSHResult, error)

RunCommandOnIP send the command to the DUT device and then get the result back

ip which device ip want to execute the command. cmd which command want to be executed. TODO: consider one thing if the command was executed failed should be an error?

func (*DUTServicesImpl) RunCommandOnIPs

func (d *DUTServicesImpl) RunCommandOnIPs(ctx context.Context, IPs []string, cmd string) []*models.SSHResult

RunCommandOnIPs send the command to DUT devices and then get the result back

ips the list of ip which want to execute the command. cmd which command want to be executed.

type Device

type Device struct {
	IP           string
	MACAddress   string
	IsPingable   bool
	HasTestImage bool
	ServoSerial  string
}

Device is a struct provides the information of the IP address and is connected.

type GSCInfo

type GSCInfo struct {
	GSCSerial     string `json:"gsc_serial"`
	ServoUSBCount int    `json:"servo_usb_count"`
}

type Host

type Host struct {
	Versions *HostVersions `json:"versions"`
}

type HostVersions

type HostVersions struct {
	RO string `json:"ro"`
	RW string `json:"rw"`
}

type IDUTServices

type IDUTServices interface {
	// RunCommandOnIP send the command to the DUT device and then get the result back
	RunCommandOnIP(ctx context.Context, IP, cmd string) (*models.SSHResult, error)

	// RunCommandOnIPs send the command to DUT devices and then get the result back
	RunCommandOnIPs(ctx context.Context, IPs []string, cmd string) []*models.SSHResult

	// GetConnectedIPs get the connected IPs from `dnsmasq.lease`
	// and then check the IPs are alive.
	GetConnectedIPs(ctx context.Context) ([]Device, error)

	// GetBoard get the DUT's board
	GetBoard(ctx context.Context, address string) (string, error)

	// GetModel gets the DUT's model
	GetModel(ctx context.Context, address string) (string, error)

	// GetGSCSerialAndServoUSBCount gets the Cr50 or Ti50 port serial number on the DUT
	GetGSCSerialAndServoUSBCount(ctx context.Context, address string) (*GSCInfo, error)

	// GetServoSerial gets the Servo serial number for given DUT IP address.
	GetServoSerial(ctx context.Context, IP string, usbDevices []enumeration.USBDevice) (bool, string, error)

	// GetUSBDevicePaths returns all the USBDevices instance of plugged devices
	GetUSBDevicePaths(ctx context.Context) ([]enumeration.USBDevice, error)

	// GetCCDStatus gets the status of CCD
	GetCCDStatus(ctx context.Context, address string) (string, error)
}

IDUTServices provides the services that regulate the DUTs.

func New

func New() (IDUTServices, error)

type ListFirmwareCommandResponse

type ListFirmwareCommandResponse struct {
	FwId     string                         `json:"fwid"`
	Model    string                         `json:"model"`
	FwUpdate map[string]*ListFirmwareResult `json:"fw_update"`
}

type ListFirmwareResult

type ListFirmwareResult struct {
	Host        *Host                  `json:"host"`
	Ec          map[string]interface{} `json:"ec"`
	SignatureId string                 `json:"signature_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL