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