Khen Nursimulu | aaac7ee | 2016-12-11 22:03:52 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Top-level Voltha API definition |
| 3 | * |
| 4 | * For details, see individual definition files. |
| 5 | */ |
| 6 | |
| 7 | syntax = "proto3"; |
| 8 | |
| 9 | package voltha; |
| 10 | |
| 11 | import "google/protobuf/empty.proto"; |
| 12 | import "google/api/annotations.proto"; |
| 13 | |
| 14 | import public "meta.proto"; |
| 15 | import public "common.proto"; |
| 16 | import public "health.proto"; |
| 17 | import public "logical_device.proto"; |
| 18 | import public "device.proto"; |
| 19 | import public "adapter.proto"; |
| 20 | import public "openflow_13.proto"; |
| 21 | |
| 22 | option java_package = "org.opencord.voltha"; |
| 23 | option java_outer_classname = "VolthaProtos"; |
| 24 | option csharp_namespace = "Opencord.Voltha.Voltha"; |
| 25 | |
| 26 | message DeviceGroup { |
| 27 | |
| 28 | string id = 1 [(access) = READ_ONLY]; |
| 29 | |
| 30 | repeated LogicalDevice logical_devices = 2 [(child_node) = {key: "id"}]; |
| 31 | |
| 32 | repeated Device devices = 3 [(child_node) = {key: "id"}]; |
| 33 | } |
| 34 | |
| 35 | message DeviceGroups { |
| 36 | repeated DeviceGroup items = 1; |
| 37 | } |
| 38 | |
| 39 | // Top-level (root) node for a Voltha Instance |
| 40 | message VolthaInstance { |
| 41 | |
| 42 | string instance_id = 1 [(access) = READ_ONLY]; |
| 43 | |
| 44 | string version = 2 [(access) = READ_ONLY]; |
| 45 | |
| 46 | LogLevel.LogLevel log_level = 3; |
| 47 | |
| 48 | HealthStatus health = 10 [(child_node) = {}]; |
| 49 | |
| 50 | repeated Adapter adapters = 11 [(child_node) = {key: "id" }]; |
| 51 | |
| 52 | repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}]; |
| 53 | |
| 54 | repeated Device devices = 13 [(child_node) = {key: "id"}]; |
| 55 | |
| 56 | repeated DeviceType device_types = 14 [(child_node) = {key: "id"}]; |
| 57 | |
| 58 | repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}]; |
| 59 | } |
| 60 | |
| 61 | message VolthaInstances { |
| 62 | repeated string items = 1; |
| 63 | } |
| 64 | |
| 65 | // Voltha representing the entire Voltha cluster |
| 66 | message Voltha { |
| 67 | |
| 68 | string version = 1 [(access) = READ_ONLY]; |
| 69 | |
| 70 | LogLevel.LogLevel log_level = 2; |
| 71 | |
| 72 | repeated VolthaInstance instances = 3 [(child_node) = {key: "instance_id"}]; |
| 73 | |
| 74 | repeated Adapter adapters = 11 [(child_node) = {key: "id"}]; |
| 75 | |
| 76 | repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}]; |
| 77 | |
| 78 | repeated Device devices = 13 [(child_node) = {key: "id"}]; |
| 79 | |
| 80 | repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}]; |
| 81 | |
| 82 | } |
| 83 | |
| 84 | |
| 85 | /* |
| 86 | * Cluster-wide Voltha APIs |
| 87 | * |
| 88 | * These APIs are potentially dispatched to the leader of the Voltha cluster, |
| 89 | * to a specific Voltha instance which owns the given device or logical device. |
| 90 | * |
| 91 | */ |
| 92 | service VolthaGlobalService { |
| 93 | |
| 94 | // Get high level information on the Voltha cluster |
| 95 | rpc GetVoltha(google.protobuf.Empty) returns(Voltha) { |
| 96 | option (google.api.http) = { |
| 97 | get: "/api/v1" |
| 98 | }; |
| 99 | } |
| 100 | |
| 101 | // List all Voltha cluster instances |
| 102 | rpc ListVolthaInstances(google.protobuf.Empty) returns(VolthaInstances) { |
| 103 | option (google.api.http) = { |
| 104 | get: "/api/v1/instances" |
| 105 | }; |
| 106 | } |
| 107 | |
| 108 | // Get details on a Voltha cluster instance |
| 109 | rpc GetVolthaInstance(ID) returns(VolthaInstance) { |
| 110 | option (google.api.http) = { |
| 111 | get: "/api/v1/instances/{id}" |
| 112 | }; |
| 113 | } |
| 114 | |
| 115 | // List all logical devices managed by the Voltha cluster |
| 116 | rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) { |
| 117 | option (google.api.http) = { |
| 118 | get: "/api/v1/logical_devices" |
| 119 | }; |
| 120 | } |
| 121 | |
| 122 | // Get additional information on a given logical device |
| 123 | rpc GetLogicalDevice(ID) returns(LogicalDevice) { |
| 124 | option (google.api.http) = { |
| 125 | get: "/api/v1/logical_devices/{id}" |
| 126 | }; |
| 127 | } |
| 128 | |
| 129 | // List ports of a logical device |
| 130 | rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) { |
| 131 | option (google.api.http) = { |
| 132 | get: "/api/v1/logical_devices/{id}/ports" |
| 133 | }; |
| 134 | } |
| 135 | |
| 136 | // List all flows of a logical device |
| 137 | rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) { |
| 138 | option (google.api.http) = { |
| 139 | get: "/api/v1/logical_devices/{id}/flows" |
| 140 | }; |
| 141 | } |
| 142 | |
| 143 | // Update flow table for logical device |
| 144 | rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate) |
| 145 | returns(google.protobuf.Empty) { |
| 146 | option (google.api.http) = { |
| 147 | post: "/api/v1/logical_devices/{id}/flows" |
| 148 | body: "*" |
| 149 | }; |
| 150 | } |
| 151 | |
| 152 | // List all flow groups of a logical device |
| 153 | rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) { |
| 154 | option (google.api.http) = { |
| 155 | get: "/api/v1/logical_devices/{id}/flow_groups" |
| 156 | }; |
| 157 | } |
| 158 | |
| 159 | // Update group table for device |
| 160 | rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate) |
| 161 | returns(google.protobuf.Empty) { |
| 162 | option (google.api.http) = { |
| 163 | post: "/api/v1/logical_devices/{id}/flow_groups" |
| 164 | body: "*" |
| 165 | }; |
| 166 | } |
| 167 | |
| 168 | // List all physical devices controlled by the Voltha cluster |
| 169 | rpc ListDevices(google.protobuf.Empty) returns(Devices) { |
| 170 | option (google.api.http) = { |
| 171 | get: "/api/v1/devices" |
| 172 | }; |
| 173 | } |
| 174 | |
| 175 | // Get more information on a given physical device |
| 176 | rpc GetDevice(ID) returns(Device) { |
| 177 | option (google.api.http) = { |
| 178 | get: "/api/v1/devices/{id}" |
| 179 | }; |
| 180 | } |
| 181 | |
| 182 | // Pre-provision a new physical device |
| 183 | rpc CreateDevice(Device) returns(Device) { |
| 184 | option (google.api.http) = { |
| 185 | post: "/api/v1/devices" |
| 186 | body: "*" |
| 187 | }; |
| 188 | } |
| 189 | |
| 190 | // Activate a pre-provisioned device |
| 191 | rpc ActivateDevice(ID) returns(google.protobuf.Empty) { |
| 192 | option (google.api.http) = { |
| 193 | post: "/api/v1/devices/{id}/activate" |
| 194 | }; |
| 195 | } |
| 196 | |
| 197 | // List ports of a device |
| 198 | rpc ListDevicePorts(ID) returns(Ports) { |
| 199 | option (google.api.http) = { |
| 200 | get: "/api/v1/devices/{id}/ports" |
| 201 | }; |
| 202 | } |
| 203 | |
| 204 | // List all flows of a device |
| 205 | rpc ListDeviceFlows(ID) returns(openflow_13.Flows) { |
| 206 | option (google.api.http) = { |
| 207 | get: "/api/v1/devices/{id}/flows" |
| 208 | }; |
| 209 | } |
| 210 | |
| 211 | // List all flow groups of a device |
| 212 | rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) { |
| 213 | option (google.api.http) = { |
| 214 | get: "/api/v1/devices/{id}/flow_groups" |
| 215 | }; |
| 216 | } |
| 217 | |
| 218 | // List device types known to Voltha |
| 219 | rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) { |
| 220 | option (google.api.http) = { |
| 221 | get: "/api/v1/device_types" |
| 222 | }; |
| 223 | } |
| 224 | |
| 225 | // Get additional information on a device type |
| 226 | rpc GetDeviceType(ID) returns(DeviceType) { |
| 227 | option (google.api.http) = { |
| 228 | get: "/api/v1/device_types/{id}" |
| 229 | }; |
| 230 | } |
| 231 | |
| 232 | // List all device sharding groups |
| 233 | rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) { |
| 234 | option (google.api.http) = { |
| 235 | get: "/api/v1/device_groups" |
| 236 | }; |
| 237 | } |
| 238 | |
| 239 | // Get additional information on a device group |
| 240 | rpc GetDeviceGroup(ID) returns(DeviceGroup) { |
| 241 | option (google.api.http) = { |
| 242 | get: "/api/v1/device_groups/{id}" |
| 243 | }; |
| 244 | } |
| 245 | |
| 246 | } |
| 247 | |
| 248 | /* |
| 249 | * Per-instance APIs |
| 250 | * |
| 251 | * These APIs are always served locally by the Voltha instance on which the |
| 252 | * call is made. |
| 253 | */ |
| 254 | service VolthaLocalService { |
| 255 | |
| 256 | // Get information on this Voltha instance |
| 257 | rpc GetVolthaInstance(google.protobuf.Empty) returns(VolthaInstance) { |
| 258 | option (google.api.http) = { |
| 259 | get: "/api/v1/local" |
| 260 | }; |
| 261 | } |
| 262 | |
| 263 | // Get the health state of the Voltha instance |
| 264 | rpc GetHealth(google.protobuf.Empty) returns(HealthStatus) { |
| 265 | option (google.api.http) = { |
| 266 | get: "/api/v1/local/health" |
| 267 | }; |
| 268 | } |
| 269 | |
| 270 | // List all active adapters (plugins) in this Voltha instance |
| 271 | rpc ListAdapters(google.protobuf.Empty) returns(Adapters) { |
| 272 | option (google.api.http) = { |
| 273 | get: "/api/v1/local/adapters" |
| 274 | }; |
| 275 | } |
| 276 | |
| 277 | // List all logical devices managed by this Voltha instance |
| 278 | rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) { |
| 279 | option (google.api.http) = { |
| 280 | get: "/api/v1/local/logical_devices" |
| 281 | }; |
| 282 | } |
| 283 | |
| 284 | // Get additional information on given logical device |
| 285 | rpc GetLogicalDevice(ID) returns(LogicalDevice) { |
| 286 | option (google.api.http) = { |
| 287 | get: "/api/v1/local/logical_devices/{id}" |
| 288 | }; |
| 289 | } |
| 290 | |
| 291 | // List ports of a logical device |
| 292 | rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) { |
| 293 | option (google.api.http) = { |
| 294 | get: "/api/v1/local/logical_devices/{id}/ports" |
| 295 | }; |
| 296 | } |
| 297 | |
| 298 | // List all flows of a logical device |
| 299 | rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) { |
| 300 | option (google.api.http) = { |
| 301 | get: "/api/v1/local/logical_devices/{id}/flows" |
| 302 | }; |
| 303 | } |
| 304 | |
| 305 | // Update flow table for logical device |
| 306 | rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate) |
| 307 | returns(google.protobuf.Empty) { |
| 308 | option (google.api.http) = { |
| 309 | post: "/api/v1/local/logical_devices/{id}/flows" |
| 310 | body: "*" |
| 311 | }; |
| 312 | } |
| 313 | |
| 314 | // List all flow groups of a logical device |
| 315 | rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) { |
| 316 | option (google.api.http) = { |
| 317 | get: "/api/v1/local/logical_devices/{id}/flow_groups" |
| 318 | }; |
| 319 | } |
| 320 | |
| 321 | // Update group table for logical device |
| 322 | rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate) |
| 323 | returns(google.protobuf.Empty) { |
| 324 | option (google.api.http) = { |
| 325 | post: "/api/v1/local/logical_devices/{id}/flow_groups" |
| 326 | body: "*" |
| 327 | }; |
| 328 | } |
| 329 | |
| 330 | // List all physical devices managed by this Voltha instance |
| 331 | rpc ListDevices(google.protobuf.Empty) returns(Devices) { |
| 332 | option (google.api.http) = { |
| 333 | get: "/api/v1/local/devices" |
| 334 | }; |
| 335 | } |
| 336 | |
| 337 | // Get additional information on this device |
| 338 | rpc GetDevice(ID) returns(Device) { |
| 339 | option (google.api.http) = { |
| 340 | get: "/api/v1/local/devices/{id}" |
| 341 | }; |
| 342 | } |
| 343 | |
| 344 | // Pre-provision a new physical device |
| 345 | rpc CreateDevice(Device) returns(Device) { |
| 346 | option (google.api.http) = { |
| 347 | post: "/api/v1/local/devices" |
| 348 | body: "*" |
| 349 | }; |
| 350 | } |
| 351 | |
| 352 | // Activate a pre-provisioned device |
| 353 | rpc ActivateDevice(ID) returns(google.protobuf.Empty) { |
| 354 | option (google.api.http) = { |
| 355 | post: "/api/v1/local/devices/{id}/activate" |
| 356 | body: "{}" |
| 357 | }; |
| 358 | } |
| 359 | |
| 360 | // List ports of a device |
| 361 | rpc ListDevicePorts(ID) returns(Ports) { |
| 362 | option (google.api.http) = { |
| 363 | get: "/api/v1/local/devices/{id}/ports" |
| 364 | }; |
| 365 | } |
| 366 | |
| 367 | // List all flows of a device |
| 368 | rpc ListDeviceFlows(ID) returns(openflow_13.Flows) { |
| 369 | option (google.api.http) = { |
| 370 | get: "/api/v1/local/devices/{id}/flows" |
| 371 | }; |
| 372 | } |
| 373 | |
| 374 | // List all flow groups of a device |
| 375 | rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) { |
| 376 | option (google.api.http) = { |
| 377 | get: "/api/v1/local/devices/{id}/flow_groups" |
| 378 | }; |
| 379 | } |
| 380 | |
| 381 | // List device types know to Voltha instance |
| 382 | rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) { |
| 383 | option (google.api.http) = { |
| 384 | get: "/api/v1/local/device_types" |
| 385 | }; |
| 386 | } |
| 387 | |
| 388 | // Get additional information on given device type |
| 389 | rpc GetDeviceType(ID) returns(DeviceType) { |
| 390 | option (google.api.http) = { |
| 391 | get: "/api/v1/local/device_types/{id}" |
| 392 | }; |
| 393 | } |
| 394 | |
| 395 | // List device sharding groups managed by this Voltha instance |
| 396 | rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) { |
| 397 | option (google.api.http) = { |
| 398 | get: "/api/v1/local/device_groups" |
| 399 | }; |
| 400 | } |
| 401 | |
| 402 | // Get more information on given device shard |
| 403 | rpc GetDeviceGroup(ID) returns(DeviceGroup) { |
| 404 | option (google.api.http) = { |
| 405 | get: "/api/v1/local/device_groups/{id}" |
| 406 | }; |
| 407 | } |
| 408 | |
| 409 | // Stream control packets to the dataplane |
| 410 | rpc StreamPacketsOut(stream openflow_13.PacketOut) |
| 411 | returns(google.protobuf.Empty) { |
| 412 | // This does not have an HTTP representation |
| 413 | } |
| 414 | |
| 415 | // Receive control packet stream |
| 416 | rpc ReceivePacketsIn(google.protobuf.Empty) |
| 417 | returns(stream openflow_13.PacketIn) { |
| 418 | // This does not have an HTTP representation |
| 419 | } |
| 420 | |
| 421 | } |