blob: 92d59dd0c4cead23ac18c2e6bed3239269f6ad62 [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
khenaidooabad44c2018-08-03 16:58:35 -040078// Top-level (root) node for a Voltha Instance
khenaidoobf6e7bb2018-08-14 22:27:29 -040079message CoreInstance {
khenaidooabad44c2018-08-03 16:58:35 -040080 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
81
82 string instance_id = 1 [(access) = READ_ONLY];
83
84 string version = 2 [(access) = READ_ONLY];
85
86 LogLevel.LogLevel log_level = 3;
87
88 HealthStatus health = 10 [(child_node) = {}];
89
khenaidooabad44c2018-08-03 16:58:35 -040090 repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
91
92 repeated Device devices = 13 [(child_node) = {key: "id"}];
93
khenaidooabad44c2018-08-03 16:58:35 -040094 repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
95
96 repeated AlarmFilter alarm_filters = 16 [(child_node) = {key: "id"}];
khenaidooabad44c2018-08-03 16:58:35 -040097}
98
khenaidoobf6e7bb2018-08-14 22:27:29 -040099message CoreInstances {
khenaidooabad44c2018-08-03 16:58:35 -0400100 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
101 repeated string items = 1;
102}
103
104// Voltha representing the entire Voltha cluster
105message Voltha {
106 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
107
108 string version = 1 [(access) = READ_ONLY];
109
110 LogLevel.LogLevel log_level = 2;
111
khenaidoobf6e7bb2018-08-14 22:27:29 -0400112 repeated CoreInstance core_instances = 3 [(child_node) = {key: "instance_id"}];
khenaidooabad44c2018-08-03 16:58:35 -0400113
114 repeated Adapter adapters = 11 [(child_node) = {key: "id"}];
115
116 repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
117
118 repeated Device devices = 13 [(child_node) = {key: "id"}];
119
120 repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
121
khenaidoobf6e7bb2018-08-14 22:27:29 -0400122 repeated AlarmFilter alarm_filters = 16 [(child_node) = {key: "id"}];
123
khenaidooabad44c2018-08-03 16:58:35 -0400124 repeated
125 omci.MibDeviceData omci_mib_database = 28
126 [(child_node) = {key: "device_id"}];
127}
128
129// Device Self Test Response
130message SelfTestResponse {
131 option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
132
133 enum SelfTestResult {
134 SUCCESS = 0;
135 FAILURE = 1;
136 NOT_SUPPORTED = 2;
137 UNKNOWN_ERROR = 3;
138 }
139 SelfTestResult result = 1;
140}
141
142message OfAgentSubscriber {
143 // ID of ofagent instance
144 string ofagent_id = 1;
145
146 // ID of voltha instance to which the ofagent is subscribed
147 string voltha_id = 2;
148}
149
150/*
151 * Voltha APIs
152 *
153 */
154service VolthaService {
155
khenaidoobf6e7bb2018-08-14 22:27:29 -0400156 // Get more information on a given physical device
157 rpc UpdateLogLevel(Logging) returns(google.protobuf.Empty) {
158 option (google.api.http) = {
159 get: "/api/v1/devices/{id}"
160 };
161 }
162
khenaidooabad44c2018-08-03 16:58:35 -0400163 // Get high level information on the Voltha cluster
164 rpc GetVoltha(google.protobuf.Empty) returns(Voltha) {
165 option (google.api.http) = {
166 get: "/api/v1"
167 };
168 }
169
khenaidoobf6e7bb2018-08-14 22:27:29 -0400170 // List all Voltha cluster core instances
171 rpc ListCoreInstances(google.protobuf.Empty) returns(CoreInstances) {
khenaidooabad44c2018-08-03 16:58:35 -0400172 option (google.api.http) = {
173 get: "/api/v1/instances"
174 };
175 option (voltha.yang_xml_tag).xml_tag = 'items';
176 option (voltha.yang_xml_tag).list_items_name = 'items';
177 }
178
179 // Get details on a Voltha cluster instance
khenaidoobf6e7bb2018-08-14 22:27:29 -0400180 rpc GetCoreInstance(ID) returns(CoreInstance) {
khenaidooabad44c2018-08-03 16:58:35 -0400181 option (google.api.http) = {
182 get: "/api/v1/instances/{id}"
183 };
184 }
185
186 // List all active adapters (plugins) in the Voltha cluster
187 rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
188 option (google.api.http) = {
189 get: "/api/v1/adapters"
190 };
191 option (voltha.yang_xml_tag).xml_tag = 'adapters';
192 }
193
194
195 // List all logical devices managed by the Voltha cluster
196 rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
197 option (google.api.http) = {
198 get: "/api/v1/logical_devices"
199 };
200 option (voltha.yang_xml_tag).xml_tag = 'logical_devices';
201 }
202
203 // Get additional information on a given logical device
204 rpc GetLogicalDevice(ID) returns(LogicalDevice) {
205 option (google.api.http) = {
206 get: "/api/v1/logical_devices/{id}"
207 };
208 }
209
210 // List ports of a logical device
211 rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) {
212 option (google.api.http) = {
213 get: "/api/v1/logical_devices/{id}/ports"
214 };
215 option (voltha.yang_xml_tag).xml_tag = 'ports';
216 }
217
218 // Gets a logical device port
219 rpc GetLogicalDevicePort(LogicalPortId) returns(LogicalPort) {
220 option (google.api.http) = {
221 get: "/api/v1/logical_devices/{id}/ports/{port_id}"
222 };
223 option (voltha.yang_xml_tag).xml_tag = 'port';
224 }
225
226 // Enables a logical device port
227 rpc EnableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
228 option (google.api.http) = {
229 post: "/api/v1/logical_devices/{id}/ports/{port_id}/enable"
230 };
231 }
232
233 // Disables a logical device port
234 rpc DisableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
235 option (google.api.http) = {
236 post: "/api/v1/logical_devices/{id}/ports/{port_id}/disable"
237 };
238 }
239
240 // List all flows of a logical device
241 rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) {
242 option (google.api.http) = {
243 get: "/api/v1/logical_devices/{id}/flows"
244 };
245 option (voltha.yang_xml_tag).xml_tag = 'flows';
246 option (voltha.yang_xml_tag).list_items_name = 'items';
247 }
248
249 // Update flow table for logical device
250 rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate)
251 returns(google.protobuf.Empty) {
252 option (google.api.http) = {
253 post: "/api/v1/logical_devices/{id}/flows"
254 body: "*"
255 };
256 }
257
258 // List all flow groups of a logical device
259 rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
260 option (google.api.http) = {
261 get: "/api/v1/logical_devices/{id}/flow_groups"
262 };
263 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
264 option (voltha.yang_xml_tag).list_items_name = 'items';
265 }
266
267 // Update group table for device
268 rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
269 returns(google.protobuf.Empty) {
270 option (google.api.http) = {
271 post: "/api/v1/logical_devices/{id}/flow_groups"
272 body: "*"
273 };
274 }
275
276 // List all physical devices controlled by the Voltha cluster
277 rpc ListDevices(google.protobuf.Empty) returns(Devices) {
278 option (google.api.http) = {
279 get: "/api/v1/devices"
280 };
281 option (voltha.yang_xml_tag).xml_tag = 'devices';
282 }
283
284 // Get more information on a given physical device
285 rpc GetDevice(ID) returns(Device) {
286 option (google.api.http) = {
287 get: "/api/v1/devices/{id}"
288 };
289 }
290
291 // Pre-provision a new physical device
292 rpc CreateDevice(Device) returns(Device) {
293 option (google.api.http) = {
294 post: "/api/v1/devices"
295 body: "*"
296 };
297 }
298
299 // Enable a device. If the device was in pre-provisioned state then it
300 // will transition to ENABLED state. If it was is DISABLED state then it
301 // will transition to ENABLED state as well.
302 rpc EnableDevice(ID) returns(google.protobuf.Empty) {
303 option (google.api.http) = {
304 post: "/api/v1/devices/{id}/enable"
305 };
306 }
307
308 // Disable a device
309 rpc DisableDevice(ID) returns(google.protobuf.Empty) {
310 option (google.api.http) = {
311 post: "/api/v1/devices/{id}/disable"
312 };
313 }
314
315 // Reboot a device
316 rpc RebootDevice(ID) returns(google.protobuf.Empty) {
317 option (google.api.http) = {
318 post: "/api/v1/devices/{id}/reboot"
319 };
320 }
321
322 // Delete a device
323 rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
324 option (google.api.http) = {
325 delete: "/api/v1/devices/{id}/delete"
326 };
327 }
328
329 // Request an image download to the standby partition
330 // of a device.
331 // Note that the call is expected to be non-blocking.
332 rpc DownloadImage(ImageDownload) returns(OperationResp) {
333 option (google.api.http) = {
334 post: "/api/v1/devices/{id}/image_downloads/{name}"
335 body: "*"
336 };
337 }
338
339 // Get image download status on a device
340 // The request retrieves progress on device and updates db record
341 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
342 option (google.api.http) = {
343 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
344 };
345 }
346
347 // Get image download db record
348 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
349 option (google.api.http) = {
350 get: "/api/v1/devices/{id}/image_downloads/{name}"
351 };
352 }
353
354 // List image download db records for a given device
355 rpc ListImageDownloads(ID) returns(ImageDownloads) {
356 option (google.api.http) = {
357 get: "/api/v1/devices/{id}/image_downloads"
358 };
359 }
360
361 // Cancel an existing image download process on a device
362 rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
363 option (google.api.http) = {
364 delete: "/api/v1/devices/{id}/image_downloads/{name}"
365 };
366 }
367
368 // Activate the specified image at a standby partition
369 // to active partition.
370 // Depending on the device implementation, this call
371 // may or may not cause device reboot.
372 // If no reboot, then a reboot is required to make the
373 // activated image running on device
374 // Note that the call is expected to be non-blocking.
375 rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
376 option (google.api.http) = {
377 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
378 body: "*"
379 };
380 }
381
382 // Revert the specified image at standby partition
383 // to active partition, and revert to previous image
384 // Depending on the device implementation, this call
385 // may or may not cause device reboot.
386 // If no reboot, then a reboot is required to make the
387 // previous image running on device
388 // Note that the call is expected to be non-blocking.
389 rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
390 option (google.api.http) = {
391 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
392 body: "*"
393 };
394 }
395
396 // List ports of a device
397 rpc ListDevicePorts(ID) returns(Ports) {
398 option (google.api.http) = {
399 get: "/api/v1/devices/{id}/ports"
400 };
401 option (voltha.yang_xml_tag).xml_tag = 'ports';
402 }
403
404 // List pm config of a device
405 rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
406 option (google.api.http) = {
407 get: "/api/v1/devices/{id}/pm_configs"
408 };
409 }
410
411 // Update the pm config of a device
412 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
413 option (google.api.http) = {
414 post: "/api/v1/devices/{id}/pm_configs"
415 body: "*"
416 };
417 }
418
419 // List all flows of a device
420 rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
421 option (google.api.http) = {
422 get: "/api/v1/devices/{id}/flows"
423 };
424 option (voltha.yang_xml_tag).xml_tag = 'flows';
425 option (voltha.yang_xml_tag).list_items_name = 'items';
426 }
427
428 // List all flow groups of a device
429 rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
430 option (google.api.http) = {
431 get: "/api/v1/devices/{id}/flow_groups"
432 };
433 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
434 option (voltha.yang_xml_tag).list_items_name = 'items';
435 }
436
437 // List device types known to Voltha
438 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
439 option (google.api.http) = {
440 get: "/api/v1/device_types"
441 };
442 option (voltha.yang_xml_tag).xml_tag = 'device_types';
443 }
444
445 // Get additional information on a device type
446 rpc GetDeviceType(ID) returns(DeviceType) {
447 option (google.api.http) = {
448 get: "/api/v1/device_types/{id}"
449 };
450 }
451
452 // List all device sharding groups
453 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
454 option (google.api.http) = {
455 get: "/api/v1/device_groups"
456 };
457 option (voltha.yang_xml_tag).xml_tag = 'device_groups';
458 }
459
460 // Get additional information on a device group
461 rpc GetDeviceGroup(ID) returns(DeviceGroup) {
462 option (google.api.http) = {
463 get: "/api/v1/device_groups/{id}"
464 };
465 }
466
467 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
468 option (google.api.http) = {
469 post: "/api/v1/alarm_filters"
470 body: "*"
471 };
472 }
473
474 rpc GetAlarmFilter(ID) returns(AlarmFilter) {
475 option (google.api.http) = {
476 get: "/api/v1/alarm_filters/{id}"
477 };
478 }
479
480 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
481 option (google.api.http) = {
482 put: "/api/v1/alarm_filters/{id}"
483 body: "*"
484 };
485 }
486
487 rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
488 option (google.api.http) = {
489 delete: "/api/v1/alarm_filters/{id}"
490 };
491 }
492
493 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
494 option (google.api.http) = {
495 get: "/api/v1/alarm_filters"
496 };
497 }
498
499 rpc GetImages(ID) returns(Images) {
500 option (google.api.http) = {
501 get: "/api/v1/devices/{id}/images"
502 };
503 }
504
505 rpc SelfTest(ID) returns(SelfTestResponse) {
506 option (google.api.http) = {
507 post: "/api/v1/devices/{id}/self_test"
508 };
509 }
510}
511