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