summaryrefslogtreecommitdiffstats
path: root/lib/mgmt.proto
blob: 8a11ff0fa50680469485b574d5a7a1da311f6695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
// SPDX-License-Identifier: ISC
//
// mgmt.proto
//
// @copyright Copyright (C) 2021  Vmware, Inc.
//
// @author Pushpasis Sarkar <spushpasis@vmware.com>
//

syntax = "proto2";

//
// Protobuf definitions pertaining to the MGMTD component.
//

package mgmtd;

//
// Common Sub-Messages
//

message YangDataXPath {
  required string xpath = 1;
}

message YangDataValue {
  oneof value {
    //
    // NOTE: For now let's use stringized value ONLY.
    // We will enhance it later to pass native-format
    // if needed.
    //
    // bool bool_val = 2;
    // double double_val = 3;
    // float float_val = 4;
    // string string_val = 5;
    // bytes bytes_val = 6;
    // int32 int32_val = 7;
    // int64 int64_val = 8;
    // uint32 uint32_val = 9;
    // uint64 uint64_val = 10;
    // int32 int8_val = 11;
    // uint32 uint8_val = 12;
    // int32 int16_val = 13;
    // uint32 uint16_val = 14;
    string encoded_str_val = 100;
  }
}

message YangData {
  required string xpath = 1;
  optional YangDataValue value = 2;
}

enum CfgDataReqType {
  REQ_TYPE_NONE = 0;
  SET_DATA = 1;
  DELETE_DATA = 2;
}

message YangCfgDataReq {
  required YangData data = 1;
  required CfgDataReqType req_type = 2;
}

message YangGetDataReq {
  required YangData data = 1;
  required int64 next_indx = 2;
}

//
// Backend Interface Messages
//
message BeSubscribeReq {
  required string client_name = 1;
  required bool subscribe_xpaths = 2;
  repeated string xpath_reg = 3;
}

message BeSubscribeReply {
  required bool success = 1;
}

message BeTxnReq {
  required uint64 txn_id = 1;
  required bool create = 2;
}

message BeTxnReply {
  required uint64 txn_id = 1;
  required bool create = 2;
  required bool success = 3;
}

message BeCfgDataCreateReq {
  required uint64 txn_id = 1;
  required uint64 batch_id = 2;
  repeated YangCfgDataReq data_req = 3;
  required bool end_of_data = 4;
}

message BeCfgDataCreateReply {
  required uint64 txn_id = 1;
  required uint64 batch_id = 2;
  required bool success = 3;
  optional string error_if_any = 4;
}

message BeCfgDataApplyReq {
  required uint64 txn_id = 1;
}

message BeCfgDataApplyReply {
  required uint64 txn_id = 1;
  repeated uint64 batch_ids = 2;
  required bool success = 3;
  optional string error_if_any = 4;
}

message BeOperDataGetReq {
  required uint64 txn_id = 1;
  required uint64 batch_id = 2;
  repeated YangGetDataReq data = 3;
}

message YangDataReply {
  repeated YangData data = 1;
  required int64 next_indx = 2;
}

message BeOperDataGetReply {
  required uint64 txn_id = 1;
  required uint64 batch_id = 2;
  required bool success = 3;
  optional string error = 4;
  optional YangDataReply data = 5;
}

message BeOperDataNotify {
  required YangDataReply data = 5;
}

message BeConfigCmdReq {
  required string cmd = 1;
}

message BeConfigCmdReply {
  required bool success = 1;
  required string error_if_any = 2;
}

message BeShowCmdReq {
  required string cmd = 1;
}

message BeShowCmdReply {
  required bool success = 1;
  required string cmd_ouput = 2;
}

