blob: a107bd2c8e3b9f0d52df33b221fa8d7fa5e01dbb [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
73// Top-level (root) node for a Voltha Instance
74message VolthaInstance {
75 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
76
77 string instance_id = 1 [(access) = READ_ONLY];
78
79 string version = 2 [(access) = READ_ONLY];
80
81 LogLevel.LogLevel log_level = 3;
82
83 HealthStatus health = 10 [(child_node) = {}];
84
85 repeated Adapter adapters = 11 [(child_node) = {key: "id" }];
86
87 repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
88
89 repeated Device devices = 13 [(child_node) = {key: "id"}];
90
91 repeated DeviceType device_types = 14 [(child_node) = {key: "id"}];
92
93 repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
94
95 repeated AlarmFilter alarm_filters = 16 [(child_node) = {key: "id"}];
96
97 repeated
98 omci.MibDeviceData omci_mibs = 28
99 [(child_node) = {key: "device_id"}];
100}
101
102message VolthaInstances {
103 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
104 repeated string items = 1;
105}
106
107// Voltha representing the entire Voltha cluster
108message Voltha {
109 option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
110
111 string version = 1 [(access) = READ_ONLY];
112
113 LogLevel.LogLevel log_level = 2;
114
115 repeated VolthaInstance instances = 3 [(child_node) = {key: "instance_id"}];
116
117 repeated Adapter adapters = 11 [(child_node) = {key: "id"}];
118
119 repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
120
121 repeated Device devices = 13 [(child_node) = {key: "id"}];
122
123 repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
124
125 repeated
126 omci.MibDeviceData omci_mib_database = 28
127 [(child_node) = {key: "device_id"}];
128}
129
130// Device Self Test Response
131message SelfTestResponse {
132 option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
133
134 enum SelfTestResult {
135 SUCCESS = 0;
136 FAILURE = 1;
137 NOT_SUPPORTED = 2;
138 UNKNOWN_ERROR = 3;
139 }
140 SelfTestResult result = 1;
141}
142
143message OfAgentSubscriber {
144 // ID of ofagent instance
145 string ofagent_id = 1;
146
147 // ID of voltha instance to which the ofagent is subscribed
148 string voltha_id = 2;
149}
150
151/*
152 * Voltha APIs
153 *
154 */
155service VolthaService {
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 instances
165 rpc ListVolthaInstances(google.protobuf.Empty) returns(VolthaInstances) {
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 GetVolthaInstance(ID) returns(VolthaInstance) {
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 // List all flow groups of a logical device
253 rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
254 option (google.api.http) = {
255 get: "/api/v1/logical_devices/{id}/flow_groups"
256 };
257 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
258 option (voltha.yang_xml_tag).list_items_name = 'items';
259 }
260
261 // Update group table for device
262 rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
263 returns(google.protobuf.Empty) {
264 option (google.api.http) = {
265 post: "/api/v1/logical_devices/{id}/flow_groups"
266 body: "*"
267 };
268 }
269
270 // List all physical devices controlled by the Voltha cluster
271 rpc ListDevices(google.protobuf.Empty) returns(Devices) {
272 option (google.api.http) = {
273 get: "/api/v1/devices"
274 };
275 option (voltha.yang_xml_tag).xml_tag = 'devices';
276 }
277
278 // Get more information on a given physical device
279 rpc GetDevice(ID) returns(Device) {
280 option (google.api.http) = {
281 get: "/api/v1/devices/{id}"
282 };
283 }
284
285 // Pre-provision a new physical device
286 rpc CreateDevice(Device) returns(Device) {
287 option (google.api.http) = {
288 post: "/api/v1/devices"
289 body: "*"
290 };
291 }
292
293 // Enable a device. If the device was in pre-provisioned state then it
294 // will transition to ENABLED state. If it was is DISABLED state then it
295 // will transition to ENABLED state as well.
296 rpc EnableDevice(ID) returns(google.protobuf.Empty) {
297 option (google.api.http) = {
298 post: "/api/v1/devices/{id}/enable"
299 };
300 }
301
302 // Disable a device
303 rpc DisableDevice(ID) returns(google.protobuf.Empty) {
304 option (google.api.http) = {
305 post: "/api/v1/devices/{id}/disable"
306 };
307 }
308
309 // Reboot a device
310 rpc RebootDevice(ID) returns(google.protobuf.Empty) {
311 option (google.api.http) = {
312 post: "/api/v1/devices/{id}/reboot"
313 };
314 }
315
316 // Delete a device
317 rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
318 option (google.api.http) = {
319 delete: "/api/v1/devices/{id}/delete"
320 };
321 }
322
323 // Request an image download to the standby partition
324 // of a device.
325 // Note that the call is expected to be non-blocking.
326 rpc DownloadImage(ImageDownload) returns(OperationResp) {
327 option (google.api.http) = {
328 post: "/api/v1/devices/{id}/image_downloads/{name}"
329 body: "*"
330 };
331 }
332
333 // Get image download status on a device
334 // The request retrieves progress on device and updates db record
335 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
336 option (google.api.http) = {
337 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
338 };
339 }
340
341 // Get image download db record
342 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
343 option (google.api.http) = {
344 get: "/api/v1/devices/{id}/image_downloads/{name}"
345 };
346 }
347
348 // List image download db records for a given device
349 rpc ListImageDownloads(ID) returns(ImageDownloads) {
350 option (google.api.http) = {
351 get: "/api/v1/devices/{id}/image_downloads"
352 };
353 }
354
355 // Cancel an existing image download process on a device
356 rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
357 option (google.api.http) = {
358 delete: "/api/v1/devices/{id}/image_downloads/{name}"
359 };
360 }
361
362 // Activate the specified image at a standby partition
363 // to active partition.
364 // Depending on the device implementation, this call
365 // may or may not cause device reboot.
366 // If no reboot, then a reboot is required to make the
367 // activated image running on device
368 // Note that the call is expected to be non-blocking.
369 rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
370 option (google.api.http) = {
371 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
372 body: "*"
373 };
374 }
375
376 // Revert the specified image at standby partition
377 // to active partition, and revert to previous image
378 // Depending on the device implementation, this call
379 // may or may not cause device reboot.
380 // If no reboot, then a reboot is required to make the
381 // previous image running on device
382 // Note that the call is expected to be non-blocking.
383 rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
384 option (google.api.http) = {
385 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
386 body: "*"
387 };
388 }
389
390 // List ports of a device
391 rpc ListDevicePorts(ID) returns(Ports) {
392 option (google.api.http) = {
393 get: "/api/v1/devices/{id}/ports"
394 };
395 option (voltha.yang_xml_tag).xml_tag = 'ports';
396 }
397
398 // List pm config of a device
399 rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
400 option (google.api.http) = {
401 get: "/api/v1/devices/{id}/pm_configs"
402 };
403 }
404
405 // Update the pm config of a device
406 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
407 option (google.api.http) = {
408 post: "/api/v1/devices/{id}/pm_configs"
409 body: "*"
410 };
411 }
412
413 // List all flows of a device
414 rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
415 option (google.api.http) = {
416 get: "/api/v1/devices/{id}/flows"
417 };
418 option (voltha.yang_xml_tag).xml_tag = 'flows';
419 option (voltha.yang_xml_tag).list_items_name = 'items';
420 }
421
422 // List all flow groups of a device
423 rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
424 option (google.api.http) = {
425 get: "/api/v1/devices/{id}/flow_groups"
426 };
427 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
428 option (voltha.yang_xml_tag).list_items_name = 'items';
429 }
430
431 // List device types known to Voltha
432 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
433 option (google.api.http) = {
434 get: "/api/v1/device_types"
435 };
436 option (voltha.yang_xml_tag).xml_tag = 'device_types';
437 }
438
439 // Get additional information on a device type
440 rpc GetDeviceType(ID) returns(DeviceType) {
441 option (google.api.http) = {
442 get: "/api/v1/device_types/{id}"
443 };
444 }
445
446 // List all device sharding groups
447 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
448 option (google.api.http) = {
449 get: "/api/v1/device_groups"
450 };
451 option (voltha.yang_xml_tag).xml_tag = 'device_groups';
452 }
453
454 // Get additional information on a device group
455 rpc GetDeviceGroup(ID) returns(DeviceGroup) {
456 option (google.api.http) = {
457 get: "/api/v1/device_groups/{id}"
458 };
459 }
460
461 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
462 option (google.api.http) = {
463 post: "/api/v1/alarm_filters"
464 body: "*"
465 };
466 }
467
468 rpc GetAlarmFilter(ID) returns(AlarmFilter) {
469 option (google.api.http) = {
470 get: "/api/v1/alarm_filters/{id}"
471 };
472 }
473
474 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
475 option (google.api.http) = {
476 put: "/api/v1/alarm_filters/{id}"
477 body: "*"
478 };
479 }
480
481 rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
482 option (google.api.http) = {
483 delete: "/api/v1/alarm_filters/{id}"
484 };
485 }
486
487 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
488 option (google.api.http) = {
489 get: "/api/v1/alarm_filters"
490 };
491 }
492
493 rpc GetImages(ID) returns(Images) {
494 option (google.api.http) = {
495 get: "/api/v1/devices/{id}/images"
496 };
497 }
498
499 rpc SelfTest(ID) returns(SelfTestResponse) {
500 option (google.api.http) = {
501 post: "/api/v1/devices/{id}/self_test"
502 };
503 }
504}
505