1 2// Copyright 2015-2016 gRPC authors. 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 16// Message definitions to be used by integration test service definitions. 17 18syntax = "proto3"; 19 20package grpc.testing; 21 22option java_package = "io.grpc.testing.integration"; 23 24// TODO(dgq): Go back to using well-known types once 25// https://github.com/grpc/grpc/issues/6980 has been fixed. 26// import "google/protobuf/wrappers.proto"; 27message BoolValue { 28 // The bool value. 29 bool value = 1; 30} 31 32// The type of payload that should be returned. 33enum PayloadType { 34 // Compressable text format. 35 COMPRESSABLE = 0; 36} 37 38// A block of data, to simply increase gRPC message size. 39message Payload { 40 // The type of data in body. 41 PayloadType type = 1; 42 // Primary contents of payload. 43 bytes body = 2; 44} 45 46// A protobuf representation for grpc status. This is used by test 47// clients to specify a status that the server should attempt to return. 48message EchoStatus { 49 int32 code = 1; 50 string message = 2; 51} 52 53// The type of route that a client took to reach a server w.r.t. gRPCLB. 54// The server must fill in "fallback" if it detects that the RPC reached 55// the server via the "gRPCLB fallback" path, and "backend" if it detects 56// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got 57// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly 58// how this detection is done is context and server dependent. 59enum GrpclbRouteType { 60 // Server didn't detect the route that a client took to reach it. 61 GRPCLB_ROUTE_TYPE_UNKNOWN = 0; 62 // Indicates that a client reached a server via gRPCLB fallback. 63 GRPCLB_ROUTE_TYPE_FALLBACK = 1; 64 // Indicates that a client reached a server as a gRPCLB-given backend. 65 GRPCLB_ROUTE_TYPE_BACKEND = 2; 66} 67 68// Unary request. 69message SimpleRequest { 70 // Desired payload type in the response from the server. 71 // If response_type is RANDOM, server randomly chooses one from other formats. 72 PayloadType response_type = 1; 73 74 // Desired payload size in the response from the server. 75 int32 response_size = 2; 76 77 // Optional input payload sent along with the request. 78 Payload payload = 3; 79 80 // Whether SimpleResponse should include username. 81 bool fill_username = 4; 82 83 // Whether SimpleResponse should include OAuth scope. 84 bool fill_oauth_scope = 5; 85 86 // Whether to request the server to compress the response. This field is 87 // "nullable" in order to interoperate seamlessly with clients not able to 88 // implement the full compression tests by introspecting the call to verify 89 // the response's compression status. 90 BoolValue response_compressed = 6; 91 92 // Whether server should return a given status 93 EchoStatus response_status = 7; 94 95 // Whether the server should expect this request to be compressed. 96 BoolValue expect_compressed = 8; 97 98 // Whether SimpleResponse should include server_id. 99 bool fill_server_id = 9; 100 101 // Whether SimpleResponse should include grpclb_route_type. 102 bool fill_grpclb_route_type = 10; 103 104 // If set the server should record this metrics report data for the current RPC. 105 TestOrcaReport orca_per_query_report = 11; 106} 107 108// Unary response, as configured by the request. 109message SimpleResponse { 110 // Payload to increase message size. 111 Payload payload = 1; 112 // The user the request came from, for verifying authentication was 113 // successful when the client expected it. 114 string username = 2; 115 // OAuth scope. 116 string oauth_scope = 3; 117 118 // Server ID. This must be unique among different server instances, 119 // but the same across all RPC's made to a particular server instance. 120 string server_id = 4; 121 // gRPCLB Path. 122 GrpclbRouteType grpclb_route_type = 5; 123 124 // Server hostname. 125 string hostname = 6; 126} 127 128// Client-streaming request. 129message StreamingInputCallRequest { 130 // Optional input payload sent along with the request. 131 Payload payload = 1; 132 133 // Whether the server should expect this request to be compressed. This field 134 // is "nullable" in order to interoperate seamlessly with servers not able to 135 // implement the full compression tests by introspecting the call to verify 136 // the request's compression status. 137 BoolValue expect_compressed = 2; 138 139 // Not expecting any payload from the response. 140} 141 142// Client-streaming response. 143message StreamingInputCallResponse { 144 // Aggregated size of payloads received from the client. 145 int32 aggregated_payload_size = 1; 146} 147 148// Configuration for a particular response. 149message ResponseParameters { 150 // Desired payload sizes in responses from the server. 151 int32 size = 1; 152 153 // Desired interval between consecutive responses in the response stream in 154 // microseconds. 155 int32 interval_us = 2; 156 157 // Whether to request the server to compress the response. This field is 158 // "nullable" in order to interoperate seamlessly with clients not able to 159 // implement the full compression tests by introspecting the call to verify 160 // the response's compression status. 161 BoolValue compressed = 3; 162} 163 164// Server-streaming request. 165message StreamingOutputCallRequest { 166 // Desired payload type in the response from the server. 167 // If response_type is RANDOM, the payload from each response in the stream 168 // might be of different types. This is to simulate a mixed type of payload 169 // stream. 170 PayloadType response_type = 1; 171 172 // Configuration for each expected response message. 173 repeated ResponseParameters response_parameters = 2; 174 175 // Optional input payload sent along with the request. 176 Payload payload = 3; 177 178 // Whether server should return a given status 179 EchoStatus response_status = 7; 180 181 // If set the server should update this metrics report data at the OOB server. 182 TestOrcaReport orca_oob_report = 8; 183} 184 185// Server-streaming response, as configured by the request and parameters. 186message StreamingOutputCallResponse { 187 // Payload to increase response size. 188 Payload payload = 1; 189} 190 191// For reconnect interop test only. 192// Client tells server what reconnection parameters it used. 193message ReconnectParams { 194 int32 max_reconnect_backoff_ms = 1; 195} 196 197// For reconnect interop test only. 198// Server tells client whether its reconnects are following the spec and the 199// reconnect backoffs it saw. 200message ReconnectInfo { 201 bool passed = 1; 202 repeated int32 backoff_ms = 2; 203} 204 205message LoadBalancerStatsRequest { 206 // Request stats for the next num_rpcs sent by client. 207 int32 num_rpcs = 1; 208 // If num_rpcs have not completed within timeout_sec, return partial results. 209 int32 timeout_sec = 2; 210} 211 212message LoadBalancerStatsResponse { 213 message RpcsByPeer { 214 // The number of completed RPCs for each peer. 215 map<string, int32> rpcs_by_peer = 1; 216 } 217 // The number of completed RPCs for each peer. 218 map<string, int32> rpcs_by_peer = 1; 219 // The number of RPCs that failed to record a remote peer. 220 int32 num_failures = 2; 221 map<string, RpcsByPeer> rpcs_by_method = 3; 222} 223 224// Request for retrieving a test client's accumulated stats. 225message LoadBalancerAccumulatedStatsRequest {} 226 227// Accumulated stats for RPCs sent by a test client. 228message LoadBalancerAccumulatedStatsResponse { 229 // The total number of RPCs have ever issued for each type. 230 // Deprecated: use stats_per_method.rpcs_started instead. 231 map<string, int32> num_rpcs_started_by_method = 1 [deprecated = true]; 232 // The total number of RPCs have ever completed successfully for each type. 233 // Deprecated: use stats_per_method.result instead. 234 map<string, int32> num_rpcs_succeeded_by_method = 2 [deprecated = true]; 235 // The total number of RPCs have ever failed for each type. 236 // Deprecated: use stats_per_method.result instead. 237 map<string, int32> num_rpcs_failed_by_method = 3 [deprecated = true]; 238 239 message MethodStats { 240 // The number of RPCs that were started for this method. 241 int32 rpcs_started = 1; 242 243 // The number of RPCs that completed with each status for this method. The 244 // key is the integral value of a google.rpc.Code; the value is the count. 245 map<int32, int32> result = 2; 246 } 247 248 // Per-method RPC statistics. The key is the RpcType in string form; e.g. 249 // 'EMPTY_CALL' or 'UNARY_CALL' 250 map<string, MethodStats> stats_per_method = 4; 251} 252 253// Configurations for a test client. 254message ClientConfigureRequest { 255 // Type of RPCs to send. 256 enum RpcType { 257 EMPTY_CALL = 0; 258 UNARY_CALL = 1; 259 } 260 261 // Metadata to be attached for the given type of RPCs. 262 message Metadata { 263 RpcType type = 1; 264 string key = 2; 265 string value = 3; 266 } 267 268 // The types of RPCs the client sends. 269 repeated RpcType types = 1; 270 // The collection of custom metadata to be attached to RPCs sent by the client. 271 repeated Metadata metadata = 2; 272 // The deadline to use, in seconds, for all RPCs. If unset or zero, the 273 // client will use the default from the command-line. 274 int32 timeout_sec = 3; 275} 276 277// Response for updating a test client's configuration. 278message ClientConfigureResponse {} 279 280// Metrics data the server will update and send to the client. It mirrors orca load report 281// https://github.com/cncf/xds/blob/eded343319d09f30032952beda9840bbd3dcf7ac/xds/data/orca/v3/orca_load_report.proto#L15, 282// but avoids orca dependency. Used by both per-query and out-of-band reporting tests. 283message TestOrcaReport { 284 double cpu_utilization = 1; 285 double memory_utilization = 2; 286 map<string, double> request_cost = 3; 287 map<string, double> utilization = 4; 288} 289