Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame^] | 1 | // Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at: |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | syntax = "proto3"; |
| 16 | package legacy; |
| 17 | |
| 18 | import "google/api/annotations.proto"; |
| 19 | import "protoc-gen-swagger/options/annotations.proto"; |
| 20 | import "voltha_protos/openolt.proto"; |
| 21 | import "voltha_protos/tech_profile.proto"; |
| 22 | |
| 23 | option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { |
| 24 | info: { |
| 25 | title: "BBSim API"; |
| 26 | version: "1.0"; |
| 27 | contact: { |
| 28 | url: "http://opencord.org"; |
| 29 | }; |
| 30 | }; |
| 31 | schemes: HTTP; |
| 32 | consumes: "application/json"; |
| 33 | produces: "application/json"; |
| 34 | responses: { |
| 35 | key: "404"; |
| 36 | value: { |
| 37 | description: "Returned when the resource does not exist."; |
| 38 | schema: { |
| 39 | json_schema: { |
| 40 | type: STRING; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | }; |
| 46 | |
| 47 | // OLT information |
Shrey Baid | 688b424 | 2020-07-10 20:40:10 +0530 | [diff] [blame] | 48 | // This supports the older format of the REST APIs (still used from some clients) |
| 49 | // Please refer to the protos in api/bbsim/bbsim.proto for the latest available version |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 50 | message OLTInfo { |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 51 | int64 olt_id = 1; |
| 52 | string olt_serial = 2; |
| 53 | string olt_ip = 3; |
| 54 | string olt_state = 4; |
| 55 | string olt_vendor = 5; |
| 56 | } |
| 57 | |
| 58 | // ONU information |
| 59 | message ONUInfo { |
| 60 | uint32 onu_id = 1; |
| 61 | uint32 pon_port_id = 2; |
| 62 | // ONU serial number |
| 63 | string onu_serial = 3; |
| 64 | // ONU oper state |
| 65 | string oper_state = 4; |
| 66 | // ONU internal state |
| 67 | string onu_state = 5; |
| 68 | repeated uint32 gemports = 6; |
| 69 | Tconts tconts = 7; |
| 70 | } |
| 71 | |
| 72 | // Bulk ONU operations |
| 73 | message ONUs { |
| 74 | repeated ONUInfo onus = 1; |
| 75 | } |
| 76 | |
| 77 | message ONURequest { |
| 78 | ONUInfo onu = 1; |
| 79 | ONUs onus_batch = 2; |
| 80 | } |
| 81 | |
| 82 | // Port information |
| 83 | message PortInfo { |
| 84 | string port_type = 1; |
| 85 | uint32 port_id = 2; |
| 86 | uint32 pon_port_max_onus = 3; |
| 87 | uint32 pon_port_active_onus = 4; |
| 88 | string port_state = 5; |
| 89 | string alarm_state = 6; |
| 90 | } |
| 91 | |
| 92 | // Bulk port information |
| 93 | message Ports { |
| 94 | repeated PortInfo ports = 1; |
| 95 | } |
| 96 | |
| 97 | // BBSim status |
| 98 | message OLTStatusResponse { |
| 99 | OLTInfo olt = 1; |
| 100 | repeated PortInfo ports = 2; |
| 101 | } |
| 102 | |
| 103 | // BBSim response message |
| 104 | message BBSimResponse { |
| 105 | string status_msg = 1; |
| 106 | } |
| 107 | |
| 108 | // ONU alarm request |
| 109 | message ONUAlarmRequest { |
| 110 | // ONU serial number |
| 111 | string onu_serial = 1; |
| 112 | // Alarm types are: |
| 113 | // "signaldegrade" |
| 114 | // "lossofomcichannel" |
| 115 | // "lossofploam" |
| 116 | string alarm_type = 2; |
| 117 | // "on"/"off" indicates raised or cleared alarm |
| 118 | string status = 3; } |
| 119 | |
| 120 | // OLT alarm request |
| 121 | message OLTAlarmRequest { |
| 122 | uint32 port_id = 1; |
| 123 | string port_type = 2; |
| 124 | string status = 3; |
| 125 | } |
| 126 | |
| 127 | // Device action |
| 128 | message DeviceAction { |
| 129 | string device_type = 1; // ONU or OLT |
| 130 | string serial_number = 2; // Device serial number |
| 131 | string action = 3; // soft or hard reboot |
| 132 | } |
| 133 | |
| 134 | message Tconts { |
| 135 | fixed32 uni_id = 4; |
| 136 | fixed32 port_no = 5; |
| 137 | repeated tech_profile.TrafficScheduler tconts = 3; |
| 138 | } |
| 139 | |
| 140 | message Flows { |
| 141 | repeated openolt.Flow flows = 1; |
| 142 | } |
| 143 | |
| 144 | message Empty {} |
| 145 | |
| 146 | service BBSimService { |
| 147 | |
| 148 | // Get current status of OLT |
| 149 | rpc OLTStatus(Empty) returns (OLTStatusResponse) { |
| 150 | option deprecated = true; |
| 151 | option (google.api.http) = { |
| 152 | get : "/v0/olt" |
| 153 | additional_bindings {get : "/v0/olt/status"} |
| 154 | }; |
| 155 | } |
| 156 | |
| 157 | // Get status of a PON/NNI port |
| 158 | rpc PortStatus(PortInfo) returns (Ports) { |
| 159 | option deprecated = true; |
| 160 | option (google.api.http) = { |
| 161 | get : "/v0/olt/ports/{port_type}/{port_id}/status" |
| 162 | }; |
| 163 | } |
| 164 | |
| 165 | // Get status of all or specific ONUs |
| 166 | rpc ONUStatus(ONURequest) returns (ONUs) { |
| 167 | option deprecated = true; |
| 168 | option (google.api.http) = { |
| 169 | get : "/v0/olt/onus" |
| 170 | additional_bindings { get : "/v0/olt/onus/{onu.onu_serial}" } |
| 171 | additional_bindings { get : "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" } |
| 172 | additional_bindings { get : "/v0/olt/ports/{onu.pon_port_id}/onus" } |
| 173 | }; |
| 174 | } |
| 175 | |
| 176 | // Single/bulk activate ONU(s) for specific PON port(s) |
| 177 | rpc ONUActivate(ONURequest) returns (BBSimResponse) { |
| 178 | option deprecated = true; |
| 179 | option (google.api.http) = { |
| 180 | post : "/v0/olt/onus" |
| 181 | body: "onus_batch" |
| 182 | additional_bindings { post : "/v0/olt/ports/{onu.pon_port_id}/onus" } |
| 183 | additional_bindings { post : "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_serial}" } |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | // Deactivate ONU(s) for specific PON port(s) specified by |
| 188 | // a given onu_serial, onu_id, or pon_port_id |
| 189 | rpc ONUDeactivate(ONURequest) returns (BBSimResponse) { |
| 190 | option deprecated = true; |
| 191 | option (google.api.http) = { |
| 192 | delete : "/v0/olt/onus" |
| 193 | body: "onus_batch" |
| 194 | additional_bindings { delete: "/v0/olt/onus/{onu.onu_serial}" } |
| 195 | additional_bindings { delete: "/v0/olt/ports/{onu.pon_port_id}/onus" } |
| 196 | additional_bindings { delete: "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" } |
| 197 | }; |
| 198 | } |
| 199 | |
| 200 | // Generate ONU related alarms |
| 201 | rpc GenerateONUAlarm(ONUAlarmRequest) returns (BBSimResponse) { |
| 202 | option deprecated = true; |
| 203 | option (google.api.http) = { |
| 204 | post : "/v0/olt/onus/{onu_serial}/alarms/{alarm_type}/{status}" |
| 205 | }; |
| 206 | } |
| 207 | |
| 208 | // Generate OLT related alarms |
| 209 | rpc GenerateOLTAlarm(OLTAlarmRequest) returns (BBSimResponse) { |
| 210 | option deprecated = true; |
| 211 | option (google.api.http) = { |
| 212 | post : "/v0/olt/ports/{port_type}/{port_id}/alarms/los/{status}" |
| 213 | }; |
| 214 | } |
| 215 | |
| 216 | // Perform actions on OLT/ONU devices (e.g. reboot) |
| 217 | rpc PerformDeviceAction(DeviceAction) returns (BBSimResponse) { |
| 218 | option deprecated = true; |
| 219 | option (google.api.http) = { |
| 220 | patch: "/v0/{device_type}/action/{action}" |
| 221 | additional_bindings { patch : "/v0/olt/{device_type}/{serial_number}/action/{action}"} |
| 222 | }; |
| 223 | } |
| 224 | |
| 225 | // Get flows |
| 226 | rpc GetFlows(ONUInfo) returns(Flows) { |
| 227 | option deprecated = true; |
| 228 | option (google.api.http) = { |
| 229 | get: "/v0/olt/flows" |
| 230 | additional_bindings {get: "/v0/olt/onu/{onu_serial}/flows"} |
| 231 | }; |
| 232 | } |
| 233 | } |