1// Copyright 2015-2016 gRPC authors. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Message definitions to be used by integration test service definitions. 16 17syntax = "proto3"; 18 19package grpc.testing; 20 21option java_package = "io.grpc.testing.integration"; 22 23// TODO(dgq): Go back to using well-known types once 24// https://github.com/grpc/grpc/issues/6980 has been fixed. 25// import "google/protobuf/wrappers.proto"; 26message BoolValue { 27 // The bool value. 28 bool value = 1; 29} 30 31// The type of payload that should be returned. 32enum PayloadType { 33 // Compressable text format. 34 COMPRESSABLE = 0; 35} 36 37// A block of data, to simply increase gRPC message size. 38message Payload { 39 // The type of data in body. 40 PayloadType type = 1; 41 // Primary contents of payload. 42 bytes body = 2; 43} 44 45// A protobuf representation for grpc status. This is used by test 46// clients to specify a status that the server should attempt to return. 47message EchoStatus { 48 int32 code = 1; 49 string message = 2; 50} 51 52// The type of route that a client took to reach a server w.r.t. gRPCLB. 53// The server must fill in "fallback" if it detects that the RPC reached 54// the server via the "gRPCLB fallback" path, and "backend" if it detects 55// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got 56// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly 57// how this detection is done is context and server dependent. 58enum GrpclbRouteType { 59 // Server didn't detect the route that a client took to reach it. 60 GRPCLB_ROUTE_TYPE_UNKNOWN = 0; 61 // Indicates that a client reached a server via gRPCLB fallback. 62 GRPCLB_ROUTE_TYPE_FALLBACK = 1; 63 // Indicates that a client reached a server as a gRPCLB-given backend. 64 GRPCLB_ROUTE_TYPE_BACKEND = 2; 65} 66 67// Unary request. 68message SimpleRequest { 69 // Desired payload type in the response from the server. 70 // If response_type is RANDOM, server randomly chooses one from other formats. 71 PayloadType response_type = 1; 72 73 // Desired payload size in the response from the server. 74 int32 response_size = 2; 75 76 // Optional input payload sent along with the request. 77 Payload payload = 3; 78 79 // Whether SimpleResponse should include username. 80 bool fill_username = 4; 81 82 // Whether SimpleResponse should include OAuth scope. 83 bool fill_oauth_scope = 5; 84 85 // Whether to request the server to compress the response. This field is 86 // "nullable" in order to interoperate seamlessly with clients not able to 87 // implement the full compression tests by introspecting the call to verify 88 // the response's compression status. 89 BoolValue response_compressed = 6; 90 91 // Whether server should return a given status 92 EchoStatus response_status = 7; 93 94 // Whether the server should expect this request to be compressed. 95 BoolValue expect_compressed = 8; 96 97 // Whether SimpleResponse should include server_id. 98 bool fill_server_id = 9; 99 100 // Whether SimpleResponse should include grpclb_route_type. 101 bool fill_grpclb_route_type = 10; 102 103 // If set the server should record this metrics report data for the current RPC. 104 TestOrcaReport orca_per_query_report = 11; 105} 106 107// Unary response, as configured by the request. 108message SimpleResponse { 109 // Payload to increase message size. 110 Payload payload = 1; 111 // The user the request came from, for verifying authentication was 112 // successful when the client expected it. 113 string username = 2; 114 // OAuth scope. 115 string oauth_scope = 3; 116 117 // Server ID. This must be unique among different server instances, 118 // but the same across all RPC's made to a particular server instance. 119 string server_id = 4; 120 // gRPCLB Path. 121 GrpclbRouteType grpclb_route_type = 5; 122 123 // Server hostname. 124 string hostname = 6; 125} 126 127// Client-streaming request. 128message StreamingInputCallRequest { 129 // Optional input payload sent along with the request. 130 Payload payload = 1; 131 132 // Whether the server should expect this request to be compressed. This field 133 // is "nullable" in order to interoperate seamlessly with servers not able to 134 // implement the full compression tests by introspecting the call to verify 135 // the request's compression status. 136 BoolValue expect_compressed = 2; 137 138 // Not expecting any payload from the response. 139} 140 141// Client-streaming response. 142message StreamingInputCallResponse { 143 // Aggregated size of payloads received from the client. 144 int32 aggregated_payload_size = 1; 145} 146 147// Configuration for a particular response. 148message ResponseParameters { 149 // Desired payload sizes in responses from the server. 150 int32 size = 1; 151 152 // Desired interval between consecutive responses in the response stream in 153 // microseconds. 154 int32 interval_us = 2; 155 156 // Whether to request the server to compress the response. This field is 157 // "nullable" in order to interoperate seamlessly with clients not able to 158 // implement the full compression tests by introspecting the call to verify 159 // the response's compression status. 160 BoolValue compressed = 3; 161} 162 163// Server-streaming request. 164message StreamingOutputCallRequest { 165 // Desired payload type in the response from the server. 166 // If response_type is RANDOM, the payload from each response in the stream 167 // might be of different types. This is to simulate a mixed type of payload 168 // stream. 169 PayloadType response_type = 1; 170 171 // Configuration for each expected response message. 172 repeated ResponseParameters response_parameters = 2; 173 174 // Optional input payload sent along with the request. 175 Payload payload = 3; 176 177 // Whether server should return a given status 178 EchoStatus response_status = 7; 179 180 // If set the server should update this metrics report data at the OOB server. 181 TestOrcaReport orca_oob_report = 8; 182} 183 184// Server-streaming response, as configured by the request and parameters. 185message StreamingOutputCallResponse { 186 // Payload to increase response size. 187 Payload payload = 1; 188} 189 190// For reconnect interop test only. 191// Client tells server what reconnection parameters it used. 192message ReconnectParams { 193 int32 max_reconnect_backoff_ms = 1; 194} 195 196// For reconnect interop test only. 197// Server tells client whether its reconnects are following the spec and the 198// reconnect backoffs it saw. 199message ReconnectInfo { 200 bool passed = 1; 201 repeated int32 backoff_ms = 2; 202} 203 204message LoadBalancerStatsRequest { 205 // Request stats for the next num_rpcs sent by client. 206 int32 num_rpcs = 1; 207 // If num_rpcs have not completed within timeout_sec, return partial results. 208 int32 timeout_sec = 2; 209 // Response header + trailer metadata entries we want the values of. 210 // Matching of the keys is case-insensitive as per rfc7540#section-8.1.2 211 // * (asterisk) is a special value that will return all metadata entries 212 repeated string metadata_keys = 3; 213} 214 215message LoadBalancerStatsResponse { 216 enum MetadataType { 217 UNKNOWN = 0; 218 INITIAL = 1; 219 TRAILING = 2; 220 } 221 message MetadataEntry { 222 // Key, exactly as received from the server. Case may be different from what 223 // was requested in the LoadBalancerStatsRequest) 224 string key = 1; 225 // Value, exactly as received from the server. 226 string value = 2; 227 // Metadata type 228 MetadataType type = 3; 229 } 230 message RpcMetadata { 231 // metadata values for each rpc for the keys specified in 232 // LoadBalancerStatsRequest.metadata_keys. 233 repeated MetadataEntry metadata = 1; 234 } 235 message MetadataByPeer { 236 // List of RpcMetadata in for each RPC with a given peer 237 repeated RpcMetadata rpc_metadata = 1; 238 } 239 message RpcsByPeer { 240 // The number of completed RPCs for each peer. 241 map<string, int32> rpcs_by_peer = 1; 242 } 243 // The number of completed RPCs for each peer. 244 map<string, int32> rpcs_by_peer = 1; 245 // The number of RPCs that failed to record a remote peer. 246 int32 num_failures = 2; 247 map<string, RpcsByPeer> rpcs_by_method = 3; 248 // All the metadata of all RPCs for each peer. 249 map<string, MetadataByPeer> metadatas_by_peer = 4; 250} 251 252// Request for retrieving a test client's accumulated stats. 253message LoadBalancerAccumulatedStatsRequest {} 254 255// Accumulated stats for RPCs sent by a test client. 256message LoadBalancerAccumulatedStatsResponse { 257 // The total number of RPCs have ever issued for each type. 258 // Deprecated: use stats_per_method.rpcs_started instead. 259 map<string, int32> num_rpcs_started_by_method = 1 [deprecated = true]; 260 // The total number of RPCs have ever completed successfully for each type. 261 // Deprecated: use stats_per_method.result instead. 262 map<string, int32> num_rpcs_succeeded_by_method = 2 [deprecated = true]; 263 // The total number of RPCs have ever failed for each type. 264 // Deprecated: use stats_per_method.result instead. 265 map<string, int32> num_rpcs_failed_by_method = 3 [deprecated = true]; 266 267 message MethodStats { 268 // The number of RPCs that were started for this method. 269 int32 rpcs_started = 1; 270 271 // The number of RPCs that completed with each status for this method. The 272 // key is the integral value of a google.rpc.Code; the value is the count. 273 map<int32, int32> result = 2; 274 } 275 276 // Per-method RPC statistics. The key is the RpcType in string form; e.g. 277 // 'EMPTY_CALL' or 'UNARY_CALL' 278 map<string, MethodStats> stats_per_method = 4; 279} 280 281// Configurations for a test client. 282message ClientConfigureRequest { 283 // Type of RPCs to send. 284 enum RpcType { 285 EMPTY_CALL = 0; 286 UNARY_CALL = 1; 287 } 288 289 // Metadata to be attached for the given type of RPCs. 290 message Metadata { 291 RpcType type = 1; 292 string key = 2; 293 string value = 3; 294 } 295 296 // The types of RPCs the client sends. 297 repeated RpcType types = 1; 298 // The collection of custom metadata to be attached to RPCs sent by the client. 299 repeated Metadata metadata = 2; 300 // The deadline to use, in seconds, for all RPCs. If unset or zero, the 301 // client will use the default from the command-line. 302 int32 timeout_sec = 3; 303} 304 305// Response for updating a test client's configuration. 306message ClientConfigureResponse {} 307 308message MemorySize { 309 int64 rss = 1; 310} 311 312// Metrics data the server will update and send to the client. It mirrors orca load report 313// https://github.com/cncf/xds/blob/eded343319d09f30032952beda9840bbd3dcf7ac/xds/data/orca/v3/orca_load_report.proto#L15, 314// but avoids orca dependency. Used by both per-query and out-of-band reporting tests. 315message TestOrcaReport { 316 double cpu_utilization = 1; 317 double memory_utilization = 2; 318 map<string, double> request_cost = 3; 319 map<string, double> utilization = 4; 320} 321 322// Status that will be return to callers of the Hook method 323message SetReturnStatusRequest { 324 int32 grpc_code_to_return = 1; 325 string grpc_status_description = 2; 326} 327 328message HookRequest { 329 enum HookRequestCommand { 330 // Default value 331 UNSPECIFIED = 0; 332 // Start the HTTP endpoint 333 START = 1; 334 // Stop 335 STOP = 2; 336 // Return from HTTP GET/POST 337 RETURN = 3; 338 } 339 HookRequestCommand command = 1; 340 int32 grpc_code_to_return = 2; 341 string grpc_status_description = 3; 342 // Server port to listen to 343 int32 server_port = 4; 344} 345 346message HookResponse { 347} 348