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