blob: 5e450339168c3541384f5644c883e543a0ffd344 [file] [log] [blame]
David K. Bainbridge24ff0232019-04-30 13:26:19 -07001/*
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-protos/go/voltha";
10
11package voltha;
12
13import "google/api/annotations.proto";
14import "google/protobuf/empty.proto";
15
16import public "voltha_protos/meta.proto";
17import public "voltha_protos/common.proto";
18import public "voltha_protos/health.proto";
19import public "voltha_protos/logical_device.proto";
20import public "voltha_protos/device.proto";
21import public "voltha_protos/adapter.proto";
22import public "voltha_protos/openflow_13.proto";
23
24import "voltha_protos/omci_mib_db.proto";
25import "voltha_protos/omci_alarm_db.proto";
26import "voltha_protos/yang_options.proto";
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 (common.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
David K. Bainbridge24ff0232019-04-30 13:26:19 -070073// CoreInstance represents a core instance. It is data held in memory when a core
74// is running. This data is not persistent.
75message CoreInstance {
76 option (common.yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
77
78 string instance_id = 1 [(access) = READ_ONLY];
79
80 HealthStatus health = 2 [(child_node) = {}];
81
82}
83
84message CoreInstances {
85 option (common.yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
86 repeated CoreInstance items = 1;
87}
88
89// Voltha represents the Voltha cluster data. Each Core instance will hold a subset of
90// the entire cluster. However, some items (e.g. adapters) will be held by all cores
91// for better performance
92message Voltha {
93 option (common.yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
94
95 string version = 1 [(access) = READ_ONLY];
96
97 repeated Adapter adapters = 2 [(child_node) = {key: "id"}];
98
99 repeated LogicalDevice logical_devices = 3 [(child_node) = {key: "id"}];
100
101 repeated Device devices = 4 [(child_node) = {key: "id"}];
102
103 repeated DeviceType device_types = 5 [(child_node) = {key: "id"}];
104
105 repeated DeviceGroup device_groups = 6 [(child_node) = {key: "id"}];
106
107 repeated AlarmFilter alarm_filters = 7 [(child_node) = {key: "id"}];
108
109 repeated
110 omci.MibDeviceData omci_mib_database = 28
111 [(child_node) = {key: "device_id"}];
112
113 repeated
114 omci.AlarmDeviceData omci_alarm_database = 29
115 [(child_node) = {key: "device_id"}];
116}
117
118// Device Self Test Response
119message SelfTestResponse {
120 option (common.yang_child_rule) = MOVE_TO_PARENT_LEVEL;
121
122 enum SelfTestResult {
123 SUCCESS = 0;
124 FAILURE = 1;
125 NOT_SUPPORTED = 2;
126 UNKNOWN_ERROR = 3;
127 }
128 SelfTestResult result = 1;
129}
130
131message OfAgentSubscriber {
132 // ID of ofagent instance
133 string ofagent_id = 1;
134
135 // ID of voltha instance to which the ofagent is subscribed
136 string voltha_id = 2;
137}
138
139// Identifies a membership group a Core belongs to
140message Membership {
141 // Group name
142 string group_name = 1;
143
144 // Unique ID of a container within that group
145 string id = 2;
146}
147
Manikkaraj kb1a10922019-07-29 12:10:34 -0400148// Additional information required to process flow at device adapters
149message FlowMetadata {
150 // Meters associated with flow-update to adapter
151 repeated openflow_13.ofp_meter_config meters = 1;
152}
153
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700154/*
155 * Voltha APIs
156 *
157 */
158service VolthaService {
159
160 // Get more information on a given physical device
Scott Baker112b0d42019-08-22 08:32:26 -0700161 rpc UpdateLogLevel(common.Logging) returns(google.protobuf.Empty) {
162 option (google.api.http) = {
163 post: "/api/v1/logs"
164 body: "*"
165 };
166 }
167
168 rpc GetLogLevels(common.LoggingComponent) returns (common.Loggings) {
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700169 option (google.api.http) = {
170 get: "/api/v1/logs"
171 };
172 }
173
174 // Get the membership group of a Voltha Core
175 rpc GetMembership(google.protobuf.Empty) returns(Membership) {
176 option (google.api.http) = {
177 get: "/api/v1/membership"
178 };
179 }
180
181 // Set the membership group of a Voltha Core
182 rpc UpdateMembership(Membership) returns(google.protobuf.Empty) {
183 option (google.api.http) = {
184 post: "/api/v1/membership"
185 body: "*"
186 };
187 }
188
189 // Get high level information on the Voltha cluster
190 rpc GetVoltha(google.protobuf.Empty) returns(Voltha) {
191 option (google.api.http) = {
192 get: "/api/v1"
193 };
194 }
195
196 // List all Voltha cluster core instances
197 rpc ListCoreInstances(google.protobuf.Empty) returns(CoreInstances) {
198 option (google.api.http) = {
199 get: "/api/v1/instances"
200 };
201 option (common.yang_xml_tag).xml_tag = 'items';
202 option (common.yang_xml_tag).list_items_name = 'items';
203 }
204
205 // Get details on a Voltha cluster instance
206 rpc GetCoreInstance(common.ID) returns(CoreInstance) {
207 option (google.api.http) = {
208 get: "/api/v1/instances/{id}"
209 };
210 }
211
212 // List all active adapters (plugins) in the Voltha cluster
213 rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
214 option (google.api.http) = {
215 get: "/api/v1/adapters"
216 };
217 option (common.yang_xml_tag).xml_tag = 'adapters';
218 }
219
220
221 // List all logical devices managed by the Voltha cluster
222 rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
223 option (google.api.http) = {
224 get: "/api/v1/logical_devices"
225 };
226 option (common.yang_xml_tag).xml_tag = 'logical_devices';
227 }
228
229 // Get additional information on a given logical device
230 rpc GetLogicalDevice(common.ID) returns(LogicalDevice) {
231 option (google.api.http) = {
232 get: "/api/v1/logical_devices/{id}"
233 };
234 }
235
236 // List ports of a logical device
237 rpc ListLogicalDevicePorts(common.ID) returns(LogicalPorts) {
238 option (google.api.http) = {
239 get: "/api/v1/logical_devices/{id}/ports"
240 };
241 option (common.yang_xml_tag).xml_tag = 'ports';
242 }
243
244 // Gets a logical device port
245 rpc GetLogicalDevicePort(LogicalPortId) returns(LogicalPort) {
246 option (google.api.http) = {
247 get: "/api/v1/logical_devices/{id}/ports/{port_id}"
248 };
249 option (common.yang_xml_tag).xml_tag = 'port';
250 }
251
252 // Enables a logical device port
253 rpc EnableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
254 option (google.api.http) = {
255 post: "/api/v1/logical_devices/{id}/ports/{port_id}/enable"
256 };
257 }
258
259 // Disables a logical device port
260 rpc DisableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
261 option (google.api.http) = {
262 post: "/api/v1/logical_devices/{id}/ports/{port_id}/disable"
263 };
264 }
265
266 // List all flows of a logical device
267 rpc ListLogicalDeviceFlows(common.ID) returns(openflow_13.Flows) {
268 option (google.api.http) = {
269 get: "/api/v1/logical_devices/{id}/flows"
270 };
271 option (common.yang_xml_tag).xml_tag = 'flows';
272 option (common.yang_xml_tag).list_items_name = 'items';
273 }
274
275 // Update flow table for logical device
276 rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate)
277 returns(google.protobuf.Empty) {
278 option (google.api.http) = {
279 post: "/api/v1/logical_devices/{id}/flows"
280 body: "*"
281 };
282 }
283
284 // Update meter table for logical device
285 rpc UpdateLogicalDeviceMeterTable(openflow_13.MeterModUpdate)
286 returns(google.protobuf.Empty) {
287 option (google.api.http) = {
288 post: "/api/v1/logical_devices/{id}/meters"
289 body: "*"
290 };
291 }
292
Manikkaraj kb1a10922019-07-29 12:10:34 -0400293 // List all meters of a logical device
294 rpc ListLogicalDeviceMeters(common.ID) returns (openflow_13.Meters) {
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700295 option (google.api.http) = {
Manikkaraj kb1a10922019-07-29 12:10:34 -0400296 get: "/api/v1/logical_devices/{id}/meters"
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700297 };
Manikkaraj kb1a10922019-07-29 12:10:34 -0400298 option (common.yang_xml_tag).xml_tag = 'meters';
299 option (common.yang_xml_tag).list_items_name = 'items';
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700300 }
301
302 // List all flow groups of a logical device
303 rpc ListLogicalDeviceFlowGroups(common.ID) returns(openflow_13.FlowGroups) {
304 option (google.api.http) = {
305 get: "/api/v1/logical_devices/{id}/flow_groups"
306 };
307 option (common.yang_xml_tag).xml_tag = 'flow_groups';
308 option (common.yang_xml_tag).list_items_name = 'items';
309 }
310
311 // Update group table for device
312 rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
313 returns(google.protobuf.Empty) {
314 option (google.api.http) = {
315 post: "/api/v1/logical_devices/{id}/flow_groups"
316 body: "*"
317 };
318 }
319
320 // List all physical devices controlled by the Voltha cluster
321 rpc ListDevices(google.protobuf.Empty) returns(Devices) {
322 option (google.api.http) = {
323 get: "/api/v1/devices"
324 };
325 option (common.yang_xml_tag).xml_tag = 'devices';
326 }
327
328 // List all physical devices IDs controlled by the Voltha cluster
329 rpc ListDeviceIds(google.protobuf.Empty) returns(common.IDs) {
330 option (google.api.http) = {
331 get: "/api/v1/deviceids"
332 };
333 option (common.yang_xml_tag).xml_tag = 'id';
334 option (common.yang_xml_tag).list_items_name = 'items';
335 }
336
337 // Request to a voltha Core to reconcile a set of devices based on their IDs
338 rpc ReconcileDevices(common.IDs) returns(google.protobuf.Empty) {
339 option (google.api.http) = {
340 post: "/api/v1/deviceids"
341 body: "*"
342 };
343 }
344
345 // Get more information on a given physical device
346 rpc GetDevice(common.ID) returns(Device) {
347 option (google.api.http) = {
348 get: "/api/v1/devices/{id}"
349 };
350 }
351
352 // Pre-provision a new physical device
353 rpc CreateDevice(Device) returns(Device) {
354 option (google.api.http) = {
355 post: "/api/v1/devices"
356 body: "*"
357 };
358 }
359
360 // Enable a device. If the device was in pre-provisioned state then it
361 // will transition to ENABLED state. If it was is DISABLED state then it
362 // will transition to ENABLED state as well.
363 rpc EnableDevice(common.ID) returns(google.protobuf.Empty) {
364 option (google.api.http) = {
365 post: "/api/v1/devices/{id}/enable"
366 };
367 }
368
369 // Disable a device
370 rpc DisableDevice(common.ID) returns(google.protobuf.Empty) {
371 option (google.api.http) = {
372 post: "/api/v1/devices/{id}/disable"
373 };
374 }
375
376 // Reboot a device
377 rpc RebootDevice(common.ID) returns(google.protobuf.Empty) {
378 option (google.api.http) = {
379 post: "/api/v1/devices/{id}/reboot"
380 };
381 }
382
383 // Delete a device
384 rpc DeleteDevice(common.ID) returns(google.protobuf.Empty) {
385 option (google.api.http) = {
386 delete: "/api/v1/devices/{id}/delete"
387 };
388 }
389
390 // Request an image download to the standby partition
391 // of a device.
392 // Note that the call is expected to be non-blocking.
393 rpc DownloadImage(ImageDownload) returns(common.OperationResp) {
394 option (google.api.http) = {
395 post: "/api/v1/devices/{id}/image_downloads/{name}"
396 body: "*"
397 };
398 }
399
400 // Get image download status on a device
401 // The request retrieves progress on device and updates db record
402 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
403 option (google.api.http) = {
404 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
405 };
406 }
407
408 // Get image download db record
409 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
410 option (google.api.http) = {
411 get: "/api/v1/devices/{id}/image_downloads/{name}"
412 };
413 }
414
415 // List image download db records for a given device
416 rpc ListImageDownloads(common.ID) returns(ImageDownloads) {
417 option (google.api.http) = {
418 get: "/api/v1/devices/{id}/image_downloads"
419 };
420 }
421
422 // Cancel an existing image download process on a device
423 rpc CancelImageDownload(ImageDownload) returns(common.OperationResp) {
424 option (google.api.http) = {
425 delete: "/api/v1/devices/{id}/image_downloads/{name}"
426 };
427 }
428
429 // Activate the specified image at a standby partition
430 // to active partition.
431 // Depending on the device implementation, this call
432 // may or may not cause device reboot.
433 // If no reboot, then a reboot is required to make the
434 // activated image running on device
435 // Note that the call is expected to be non-blocking.
436 rpc ActivateImageUpdate(ImageDownload) returns(common.OperationResp) {
437 option (google.api.http) = {
438 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
439 body: "*"
440 };
441 }
442
443 // Revert the specified image at standby partition
444 // to active partition, and revert to previous image
445 // Depending on the device implementation, this call
446 // may or may not cause device reboot.
447 // If no reboot, then a reboot is required to make the
448 // previous image running on device
449 // Note that the call is expected to be non-blocking.
450 rpc RevertImageUpdate(ImageDownload) returns(common.OperationResp) {
451 option (google.api.http) = {
452 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
453 body: "*"
454 };
455 }
456
457 // List ports of a device
458 rpc ListDevicePorts(common.ID) returns(Ports) {
459 option (google.api.http) = {
460 get: "/api/v1/devices/{id}/ports"
461 };
462 option (common.yang_xml_tag).xml_tag = 'ports';
463 }
464
465 // List pm config of a device
466 rpc ListDevicePmConfigs(common.ID) returns(PmConfigs) {
467 option (google.api.http) = {
468 get: "/api/v1/devices/{id}/pm_configs"
469 };
470 }
471
472 // Update the pm config of a device
473 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
474 option (google.api.http) = {
475 post: "/api/v1/devices/{id}/pm_configs"
476 body: "*"
477 };
478 }
479
480 // List all flows of a device
481 rpc ListDeviceFlows(common.ID) returns(openflow_13.Flows) {
482 option (google.api.http) = {
483 get: "/api/v1/devices/{id}/flows"
484 };
485 option (common.yang_xml_tag).xml_tag = 'flows';
486 option (common.yang_xml_tag).list_items_name = 'items';
487 }
488
489 // List all flow groups of a device
490 rpc ListDeviceFlowGroups(common.ID) returns(openflow_13.FlowGroups) {
491 option (google.api.http) = {
492 get: "/api/v1/devices/{id}/flow_groups"
493 };
494 option (common.yang_xml_tag).xml_tag = 'flow_groups';
495 option (common.yang_xml_tag).list_items_name = 'items';
496 }
497
498 // List device types known to Voltha
499 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
500 option (google.api.http) = {
501 get: "/api/v1/device_types"
502 };
503 option (common.yang_xml_tag).xml_tag = 'device_types';
504 }
505
506 // Get additional information on a device type
507 rpc GetDeviceType(common.ID) returns(DeviceType) {
508 option (google.api.http) = {
509 get: "/api/v1/device_types/{id}"
510 };
511 }
512
513 // List all device sharding groups
514 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
515 option (google.api.http) = {
516 get: "/api/v1/device_groups"
517 };
518 option (common.yang_xml_tag).xml_tag = 'device_groups';
519 }
520
521 // Stream control packets to the dataplane
522 rpc StreamPacketsOut(stream openflow_13.PacketOut)
523 returns(google.protobuf.Empty) {
524 // This does not have an HTTP representation
525 }
526
527 // Receive control packet stream
528 rpc ReceivePacketsIn(google.protobuf.Empty)
529 returns(stream openflow_13.PacketIn) {
530 // This does not have an HTTP representation
531 }
532
533 rpc ReceiveChangeEvents(google.protobuf.Empty)
534 returns(stream openflow_13.ChangeEvent) {
535 // This does not have an HTTP representation
536 }
537
538 // Get additional information on a device group
539 rpc GetDeviceGroup(common.ID) returns(DeviceGroup) {
540 option (google.api.http) = {
541 get: "/api/v1/device_groups/{id}"
542 };
543 }
544
545 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
546 option (google.api.http) = {
547 post: "/api/v1/alarm_filters"
548 body: "*"
549 };
550 }
551
552 rpc GetAlarmFilter(common.ID) returns(AlarmFilter) {
553 option (google.api.http) = {
554 get: "/api/v1/alarm_filters/{id}"
555 };
556 }
557
558 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
559 option (google.api.http) = {
560 put: "/api/v1/alarm_filters/{id}"
561 body: "*"
562 };
563 }
564
565 rpc DeleteAlarmFilter(common.ID) returns(google.protobuf.Empty) {
566 option (google.api.http) = {
567 delete: "/api/v1/alarm_filters/{id}"
568 };
569 }
570
571 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
572 option (google.api.http) = {
573 get: "/api/v1/alarm_filters"
574 };
575 }
576
577 rpc GetImages(common.ID) returns(Images) {
578 option (google.api.http) = {
579 get: "/api/v1/devices/{id}/images"
580 };
581 }
582
583 rpc SelfTest(common.ID) returns(SelfTestResponse) {
584 option (google.api.http) = {
585 post: "/api/v1/devices/{id}/self_test"
586 };
587 }
588
589 // OpenOMCI MIB information
590 rpc GetMibDeviceData(common.ID) returns(omci.MibDeviceData) {
591 option (google.api.http) = {
592 get: "/api/v1/openomci/{id}/mib"
593 };
594 }
595
596 // OpenOMCI ALARM information
597 rpc GetAlarmDeviceData(common.ID) returns(omci.AlarmDeviceData) {
598 option (google.api.http) = {
599 get: "/api/v1/openomci/{id}/alarm"
600 };
601 }
602
603 // Simulate an Alarm
604 rpc SimulateAlarm(SimulateAlarmRequest) returns(common.OperationResp) {
605 option (google.api.http) = {
606 post: "/api/v1/devices/{id}/simulate_larm"
607 body: "*"
608 };
609 }
610 rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
611 }
Manikkaraj kb1a10922019-07-29 12:10:34 -0400612
David K. Bainbridge24ff0232019-04-30 13:26:19 -0700613}
614