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