xref: /aosp_15_r20/external/grpc-grpc/test/core/xds/xds_client_fuzzer.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1//
2// Copyright 2022 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
17syntax = "proto3";
18
19import "src/proto/grpc/testing/xds/v3/discovery.proto";
20
21package xds_client_fuzzer;
22
23// We'd ideally like to use google.rpc.Status instead of creating our
24// own proto for this, but that winds up causing all sorts of dependency
25// headaches.
26message Status {
27  int32 code = 1;
28  string message = 2;
29}
30
31//
32// interactions with XdsClient API
33//
34
35// Use a oneof instead of an enum so that we can ensure that the code
36// will fail to build if we add a type here and don't handle it in the
37// fuzzer code.
38message ResourceType {
39  message EmptyMessage {}
40  oneof resource_type {
41    EmptyMessage listener = 1;
42    EmptyMessage route_config = 2;
43    EmptyMessage cluster = 3;
44    EmptyMessage endpoint = 4;
45  }
46}
47
48message StartWatch {
49  ResourceType resource_type = 1;
50  string resource_name = 2;
51}
52
53message StopWatch {
54  ResourceType resource_type = 1;
55  string resource_name = 2;
56}
57
58// TODO(roth): add LRS methods on XdsClient
59
60message DumpCsdsData {}
61
62message ReportResourceCounts {}
63
64message ReportServerConnections {}
65
66//
67// interactions with fake transport
68//
69
70message TriggerConnectionFailure {
71  string authority = 1;
72  Status status = 2;
73}
74
75message StreamId {
76  string authority = 1;
77
78  // Use a oneof instead of an enum so that we can ensure that the code
79  // will fail to build if we add a type here and don't handle it in the
80  // fuzzer code.
81  message EmptyMessage {}
82  oneof method {
83    EmptyMessage ads = 2;
84    EmptyMessage lrs = 3;
85  }
86}
87
88message ReadMessageFromClient {
89  StreamId stream_id = 1;
90  bool ok = 2;
91}
92
93message SendMessageToClient {
94  StreamId stream_id = 1;
95  envoy.service.discovery.v3.DiscoveryResponse response = 2;
96}
97
98message SendStatusToClient {
99  StreamId stream_id = 1;
100  Status status = 2;
101}
102
103// Next free field: 10
104message Action {
105  oneof action_type {
106    // interactions with XdsClient API
107    StartWatch start_watch = 1;
108    StopWatch stop_watch = 2;
109    DumpCsdsData dump_csds_data = 3;
110    ReportResourceCounts report_resource_counts = 8;
111    ReportServerConnections report_server_connections = 9;
112    // interactions with fake transport
113    TriggerConnectionFailure trigger_connection_failure = 4;
114    ReadMessageFromClient read_message_from_client = 5;
115    SendMessageToClient send_message_to_client = 6;
116    SendStatusToClient send_status_to_client = 7;
117  }
118}
119
120message Message {
121  string bootstrap = 1;
122  repeated Action actions = 2;
123}
124