//
// Any message on the MGMTD Backend Interface.
//
message BeMessage {
  oneof message {
    BeSubscribeReq subscr_req = 2;
    BeSubscribeReply subscr_reply = 3;
    BeTxnReq txn_req = 4;
    BeTxnReply txn_reply = 5;
    BeCfgDataCreateReq cfg_data_req = 6;
    BeCfgDataCreateReply cfg_data_reply = 7;
    BeCfgDataApplyReq cfg_apply_req = 8;
    BeCfgDataApplyReply cfg_apply_reply = 9;
    BeOperDataGetReq get_req = 10;
    BeOperDataGetReply get_reply = 11;
    BeOperDataNotify notify_data = 12;
    BeConfigCmdReq cfg_cmd_req = 13;
    BeConfigCmdReply cfg_cmd_reply = 14;
    BeShowCmdReq show_cmd_req = 15;
    BeShowCmdReply show_cmd_reply = 16;
  }
}


//
// Frontend Interface Messages
//

message FeRegisterReq {
  required string client_name = 1;
}

message FeSessionReq {
  required bool create = 1;
  oneof id {
    uint64 client_conn_id = 2; // Applicable for create request only
    uint64 session_id = 3; // Applicable for delete request only
  }
}

message FeSessionReply {
  required bool create = 1;
  required bool success = 2;
  optional uint64 client_conn_id = 3; // Applicable for create request only
  required uint64 session_id = 4;
}

enum DatastoreId {
  DS_NONE = 0;
  RUNNING_DS = 1;
  CANDIDATE_DS = 2;
  OPERATIONAL_DS = 3;
  STARTUP_DS = 4;
}

message FeLockDsReq {
  required uint64 session_id = 1;
  required uint64 req_id = 2;
  required DatastoreId ds_id = 3;
  required bool lock = 4;
}

message FeLockDsReply {
  required uint64 session_id = 1;
  required uint64 req_id = 2;
  required DatastoreId ds_id = 3;
  required bool lock = 4;
  required bool success = 5;
  optional string error_if_any = 6;
}

message FeSetConfigReq {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  repeated YangCfgDataReq data = 4;
  required bool implicit_commit = 5;
  required DatastoreId commit_ds_id = 6;
}

message FeSetConfigReply {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  required bool success = 4;
  optional string error_if_any = 5;
}

message FeCommitConfigReq {
  required uint64 session_id = 1;
  required DatastoreId src_ds_id = 2;
  required DatastoreId dst_ds_id = 3;
  required uint64 req_id = 4;
  required bool validate_only = 5;
  required bool abort = 6;
}

message FeCommitConfigReply {
  required uint64 session_id = 1;
  required DatastoreId src_ds_id = 2;
  required DatastoreId dst_ds_id = 3;
  required uint64 req_id = 4;
  required bool validate_only = 5;
  required bool success = 6;
  required bool abort = 7;
  optional string error_if_any = 8;
}

message FeGetConfigReq {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  repeated YangGetDataReq data = 4;
}

message FeGetConfigReply {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  required bool success = 4;
  optional string error_if_any = 5;
  optional YangDataReply data = 6;
}

message FeGetDataReq {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  repeated YangGetDataReq data = 4;
}

message FeGetDataReply {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required uint64 req_id = 3;
  required bool success = 4;
  optional string error_if_any = 5;
  optional YangDataReply data = 6;
}

message FeNotifyDataReq {
  repeated YangData data = 1;
}

message FeRegisterNotifyReq {
  required uint64 session_id = 1;
  required DatastoreId ds_id = 2;
  required bool register_req = 3;
  required uint64 req_id = 4;
  repeated YangDataXPath data_xpath = 5;
}

message FeMessage {
  oneof message {
    FeRegisterReq register_req = 2;
    FeSessionReq session_req = 3;
    FeSessionReply session_reply = 4;
    FeLockDsReq lockds_req = 5;
    FeLockDsReply lockds_reply = 6;
    FeSetConfigReq setcfg_req = 7;
    FeSetConfigReply setcfg_reply = 8;
    FeCommitConfigReq commcfg_req = 9;
    FeCommitConfigReply commcfg_reply = 10;
    FeGetConfigReq getcfg_req = 11;
    FeGetConfigReply getcfg_reply = 12;
    FeGetDataReq getdata_req = 13;
    FeGetDataReply getdata_reply = 14;
    FeNotifyDataReq notify_data_req = 15;
    FeRegisterNotifyReq regnotify_req = 16;
  }
}