]> git.proxmox.com Git - mirror_frr.git/blob - grpc/frr-northbound.proto
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / grpc / frr-northbound.proto
1 // SPDX-License-Identifier: BSD-2-Clause
2 //
3 // Copyright 2019 FRRouting
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
19 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20 // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 // THE POSSIBILITY OF SUCH DAMAGE.
26 //
27
28 syntax = "proto3";
29
30 package frr;
31
32 // Service specification for the FRR northbound interface.
33 service Northbound {
34 // Retrieve the capabilities supported by the target.
35 rpc GetCapabilities(GetCapabilitiesRequest) returns (GetCapabilitiesResponse) {}
36
37 // Retrieve configuration data, state data or both from the target.
38 rpc Get(GetRequest) returns (stream GetResponse) {}
39
40 // Create a new candidate configuration and return a reference to it. The
41 // created candidate is a copy of the running configuration.
42 rpc CreateCandidate(CreateCandidateRequest) returns (CreateCandidateResponse) {}
43
44 // Delete a candidate configuration.
45 rpc DeleteCandidate(DeleteCandidateRequest) returns (DeleteCandidateResponse) {}
46
47 // Update a candidate configuration by rebasing the changes on top of the
48 // latest running configuration. Resolve conflicts automatically by giving
49 // preference to the changes done in the candidate configuration.
50 rpc UpdateCandidate(UpdateCandidateRequest) returns (UpdateCandidateResponse) {}
51
52 // Edit a candidate configuration. All changes are discarded if any error
53 // happens.
54 rpc EditCandidate(EditCandidateRequest) returns (EditCandidateResponse) {}
55
56 // Load configuration data into a candidate configuration. Both merge and
57 // replace semantics are supported.
58 rpc LoadToCandidate(LoadToCandidateRequest) returns (LoadToCandidateResponse) {}
59
60 // Create a new configuration transaction using a two-phase commit protocol.
61 rpc Commit(CommitRequest) returns (CommitResponse) {}
62
63 // List the metadata of all configuration transactions recorded in the
64 // transactions database.
65 rpc ListTransactions(ListTransactionsRequest) returns (stream ListTransactionsResponse) {}
66
67 // Fetch a configuration (identified by its transaction ID) from the
68 // transactions database.
69 rpc GetTransaction(GetTransactionRequest) returns (GetTransactionResponse) {}
70
71 // Lock the running configuration, preventing other users from changing it.
72 rpc LockConfig(LockConfigRequest) returns (LockConfigResponse) {}
73
74 // Unlock the running configuration.
75 rpc UnlockConfig(UnlockConfigRequest) returns (UnlockConfigResponse) {}
76
77 // Execute a YANG RPC.
78 rpc Execute(ExecuteRequest) returns (ExecuteResponse) {}
79 }
80
81 // ----------------------- Parameters and return types -------------------------
82
83 //
84 // RPC: GetCapabilities()
85 //
86 message GetCapabilitiesRequest {
87 // Empty.
88 }
89
90 message GetCapabilitiesResponse {
91 // Return values:
92 // - grpc::StatusCode::OK: Success.
93
94 // FRR version.
95 string frr_version = 1;
96
97 // Indicates whether FRR was compiled with support for configuration
98 // rollbacks or not (--enable-config-rollbacks).
99 bool rollback_support = 2;
100
101 // Supported schema modules.
102 repeated ModuleData supported_modules = 3;
103
104 // Supported encodings.
105 repeated Encoding supported_encodings = 4;
106 }
107
108 //
109 // RPC: Get()
110 //
111 message GetRequest {
112 // Type of elements within the data tree.
113 enum DataType {
114 // All data elements.
115 ALL = 0;
116
117 // Config elements.
118 CONFIG = 1;
119
120 // State elements.
121 STATE = 2;
122 }
123
124 // The type of data being requested.
125 DataType type = 1;
126
127 // Encoding to be used.
128 Encoding encoding = 2;
129
130 // Include implicit default nodes.
131 bool with_defaults = 3;
132
133 // Paths requested by the client.
134 repeated string path = 4;
135 }
136
137 message GetResponse {
138 // Return values:
139 // - grpc::StatusCode::OK: Success.
140 // - grpc::StatusCode::INVALID_ARGUMENT: Invalid YANG data path.
141
142 // Timestamp in nanoseconds since Epoch.
143 int64 timestamp = 1;
144
145 // The requested data.
146 DataTree data = 2;
147 }
148
149 //
150 // RPC: CreateCandidate()
151 //
152 message CreateCandidateRequest {
153 // Empty.
154 }
155
156 message CreateCandidateResponse {
157 // Return values:
158 // - grpc::StatusCode::OK: Success.
159 // - grpc::StatusCode::RESOURCE_EXHAUSTED: can't create candidate
160 // configuration.
161
162 // Handle to the new created candidate configuration.
163 uint32 candidate_id = 1;
164 }
165
166 //
167 // RPC: DeleteCandidate()
168 //
169 message DeleteCandidateRequest {
170 // Candidate configuration to delete.
171 uint32 candidate_id = 1;
172 }
173
174 message DeleteCandidateResponse {
175 // Return values:
176 // - grpc::StatusCode::OK: Success.
177 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
178 }
179
180 //
181 // RPC: UpdateCandidate()
182 //
183 message UpdateCandidateRequest {
184 // Candidate configuration to update.
185 uint32 candidate_id = 1;
186 }
187
188 message UpdateCandidateResponse {
189 // Return values:
190 // - grpc::StatusCode::OK: Success.
191 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
192 }
193
194 //
195 // RPC: EditCandidate()
196 //
197 message EditCandidateRequest {
198 // Candidate configuration that is going to be edited.
199 uint32 candidate_id = 1;
200
201 // Data elements to be created or updated.
202 repeated PathValue update = 2;
203
204 // Paths to be deleted from the data tree.
205 repeated PathValue delete = 3;
206 }
207
208 message EditCandidateResponse {
209 // Return values:
210 // - grpc::StatusCode::OK: Success.
211 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
212 // - grpc::StatusCode::INVALID_ARGUMENT: An error occurred while editing the
213 // candidate configuration.
214 }
215
216 //
217 // RPC: LoadToCandidate()
218 //
219 message LoadToCandidateRequest {
220 enum LoadType {
221 // Merge the data tree into the candidate configuration.
222 MERGE = 0;
223
224 // Replace the candidate configuration by the provided data tree.
225 REPLACE = 1;
226 }
227
228 // Candidate configuration that is going to be edited.
229 uint32 candidate_id = 1;
230
231 // Load operation to apply.
232 LoadType type = 2;
233
234 // Configuration data.
235 DataTree config = 3;
236 }
237
238 message LoadToCandidateResponse {
239 // Return values:
240 // - grpc::StatusCode::OK: Success.
241 // - grpc::StatusCode::INVALID_ARGUMENT: An error occurred while performing
242 // the load operation.
243 }
244
245 //
246 // RPC: Commit()
247 //
248 message CommitRequest {
249 enum Phase {
250 // Validate if the configuration changes are valid (phase 0).
251 VALIDATE = 0;
252
253 // Prepare resources to apply the configuration changes (phase 1).
254 PREPARE = 1;
255
256 // Release previously allocated resources (phase 2).
257 ABORT = 2;
258
259 // Apply the configuration changes (phase 2).
260 APPLY = 3;
261
262 // All of the above (VALIDATE + PREPARE + ABORT/APPLY).
263 //
264 // This option can't be used to implement network-wide transactions,
265 // since they require the manager entity to take into account the results
266 // of the preparation phase of multiple managed devices.
267 ALL = 4;
268 }
269
270 // Candidate configuration that is going to be committed.
271 uint32 candidate_id = 1;
272
273 // Transaction phase.
274 Phase phase = 2;
275
276 // Assign a comment to this commit.
277 string comment = 3;
278 }
279
280 message CommitResponse {
281 // Return values:
282 // - grpc::StatusCode::OK: Success.
283 // - grpc::StatusCode::FAILED_PRECONDITION: misuse of the two-phase commit
284 // protocol.
285 // - grpc::StatusCode::INVALID_ARGUMENT: Validation error.
286 // - grpc::StatusCode::RESOURCE_EXHAUSTED: Failure to allocate resource.
287
288 // ID of the created configuration transaction (when the phase is APPLY
289 // or ALL).
290 uint32 transaction_id = 1;
291
292 // Human-readable error or warning message(s).
293 string error_message = 2;
294 }
295
296 //
297 // RPC: ListTransactions()
298 //
299 message ListTransactionsRequest {
300 // Empty.
301 }
302
303 message ListTransactionsResponse {
304 // Return values:
305 // - grpc::StatusCode::OK: Success.
306
307 // Transaction ID.
308 uint32 id = 1;
309
310 // Client that committed the transaction.
311 string client = 2;
312
313 // Date and time the transaction was committed.
314 string date = 3;
315
316 // Comment assigned to the transaction.
317 string comment = 4;
318 }
319
320 //
321 // RPC: GetTransaction()
322 //
323 message GetTransactionRequest {
324 // Transaction to retrieve.
325 uint32 transaction_id = 1;
326
327 // Encoding to be used.
328 Encoding encoding = 2;
329
330 // Include implicit default nodes.
331 bool with_defaults = 3;
332 }
333
334 message GetTransactionResponse {
335 // Return values:
336 // - grpc::StatusCode::OK: Success.
337 // - grpc::StatusCode::NOT_FOUND: Transaction wasn't found in the transactions
338 // database.
339
340 DataTree config = 1;
341 }
342
343 //
344 // RPC: LockConfig()
345 //
346 message LockConfigRequest {
347 // Empty.
348 }
349
350 message LockConfigResponse {
351 // Return values:
352 // - grpc::StatusCode::OK: Success.
353 // - grpc::StatusCode::FAILED_PRECONDITION: Running configuration is
354 // locked already.
355 }
356
357 //
358 // RPC: UnlockConfig()
359 //
360 message UnlockConfigRequest {
361 // Empty.
362 }
363
364 message UnlockConfigResponse {
365 // Return values:
366 // - grpc::StatusCode::OK: Success.
367 // - grpc::StatusCode::FAILED_PRECONDITION: Running configuration isn't
368 // locked.
369 }
370
371 //
372 // RPC: Execute()
373 //
374 message ExecuteRequest {
375 // Path of the YANG RPC or YANG Action.
376 string path = 1;
377
378 // Input parameters.
379 repeated PathValue input = 2;
380 }
381
382 message ExecuteResponse {
383 // Return values:
384 // - grpc::StatusCode::OK: Success.
385
386 // Output parameters.
387 repeated PathValue output = 1;
388 }
389
390 // -------------------------------- Definitions --------------------------------
391
392 // YANG module.
393 message ModuleData {
394 // Name of the YANG module;
395 string name = 1;
396
397 // Organization publishing the module.
398 string organization = 2;
399
400 // Latest revision of the module;
401 string revision = 3;
402 }
403
404 // Supported encodings for YANG instance data.
405 enum Encoding {
406 JSON = 0;
407 XML = 1;
408 }
409
410 // Path-value pair representing a data element.
411 message PathValue {
412 // YANG data path.
413 string path = 1;
414
415 // Data value.
416 string value = 2;
417 }
418
419 // YANG instance data.
420 message DataTree {
421 Encoding encoding = 1;
422 string data = 2;
423 }