blob: fee9bec9a01083eed8800d344c1a8beff3dac915 [file] [log] [blame]
Zdravko Bozakov2da76342019-10-21 09:47:35 +02001// Copyright (c) 2018 Open Networking Foundation
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
15syntax = "proto3";
16package legacy;
17
18import "google/api/annotations.proto";
19import "protoc-gen-swagger/options/annotations.proto";
20import "voltha_protos/openolt.proto";
21import "voltha_protos/tech_profile.proto";
22
23option (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
48message OLTInfo {
49 option deprecated = true;
50 int64 olt_id = 1;
51 string olt_serial = 2;
52 string olt_ip = 3;
53 string olt_state = 4;
54 string olt_vendor = 5;
55}
56
57// ONU information
58message ONUInfo {
59 uint32 onu_id = 1;
60 uint32 pon_port_id = 2;
61 // ONU serial number
62 string onu_serial = 3;
63 // ONU oper state
64 string oper_state = 4;
65 // ONU internal state
66 string onu_state = 5;
67 repeated uint32 gemports = 6;
68 Tconts tconts = 7;
69}
70
71// Bulk ONU operations
72message ONUs {
73 repeated ONUInfo onus = 1;
74}
75
76message ONURequest {
77 ONUInfo onu = 1;
78 ONUs onus_batch = 2;
79}
80
81// Port information
82message PortInfo {
83 string port_type = 1;
84 uint32 port_id = 2;
85 uint32 pon_port_max_onus = 3;
86 uint32 pon_port_active_onus = 4;
87 string port_state = 5;
88 string alarm_state = 6;
89}
90
91// Bulk port information
92message Ports {
93 repeated PortInfo ports = 1;
94}
95
96// BBSim status
97message OLTStatusResponse {
98 OLTInfo olt = 1;
99 repeated PortInfo ports = 2;
100}
101
102// BBSim response message
103message BBSimResponse {
104 string status_msg = 1;
105}
106
107// ONU alarm request
108message ONUAlarmRequest {
109 // ONU serial number
110 string onu_serial = 1;
111 // Alarm types are:
112 // "signaldegrade"
113 // "lossofomcichannel"
114 // "lossofploam"
115 string alarm_type = 2;
116 // "on"/"off" indicates raised or cleared alarm
117 string status = 3; }
118
119// OLT alarm request
120message OLTAlarmRequest {
121 uint32 port_id = 1;
122 string port_type = 2;
123 string status = 3;
124}
125
126// Device action
127message DeviceAction {
128 string device_type = 1; // ONU or OLT
129 string serial_number = 2; // Device serial number
130 string action = 3; // soft or hard reboot
131}
132
133message Tconts {
134 fixed32 uni_id = 4;
135 fixed32 port_no = 5;
136 repeated tech_profile.TrafficScheduler tconts = 3;
137}
138
139message Flows {
140 repeated openolt.Flow flows = 1;
141}
142
143message Empty {}
144
145service BBSimService {
146
147 // Get current status of OLT
148 rpc OLTStatus(Empty) returns (OLTStatusResponse) {
149 option deprecated = true;
150 option (google.api.http) = {
151 get : "/v0/olt"
152 additional_bindings {get : "/v0/olt/status"}
153 };
154 }
155
156 // Get status of a PON/NNI port
157 rpc PortStatus(PortInfo) returns (Ports) {
158 option deprecated = true;
159 option (google.api.http) = {
160 get : "/v0/olt/ports/{port_type}/{port_id}/status"
161 };
162 }
163
164 // Get status of all or specific ONUs
165 rpc ONUStatus(ONURequest) returns (ONUs) {
166 option deprecated = true;
167 option (google.api.http) = {
168 get : "/v0/olt/onus"
169 additional_bindings { get : "/v0/olt/onus/{onu.onu_serial}" }
170 additional_bindings { get : "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" }
171 additional_bindings { get : "/v0/olt/ports/{onu.pon_port_id}/onus" }
172 };
173 }
174
175 // Single/bulk activate ONU(s) for specific PON port(s)
176 rpc ONUActivate(ONURequest) returns (BBSimResponse) {
177 option deprecated = true;
178 option (google.api.http) = {
179 post : "/v0/olt/onus"
180 body: "onus_batch"
181 additional_bindings { post : "/v0/olt/ports/{onu.pon_port_id}/onus" }
182 additional_bindings { post : "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_serial}" }
183 };
184 }
185
186 // Deactivate ONU(s) for specific PON port(s) specified by
187 // a given onu_serial, onu_id, or pon_port_id
188 rpc ONUDeactivate(ONURequest) returns (BBSimResponse) {
189 option deprecated = true;
190 option (google.api.http) = {
191 delete : "/v0/olt/onus"
192 body: "onus_batch"
193 additional_bindings { delete: "/v0/olt/onus/{onu.onu_serial}" }
194 additional_bindings { delete: "/v0/olt/ports/{onu.pon_port_id}/onus" }
195 additional_bindings { delete: "/v0/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" }
196 };
197 }
198
199 // Generate ONU related alarms
200 rpc GenerateONUAlarm(ONUAlarmRequest) returns (BBSimResponse) {
201 option deprecated = true;
202 option (google.api.http) = {
203 post : "/v0/olt/onus/{onu_serial}/alarms/{alarm_type}/{status}"
204 };
205 }
206
207 // Generate OLT related alarms
208 rpc GenerateOLTAlarm(OLTAlarmRequest) returns (BBSimResponse) {
209 option deprecated = true;
210 option (google.api.http) = {
211 post : "/v0/olt/ports/{port_type}/{port_id}/alarms/los/{status}"
212 };
213 }
214
215 // Perform actions on OLT/ONU devices (e.g. reboot)
216 rpc PerformDeviceAction(DeviceAction) returns (BBSimResponse) {
217 option deprecated = true;
218 option (google.api.http) = {
219 patch: "/v0/{device_type}/action/{action}"
220 additional_bindings { patch : "/v0/olt/{device_type}/{serial_number}/action/{action}"}
221 };
222 }
223
224 // Get flows
225 rpc GetFlows(ONUInfo) returns(Flows) {
226 option deprecated = true;
227 option (google.api.http) = {
228 get: "/v0/olt/flows"
229 additional_bindings {get: "/v0/olt/onu/{onu_serial}/flows"}
230 };
231 }
232}