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