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