blob: faf57a18840f5e39c7d4a432354db4fc357eb5ca [file] [log] [blame]
khenaidooabad44c2018-08-03 16:58:35 -04001/*
2 * Top-level Voltha API definition
3 *
4 * For details, see individual definition files.
5 */
6
7syntax = "proto3";
8
9option go_package = "github.com/opencord/voltha-go/protos/voltha";
10
11package voltha;
12
13import "google/protobuf/empty.proto";
14import "google/api/annotations.proto";
15
16import "yang_options.proto";
17
18import public "meta.proto";
19import public "common.proto";
20import public "health.proto";
21import public "logical_device.proto";
22import public "device.proto";
23import public "adapter.proto";
24import public "openflow_13.proto";
25import "omci_mib_db.proto";
26
27
28option java_package = "org.opencord.voltha";
29option java_outer_classname = "VolthaProtos";
30option csharp_namespace = "Opencord.Voltha.Voltha";
31
32message DeviceGroup {
33
34 string id = 1 [(access) = READ_ONLY];
35
36 repeated LogicalDevice logical_devices = 2 [(child_node) = {key: "id"}];
37
38 repeated Device devices = 3 [(child_node) = {key: "id"}];
39}
40
41message DeviceGroups {
42 repeated DeviceGroup items = 1;
43}
44
45
46message AlarmFilterRuleKey {
47 option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
48
49 enum AlarmFilterRuleKey {
50 id = 0;
51 type = 1;
52 severity = 2;
53 resource_id = 3;
54 category = 4;
55 device_id = 5;
56 }
57}
58
59message AlarmFilterRule {
60 AlarmFilterRuleKey.AlarmFilterRuleKey key = 1;
61 string value = 2;
62}
63message AlarmFilter {
64 string id = 1 [(access) = READ_ONLY];
65
66 repeated AlarmFilterRule rules = 2;
67}
68
69message AlarmFilters {
70 repeated AlarmFilter filters = 1;
71}
72
khenaidoobf6e7bb2018-08-14 22:27:29 -040073message Logging {
74 LogLevel.LogLevel level = 1;
khenaidoob9203542018-09-17 22:56:37 -040075 string package_name = 2;
khenaidoobf6e7bb2018-08-14 22:27:29 -040076}
77
khenaidoo9a468962018-09-19 15:33:13 -040078// CoreInstance represents a core instance. It is data held in memory when a core
79// is running. This data is not persistent.
khenaidoobf6e7bb2018-08-14 22:27:29 -040080message CoreInstance {
khenaidooabad44c2018-08-03 16:58:35 -040081 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
82
83 string instance_id = 1 [(access) = READ_ONLY];
84
khenaidoo9a468962018-09-19 15:33:13 -040085 HealthStatus health = 2 [(child_node) = {}];
khenaidooabad44c2018-08-03 16:58:35 -040086
khenaidooabad44c2018-08-03 16:58:35 -040087}
88
khenaidoobf6e7bb2018-08-14 22:27:29 -040089message CoreInstances {
khenaidooabad44c2018-08-03 16:58:35 -040090 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
Stephane Barbariea75791c2019-01-24 10:58:06 -050091 repeated CoreInstance items = 1;
khenaidooabad44c2018-08-03 16:58:35 -040092}
93
khenaidoo9a468962018-09-19 15:33:13 -040094// Voltha represents the Voltha cluster data. Each Core instance will hold a subset of
95// the entire cluster. However, some items (e.g. adapters) will be held by all cores
96// for better performance
khenaidooabad44c2018-08-03 16:58:35 -040097message Voltha {
98 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
99
100 string version = 1 [(access) = READ_ONLY];
101
khenaidoo9a468962018-09-19 15:33:13 -0400102 repeated Adapter adapters = 2 [(child_node) = {key: "id"}];
khenaidooabad44c2018-08-03 16:58:35 -0400103
khenaidoo9a468962018-09-19 15:33:13 -0400104 repeated LogicalDevice logical_devices = 3 [(child_node) = {key: "id"}];
khenaidooabad44c2018-08-03 16:58:35 -0400105
khenaidoo9a468962018-09-19 15:33:13 -0400106 repeated Device devices = 4 [(child_node) = {key: "id"}];
khenaidooabad44c2018-08-03 16:58:35 -0400107
Stephane Barbariea75791c2019-01-24 10:58:06 -0500108 repeated DeviceType device_types = 5 [(child_node) = {key: "id"}];
khenaidooabad44c2018-08-03 16:58:35 -0400109
Stephane Barbariea75791c2019-01-24 10:58:06 -0500110 repeated DeviceGroup device_groups = 6 [(child_node) = {key: "id"}];
111
112 repeated AlarmFilter alarm_filters = 7 [(child_node) = {key: "id"}];
khenaidoobf6e7bb2018-08-14 22:27:29 -0400113
khenaidooabad44c2018-08-03 16:58:35 -0400114 repeated
115 omci.MibDeviceData omci_mib_database = 28
116 [(child_node) = {key: "device_id"}];
117}
118
119// Device Self Test Response
120message SelfTestResponse {
121 option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
122
123 enum SelfTestResult {
124 SUCCESS = 0;
125 FAILURE = 1;
126 NOT_SUPPORTED = 2;
127 UNKNOWN_ERROR = 3;
128 }
129 SelfTestResult result = 1;
130}
131
132message OfAgentSubscriber {
133 // ID of ofagent instance
134 string ofagent_id = 1;
135
136 // ID of voltha instance to which the ofagent is subscribed
137 string voltha_id = 2;
138}
139
140/*
141 * Voltha APIs
142 *
143 */
144service VolthaService {
145
khenaidoobf6e7bb2018-08-14 22:27:29 -0400146 // Get more information on a given physical device
147 rpc UpdateLogLevel(Logging) returns(google.protobuf.Empty) {
148 option (google.api.http) = {
149 get: "/api/v1/devices/{id}"
150 };
151 }
152
khenaidooabad44c2018-08-03 16:58:35 -0400153 // Get high level information on the Voltha cluster
154 rpc GetVoltha(google.protobuf.Empty) returns(Voltha) {
155 option (google.api.http) = {
156 get: "/api/v1"
157 };
158 }
159
khenaidoobf6e7bb2018-08-14 22:27:29 -0400160 // List all Voltha cluster core instances
161 rpc ListCoreInstances(google.protobuf.Empty) returns(CoreInstances) {
khenaidooabad44c2018-08-03 16:58:35 -0400162 option (google.api.http) = {
163 get: "/api/v1/instances"
164 };
165 option (voltha.yang_xml_tag).xml_tag = 'items';
166 option (voltha.yang_xml_tag).list_items_name = 'items';
167 }
168
169 // Get details on a Voltha cluster instance
khenaidoobf6e7bb2018-08-14 22:27:29 -0400170 rpc GetCoreInstance(ID) returns(CoreInstance) {
khenaidooabad44c2018-08-03 16:58:35 -0400171 option (google.api.http) = {
172 get: "/api/v1/instances/{id}"
173 };
174 }
175
176 // List all active adapters (plugins) in the Voltha cluster
177 rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
178 option (google.api.http) = {
179 get: "/api/v1/adapters"
180 };
181 option (voltha.yang_xml_tag).xml_tag = 'adapters';
182 }
183
184
185 // List all logical devices managed by the Voltha cluster
186 rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
187 option (google.api.http) = {
188 get: "/api/v1/logical_devices"
189 };
190 option (voltha.yang_xml_tag).xml_tag = 'logical_devices';
191 }
192
193 // Get additional information on a given logical device
194 rpc GetLogicalDevice(ID) returns(LogicalDevice) {
195 option (google.api.http) = {
196 get: "/api/v1/logical_devices/{id}"
197 };
198 }
199
200 // List ports of a logical device
201 rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) {
202 option (google.api.http) = {
203 get: "/api/v1/logical_devices/{id}/ports"
204 };
205 option (voltha.yang_xml_tag).xml_tag = 'ports';
206 }
207
208 // Gets a logical device port
209 rpc GetLogicalDevicePort(LogicalPortId) returns(LogicalPort) {
210 option (google.api.http) = {
211 get: "/api/v1/logical_devices/{id}/ports/{port_id}"
212 };
213 option (voltha.yang_xml_tag).xml_tag = 'port';
214 }
215
216 // Enables a logical device port
217 rpc EnableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
218 option (google.api.http) = {
219 post: "/api/v1/logical_devices/{id}/ports/{port_id}/enable"
220 };
221 }
222
223 // Disables a logical device port
224 rpc DisableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
225 option (google.api.http) = {
226 post: "/api/v1/logical_devices/{id}/ports/{port_id}/disable"
227 };
228 }
229
230 // List all flows of a logical device
231 rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) {
232 option (google.api.http) = {
233 get: "/api/v1/logical_devices/{id}/flows"
234 };
235 option (voltha.yang_xml_tag).xml_tag = 'flows';
236 option (voltha.yang_xml_tag).list_items_name = 'items';
237 }
238
239 // Update flow table for logical device
240 rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate)
241 returns(google.protobuf.Empty) {
242 option (google.api.http) = {
243 post: "/api/v1/logical_devices/{id}/flows"
244 body: "*"
245 };
246 }
247
248 // List all flow groups of a logical device
249 rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
250 option (google.api.http) = {
251 get: "/api/v1/logical_devices/{id}/flow_groups"
252 };
253 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
254 option (voltha.yang_xml_tag).list_items_name = 'items';
255 }
256
257 // Update group table for device
258 rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
259 returns(google.protobuf.Empty) {
260 option (google.api.http) = {
261 post: "/api/v1/logical_devices/{id}/flow_groups"
262 body: "*"
263 };
264 }
265
266 // List all physical devices controlled by the Voltha cluster
267 rpc ListDevices(google.protobuf.Empty) returns(Devices) {
268 option (google.api.http) = {
269 get: "/api/v1/devices"
270 };
271 option (voltha.yang_xml_tag).xml_tag = 'devices';
272 }
273
khenaidoo7ccedd52018-12-14 16:48:54 -0500274 // List all physical devices IDs controlled by the Voltha cluster
275 rpc ListDeviceIds(google.protobuf.Empty) returns(IDs) {
276 option (google.api.http) = {
277 get: "/api/v1/deviceids"
278 };
279 option (voltha.yang_xml_tag).xml_tag = 'id';
280 option (voltha.yang_xml_tag).list_items_name = 'items';
281 }
282
283 // Request to a voltha Core to reconcile a set of devices based on their IDs
284 rpc ReconcileDevices(IDs) returns(google.protobuf.Empty) {
285 option (google.api.http) = {
286 post: "/api/v1/deviceids"
287 body: "*"
288 };
289 }
290
khenaidooabad44c2018-08-03 16:58:35 -0400291 // Get more information on a given physical device
292 rpc GetDevice(ID) returns(Device) {
293 option (google.api.http) = {
294 get: "/api/v1/devices/{id}"
295 };
296 }
297
298 // Pre-provision a new physical device
299 rpc CreateDevice(Device) returns(Device) {
300 option (google.api.http) = {
301 post: "/api/v1/devices"
302 body: "*"
303 };
304 }
305
306 // Enable a device. If the device was in pre-provisioned state then it
307 // will transition to ENABLED state. If it was is DISABLED state then it
308 // will transition to ENABLED state as well.
309 rpc EnableDevice(ID) returns(google.protobuf.Empty) {
310 option (google.api.http) = {
311 post: "/api/v1/devices/{id}/enable"
312 };
313 }
314
315 // Disable a device
316 rpc DisableDevice(ID) returns(google.protobuf.Empty) {
317 option (google.api.http) = {
318 post: "/api/v1/devices/{id}/disable"
319 };
320 }
321
322 // Reboot a device
323 rpc RebootDevice(ID) returns(google.protobuf.Empty) {
324 option (google.api.http) = {
325 post: "/api/v1/devices/{id}/reboot"
326 };
327 }
328
329 // Delete a device
330 rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
331 option (google.api.http) = {
332 delete: "/api/v1/devices/{id}/delete"
333 };
334 }
335
336 // Request an image download to the standby partition
337 // of a device.
338 // Note that the call is expected to be non-blocking.
339 rpc DownloadImage(ImageDownload) returns(OperationResp) {
340 option (google.api.http) = {
341 post: "/api/v1/devices/{id}/image_downloads/{name}"
342 body: "*"
343 };
344 }
345
346 // Get image download status on a device
347 // The request retrieves progress on device and updates db record
348 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
349 option (google.api.http) = {
350 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
351 };
352 }
353
354 // Get image download db record
355 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
356 option (google.api.http) = {
357 get: "/api/v1/devices/{id}/image_downloads/{name}"
358 };
359 }
360
361 // List image download db records for a given device
362 rpc ListImageDownloads(ID) returns(ImageDownloads) {
363 option (google.api.http) = {
364 get: "/api/v1/devices/{id}/image_downloads"
365 };
366 }
367
368 // Cancel an existing image download process on a device
369 rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
370 option (google.api.http) = {
371 delete: "/api/v1/devices/{id}/image_downloads/{name}"
372 };
373 }
374
375 // Activate the specified image at a standby partition
376 // to active partition.
377 // Depending on the device implementation, this call
378 // may or may not cause device reboot.
379 // If no reboot, then a reboot is required to make the
380 // activated image running on device
381 // Note that the call is expected to be non-blocking.
382 rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
383 option (google.api.http) = {
384 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
385 body: "*"
386 };
387 }
388
389 // Revert the specified image at standby partition
390 // to active partition, and revert to previous image
391 // Depending on the device implementation, this call
392 // may or may not cause device reboot.
393 // If no reboot, then a reboot is required to make the
394 // previous image running on device
395 // Note that the call is expected to be non-blocking.
396 rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
397 option (google.api.http) = {
398 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
399 body: "*"
400 };
401 }
402
403 // List ports of a device
404 rpc ListDevicePorts(ID) returns(Ports) {
405 option (google.api.http) = {
406 get: "/api/v1/devices/{id}/ports"
407 };
408 option (voltha.yang_xml_tag).xml_tag = 'ports';
409 }
410
411 // List pm config of a device
412 rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
413 option (google.api.http) = {
414 get: "/api/v1/devices/{id}/pm_configs"
415 };
416 }
417
418 // Update the pm config of a device
419 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
420 option (google.api.http) = {
421 post: "/api/v1/devices/{id}/pm_configs"
422 body: "*"
423 };
424 }
425
426 // List all flows of a device
427 rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
428 option (google.api.http) = {
429 get: "/api/v1/devices/{id}/flows"
430 };
431 option (voltha.yang_xml_tag).xml_tag = 'flows';
432 option (voltha.yang_xml_tag).list_items_name = 'items';
433 }
434
435 // List all flow groups of a device
436 rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
437 option (google.api.http) = {
438 get: "/api/v1/devices/{id}/flow_groups"
439 };
440 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
441 option (voltha.yang_xml_tag).list_items_name = 'items';
442 }
443
444 // List device types known to Voltha
445 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
446 option (google.api.http) = {
447 get: "/api/v1/device_types"
448 };
449 option (voltha.yang_xml_tag).xml_tag = 'device_types';
450 }
451
452 // Get additional information on a device type
453 rpc GetDeviceType(ID) returns(DeviceType) {
454 option (google.api.http) = {
455 get: "/api/v1/device_types/{id}"
456 };
457 }
458
459 // List all device sharding groups
460 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
461 option (google.api.http) = {
462 get: "/api/v1/device_groups"
463 };
464 option (voltha.yang_xml_tag).xml_tag = 'device_groups';
465 }
466
khenaidoofdbad6e2018-11-06 22:26:38 -0500467 // Stream control packets to the dataplane
468 rpc StreamPacketsOut(stream openflow_13.PacketOut)
469 returns(google.protobuf.Empty) {
470 // This does not have an HTTP representation
471 }
472
473 // Receive control packet stream
474 rpc ReceivePacketsIn(google.protobuf.Empty)
475 returns(stream openflow_13.PacketIn) {
476 // This does not have an HTTP representation
477 }
478
479 rpc ReceiveChangeEvents(google.protobuf.Empty)
480 returns(stream openflow_13.ChangeEvent) {
481 // This does not have an HTTP representation
482 }
483
khenaidooabad44c2018-08-03 16:58:35 -0400484 // Get additional information on a device group
485 rpc GetDeviceGroup(ID) returns(DeviceGroup) {
486 option (google.api.http) = {
487 get: "/api/v1/device_groups/{id}"
488 };
489 }
490
491 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
492 option (google.api.http) = {
493 post: "/api/v1/alarm_filters"
494 body: "*"
495 };
496 }
497
498 rpc GetAlarmFilter(ID) returns(AlarmFilter) {
499 option (google.api.http) = {
500 get: "/api/v1/alarm_filters/{id}"
501 };
502 }
503
504 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
505 option (google.api.http) = {
506 put: "/api/v1/alarm_filters/{id}"
507 body: "*"
508 };
509 }
510
511 rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
512 option (google.api.http) = {
513 delete: "/api/v1/alarm_filters/{id}"
514 };
515 }
516
517 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
518 option (google.api.http) = {
519 get: "/api/v1/alarm_filters"
520 };
521 }
522
523 rpc GetImages(ID) returns(Images) {
524 option (google.api.http) = {
525 get: "/api/v1/devices/{id}/images"
526 };
527 }
528
529 rpc SelfTest(ID) returns(SelfTestResponse) {
530 option (google.api.http) = {
531 post: "/api/v1/devices/{id}/self_test"
532 };
533 }
Stephane Barbarie6e1bd502018-11-05 22:44:45 -0500534
535 rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
536 }
khenaidooabad44c2018-08-03 16:58:35 -0400537}
538