Documentation
¶
Overview ¶
Package servodserver implements servod_service.proto (see proto for details)
Package servodserver implements servod_service.proto (see proto for details)
Index ¶
- Constants
- func SaveServoLog(ctx context.Context, servoHost, dockerContainer string, servoPorts []int32, ...) error
- type ServodService
- func (s *ServodService) CallServod(ctx context.Context, req *api.CallServodRequest) (*api.CallServodResponse, error)
- func (s *ServodService) ExecCmd(ctx context.Context, req *api.ExecCmdRequest) (*api.ExecCmdResponse, error)
- func (s *ServodService) LogCheckPoint(ctx context.Context, req *api.LogCheckPointRequest) (*api.LogCheckPointResponse, error)
- func (s *ServodService) RunCli(cs model.CliSubcommand, a model.CliArgs, stdin io.Reader, routeToStd bool) (bytes.Buffer, bytes.Buffer, error)
- func (s *ServodService) SaveLogs(ctx context.Context, req *api.SaveLogsRequest) (*api.SaveLogsResponse, error)
- func (s *ServodService) StartServer(port int32) error
- func (s *ServodService) StartServo(a model.CliArgs) error
- func (s *ServodService) StartServod(ctx context.Context, req *api.StartServodRequest) (*longrunning.Operation, error)
- func (s *ServodService) StopServod(ctx context.Context, req *api.StopServodRequest) (*longrunning.Operation, error)
Constants ¶
const (
SatlabRPCServer = "satlab_rpcserver:6003"
)
Variables ¶
This section is empty.
Functions ¶
func SaveServoLog ¶
func SaveServoLog(ctx context.Context, servoHost, dockerContainer string, servoPorts []int32, sshClient *ssh.Client, dst string, l *log.Logger) error
SaveServoLog save logs from servo and servo host. TODO: Change the interface to get connection directly instead of passing the servoHost.
Types ¶
type ServodService ¶
type ServodService struct {
// contains filtered or unexported fields
}
ServodService implementation of servod_service.proto
func NewServodService ¶
func NewServodService(ctx context.Context, logger *log.Logger, commandexecutor commandexecutor.CommandExecutorInterface) (*ServodService, func(), error)
NewServodService creates a new servod service.
func (*ServodService) CallServod ¶
func (s *ServodService) CallServod(ctx context.Context, req *api.CallServodRequest) (*api.CallServodResponse, error)
CallServod runs a servod command through an XML-RPC call. It runs the command inside the servod Docker container if the servod_docker_container_name parameter is provided in the request. Otherwise, it runs the command directly inside the host that the servo is physically connected to. Allowed methods: doc, get, set, and hwinit.
func (*ServodService) ExecCmd ¶
func (s *ServodService) ExecCmd(ctx context.Context, req *api.ExecCmdRequest) (*api.ExecCmdResponse, error)
ExecCmd executes a system command that is provided through the command parameter in the request. It allows the user to execute arbitrary commands that can't be handled by calling servod (e.g. update firmware through "futility", remote file copy through "scp"). It executes the command inside the servod Docker container if the servod_docker_container_name parameter is provided in the request. Otherwise, it executes the command directly inside the host that the servo is physically connected to.
func (*ServodService) LogCheckPoint ¶
func (s *ServodService) LogCheckPoint(ctx context.Context, req *api.LogCheckPointRequest) (*api.LogCheckPointResponse, error)
LogCheckPoint will create checkpoint certain files so that some files can be saved partially when SaveLogs is called. For example, /var/log/messages in a labstation can be very big and include information from a few days ago. Getting the checkpoint of the current /var/log/messages will allow SaveLogs to save the portion only relevant to the current testing session.
func (*ServodService) RunCli ¶
func (s *ServodService) RunCli(cs model.CliSubcommand, a model.CliArgs, stdin io.Reader, routeToStd bool) (bytes.Buffer, bytes.Buffer, error)
RunCli runs servod service as execution by CLI.
func (*ServodService) SaveLogs ¶
func (s *ServodService) SaveLogs(ctx context.Context, req *api.SaveLogsRequest) (*api.SaveLogsResponse, error)
SaveLogs will save servod related logs on the host that this service is running. Logs include:
/var/log/message from the servod host. /var/log/servod_<port>/ latest.DEBUG from servod host. /var/log/servod_<port>.STARTUP.log from servod host. The output of "dmesg -H" from the servod host. The extraction of the MCU console logs from latest.DEBUG
func (*ServodService) StartServer ¶
func (s *ServodService) StartServer(port int32) error
StartServer starts servod server on requested port
func (*ServodService) StartServo ¶
func (s *ServodService) StartServo(a model.CliArgs) error
func (*ServodService) StartServod ¶
func (s *ServodService) StartServod(ctx context.Context, req *api.StartServodRequest) (*longrunning.Operation, error)
StartServod runs a servod Docker container and starts the servod daemon inside the container if servod is containerized. Otherwise, it simply starts the servod daemon.
func (*ServodService) StopServod ¶
func (s *ServodService) StopServod(ctx context.Context, req *api.StopServodRequest) (*longrunning.Operation, error)
StopServod stops the servod daemon inside the container and stops the servod Docker container if servod is containerized. Otherwise, it simply stops the servod daemon.