blob: 2563bb025df3b58ca4e23001f323e750c477cf08 [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
William Kurkiandaa6bb22019-03-07 12:26:28 -05009option go_package = "github.com/opencord/voltha-protos/go/voltha";
khenaidooabad44c2018-08-03 16:58:35 -040010
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
khenaidoo54e0ddf2019-02-27 16:21:33 -0500140// Identifies a membership group a Core belongs to
141message Membership {
142 // Group name
143 string group_name = 1;
144
145 // Unique ID of a container within that group
146 string id = 2;
147}
148
khenaidooabad44c2018-08-03 16:58:35 -0400149/*
150 * Voltha APIs
151 *
152 */
153service VolthaService {
154
khenaidoobf6e7bb2018-08-14 22:27:29 -0400155 // Get more information on a given physical device
156 rpc UpdateLogLevel(Logging) returns(google.protobuf.Empty) {
157 option (google.api.http) = {
Stephane Barbariedf5479f2019-01-29 22:13:00 -0500158 get: "/api/v1/logs"
khenaidoobf6e7bb2018-08-14 22:27:29 -0400159 };
160 }
161
khenaidoo54e0ddf2019-02-27 16:21:33 -0500162 // Set the membership group of a Voltha Core
163 rpc UpdateMembership(Membership) returns(google.protobuf.Empty) {
164 option (google.api.http) = {
165 post: "/api/v1/membership"
166 body: "*"
167 };
168 }
169
khenaidooabad44c2018-08-03 16:58:35 -0400170 // Get high level information on the Voltha cluster
171 rpc GetVoltha(google.protobuf.Empty) returns(Voltha) {
172 option (google.api.http) = {
173 get: "/api/v1"
174 };
175 }
176
khenaidoobf6e7bb2018-08-14 22:27:29 -0400177 // List all Voltha cluster core instances
178 rpc ListCoreInstances(google.protobuf.Empty) returns(CoreInstances) {
khenaidooabad44c2018-08-03 16:58:35 -0400179 option (google.api.http) = {
180 get: "/api/v1/instances"
181 };
182 option (voltha.yang_xml_tag).xml_tag = 'items';
183 option (voltha.yang_xml_tag).list_items_name = 'items';
184 }
185
186 // Get details on a Voltha cluster instance
khenaidoobf6e7bb2018-08-14 22:27:29 -0400187 rpc GetCoreInstance(ID) returns(CoreInstance) {
khenaidooabad44c2018-08-03 16:58:35 -0400188 option (google.api.http) = {
189 get: "/api/v1/instances/{id}"
190 };
191 }
192
193 // List all active adapters (plugins) in the Voltha cluster
194 rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
195 option (google.api.http) = {
196 get: "/api/v1/adapters"
197 };
198 option (voltha.yang_xml_tag).xml_tag = 'adapters';
199 }
200
201
202 // List all logical devices managed by the Voltha cluster
203 rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
204 option (google.api.http) = {
205 get: "/api/v1/logical_devices"
206 };
207 option (voltha.yang_xml_tag).xml_tag = 'logical_devices';
208 }
209
210 // Get additional information on a given logical device
211 rpc GetLogicalDevice(ID) returns(LogicalDevice) {
212 option (google.api.http) = {
213 get: "/api/v1/logical_devices/{id}"
214 };
215 }
216
217 // List ports of a logical device
218 rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) {
219 option (google.api.http) = {
220 get: "/api/v1/logical_devices/{id}/ports"
221 };
222 option (voltha.yang_xml_tag).xml_tag = 'ports';
223 }
224
225 // Gets a logical device port
226 rpc GetLogicalDevicePort(LogicalPortId) returns(LogicalPort) {
227 option (google.api.http) = {
228 get: "/api/v1/logical_devices/{id}/ports/{port_id}"
229 };
230 option (voltha.yang_xml_tag).xml_tag = 'port';
231 }
232
233 // Enables a logical device port
234 rpc EnableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
235 option (google.api.http) = {
236 post: "/api/v1/logical_devices/{id}/ports/{port_id}/enable"
237 };
238 }
239
240 // Disables a logical device port
241 rpc DisableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
242 option (google.api.http) = {
243 post: "/api/v1/logical_devices/{id}/ports/{port_id}/disable"
244 };
245 }
246
247 // List all flows of a logical device
248 rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) {
249 option (google.api.http) = {
250 get: "/api/v1/logical_devices/{id}/flows"
251 };
252 option (voltha.yang_xml_tag).xml_tag = 'flows';
253 option (voltha.yang_xml_tag).list_items_name = 'items';
254 }
255
256 // Update flow table for logical device
257 rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate)
258 returns(google.protobuf.Empty) {
259 option (google.api.http) = {
260 post: "/api/v1/logical_devices/{id}/flows"
261 body: "*"
262 };
263 }
264
265 // List all flow groups of a logical device
266 rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
267 option (google.api.http) = {
268 get: "/api/v1/logical_devices/{id}/flow_groups"
269 };
270 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
271 option (voltha.yang_xml_tag).list_items_name = 'items';
272 }
273
274 // Update group table for device
275 rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
276 returns(google.protobuf.Empty) {
277 option (google.api.http) = {
278 post: "/api/v1/logical_devices/{id}/flow_groups"
279 body: "*"
280 };
281 }
282
283 // List all physical devices controlled by the Voltha cluster
284 rpc ListDevices(google.protobuf.Empty) returns(Devices) {
285 option (google.api.http) = {
286 get: "/api/v1/devices"
287 };
288 option (voltha.yang_xml_tag).xml_tag = 'devices';
289 }
290
khenaidoo7ccedd52018-12-14 16:48:54 -0500291 // List all physical devices IDs controlled by the Voltha cluster
292 rpc ListDeviceIds(google.protobuf.Empty) returns(IDs) {
293 option (google.api.http) = {
294 get: "/api/v1/deviceids"
295 };
296 option (voltha.yang_xml_tag).xml_tag = 'id';
297 option (voltha.yang_xml_tag).list_items_name = 'items';
298 }
299
300 // Request to a voltha Core to reconcile a set of devices based on their IDs
301 rpc ReconcileDevices(IDs) returns(google.protobuf.Empty) {
302 option (google.api.http) = {
303 post: "/api/v1/deviceids"
304 body: "*"
305 };
306 }
307
khenaidooabad44c2018-08-03 16:58:35 -0400308 // Get more information on a given physical device
309 rpc GetDevice(ID) returns(Device) {
310 option (google.api.http) = {
311 get: "/api/v1/devices/{id}"
312 };
313 }
314
315 // Pre-provision a new physical device
316 rpc CreateDevice(Device) returns(Device) {
317 option (google.api.http) = {
318 post: "/api/v1/devices"
319 body: "*"
320 };
321 }
322
323 // Enable a device. If the device was in pre-provisioned state then it
324 // will transition to ENABLED state. If it was is DISABLED state then it
325 // will transition to ENABLED state as well.
326 rpc EnableDevice(ID) returns(google.protobuf.Empty) {
327 option (google.api.http) = {
328 post: "/api/v1/devices/{id}/enable"
329 };
330 }
331
332 // Disable a device
333 rpc DisableDevice(ID) returns(google.protobuf.Empty) {
334 option (google.api.http) = {
335 post: "/api/v1/devices/{id}/disable"
336 };
337 }
338
339 // Reboot a device
340 rpc RebootDevice(ID) returns(google.protobuf.Empty) {
341 option (google.api.http) = {
342 post: "/api/v1/devices/{id}/reboot"
343 };
344 }
345
346 // Delete a device
347 rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
348 option (google.api.http) = {
349 delete: "/api/v1/devices/{id}/delete"
350 };
351 }
352
353 // Request an image download to the standby partition
354 // of a device.
355 // Note that the call is expected to be non-blocking.
356 rpc DownloadImage(ImageDownload) returns(OperationResp) {
357 option (google.api.http) = {
358 post: "/api/v1/devices/{id}/image_downloads/{name}"
359 body: "*"
360 };
361 }
362
363 // Get image download status on a device
364 // The request retrieves progress on device and updates db record
365 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
366 option (google.api.http) = {
367 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
368 };
369 }
370
371 // Get image download db record
372 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
373 option (google.api.http) = {
374 get: "/api/v1/devices/{id}/image_downloads/{name}"
375 };
376 }
377
378 // List image download db records for a given device
379 rpc ListImageDownloads(ID) returns(ImageDownloads) {
380 option (google.api.http) = {
381 get: "/api/v1/devices/{id}/image_downloads"
382 };
383 }
384
385 // Cancel an existing image download process on a device
386 rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
387 option (google.api.http) = {
388 delete: "/api/v1/devices/{id}/image_downloads/{name}"
389 };
390 }
391
392 // Activate the specified image at a standby partition
393 // to active partition.
394 // Depending on the device implementation, this call
395 // may or may not cause device reboot.
396 // If no reboot, then a reboot is required to make the
397 // activated image running on device
398 // Note that the call is expected to be non-blocking.
399 rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
400 option (google.api.http) = {
401 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
402 body: "*"
403 };
404 }
405
406 // Revert the specified image at standby partition
407 // to active partition, and revert to previous image
408 // Depending on the device implementation, this call
409 // may or may not cause device reboot.
410 // If no reboot, then a reboot is required to make the
411 // previous image running on device
412 // Note that the call is expected to be non-blocking.
413 rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
414 option (google.api.http) = {
415 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
416 body: "*"
417 };
418 }
419
420 // List ports of a device
421 rpc ListDevicePorts(ID) returns(Ports) {
422 option (google.api.http) = {
423 get: "/api/v1/devices/{id}/ports"
424 };
425 option (voltha.yang_xml_tag).xml_tag = 'ports';
426 }
427
428 // List pm config of a device
429 rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
430 option (google.api.http) = {
431 get: "/api/v1/devices/{id}/pm_configs"
432 };
433 }
434
435 // Update the pm config of a device
436 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
437 option (google.api.http) = {
438 post: "/api/v1/devices/{id}/pm_configs"
439 body: "*"
440 };
441 }
442
443 // List all flows of a device
444 rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
445 option (google.api.http) = {
446 get: "/api/v1/devices/{id}/flows"
447 };
448 option (voltha.yang_xml_tag).xml_tag = 'flows';
449 option (voltha.yang_xml_tag).list_items_name = 'items';
450 }
451
452 // List all flow groups of a device
453 rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
454 option (google.api.http) = {
455 get: "/api/v1/devices/{id}/flow_groups"
456 };
457 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
458 option (voltha.yang_xml_tag).list_items_name = 'items';
459 }
460
461 // List device types known to Voltha
462 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
463 option (google.api.http) = {
464 get: "/api/v1/device_types"
465 };
466 option (voltha.yang_xml_tag).xml_tag = 'device_types';
467 }
468
469 // Get additional information on a device type
470 rpc GetDeviceType(ID) returns(DeviceType) {
471 option (google.api.http) = {
472 get: "/api/v1/device_types/{id}"
473 };
474 }
475
476 // List all device sharding groups
477 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
478 option (google.api.http) = {
479 get: "/api/v1/device_groups"
480 };
481 option (voltha.yang_xml_tag).xml_tag = 'device_groups';
482 }
483
khenaidoofdbad6e2018-11-06 22:26:38 -0500484 // Stream control packets to the dataplane
485 rpc StreamPacketsOut(stream openflow_13.PacketOut)
486 returns(google.protobuf.Empty) {
487 // This does not have an HTTP representation
488 }
489
490 // Receive control packet stream
491 rpc ReceivePacketsIn(google.protobuf.Empty)
492 returns(stream openflow_13.PacketIn) {
493 // This does not have an HTTP representation
494 }
495
496 rpc ReceiveChangeEvents(google.protobuf.Empty)
497 returns(stream openflow_13.ChangeEvent) {
498 // This does not have an HTTP representation
499 }
500
khenaidooabad44c2018-08-03 16:58:35 -0400501 // Get additional information on a device group
502 rpc GetDeviceGroup(ID) returns(DeviceGroup) {
503 option (google.api.http) = {
504 get: "/api/v1/device_groups/{id}"
505 };
506 }
507
508 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
509 option (google.api.http) = {
510 post: "/api/v1/alarm_filters"
511 body: "*"
512 };
513 }
514
515 rpc GetAlarmFilter(ID) returns(AlarmFilter) {
516 option (google.api.http) = {
517 get: "/api/v1/alarm_filters/{id}"
518 };
519 }
520
521 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
522 option (google.api.http) = {
523 put: "/api/v1/alarm_filters/{id}"
524 body: "*"
525 };
526 }
527
528 rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
529 option (google.api.http) = {
530 delete: "/api/v1/alarm_filters/{id}"
531 };
532 }
533
534 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
535 option (google.api.http) = {
536 get: "/api/v1/alarm_filters"
537 };
538 }
539
540 rpc GetImages(ID) returns(Images) {
541 option (google.api.http) = {
542 get: "/api/v1/devices/{id}/images"
543 };
544 }
545
546 rpc SelfTest(ID) returns(SelfTestResponse) {
547 option (google.api.http) = {
548 post: "/api/v1/devices/{id}/self_test"
549 };
550 }
Stephane Barbarie6e1bd502018-11-05 22:44:45 -0500551
552 rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
553 }
khenaidooabad44c2018-08-03 16:58:35 -0400554}
555