blob: 1b35541f35544b06227400ff10ff91df32b64921 [file] [log] [blame]
Zdravko Bozakov7401ff22019-05-28 22:45:12 +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 bbsim.api.v1;
17
18import "google/api/annotations.proto";
19import "protoc-gen-swagger/options/annotations.proto";
Zdravko Bozakov078a2712019-07-19 23:25:15 +020020import "voltha_protos/openolt.proto";
21import "voltha_protos/tech_profile.proto";
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020022
23option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020024 info: {
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020025 title: "BBSim API";
26 version: "1.0";
Zdravko Bozakov078a2712019-07-19 23:25:15 +020027 contact: {
28 url: "http://opencord.org";
29 };
30 };
31 schemes: HTTP;
32 consumes: "application/json";
33 produces: "application/json";
34 responses: {
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020035 key: "404";
36 value: {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020037 description: "Returned when the resource does not exist.";
38 schema: {
39 json_schema: {
40 type: STRING;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020041 }
Zdravko Bozakov078a2712019-07-19 23:25:15 +020042 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020043 }
Zdravko Bozakov078a2712019-07-19 23:25:15 +020044 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020045};
46
47// OLT information
48message OLTInfo {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020049 int64 olt_id = 1;
50 string olt_serial = 2;
51 string olt_ip = 3;
52 string olt_state = 4;
53 string olt_vendor = 5;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020054}
55
56// ONU information
57message ONUInfo {
58 uint32 onu_id = 1;
59 uint32 pon_port_id = 2;
60 // ONU serial number
61 string onu_serial = 3;
62 // ONU oper state
63 string oper_state = 4;
64 // ONU internal state
65 string onu_state = 5;
Zdravko Bozakov078a2712019-07-19 23:25:15 +020066 repeated uint32 gemports = 6;
67 Tconts tconts = 7;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020068}
69
70// Bulk ONU operations
71message ONUs {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020072 repeated ONUInfo onus = 1;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020073}
74
75message ONURequest {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020076 ONUInfo onu = 1;
77 ONUs onus_batch = 2;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020078}
79
80// Port information
81message PortInfo {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020082 string port_type = 1;
83 uint32 port_id = 2;
84 uint32 pon_port_max_onus = 3;
85 uint32 pon_port_active_onus = 4;
86 string port_state = 5;
87 string alarm_state = 6;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020088}
89
90// Bulk port information
91message Ports {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020092 repeated PortInfo ports = 1;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020093}
94
95// BBSim status
96message OLTStatusResponse {
Zdravko Bozakov078a2712019-07-19 23:25:15 +020097 OLTInfo olt = 1;
98 repeated PortInfo ports = 2;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +020099}
100
101// BBSim response message
102message BBSimResponse {
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200103 string status_msg = 1;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200104}
105
106// ONU alarm request
107message ONUAlarmRequest {
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200108 // ONU serial number
109 string onu_serial = 1;
110 // Alarm types are:
111 // "signaldegrade"
112 // "lossofomcichannel"
113 // "lossofploam"
114 string alarm_type = 2;
115 // "on"/"off" indicates raised or cleared alarm
116 string status = 3; }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200117
118// OLT alarm request
119message OLTAlarmRequest {
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200120 uint32 port_id = 1;
121 string port_type = 2;
122 string status = 3;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200123}
124
125// Device action
126message DeviceAction {
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200127 string device_type = 1; // ONU or OLT
128 string serial_number = 2; // Device serial number
129 string action = 3; // soft or hard reboot
130}
131
132message Tconts {
133 fixed32 uni_id = 4;
134 fixed32 port_no = 5;
135 repeated tech_profile.TrafficScheduler tconts = 3;
136}
137
138message Flows {
139 repeated openolt.Flow flows = 1;
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200140}
141
142message Empty {}
143
144service BBSimService {
145
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200146 // Get current status of OLT
147 rpc OLTStatus(Empty) returns (OLTStatusResponse) {
148 option (google.api.http) = {
149 get : "/v1/olt"
150 additional_bindings {get : "/v1/olt/status"}
151 };
152 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200153
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200154 // Get status of a PON/NNI port
155 rpc PortStatus(PortInfo) returns (Ports) {
156 option (google.api.http) = {
157 get : "/v1/olt/ports/{port_type}/{port_id}/status"
158 };
159 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200160
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200161 // Get status of all or specific ONUs
162 rpc ONUStatus(ONURequest) returns (ONUs) {
163 option (google.api.http) = {
164 get : "/v1/olt/onus"
165 additional_bindings { get : "/v1/olt/ports/{onu.pon_port_id}/onus" }
166 additional_bindings { get : "/v1/olt/onus/{onu.onu_serial}" }
167 };
168 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200169
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200170 // Single/bulk activate ONU(s) for specific PON port(s)
171 rpc ONUActivate(ONURequest) returns (BBSimResponse) {
172 option (google.api.http) = {
173 post : "/v1/olt/onus"
174 body: "onus_batch"
175 additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus" }
176 additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_serial}" }
177 };
178 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200179
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200180 // Deactivate ONU(s) for specific PON port(s) specified by
181 // a given onu_serial, onu_id, or pon_port_id
182 rpc ONUDeactivate(ONURequest) returns (BBSimResponse) {
183 option (google.api.http) = {
184 delete : "/v1/olt/onus"
185 body: "onus_batch"
186 additional_bindings { delete: "/v1/olt/onus/{onu.onu_serial}" }
187 additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus" }
188 additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" }
189 };
190 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200191
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200192 // Generate ONU related alarms
193 rpc GenerateONUAlarm(ONUAlarmRequest) returns (BBSimResponse) {
194 option (google.api.http) = {
195 post : "/v1/olt/onus/{onu_serial}/alarms/{alarm_type}/{status}"
196 };
197 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200198
Zdravko Bozakov078a2712019-07-19 23:25:15 +0200199 // Generate OLT related alarms
200 rpc GenerateOLTAlarm(OLTAlarmRequest) returns (BBSimResponse) {
201 option (google.api.http) = {
202 post : "/v1/olt/ports/{port_type}/{port_id}/alarms/los/{status}"
203 };
204 }
205
206 // Perform actions on OLT/ONU devices (e.g. reboot)
207 rpc PerformDeviceAction(DeviceAction) returns (BBSimResponse) {
208 option (google.api.http) = {
209 patch: "/v1/{device_type}/action/{action}"
210 additional_bindings { patch : "/v1/olt/{device_type}/{serial_number}/action/{action}"}
211 };
212 }
213
214 // Get flows
215 rpc GetFlows(ONUInfo) returns(Flows) {
216 option (google.api.http) = {
217 get: "/v1/olt/flows"
218 additional_bindings {get: "/v1/olt/onu/{onu_serial}/flows"}
219 };
220 }
Zdravko Bozakov7401ff22019-05-28 22:45:12 +0200221}