blob: e03442aa355c41fe1d1317c9e136d4fc93fd439b [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
272 // Get more information on a given physical device
273 rpc GetDevice(ID) returns(Device) {
274 option (google.api.http) = {
275 get: "/api/v1/devices/{id}"
276 };
277 }
278
279 // Pre-provision a new physical device
280 rpc CreateDevice(Device) returns(Device) {
281 option (google.api.http) = {
282 post: "/api/v1/devices"
283 body: "*"
284 };
285 }
286
287 // Enable a device. If the device was in pre-provisioned state then it
288 // will transition to ENABLED state. If it was is DISABLED state then it
289 // will transition to ENABLED state as well.
290 rpc EnableDevice(ID) returns(google.protobuf.Empty) {
291 option (google.api.http) = {
292 post: "/api/v1/devices/{id}/enable"
293 };
294 }
295
296 // Disable a device
297 rpc DisableDevice(ID) returns(google.protobuf.Empty) {
298 option (google.api.http) = {
299 post: "/api/v1/devices/{id}/disable"
300 };
301 }
302
303 // Reboot a device
304 rpc RebootDevice(ID) returns(google.protobuf.Empty) {
305 option (google.api.http) = {
306 post: "/api/v1/devices/{id}/reboot"
307 };
308 }
309
310 // Delete a device
311 rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
312 option (google.api.http) = {
313 delete: "/api/v1/devices/{id}/delete"
314 };
315 }
316
317 // Request an image download to the standby partition
318 // of a device.
319 // Note that the call is expected to be non-blocking.
320 rpc DownloadImage(ImageDownload) returns(OperationResp) {
321 option (google.api.http) = {
322 post: "/api/v1/devices/{id}/image_downloads/{name}"
323 body: "*"
324 };
325 }
326
327 // Get image download status on a device
328 // The request retrieves progress on device and updates db record
329 rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
330 option (google.api.http) = {
331 get: "/api/v1/devices/{id}/image_downloads/{name}/status"
332 };
333 }
334
335 // Get image download db record
336 rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
337 option (google.api.http) = {
338 get: "/api/v1/devices/{id}/image_downloads/{name}"
339 };
340 }
341
342 // List image download db records for a given device
343 rpc ListImageDownloads(ID) returns(ImageDownloads) {
344 option (google.api.http) = {
345 get: "/api/v1/devices/{id}/image_downloads"
346 };
347 }
348
349 // Cancel an existing image download process on a device
350 rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
351 option (google.api.http) = {
352 delete: "/api/v1/devices/{id}/image_downloads/{name}"
353 };
354 }
355
356 // Activate the specified image at a standby partition
357 // to active partition.
358 // Depending on the device implementation, this call
359 // may or may not cause device reboot.
360 // If no reboot, then a reboot is required to make the
361 // activated image running on device
362 // Note that the call is expected to be non-blocking.
363 rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
364 option (google.api.http) = {
365 post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
366 body: "*"
367 };
368 }
369
370 // Revert the specified image at standby partition
371 // to active partition, and revert to previous image
372 // Depending on the device implementation, this call
373 // may or may not cause device reboot.
374 // If no reboot, then a reboot is required to make the
375 // previous image running on device
376 // Note that the call is expected to be non-blocking.
377 rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
378 option (google.api.http) = {
379 post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
380 body: "*"
381 };
382 }
383
384 // List ports of a device
385 rpc ListDevicePorts(ID) returns(Ports) {
386 option (google.api.http) = {
387 get: "/api/v1/devices/{id}/ports"
388 };
389 option (voltha.yang_xml_tag).xml_tag = 'ports';
390 }
391
392 // List pm config of a device
393 rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
394 option (google.api.http) = {
395 get: "/api/v1/devices/{id}/pm_configs"
396 };
397 }
398
399 // Update the pm config of a device
400 rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
401 option (google.api.http) = {
402 post: "/api/v1/devices/{id}/pm_configs"
403 body: "*"
404 };
405 }
406
407 // List all flows of a device
408 rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
409 option (google.api.http) = {
410 get: "/api/v1/devices/{id}/flows"
411 };
412 option (voltha.yang_xml_tag).xml_tag = 'flows';
413 option (voltha.yang_xml_tag).list_items_name = 'items';
414 }
415
416 // List all flow groups of a device
417 rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
418 option (google.api.http) = {
419 get: "/api/v1/devices/{id}/flow_groups"
420 };
421 option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
422 option (voltha.yang_xml_tag).list_items_name = 'items';
423 }
424
425 // List device types known to Voltha
426 rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
427 option (google.api.http) = {
428 get: "/api/v1/device_types"
429 };
430 option (voltha.yang_xml_tag).xml_tag = 'device_types';
431 }
432
433 // Get additional information on a device type
434 rpc GetDeviceType(ID) returns(DeviceType) {
435 option (google.api.http) = {
436 get: "/api/v1/device_types/{id}"
437 };
438 }
439
440 // List all device sharding groups
441 rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
442 option (google.api.http) = {
443 get: "/api/v1/device_groups"
444 };
445 option (voltha.yang_xml_tag).xml_tag = 'device_groups';
446 }
447
khenaidoofdbad6e2018-11-06 22:26:38 -0500448 // Stream control packets to the dataplane
449 rpc StreamPacketsOut(stream openflow_13.PacketOut)
450 returns(google.protobuf.Empty) {
451 // This does not have an HTTP representation
452 }
453
454 // Receive control packet stream
455 rpc ReceivePacketsIn(google.protobuf.Empty)
456 returns(stream openflow_13.PacketIn) {
457 // This does not have an HTTP representation
458 }
459
460 rpc ReceiveChangeEvents(google.protobuf.Empty)
461 returns(stream openflow_13.ChangeEvent) {
462 // This does not have an HTTP representation
463 }
464
khenaidooabad44c2018-08-03 16:58:35 -0400465 // Get additional information on a device group
466 rpc GetDeviceGroup(ID) returns(DeviceGroup) {
467 option (google.api.http) = {
468 get: "/api/v1/device_groups/{id}"
469 };
470 }
471
472 rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
473 option (google.api.http) = {
474 post: "/api/v1/alarm_filters"
475 body: "*"
476 };
477 }
478
479 rpc GetAlarmFilter(ID) returns(AlarmFilter) {
480 option (google.api.http) = {
481 get: "/api/v1/alarm_filters/{id}"
482 };
483 }
484
485 rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
486 option (google.api.http) = {
487 put: "/api/v1/alarm_filters/{id}"
488 body: "*"
489 };
490 }
491
492 rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
493 option (google.api.http) = {
494 delete: "/api/v1/alarm_filters/{id}"
495 };
496 }
497
498 rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
499 option (google.api.http) = {
500 get: "/api/v1/alarm_filters"
501 };
502 }
503
504 rpc GetImages(ID) returns(Images) {
505 option (google.api.http) = {
506 get: "/api/v1/devices/{id}/images"
507 };
508 }
509
510 rpc SelfTest(ID) returns(SelfTestResponse) {
511 option (google.api.http) = {
512 post: "/api/v1/devices/{id}/self_test"
513 };
514 }
Stephane Barbarie6e1bd502018-11-05 22:44:45 -0500515
516 rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
517 }
khenaidooabad44c2018-08-03 16:58:35 -0400518}
519