Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 1 | /* |
Joey Armstrong | 89c812c | 2024-01-12 19:00:20 -0500 | [diff] [blame] | 2 | * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 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 | |
Joey Armstrong | 89c812c | 2024-01-12 19:00:20 -0500 | [diff] [blame] | 17 | // Package mib provides the utilities for managing the onu mib |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 18 | package mib |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 19 | |
| 20 | import ( |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 21 | "context" |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 22 | "fmt" |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 23 | "time" |
| 24 | |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 25 | "github.com/looplab/fsm" |
| 26 | |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 27 | "github.com/opencord/omci-lib-go/v2" |
| 28 | me "github.com/opencord/omci-lib-go/v2/generated" |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 29 | "github.com/opencord/voltha-lib-go/v7/pkg/log" |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 30 | cmn "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/common" |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 31 | ) |
| 32 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 33 | func (onuDeviceEntry *OnuDeviceEntry) enterDLStartingState(ctx context.Context, e *fsm.Event) { |
| 34 | logger.Debugw(ctx, "MibDownload FSM", log.Fields{"Start downloading OMCI MIB in state": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 35 | // in case the used channel is not yet defined (can be re-used after restarts) |
| 36 | if onuDeviceEntry.omciMessageReceived == nil { |
| 37 | onuDeviceEntry.omciMessageReceived = make(chan bool) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 38 | logger.Debug(ctx, "MibDownload FSM - defining the BridgeInit RxChannel") |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 39 | } |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 40 | // start go routine for processing of MibDownload messages |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 41 | go onuDeviceEntry.processMibDownloadMessages(ctx) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 42 | } |
| 43 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 44 | func (onuDeviceEntry *OnuDeviceEntry) enterCreatingGalState(ctx context.Context, e *fsm.Event) { |
| 45 | logger.Debugw(ctx, "MibDownload FSM", log.Fields{"Tx create::GAL Ethernet Profile in state": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 46 | onuDeviceEntry.mutexPLastTxMeInstance.Lock() |
| 47 | meInstance, err := onuDeviceEntry.PDevOmciCC.SendCreateGalEthernetProfile(log.WithSpanFromContext(context.TODO(), ctx), |
| 48 | onuDeviceEntry.baseDeviceHandler.GetOmciTimeout(), true) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 49 | //accept also nil as (error) return value for writing to LastTx |
| 50 | // - this avoids misinterpretation of new received OMCI messages |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 51 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 52 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 53 | logger.Errorw(ctx, "GalEthernetProfile create failed, aborting MibDownload FSM!", |
| 54 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 55 | pMibDlFsm := onuDeviceEntry.PMibDownloadFsm |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 56 | if pMibDlFsm != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 57 | go func(a_pAFsm *cmn.AdapterFsm) { |
| 58 | _ = a_pAFsm.PFsm.Event(DlEvReset) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 59 | }(pMibDlFsm) |
| 60 | } |
| 61 | return |
| 62 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 63 | onuDeviceEntry.pLastTxMeInstance = meInstance |
| 64 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 65 | } |
| 66 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 67 | func (onuDeviceEntry *OnuDeviceEntry) enterSettingOnu2gState(ctx context.Context, e *fsm.Event) { |
| 68 | logger.Debugw(ctx, "MibDownload FSM", log.Fields{"Tx Set::ONU2-G in state": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 69 | onuDeviceEntry.mutexPLastTxMeInstance.Lock() |
| 70 | meInstance, err := onuDeviceEntry.PDevOmciCC.SendSetOnu2g(log.WithSpanFromContext(context.TODO(), ctx), |
| 71 | onuDeviceEntry.baseDeviceHandler.GetOmciTimeout(), true) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 72 | //accept also nil as (error) return value for writing to LastTx |
| 73 | // - this avoids misinterpretation of new received OMCI messages |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 74 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 75 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 76 | logger.Errorw(ctx, "ONU2-G set failed, aborting MibDownload FSM!", |
| 77 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 78 | pMibDlFsm := onuDeviceEntry.PMibDownloadFsm |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 79 | if pMibDlFsm != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 80 | go func(a_pAFsm *cmn.AdapterFsm) { |
| 81 | _ = a_pAFsm.PFsm.Event(DlEvReset) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 82 | }(pMibDlFsm) |
| 83 | } |
| 84 | return |
| 85 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 86 | onuDeviceEntry.pLastTxMeInstance = meInstance |
| 87 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 88 | } |
| 89 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 90 | func (onuDeviceEntry *OnuDeviceEntry) enterBridgeInitState(ctx context.Context, e *fsm.Event) { |
| 91 | logger.Debugw(ctx, "MibDownload FSM - starting bridge config port loop", log.Fields{ |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 92 | "in state": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 93 | go onuDeviceEntry.performInitialBridgeSetup(ctx) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 94 | } |
| 95 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 96 | func (onuDeviceEntry *OnuDeviceEntry) enterDownloadedState(ctx context.Context, e *fsm.Event) { |
| 97 | logger.Debugw(ctx, "MibDownload FSM", log.Fields{"send notification to core in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 98 | onuDeviceEntry.transferSystemEvent(ctx, cmn.MibDownloadDone) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 99 | //let's reset the state machine in order to release all resources now |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 100 | pMibDlFsm := onuDeviceEntry.PMibDownloadFsm |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 101 | if pMibDlFsm != nil { |
| 102 | // obviously calling some FSM event here directly does not work - so trying to decouple it ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 103 | go func(a_pAFsm *cmn.AdapterFsm) { |
| 104 | if a_pAFsm != nil && a_pAFsm.PFsm != nil { |
| 105 | _ = a_pAFsm.PFsm.Event(DlEvReset) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 106 | } |
| 107 | }(pMibDlFsm) |
| 108 | } |
| 109 | } |
| 110 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 111 | func (onuDeviceEntry *OnuDeviceEntry) enterResettingState(ctx context.Context, e *fsm.Event) { |
| 112 | logger.Debugw(ctx, "MibDownload FSM resetting", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 113 | pMibDlFsm := onuDeviceEntry.PMibDownloadFsm |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 114 | if pMibDlFsm != nil { |
| 115 | // abort running message processing |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 116 | fsmAbortMsg := cmn.Message{ |
| 117 | Type: cmn.TestMsg, |
| 118 | Data: cmn.TestMessage{ |
| 119 | TestMessageVal: cmn.AbortMessageProcessing, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 120 | }, |
| 121 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 122 | pMibDlFsm.CommChan <- fsmAbortMsg |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 123 | |
| 124 | //try to restart the FSM to 'disabled' |
| 125 | // see DownloadedState: decouple event transfer |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 126 | go func(a_pAFsm *cmn.AdapterFsm) { |
| 127 | if a_pAFsm != nil && a_pAFsm.PFsm != nil { |
| 128 | _ = a_pAFsm.PFsm.Event(DlEvRestart) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 129 | } |
| 130 | }(pMibDlFsm) |
| 131 | } |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 132 | } |
| 133 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 134 | func (onuDeviceEntry *OnuDeviceEntry) processMibDownloadMessages(ctx context.Context) { |
| 135 | logger.Debugw(ctx, "Start MibDownload Msg processing", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 136 | loop: |
| 137 | for { |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 138 | // case <-ctx.Done(): |
| 139 | // logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": onuDeviceEntry.deviceID}) |
| 140 | // break loop |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 141 | // unless multiple channels are not involved, we should not use select |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 142 | message, ok := <-onuDeviceEntry.PMibDownloadFsm.CommChan |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 143 | if !ok { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 144 | logger.Info(ctx, "MibDownload Rx Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID}) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 145 | // but then we have to ensure a restart of the FSM as well - as exceptional procedure |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 146 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvRestart) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 147 | break loop |
| 148 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 149 | logger.Debugw(ctx, "MibDownload Rx Msg", log.Fields{"Received message for device-id": onuDeviceEntry.deviceID}) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 150 | |
| 151 | switch message.Type { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 152 | case cmn.TestMsg: |
| 153 | msg, _ := message.Data.(cmn.TestMessage) |
| 154 | if msg.TestMessageVal == cmn.AbortMessageProcessing { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 155 | logger.Debugw(ctx, "MibDownload abort ProcessMsg", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 156 | break loop |
| 157 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 158 | logger.Warnw(ctx, "MibDownload unknown TestMessage", log.Fields{"device-id": onuDeviceEntry.deviceID, "MessageVal": msg.TestMessageVal}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 159 | case cmn.OMCI: |
| 160 | msg, _ := message.Data.(cmn.OmciMessage) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 161 | onuDeviceEntry.handleOmciMibDownloadMessage(ctx, msg) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 162 | default: |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 163 | logger.Warn(ctx, "MibDownload Rx Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 164 | "message.Type": message.Type}) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 165 | } |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 166 | |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 167 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 168 | logger.Debugw(ctx, "End MibDownload Msg processing", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 171 | func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibDownloadCreateResponseMessage(ctx context.Context, msg cmn.OmciMessage) { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 172 | msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeCreateResponse) |
| 173 | if msgLayer == nil { |
| 174 | logger.Errorw(ctx, "Omci Msg layer could not be detected for CreateResponse", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 175 | return |
| 176 | } |
| 177 | msgObj, msgOk := msgLayer.(*omci.CreateResponse) |
| 178 | if !msgOk { |
| 179 | logger.Errorw(ctx, "Omci Msg layer could not be assigned for CreateResponse", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 180 | return |
| 181 | } |
| 182 | logger.Debugw(ctx, "CreateResponse Data", log.Fields{"device-id": onuDeviceEntry.deviceID, "data-fields": msgObj}) |
| 183 | if msgObj.Result != me.Success && msgObj.Result != me.InstanceExists { |
| 184 | logger.Errorw(ctx, "Omci CreateResponse Error - later: drive FSM to abort state ?", log.Fields{"device-id": onuDeviceEntry.deviceID, "Error": msgObj.Result}) |
Holger Hildebrandt | 7e13846 | 2023-03-29 12:12:14 +0000 | [diff] [blame] | 185 | // possibly force FSM into abort or ignore some errors for some messages? |
| 186 | onuDeviceEntry.PDevOmciCC.NotifyAboutOnuConfigFailure(ctx, cmn.OnuConfigFailureResponseErr, msgObj.EntityClass, |
| 187 | msgObj.EntityInstance, msgObj.EntityClass.String(), msgObj.Result) |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 188 | return |
| 189 | } |
| 190 | // maybe there is a way of pushing the specific create response type generally to the FSM |
| 191 | // and let the FSM verify, if the response was according to current state |
| 192 | // and possibly store the element to DB and progress - maybe some future option ... |
| 193 | // but as that is not straightforward to me I insert the type checkes manually here |
| 194 | // and feed the FSM with only 'pre-defined' events ... |
| 195 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 196 | onuDeviceEntry.mutexPLastTxMeInstance.RLock() |
| 197 | if onuDeviceEntry.pLastTxMeInstance != nil { |
| 198 | if msgObj.EntityClass == onuDeviceEntry.pLastTxMeInstance.GetClassID() && |
| 199 | msgObj.EntityInstance == onuDeviceEntry.pLastTxMeInstance.GetEntityID() { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 200 | //store the created ME into DB //TODO??? obviously the Python code does not store the config ... |
| 201 | // if, then something like: |
| 202 | //onuDeviceEntry.pOnuDB.StoreMe(msgObj) |
| 203 | |
| 204 | // maybe we can use just the same eventName for different state transitions like "forward" |
| 205 | // - might be checked, but so far I go for sure and have to inspect the concrete state events ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 206 | switch onuDeviceEntry.pLastTxMeInstance.GetName() { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 207 | case "GalEthernetProfile": |
| 208 | { // let the FSM proceed ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 209 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
| 210 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvRxGalResp) |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 211 | } |
| 212 | case "MacBridgeServiceProfile", |
| 213 | "MacBridgePortConfigurationData", |
| 214 | "ExtendedVlanTaggingOperationConfigurationData": |
| 215 | { // let bridge init proceed by stopping the wait function |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 216 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 217 | onuDeviceEntry.omciMessageReceived <- true |
| 218 | } |
| 219 | default: |
| 220 | { |
| 221 | logger.Warnw(ctx, "Unsupported ME name received!", |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 222 | log.Fields{"ME name": onuDeviceEntry.pLastTxMeInstance.GetName(), "device-id": onuDeviceEntry.deviceID}) |
| 223 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 224 | } |
| 225 | } |
| 226 | } else { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 227 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 228 | } |
| 229 | } else { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 230 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 231 | logger.Errorw(ctx, "Pointer to last Tx MeInstance is nil!", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 232 | } |
| 233 | } |
| 234 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 235 | func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibDownloadSetResponseMessage(ctx context.Context, msg cmn.OmciMessage) { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 236 | msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeSetResponse) |
| 237 | if msgLayer == nil { |
| 238 | logger.Errorw(ctx, "Omci Msg layer could not be detected for SetResponse", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 239 | return |
| 240 | } |
| 241 | msgObj, msgOk := msgLayer.(*omci.SetResponse) |
| 242 | if !msgOk { |
| 243 | logger.Errorw(ctx, "Omci Msg layer could not be assigned for SetResponse", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 244 | return |
| 245 | } |
| 246 | logger.Debugw(ctx, "SetResponse Data", log.Fields{"device-id": onuDeviceEntry.deviceID, "data-fields": msgObj}) |
| 247 | if msgObj.Result != me.Success { |
| 248 | logger.Errorw(ctx, "Omci SetResponse Error - later: drive FSM to abort state ?", log.Fields{"device-id": onuDeviceEntry.deviceID, |
| 249 | "Error": msgObj.Result}) |
Holger Hildebrandt | 7e13846 | 2023-03-29 12:12:14 +0000 | [diff] [blame] | 250 | // possibly force FSM into abort or ignore some errors for some messages? |
| 251 | onuDeviceEntry.PDevOmciCC.NotifyAboutOnuConfigFailure(ctx, cmn.OnuConfigFailureResponseErr, msgObj.EntityClass, |
| 252 | msgObj.EntityInstance, msgObj.EntityClass.String(), msgObj.Result) |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 253 | return |
| 254 | } |
| 255 | // compare comments above for CreateResponse (apply also here ...) |
| 256 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 257 | onuDeviceEntry.mutexPLastTxMeInstance.RLock() |
| 258 | if onuDeviceEntry.pLastTxMeInstance != nil { |
| 259 | if msgObj.EntityClass == onuDeviceEntry.pLastTxMeInstance.GetClassID() && |
| 260 | msgObj.EntityInstance == onuDeviceEntry.pLastTxMeInstance.GetEntityID() { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 261 | //store the created ME into DB //TODO??? obviously the Python code does not store the config ... |
| 262 | // if, then something like: |
| 263 | //onuDeviceEntry.pOnuDB.StoreMe(msgObj) |
| 264 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 265 | switch onuDeviceEntry.pLastTxMeInstance.GetName() { |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 266 | case "Onu2G": |
| 267 | { // let the FSM proceed ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 268 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
| 269 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvRxOnu2gResp) |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 270 | } |
| 271 | //so far that was the only MibDownlad Set Element ... |
| 272 | default: |
| 273 | { |
| 274 | logger.Warnw(ctx, "Unsupported ME name received!", |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 275 | log.Fields{"ME name": onuDeviceEntry.pLastTxMeInstance.GetName(), "device-id": onuDeviceEntry.deviceID}) |
| 276 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | } |
| 280 | } else { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 281 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 282 | } |
| 283 | } else { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 284 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 285 | logger.Errorw(ctx, "Pointer to last Tx MeInstance is nil!", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 286 | } |
| 287 | } |
| 288 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 289 | func (onuDeviceEntry *OnuDeviceEntry) handleOmciMibDownloadMessage(ctx context.Context, msg cmn.OmciMessage) { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 290 | logger.Debugw(ctx, "Rx OMCI MibDownload Msg", log.Fields{"device-id": onuDeviceEntry.deviceID, |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 291 | "msgType": msg.OmciMsg.MessageType}) |
| 292 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 293 | switch msg.OmciMsg.MessageType { |
| 294 | case omci.CreateResponseType: |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 295 | onuDeviceEntry.handleOmciMibDownloadCreateResponseMessage(ctx, msg) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 296 | //TODO |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 297 | // onuDeviceEntry.PMibDownloadFsm.PFsm.Event("rx_evtocd_resp") |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 298 | case omci.SetResponseType: |
Holger Hildebrandt | 0da7e6f | 2021-05-12 13:08:43 +0000 | [diff] [blame] | 299 | onuDeviceEntry.handleOmciMibDownloadSetResponseMessage(ctx, msg) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 300 | default: |
| 301 | { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 302 | logger.Errorw(ctx, "Rx OMCI MibDownload unhandled MsgType", log.Fields{"device-id": onuDeviceEntry.deviceID, |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 303 | "omciMsgType": msg.OmciMsg.MessageType}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 304 | return |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 305 | } |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 306 | } // switch msg.OmciMsg.MessageType |
| 307 | } |
| 308 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 309 | func (onuDeviceEntry *OnuDeviceEntry) performInitialBridgeSetup(ctx context.Context) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 310 | for uniNo, uniPort := range *onuDeviceEntry.baseDeviceHandler.GetUniEntityMap() { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 311 | logger.Debugw(ctx, "Starting IntialBridgeSetup", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 312 | "device-id": onuDeviceEntry.deviceID, "for PortNo": uniNo}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 313 | |
| 314 | //create MBSP |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 315 | onuDeviceEntry.mutexPLastTxMeInstance.Lock() |
| 316 | meInstance, err := onuDeviceEntry.PDevOmciCC.SendCreateMBServiceProfile( |
| 317 | log.WithSpanFromContext(context.TODO(), ctx), uniPort, onuDeviceEntry.baseDeviceHandler.GetOmciTimeout(), true) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 318 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 319 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 320 | logger.Errorw(ctx, "MBServiceProfile create failed, aborting MibDownload FSM!", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 321 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 322 | return |
| 323 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 324 | onuDeviceEntry.pLastTxMeInstance = meInstance |
| 325 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 326 | //verify response |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 327 | err = onuDeviceEntry.waitforOmciResponse(ctx, meInstance) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 328 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 329 | logger.Errorw(ctx, "InitialBridgeSetup failed at MBSP, aborting MIB Download!", |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 330 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 331 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 332 | return |
| 333 | } |
| 334 | |
| 335 | //create MBPCD |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 336 | onuDeviceEntry.mutexPLastTxMeInstance.Lock() |
| 337 | meInstance, err = onuDeviceEntry.PDevOmciCC.SendCreateMBPConfigDataUniSide( |
| 338 | log.WithSpanFromContext(context.TODO(), ctx), uniPort, onuDeviceEntry.baseDeviceHandler.GetOmciTimeout(), true) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 339 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 340 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 341 | logger.Errorw(ctx, "MBPConfigData create failed, aborting MibDownload FSM!", |
| 342 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 343 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 344 | return |
| 345 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 346 | onuDeviceEntry.pLastTxMeInstance = meInstance |
| 347 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 348 | //verify response |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 349 | err = onuDeviceEntry.waitforOmciResponse(ctx, meInstance) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 350 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 351 | logger.Errorw(ctx, "InitialBridgeSetup failed at MBPCD, aborting MIB Download!", |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 352 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 353 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 354 | return |
| 355 | } |
| 356 | |
| 357 | //create EVTOCD |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 358 | onuDeviceEntry.mutexPLastTxMeInstance.Lock() |
| 359 | meInstance, err = onuDeviceEntry.PDevOmciCC.SendCreateEVTOConfigData( |
| 360 | log.WithSpanFromContext(context.TODO(), ctx), uniPort, onuDeviceEntry.baseDeviceHandler.GetOmciTimeout(), true) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 361 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 362 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 363 | logger.Errorw(ctx, "EVTOConfigData create failed, aborting MibDownload FSM!", |
| 364 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 365 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 366 | return |
| 367 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 368 | onuDeviceEntry.pLastTxMeInstance = meInstance |
| 369 | onuDeviceEntry.mutexPLastTxMeInstance.Unlock() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 370 | //verify response |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 371 | err = onuDeviceEntry.waitforOmciResponse(ctx, meInstance) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 372 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 373 | logger.Errorw(ctx, "InitialBridgeSetup failed at EVTOCD, aborting MIB Download!", |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 374 | log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 375 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvReset) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 376 | return |
| 377 | } |
| 378 | } |
| 379 | // if Config has been done for all UNI related instances let the FSM proceed |
| 380 | // while we did not check here, if there is some port at all - !? |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 381 | logger.Infow(ctx, "IntialBridgeSetup finished", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 382 | _ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvRxBridgeResp) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 383 | } |
| 384 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 385 | func (onuDeviceEntry *OnuDeviceEntry) waitforOmciResponse(ctx context.Context, apMeInstance *me.ManagedEntity) error { |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 386 | select { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 387 | // maybe be also some outside cancel (but no context modeled for the moment ...) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 388 | // case <-ctx.Done(): |
| 389 | // logger.Info("MibDownload-bridge-init message reception canceled", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 390 | case <-time.After(onuDeviceEntry.PDevOmciCC.GetMaxOmciTimeoutWithRetries() * time.Second): //3s was detected to be to less in 8*8 bbsim test with debug Info/Debug |
Holger Hildebrandt | 7e13846 | 2023-03-29 12:12:14 +0000 | [diff] [blame] | 391 | onuDeviceEntry.mutexPLastTxMeInstance.RLock() |
| 392 | if onuDeviceEntry.pLastTxMeInstance != nil { |
| 393 | onuDeviceEntry.PDevOmciCC.NotifyAboutOnuConfigFailure(ctx, cmn.OnuConfigFailureTimeout, |
| 394 | onuDeviceEntry.pLastTxMeInstance.GetClassID(), onuDeviceEntry.pLastTxMeInstance.GetEntityID(), |
| 395 | onuDeviceEntry.pLastTxMeInstance.GetClassID().String(), 0) |
| 396 | } |
| 397 | onuDeviceEntry.mutexPLastTxMeInstance.RUnlock() |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 398 | logger.Warnw(ctx, "MibDownload-bridge-init timeout", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 399 | return fmt.Errorf("mibDownloadBridgeInit timeout %s", onuDeviceEntry.deviceID) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 400 | case success := <-onuDeviceEntry.omciMessageReceived: |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 401 | if success { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 402 | logger.Debug(ctx, "MibDownload-bridge-init response received") |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 403 | return nil |
| 404 | } |
| 405 | // should not happen so far |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 406 | logger.Warnw(ctx, "MibDownload-bridge-init response error", log.Fields{"for device-id": onuDeviceEntry.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 407 | return fmt.Errorf("mibDownloadBridgeInit responseError %s", onuDeviceEntry.deviceID) |
Praneeth Kumar Nalmas | aacc612 | 2024-04-09 22:55:49 +0530 | [diff] [blame^] | 408 | case <-onuDeviceEntry.baseDeviceHandler.GetDeviceDeleteCommChan(ctx): |
| 409 | logger.Warnw(ctx, "Deleting device, do not wait for OMCI response", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 410 | return fmt.Errorf("mibDownloadBridgeInit device deletion in progress! %s", onuDeviceEntry.deviceID) |
| 411 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 412 | } |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 413 | } |