2 // Copyright (C) 2019 NetDEF, Inc.
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along
16 // with this program; see the file COPYING; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 // Service specification for the FRR northbound interface.
26 // Retrieve the capabilities supported by the target.
27 rpc GetCapabilities(GetCapabilitiesRequest) returns (GetCapabilitiesResponse) {}
29 // Retrieve configuration data, state data or both from the target.
30 rpc Get(GetRequest) returns (stream GetResponse) {}
32 // Create a new candidate configuration and return a reference to it. The
33 // created candidate is a copy of the running configuration.
34 rpc CreateCandidate(CreateCandidateRequest) returns (CreateCandidateResponse) {}
36 // Delete a candidate configuration.
37 rpc DeleteCandidate(DeleteCandidateRequest) returns (DeleteCandidateResponse) {}
39 // Update a candidate configuration by rebasing the changes on top of the
40 // latest running configuration. Resolve conflicts automatically by giving
41 // preference to the changes done in the candidate configuration.
42 rpc UpdateCandidate(UpdateCandidateRequest) returns (UpdateCandidateResponse) {}
44 // Edit a candidate configuration. All changes are discarded if any error
46 rpc EditCandidate(EditCandidateRequest) returns (EditCandidateResponse) {}
48 // Load configuration data into a candidate configuration. Both merge and
49 // replace semantics are supported.
50 rpc LoadToCandidate(LoadToCandidateRequest) returns (LoadToCandidateResponse) {}
52 // Create a new configuration transaction using a two-phase commit protocol.
53 rpc Commit(CommitRequest) returns (CommitResponse) {}
55 // List the metadata of all configuration transactions recorded in the
56 // transactions database.
57 rpc ListTransactions(ListTransactionsRequest) returns (stream ListTransactionsResponse) {}
59 // Fetch a configuration (identified by its transaction ID) from the
60 // transactions database.
61 rpc GetTransaction(GetTransactionRequest) returns (GetTransactionResponse) {}
63 // Lock the running configuration, preventing other users from changing it.
64 rpc LockConfig(LockConfigRequest) returns (LockConfigResponse) {}
66 // Unlock the running configuration.
67 rpc UnlockConfig(UnlockConfigRequest) returns (UnlockConfigResponse) {}
69 // Execute a YANG RPC.
70 rpc Execute(ExecuteRequest) returns (ExecuteResponse) {}
73 // ----------------------- Parameters and return types -------------------------
76 // RPC: GetCapabilities()
78 message GetCapabilitiesRequest {
82 message GetCapabilitiesResponse {
84 // - grpc::StatusCode::OK: Success.
87 string frr_version = 1;
89 // Indicates whether FRR was compiled with support for configuration
90 // rollbacks or not (--enable-config-rollbacks).
91 bool rollback_support = 2;
93 // Supported schema modules.
94 repeated ModuleData supported_modules = 3;
96 // Supported encodings.
97 repeated Encoding supported_encodings = 4;
104 // Type of elements within the data tree.
106 // All data elements.
116 // The type of data being requested.
119 // Encoding to be used.
120 Encoding encoding = 2;
122 // Include implicit default nodes.
123 bool with_defaults = 3;
125 // Paths requested by the client.
126 repeated string path = 4;
129 message GetResponse {
131 // - grpc::StatusCode::OK: Success.
132 // - grpc::StatusCode::INVALID_ARGUMENT: Invalid YANG data path.
134 // Timestamp in nanoseconds since Epoch.
137 // The requested data.
142 // RPC: CreateCandidate()
144 message CreateCandidateRequest {
148 message CreateCandidateResponse {
150 // - grpc::StatusCode::OK: Success.
151 // - grpc::StatusCode::RESOURCE_EXHAUSTED: can't create candidate
154 // Handle to the new created candidate configuration.
155 uint32 candidate_id = 1;
159 // RPC: DeleteCandidate()
161 message DeleteCandidateRequest {
162 // Candidate configuration to delete.
163 uint32 candidate_id = 1;
166 message DeleteCandidateResponse {
168 // - grpc::StatusCode::OK: Success.
169 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
173 // RPC: UpdateCandidate()
175 message UpdateCandidateRequest {
176 // Candidate configuration to update.
177 uint32 candidate_id = 1;
180 message UpdateCandidateResponse {
182 // - grpc::StatusCode::OK: Success.
183 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
187 // RPC: EditCandidate()
189 message EditCandidateRequest {
190 // Candidate configuration that is going to be edited.
191 uint32 candidate_id = 1;
193 // Data elements to be created or updated.
194 repeated PathValue update = 2;
196 // Paths to be deleted from the data tree.
197 repeated PathValue delete = 3;
200 message EditCandidateResponse {
202 // - grpc::StatusCode::OK: Success.
203 // - grpc::StatusCode::NOT_FOUND: Candidate wasn't found.
204 // - grpc::StatusCode::INVALID_ARGUMENT: An error occurred while editing the
205 // candidate configuration.
209 // RPC: LoadToCandidate()
211 message LoadToCandidateRequest {
213 // Merge the data tree into the candidate configuration.
216 // Replace the candidate configuration by the provided data tree.
220 // Candidate configuration that is going to be edited.
221 uint32 candidate_id = 1;
223 // Load operation to apply.
226 // Configuration data.
230 message LoadToCandidateResponse {
232 // - grpc::StatusCode::OK: Success.
233 // - grpc::StatusCode::INVALID_ARGUMENT: An error occurred while performing
234 // the load operation.
240 message CommitRequest {
242 // Validate if the configuration changes are valid (phase 0).
245 // Prepare resources to apply the configuration changes (phase 1).
248 // Release previously allocated resources (phase 2).
251 // Apply the configuration changes (phase 2).
254 // All of the above (VALIDATE + PREPARE + ABORT/APPLY).
256 // This option can't be used to implement network-wide transactions,
257 // since they require the manager entity to take into account the results
258 // of the preparation phase of multiple managed devices.
262 // Candidate configuration that is going to be committed.
263 uint32 candidate_id = 1;
265 // Transaction phase.
268 // Assign a comment to this commit.
272 message CommitResponse {
274 // - grpc::StatusCode::OK: Success.
275 // - grpc::StatusCode::FAILED_PRECONDITION: misuse of the two-phase commit
277 // - grpc::StatusCode::INVALID_ARGUMENT: Validation error.
278 // - grpc::StatusCode::RESOURCE_EXHAUSTED: Failure to allocate resource.
280 // ID of the created configuration transaction (when the phase is APPLY
282 uint32 transaction_id = 1;
286 // RPC: ListTransactions()
288 message ListTransactionsRequest {
292 message ListTransactionsResponse {
294 // - grpc::StatusCode::OK: Success.
299 // Client that committed the transaction.
302 // Date and time the transaction was committed.
305 // Comment assigned to the transaction.
310 // RPC: GetTransaction()
312 message GetTransactionRequest {
313 // Transaction to retrieve.
314 uint32 transaction_id = 1;
316 // Encoding to be used.
317 Encoding encoding = 2;
319 // Include implicit default nodes.
320 bool with_defaults = 3;
323 message GetTransactionResponse {
325 // - grpc::StatusCode::OK: Success.
326 // - grpc::StatusCode::NOT_FOUND: Transaction wasn't found in the transactions
335 message LockConfigRequest {
339 message LockConfigResponse {
341 // - grpc::StatusCode::OK: Success.
342 // - grpc::StatusCode::FAILED_PRECONDITION: Running configuration is
347 // RPC: UnlockConfig()
349 message UnlockConfigRequest {
353 message UnlockConfigResponse {
355 // - grpc::StatusCode::OK: Success.
356 // - grpc::StatusCode::FAILED_PRECONDITION: Running configuration isn't
363 message ExecuteRequest {
364 // Path of the YANG RPC or YANG Action.
368 repeated PathValue input = 2;
371 message ExecuteResponse {
373 // - grpc::StatusCode::OK: Success.
375 // Output parameters.
376 repeated PathValue output = 1;
379 // -------------------------------- Definitions --------------------------------
383 // Name of the YANG module;
386 // Organization publishing the module.
387 string organization = 2;
389 // Latest revision of the module;
393 // Supported encodings for YANG instance data.
399 // Path-value pair representing a data element.
408 // YANG instance data.
410 Encoding encoding = 1;