blob: 7ace1c0772220c056d9c72a969cdc0cf625a0672 [file] [log] [blame]
Matteo Scandolo11006992019-08-28 11:29:46 -07001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Matteo Scandolo4747d292019-08-05 11:50:18 -070017package devices
18
19import (
20 "context"
21 "errors"
22 "fmt"
Matteo Scandolod54283a2019-08-13 16:22:31 -070023 "github.com/opencord/voltha-protos/go/openolt"
Matteo Scandolo4747d292019-08-05 11:50:18 -070024 "github.com/looplab/fsm"
Matteo Scandolod54283a2019-08-13 16:22:31 -070025 "github.com/opencord/voltha-protos/go/tech_profile"
Matteo Scandolo4747d292019-08-05 11:50:18 -070026 log "github.com/sirupsen/logrus"
27 "google.golang.org/grpc"
28 "net"
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070029 "os"
Matteo Scandolo4747d292019-08-05 11:50:18 -070030 "sync"
31)
32
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070033var oltLogger = log.WithFields(log.Fields{
Matteo Scandolo84f7d482019-08-08 19:00:47 -070034 "module": "OLT",
35})
36
Matteo Scandolo4747d292019-08-05 11:50:18 -070037func init() {
38 //log.SetReportCaller(true)
39 log.SetLevel(log.DebugLevel)
40}
41
Matteo Scandolo84f7d482019-08-08 19:00:47 -070042var olt = OltDevice{}
43
44func GetOLT() OltDevice {
45 return olt
46}
47
Matteo Scandolo4747d292019-08-05 11:50:18 -070048func CreateOLT(seq int, nni int, pon int, onuPerPon int) OltDevice {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070049 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -070050 "ID": seq,
51 "NumNni":nni,
52 "NumPon":pon,
53 "NumOnuPerPon":onuPerPon,
54 }).Debug("CreateOLT")
55
Matteo Scandolo84f7d482019-08-08 19:00:47 -070056 olt = OltDevice{
Matteo Scandolo4747d292019-08-05 11:50:18 -070057 ID: seq,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070058 OperState: getOperStateFSM(func(e *fsm.Event) {
59 oltLogger.Debugf("Changing OLT OperState from %s to %s", e.Src, e.Dst)
60 }),
Matteo Scandolo4747d292019-08-05 11:50:18 -070061 NumNni:nni,
62 NumPon:pon,
63 NumOnuPerPon:onuPerPon,
64 Pons: []PonPort{},
65 Nnis: []NniPort{},
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070066 channel: make(chan Message),
Matteo Scandolo4747d292019-08-05 11:50:18 -070067 }
68
69 // OLT State machine
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070070 // NOTE do we need 2 state machines for the OLT? (InternalState and OperState)
Matteo Scandolo4747d292019-08-05 11:50:18 -070071 olt.InternalState = fsm.NewFSM(
72 "created",
73 fsm.Events{
74 {Name: "enable", Src: []string{"created"}, Dst: "enabled"},
75 {Name: "disable", Src: []string{"enabled"}, Dst: "disabled"},
76 },
77 fsm.Callbacks{
78 "enter_state": func(e *fsm.Event) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070079 oltLogger.Debugf("Changing OLT InternalState from %s to %s", e.Src, e.Dst)
Matteo Scandolo4747d292019-08-05 11:50:18 -070080 },
81 },
82 )
83
84 // create NNI Port
85 nniPort := NniPort{
86 ID: uint32(0),
Matteo Scandolo9a3518c2019-08-13 14:36:01 -070087 OperState: getOperStateFSM(func(e *fsm.Event) {
88 oltLogger.Debugf("Changing NNI OperState from %s to %s", e.Src, e.Dst)
89 }),
Matteo Scandolo4747d292019-08-05 11:50:18 -070090 Type: "nni",
91 }
92 olt.Nnis = append(olt.Nnis, nniPort)
93
94 // create PON ports
Matteo Scandoloda9cbe22019-08-19 16:05:10 -070095 onuId := 1
Matteo Scandolo4747d292019-08-05 11:50:18 -070096 for i := 0; i < pon; i++ {
97 p := PonPort{
98 NumOnu: olt.NumOnuPerPon,
99 ID: uint32(i),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700100 Type: "pon",
101 }
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700102 p.OperState = getOperStateFSM(func(e *fsm.Event) {
103 oltLogger.WithFields(log.Fields{
104 "ID": p.ID,
105 }).Debugf("Changing PON Port OperState from %s to %s", e.Src, e.Dst)
106 })
Matteo Scandolo4747d292019-08-05 11:50:18 -0700107
108 // create ONU devices
109 for j := 0; j < onuPerPon; j++ {
Matteo Scandoloda9cbe22019-08-19 16:05:10 -0700110 o := CreateONU(olt, p, uint32(onuId))
Matteo Scandolo4747d292019-08-05 11:50:18 -0700111 p.Onus = append(p.Onus, o)
Matteo Scandoloda9cbe22019-08-19 16:05:10 -0700112 onuId = onuId + 1
Matteo Scandolo4747d292019-08-05 11:50:18 -0700113 }
114
115 olt.Pons = append(olt.Pons, p)
116 }
117
118 wg := sync.WaitGroup{}
119
120 wg.Add(1)
121 go newOltServer(olt)
122 wg.Wait()
123 return olt
124}
125
126func newOltServer(o OltDevice) error {
127 // TODO make configurable
128 address := "0.0.0.0:50060"
Matteo Scandolo4747d292019-08-05 11:50:18 -0700129 lis, err := net.Listen("tcp", address)
130 if err != nil {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700131 oltLogger.Fatalf("OLT failed to listen: %v", err)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700132 }
133 grpcServer := grpc.NewServer()
134 openolt.RegisterOpenoltServer(grpcServer, o)
135
136 go grpcServer.Serve(lis)
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700137 oltLogger.Debugf("OLT Listening on: %v", address)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700138
139 return nil
140}
141
142// Device Methods
143
144func (o OltDevice) Enable (stream openolt.Openolt_EnableIndicationServer) error {
145
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700146 oltLogger.Debug("Enable OLT called")
Matteo Scandolo84f7d482019-08-08 19:00:47 -0700147
Matteo Scandolo4747d292019-08-05 11:50:18 -0700148 wg := sync.WaitGroup{}
149 wg.Add(1)
150
151 // create a channel for all the OLT events
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700152 go o.processOltMessages(stream)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700153
154 // enable the OLT
155 olt_msg := Message{
156 Type: OltIndication,
157 Data: OltIndicationMessage{
158 OperState: UP,
159 },
160 }
161 o.channel <- olt_msg
162
163 // send NNI Port Indications
164 for _, nni := range o.Nnis {
165 msg := Message{
166 Type: NniIndication,
167 Data: NniIndicationMessage{
168 OperState: UP,
169 NniPortID: nni.ID,
170 },
171 }
172 o.channel <- msg
173 }
174
175 // send PON Port indications
176 for _, pon := range o.Pons {
177 msg := Message{
178 Type: PonIndication,
179 Data: PonIndicationMessage{
180 OperState: UP,
181 PonPortID: pon.ID,
182 },
183 }
184 o.channel <- msg
185
186 for _, onu := range pon.Onus {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700187 go onu.processOnuMessages(stream)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700188 msg := Message{
189 Type: OnuDiscIndication,
190 Data: OnuDiscIndicationMessage{
191 Onu: onu,
192 OperState: UP,
193 },
194 }
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700195 onu.channel <- msg
Matteo Scandolo4747d292019-08-05 11:50:18 -0700196 }
197 }
198
199 wg.Wait()
200 return nil
201}
202
203// Helpers method
204
205func (o OltDevice) getPonById(id uint32) (*PonPort, error) {
206 for _, pon := range o.Pons {
207 if pon.ID == id {
208 return &pon, nil
209 }
210 }
211 return nil, errors.New(fmt.Sprintf("Cannot find PonPort with id %d in OLT %d", id, o.ID))
212}
213
214func (o OltDevice) getNniById(id uint32) (*NniPort, error) {
215 for _, nni := range o.Nnis {
216 if nni.ID == id {
217 return &nni, nil
218 }
219 }
220 return nil, errors.New(fmt.Sprintf("Cannot find NniPort with id %d in OLT %d", id, o.ID))
221}
222
Matteo Scandolo4747d292019-08-05 11:50:18 -0700223func (o OltDevice) sendOltIndication(msg OltIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
224 data := &openolt.Indication_OltInd{OltInd: &openolt.OltIndication{OperState: msg.OperState.String()}}
225 if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
Matteo Scandolo11006992019-08-28 11:29:46 -0700226 oltLogger.Errorf("Failed to send Indication_OltInd: %v", err)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700227 }
228
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700229 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -0700230 "OperState": msg.OperState,
231 }).Debug("Sent Indication_OltInd")
232}
233
234func (o OltDevice) sendNniIndication(msg NniIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
235 nni, _ := o.getNniById(msg.NniPortID)
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700236 nni.OperState.Event("enable")
237 // NOTE Operstate may need to be an integer
Matteo Scandolo4747d292019-08-05 11:50:18 -0700238 operData := &openolt.Indication_IntfOperInd{IntfOperInd: &openolt.IntfOperIndication{
239 Type: nni.Type,
240 IntfId: nni.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700241 OperState: nni.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700242 }}
243
244 if err := stream.Send(&openolt.Indication{Data: operData}); err != nil {
Matteo Scandolo11006992019-08-28 11:29:46 -0700245 oltLogger.Errorf("Failed to send Indication_IntfOperInd for NNI: %v", err)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700246 }
247
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700248 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -0700249 "Type": nni.Type,
250 "IntfId": nni.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700251 "OperState": nni.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700252 }).Debug("Sent Indication_IntfOperInd for NNI")
253}
254
255func (o OltDevice) sendPonIndication(msg PonIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
256 pon, _ := o.getPonById(msg.PonPortID)
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700257 pon.OperState.Event("enable")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700258 discoverData := &openolt.Indication_IntfInd{IntfInd: &openolt.IntfIndication{
259 IntfId: pon.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700260 OperState: pon.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700261 }}
262
263 if err := stream.Send(&openolt.Indication{Data: discoverData}); err != nil {
Matteo Scandolo11006992019-08-28 11:29:46 -0700264 oltLogger.Errorf("Failed to send Indication_IntfInd: %v", err)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700265 }
266
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700267 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -0700268 "IntfId": pon.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700269 "OperState": pon.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700270 }).Debug("Sent Indication_IntfInd")
271
272 operData := &openolt.Indication_IntfOperInd{IntfOperInd: &openolt.IntfOperIndication{
273 Type: pon.Type,
274 IntfId: pon.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700275 OperState: pon.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700276 }}
277
278 if err := stream.Send(&openolt.Indication{Data: operData}); err != nil {
Matteo Scandolo11006992019-08-28 11:29:46 -0700279 oltLogger.Errorf("Failed to send Indication_IntfOperInd for PON: %v", err)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700280 }
281
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700282 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -0700283 "Type": pon.Type,
284 "IntfId": pon.ID,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700285 "OperState": pon.OperState.Current(),
Matteo Scandolo4747d292019-08-05 11:50:18 -0700286 }).Debug("Sent Indication_IntfOperInd for PON")
287}
288
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700289func (o OltDevice) processOltMessages(stream openolt.Openolt_EnableIndicationServer) {
290 oltLogger.Debug("Started OLT Indication Channel")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700291 for message := range o.channel {
292
Matteo Scandolo4747d292019-08-05 11:50:18 -0700293
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700294 oltLogger.WithFields(log.Fields{
295 "oltId": o.ID,
296 "messageType": message.Type,
297 }).Trace("Received message")
298
299 switch message.Type {
300 case OltIndication:
301 msg, _ := message.Data.(OltIndicationMessage)
302 if msg.OperState == UP {
Matteo Scandolo4747d292019-08-05 11:50:18 -0700303 o.InternalState.Event("enable")
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700304 o.OperState.Event("enable")
305 } else if msg.OperState == DOWN {
306 o.InternalState.Event("disable")
307 o.OperState.Event("disable")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700308 }
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700309 o.sendOltIndication(msg, stream)
310 case NniIndication:
311 msg, _ := message.Data.(NniIndicationMessage)
312 o.sendNniIndication(msg, stream)
313 case PonIndication:
314 msg, _ := message.Data.(PonIndicationMessage)
315 o.sendPonIndication(msg, stream)
316 default:
317 oltLogger.Warnf("Received unknown message data %v for type %v in OLT channel", message.Data, message.Type)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700318 }
319
320 }
321}
322
323// GRPC Endpoints
324
325func (o OltDevice) ActivateOnu(context context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700326 oltLogger.WithFields(log.Fields{
Matteo Scandolo4747d292019-08-05 11:50:18 -0700327 "onuSerialNumber": onu.SerialNumber,
328 }).Info("Received ActivateOnu call from VOLTHA")
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700329
330 pon, _ := o.getPonById(onu.IntfId)
331 _onu, _ := pon.getOnuBySn(onu.SerialNumber)
332
333 // NOTE we need to immediately activate the ONU or the OMCI state machine won't start
Matteo Scandolo4747d292019-08-05 11:50:18 -0700334 msg := Message{
335 Type: OnuIndication,
336 Data: OnuIndicationMessage{
337 OnuSN: onu.SerialNumber,
338 PonPortID: onu.IntfId,
339 OperState: UP,
340 },
341 }
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700342 _onu.channel <- msg
Matteo Scandolo4747d292019-08-05 11:50:18 -0700343 return new(openolt.Empty) , nil
344}
345
346func (o OltDevice) DeactivateOnu(context.Context, *openolt.Onu) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700347 oltLogger.Error("DeactivateOnu not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700348 return new(openolt.Empty) , nil
349}
350
351func (o OltDevice) DeleteOnu(context.Context, *openolt.Onu) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700352 oltLogger.Error("DeleteOnu not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700353 return new(openolt.Empty) , nil
354}
355
356func (o OltDevice) DisableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700357 // NOTE when we disable the OLT should we disable NNI, PONs and ONUs altogether?
358 olt_msg := Message{
359 Type: OltIndication,
360 Data: OltIndicationMessage{
361 OperState: DOWN,
362 },
363 }
364 o.channel <- olt_msg
Matteo Scandolo4747d292019-08-05 11:50:18 -0700365 return new(openolt.Empty) , nil
366}
367
368func (o OltDevice) DisablePonIf(context.Context, *openolt.Interface) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700369 oltLogger.Error("DisablePonIf not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700370 return new(openolt.Empty) , nil
371}
372
373func (o OltDevice) EnableIndication(_ *openolt.Empty, stream openolt.Openolt_EnableIndicationServer) error {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700374 oltLogger.WithField("oltId", o.ID).Info("OLT receives EnableIndication call from VOLTHA")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700375 o.Enable(stream)
376 return nil
377}
378
379func (o OltDevice) EnablePonIf(context.Context, *openolt.Interface) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700380 oltLogger.Error("EnablePonIf not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700381 return new(openolt.Empty) , nil
382}
383
384func (o OltDevice) FlowAdd(context.Context, *openolt.Flow) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700385 oltLogger.Info("received FlowAdd")
386 // TODO store flows somewhere
Matteo Scandolo4747d292019-08-05 11:50:18 -0700387 return new(openolt.Empty) , nil
388}
389
390func (o OltDevice) FlowRemove(context.Context, *openolt.Flow) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700391 oltLogger.Info("received FlowRemove")
392 // TODO store flows somewhere
Matteo Scandolo4747d292019-08-05 11:50:18 -0700393 return new(openolt.Empty) , nil
394}
395
396func (o OltDevice) HeartbeatCheck(context.Context, *openolt.Empty) (*openolt.Heartbeat, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700397 oltLogger.Error("HeartbeatCheck not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700398 return new(openolt.Heartbeat) , nil
399}
400
401func (o OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error) {
402
Matteo Scandoloda9cbe22019-08-19 16:05:10 -0700403 oltLogger.WithFields(log.Fields{
404 "oltId": o.ID,
405 "PonPorts": o.NumPon,
406 }).Info("OLT receives GetDeviceInfo call from VOLTHA")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700407 devinfo := new(openolt.DeviceInfo)
408 devinfo.Vendor = "BBSim"
409 devinfo.Model = "asfvolt16"
Matteo Scandolo84f7d482019-08-08 19:00:47 -0700410 devinfo.HardwareVersion = "emulated"
Matteo Scandolo4747d292019-08-05 11:50:18 -0700411 devinfo.FirmwareVersion = ""
412 devinfo.Technology = "xgspon"
Matteo Scandoloda9cbe22019-08-19 16:05:10 -0700413 devinfo.PonPorts = uint32(o.NumPon)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700414 devinfo.OnuIdStart = 1
415 devinfo.OnuIdEnd = 255
416 devinfo.AllocIdStart = 1024
417 devinfo.AllocIdEnd = 16383
418 devinfo.GemportIdStart = 1024
419 devinfo.GemportIdEnd = 65535
420 devinfo.FlowIdStart = 1
421 devinfo.FlowIdEnd = 16383
Matteo Scandolo84f7d482019-08-08 19:00:47 -0700422 devinfo.DeviceSerialNumber = fmt.Sprintf("BBSIM_OLT_%d", o.ID)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700423
424 return devinfo, nil
425}
426
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700427func (o OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700428 pon, _ := o.getPonById(omci_msg.IntfId)
429 onu, _ := pon.getOnuById(omci_msg.OnuId)
430 msg := Message{
431 Type: OMCI,
432 Data: OmciMessage{
433 OnuSN: onu.SerialNumber,
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700434 OnuID: onu.ID,
435 omciMsg: omci_msg,
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700436 },
437 }
438 onu.channel <- msg
Matteo Scandolo4747d292019-08-05 11:50:18 -0700439 return new(openolt.Empty) , nil
440}
441
442func (o OltDevice) OnuPacketOut(context.Context, *openolt.OnuPacket) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700443 oltLogger.Error("OnuPacketOut not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700444 return new(openolt.Empty) , nil
445}
446
447func (o OltDevice) Reboot(context.Context, *openolt.Empty) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700448 oltLogger.Info("Shutting Down, hope you're running in K8s...")
449 os.Exit(0)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700450 return new(openolt.Empty) , nil
451}
452
453func (o OltDevice) ReenableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700454 oltLogger.Error("ReenableOlt not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700455 return new(openolt.Empty) , nil
456}
457
458func (o OltDevice) UplinkPacketOut(context context.Context, packet *openolt.UplinkPacket) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700459 oltLogger.Warn("UplinkPacketOut not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700460 return new(openolt.Empty) , nil
461}
462
463func (o OltDevice) CollectStatistics(context.Context, *openolt.Empty) (*openolt.Empty, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700464 oltLogger.Error("CollectStatistics not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700465 return new(openolt.Empty) , nil
466}
467
Matteo Scandolo4747d292019-08-05 11:50:18 -0700468func (o OltDevice) GetOnuInfo(context context.Context, packet *openolt.Onu) (*openolt.OnuIndication, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700469 oltLogger.Error("GetOnuInfo not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700470 return new(openolt.OnuIndication) , nil
471}
472
473func (o OltDevice) GetPonIf(context context.Context, packet *openolt.Interface) (*openolt.IntfIndication, error) {
Matteo Scandolo9a3518c2019-08-13 14:36:01 -0700474 oltLogger.Error("GetPonIf not implemented")
Matteo Scandolo4747d292019-08-05 11:50:18 -0700475 return new(openolt.IntfIndication) , nil
Matteo Scandolod54283a2019-08-13 16:22:31 -0700476}
477
478func (s OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700479 oltLogger.Info("received CreateTrafficQueues")
Matteo Scandolod54283a2019-08-13 16:22:31 -0700480 return new(openolt.Empty), nil
481}
482
483func (s OltDevice) RemoveTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700484 oltLogger.Info("received RemoveTrafficQueues")
Matteo Scandolod54283a2019-08-13 16:22:31 -0700485 return new(openolt.Empty), nil
486}
487
488func (s OltDevice) CreateTrafficSchedulers(context.Context, *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700489 oltLogger.Info("received CreateTrafficSchedulers")
Matteo Scandolod54283a2019-08-13 16:22:31 -0700490 return new(openolt.Empty), nil
491}
492
493func (s OltDevice) RemoveTrafficSchedulers(context.Context, *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
Matteo Scandoloc559ef12019-08-20 13:24:21 -0700494 oltLogger.Info("received RemoveTrafficSchedulers")
Matteo Scandolod54283a2019-08-13 16:22:31 -0700495 return new(openolt.Empty), nil
Matteo Scandolo4747d292019-08-05 11:50:18 -0700496}