1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16syntax = "proto3"; 17 18package tradefed.invocation.server; 19 20option java_package = "com.proto.tradefed.invocation"; 21option java_outer_classname = "TradefedInvocationService"; 22 23option java_multiple_files = true; 24option java_generic_services = true; 25 26// The Tradefed invocation service provides TF test lifecycle management. 27service TestInvocationManagement { 28 // Submit a new test command request. 29 rpc SubmitTestCommand(NewTestCommandRequest) returns (NewTestCommandResponse) {} 30 // Query the invocation detail info of a specific test command. 31 rpc GetInvocationDetail(InvocationDetailRequest) returns (InvocationDetailResponse) {} 32 // Request an invocation to be stopped, non-blocking. 33 rpc StopInvocation(StopInvocationRequest) returns (StopInvocationResponse) {} 34 // Request the Tradefed process to exit after a delay that specified by the client, non-blocking. 35 rpc ShutdownTradefed(ShutdownTradefedRequest) returns (ShutdownTradefedResponse) {} 36} 37 38// A new TF test request. 39message NewTestCommandRequest { 40 // The test command arguments. 41 repeated string args = 1; 42 // If the devices were pre-reserved, you can select them by reservation ids 43 repeated string reservation_id = 2; 44} 45 46// Response for submitted test. 47message NewTestCommandResponse { 48 // Invocation id of the requested test, unset if the test request command could not be 49 // parsed or was not added successfully. 50 string invocation_id = 1; 51 // If set, an error occurred and is described by ErrorInfo. 52 CommandErrorInfo command_error_info = 2; 53} 54 55// Request the invocation to stop 56message StopInvocationRequest { 57 // Invocation id of the test to request stop 58 string invocation_id = 1; 59 // Specify a reason to be associated with the stop request 60 string reason = 2; 61} 62 63message StopInvocationResponse { 64 // Type of invocation status 65 enum Status { 66 UNSPECIFIED = 0; 67 SUCCESS = 1; 68 ERROR = 2; 69 } 70 // The type of status. 71 Status status = 1; 72 // If set, an error occurred and is described by ErrorInfo. 73 CommandErrorInfo command_error_info = 2; 74} 75 76// Request the Tradefed Java Process to exit after a delay 77message ShutdownTradefedRequest { 78 // The delay of Tradefed process exit in ms 79 int32 shutdown_delay = 1; 80} 81 82message ShutdownTradefedResponse { 83 // Type of Shutdown Tradefed Request status 84 enum Status { 85 RECEIVED = 0; 86 } 87 // The type of status. 88 Status status = 1; 89} 90 91// The current status of the test command. 92message InvocationStatus { 93 // Type of invocation status 94 enum Status { 95 // Invocation is not invoked. 96 PENDING = 0; 97 // Invocation is running. 98 RUNNING = 1; 99 // Invocation is done, test record ready to retrieve. 100 DONE = 2; 101 // Invocation id is unknown. 102 UNKNOWN = 3; 103 } 104 // The type of status. 105 Status status = 1; 106 // Reason for the status of the invocation 107 string status_reason = 2; 108} 109 110// Query invocation detail request. 111message InvocationDetailRequest { 112 // Test invocation id. 113 string invocation_id = 1; 114} 115 116// Query invocation detail response. 117message InvocationDetailResponse { 118 // The status of queried invocation. 119 InvocationStatus invocation_status = 1; 120 // Test record proto path if available. 121 string test_record_path = 2; 122} 123 124// Describe an error and its identifiers for response 125message CommandErrorInfo { 126 // The error message associated with response 127 string error_message = 1; 128 // The error identifier for the error 129 string error_name = 2; 130 // The error code associated with the identifier 131 int64 error_code = 3; 132} 133