Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020-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 | |
| 17 | //Package adaptercoreonu provides the utility for onu devices, flows and statistics |
| 18 | package adaptercoreonu |
| 19 | |
| 20 | import ( |
| 21 | "context" |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 22 | "encoding/json" |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 23 | "errors" |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 24 | "fmt" |
| 25 | "strconv" |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 26 | |
| 27 | "github.com/looplab/fsm" |
| 28 | |
| 29 | //"sync" |
| 30 | //"time" |
| 31 | |
| 32 | //"github.com/opencord/voltha-lib-go/v3/pkg/kafka" |
| 33 | "github.com/opencord/omci-lib-go" |
| 34 | me "github.com/opencord/omci-lib-go/generated" |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 35 | "github.com/opencord/voltha-lib-go/v3/pkg/db" |
| 36 | "github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore" |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 37 | "github.com/opencord/voltha-lib-go/v3/pkg/log" |
| 38 | //ic "github.com/opencord/voltha-protos/v3/go/inter_container" |
| 39 | //"github.com/opencord/voltha-protos/v3/go/openflow_13" |
| 40 | //"github.com/opencord/voltha-protos/v3/go/voltha" |
| 41 | ) |
| 42 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 43 | var supportedClassIds = []me.ClassID{ |
| 44 | me.CardholderClassID, // 5 |
| 45 | me.CircuitPackClassID, // 6 |
| 46 | me.SoftwareImageClassID, // 7 |
| 47 | me.PhysicalPathTerminationPointEthernetUniClassID, // 11 |
| 48 | me.OltGClassID, // 131 |
| 49 | me.OnuPowerSheddingClassID, // 133 |
| 50 | me.IpHostConfigDataClassID, // 134 |
| 51 | me.OnuGClassID, // 256 |
| 52 | me.Onu2GClassID, // 257 |
| 53 | me.TContClassID, // 262 |
| 54 | me.AniGClassID, // 263 |
| 55 | me.UniGClassID, // 264 |
| 56 | me.PriorityQueueClassID, // 277 |
| 57 | me.TrafficSchedulerClassID, // 278 |
| 58 | me.VirtualEthernetInterfacePointClassID, // 329 |
| 59 | me.EnhancedSecurityControlClassID, // 332 |
| 60 | me.OnuDynamicPowerManagementControlClassID, // 336 |
| 61 | // 347 // definitions for ME "IPv6 host config data" are currently missing in omci-lib-go! |
| 62 | } |
| 63 | |
| 64 | var fsmMsg TestMessageType |
| 65 | |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 66 | func (onuDeviceEntry *OnuDeviceEntry) enterStartingState(e *fsm.Event) { |
| 67 | logger.Debugw("MibSync FSM", log.Fields{"Start processing MibSync-msgs in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 68 | |
Holger Hildebrandt | 24d5195 | 2020-05-04 14:03:42 +0000 | [diff] [blame] | 69 | onuDeviceEntry.pOnuDB = NewOnuDeviceDB(context.TODO(), onuDeviceEntry) |
| 70 | |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 71 | go onuDeviceEntry.ProcessMibSyncMessages() |
| 72 | } |
| 73 | |
| 74 | func (onuDeviceEntry *OnuDeviceEntry) enterLoadingMibTemplateState(e *fsm.Event) { |
| 75 | logger.Debugw("MibSync FSM", log.Fields{"Start MibTemplate processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 76 | |
| 77 | meStoredFromTemplate := false |
| 78 | |
| 79 | //TODO: perform MIB-reset |
| 80 | //TODO: needs to handle timeouts |
| 81 | |
| 82 | //TODO: etrieve these values via OMCI GetRequests |
| 83 | //OltGClassID |
| 84 | onuDeviceEntry.vendorID = "BBSM" |
| 85 | onuDeviceEntry.serialNumber = "BBSM00000001" |
| 86 | //Onu2GClassID |
| 87 | onuDeviceEntry.equipmentID = "12345123451234512345" |
| 88 | //SoftwareImageClassID |
| 89 | onuDeviceEntry.activeSwVersion = "00000000000001" |
| 90 | //IpHostConfigDataClassID |
| 91 | onuDeviceEntry.macAddress = "00:00:00:00:00:00" |
| 92 | |
| 93 | Path := fmt.Sprintf(SuffixMibTemplateKvStore, onuDeviceEntry.vendorID, onuDeviceEntry.equipmentID, onuDeviceEntry.activeSwVersion) |
| 94 | Value, err := onuDeviceEntry.mibTemplateKVStore.Get(context.TODO(), Path) |
| 95 | if err == nil { |
| 96 | if Value != nil { |
| 97 | logger.Debugf("MibSync FSM - MibTemplate read: Key: %s, Value: %s %s", Value.Key, Value.Value) |
| 98 | mibTmpBytes, _ := kvstore.ToByte(Value.Value) |
| 99 | |
| 100 | var fistLevelMap map[string]interface{} |
| 101 | if err = json.Unmarshal(mibTmpBytes, &fistLevelMap); err != nil { |
| 102 | logger.Error("MibSync FSM - Failed to unmarshal template", log.Fields{"error": err, "device-id": onuDeviceEntry.deviceID}) |
| 103 | } else { |
| 104 | for fistLevelKey, firstLevelValue := range fistLevelMap { |
| 105 | logger.Debugw("MibSync FSM - fistLevelKey", log.Fields{"fistLevelKey": fistLevelKey}) |
| 106 | if uint16ValidNumber, err := strconv.ParseUint(fistLevelKey, 10, 16); err == nil { |
| 107 | meClassId := me.ClassID(uint16ValidNumber) |
| 108 | logger.Debugw("MibSync FSM - fistLevelKey is a number in uint16-range", log.Fields{"uint16ValidNumber": uint16ValidNumber}) |
| 109 | if IsSupportedClassId(meClassId) { |
| 110 | logger.Debugw("MibSync FSM - fistLevelKey is a supported classId", log.Fields{"meClassId": meClassId}) |
| 111 | secondLevelMap := firstLevelValue.(map[string]interface{}) |
| 112 | for secondLevelKey, secondLevelValue := range secondLevelMap { |
| 113 | logger.Debugw("MibSync FSM - secondLevelKey", log.Fields{"secondLevelKey": secondLevelKey}) |
| 114 | if uint16ValidNumber, err := strconv.ParseUint(secondLevelKey, 10, 16); err == nil { |
| 115 | meEntityId := uint16(uint16ValidNumber) |
| 116 | logger.Debugw("MibSync FSM - secondLevelKey is a numberand a valid EntityId", log.Fields{"meEntityId": meEntityId}) |
| 117 | thirdLevelMap := secondLevelValue.(map[string]interface{}) |
| 118 | for thirdLevelKey, thirdLevelValue := range thirdLevelMap { |
| 119 | if thirdLevelKey == "attributes" { |
| 120 | logger.Debugw("MibSync FSM - thirdLevelKey refers to attributes", log.Fields{"thirdLevelKey": thirdLevelKey}) |
| 121 | attributesMap := thirdLevelValue.(map[string]interface{}) |
| 122 | logger.Debugw("MibSync FSM - attributesMap", log.Fields{"attributesMap": attributesMap}) |
| 123 | onuDeviceEntry.pOnuDB.StoreMe(meClassId, meEntityId, attributesMap) |
| 124 | meStoredFromTemplate = true |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } else { |
| 134 | logger.Debugw("No MIB template found", log.Fields{"device-id": onuDeviceEntry.deviceID}) |
| 135 | } |
| 136 | } else { |
| 137 | logger.Errorf("Get from kvstore operation failed for path %s", Path) |
| 138 | } |
| 139 | if meStoredFromTemplate { |
| 140 | logger.Debug("MibSync FSM - valid MEs stored from template") |
| 141 | onuDeviceEntry.pOnuDB.LogMeDb() |
| 142 | fsmMsg = LoadMibTemplateOk |
| 143 | } else { |
| 144 | logger.Debug("MibSync FSM - no valid MEs stored from template - perform MIB-upload!") |
| 145 | fsmMsg = LoadMibTemplateFailed |
| 146 | } |
| 147 | |
| 148 | mibSyncMsg := Message{ |
| 149 | Type: TestMsg, |
| 150 | Data: TestMessage{ |
| 151 | TestMessageVal: fsmMsg, |
| 152 | }, |
| 153 | } |
| 154 | onuDeviceEntry.pMibUploadFsm.commChan <- mibSyncMsg |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | func (onuDeviceEntry *OnuDeviceEntry) enterUploadingState(e *fsm.Event) { |
| 158 | logger.Debugw("MibSync FSM", log.Fields{"send mibReset in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 159 | onuDeviceEntry.PDevOmciCC.sendMibReset(context.TODO(), ConstDefaultOmciTimeout, true) |
| 160 | } |
| 161 | |
| 162 | func (onuDeviceEntry *OnuDeviceEntry) enterInSyncState(e *fsm.Event) { |
| 163 | logger.Debugw("MibSync FSM", log.Fields{"send notification to core in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 164 | onuDeviceEntry.transferSystemEvent(MibDatabaseSync) |
| 165 | } |
| 166 | |
| 167 | func (onuDeviceEntry *OnuDeviceEntry) enterExaminingMdsState(e *fsm.Event) { |
| 168 | logger.Debugw("MibSync FSM", log.Fields{"Start GetMds processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 169 | logger.Debug("function not implemented yet") |
| 170 | } |
| 171 | |
| 172 | func (onuDeviceEntry *OnuDeviceEntry) enterResynchronizingState(e *fsm.Event) { |
| 173 | logger.Debugw("MibSync FSM", log.Fields{"Start MibResync processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 174 | logger.Debug("function not implemented yet") |
| 175 | } |
| 176 | |
| 177 | func (onuDeviceEntry *OnuDeviceEntry) enterAuditingState(e *fsm.Event) { |
| 178 | logger.Debugw("MibSync FSM", log.Fields{"Start MibResync processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 179 | logger.Debug("function not implemented yet") |
| 180 | } |
| 181 | |
| 182 | func (onuDeviceEntry *OnuDeviceEntry) enterOutOfSyncState(e *fsm.Event) { |
| 183 | logger.Debugw("MibSync FSM", log.Fields{"Start MibReconcile processing in State": e.FSM.Current(), "device-id": onuDeviceEntry.deviceID}) |
| 184 | logger.Debug("function not implemented yet") |
| 185 | } |
| 186 | |
| 187 | func (onuDeviceEntry *OnuDeviceEntry) ProcessMibSyncMessages( /*ctx context.Context*/ ) { |
| 188 | logger.Debugw("MibSync Msg", log.Fields{"Start routine to process OMCI-messages for device-id": onuDeviceEntry.deviceID}) |
| 189 | loop: |
| 190 | for { |
| 191 | select { |
| 192 | // case <-ctx.Done(): |
| 193 | // logger.Info("MibSync Msg", log.Fields{"Message handling canceled via context for device-id": onuDeviceEntry.deviceID}) |
| 194 | // break loop |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 195 | case message, ok := <-onuDeviceEntry.pMibUploadFsm.commChan: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 196 | if !ok { |
| 197 | logger.Info("MibSync Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID}) |
| 198 | break loop |
| 199 | } |
| 200 | logger.Debugw("MibSync Msg", log.Fields{"Received message on ONU MibSyncChan for device-id": onuDeviceEntry.deviceID}) |
| 201 | |
| 202 | switch message.Type { |
| 203 | case TestMsg: |
| 204 | msg, _ := message.Data.(TestMessage) |
| 205 | onuDeviceEntry.handleTestMsg(msg) |
| 206 | case OMCI: |
| 207 | msg, _ := message.Data.(OmciMessage) |
| 208 | onuDeviceEntry.handleOmciMessage(msg) |
| 209 | default: |
| 210 | logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "message.Type": message.Type}) |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID}) |
| 215 | // TODO: only this action? |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 216 | onuDeviceEntry.pMibUploadFsm.pFsm.Event("stop") |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | func (onuDeviceEntry *OnuDeviceEntry) handleTestMsg(msg TestMessage) { |
| 220 | |
| 221 | logger.Debugw("MibSync Msg", log.Fields{"TestMessage received for device-id": onuDeviceEntry.deviceID, "msg.TestMessageVal": msg.TestMessageVal}) |
| 222 | |
| 223 | switch msg.TestMessageVal { |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 224 | case LoadMibTemplateFailed: |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 225 | onuDeviceEntry.pMibUploadFsm.pFsm.Event("upload_mib") |
| 226 | logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 227 | case LoadMibTemplateOk: |
| 228 | onuDeviceEntry.pMibUploadFsm.pFsm.Event("success") |
| 229 | logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())}) |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 230 | default: |
| 231 | logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "msg.TestMessageVal": msg.TestMessageVal}) |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | func (onuDeviceEntry *OnuDeviceEntry) handleOmciMessage(msg OmciMessage) { |
| 236 | |
| 237 | logger.Debugw("MibSync Msg", log.Fields{"OmciMessage received for device-id": onuDeviceEntry.deviceID, |
| 238 | "msgType": msg.OmciMsg.MessageType}) |
| 239 | |
| 240 | //further analysis could be done here based on msg.OmciMsg.Payload, e.g. verification of error code ... |
| 241 | switch msg.OmciMsg.MessageType { |
| 242 | case omci.MibResetResponseType: |
| 243 | msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibResetResponse) |
| 244 | if msgLayer == nil { |
| 245 | logger.Error("Omci Msg layer could not be detected") |
| 246 | return |
| 247 | } |
| 248 | msgObj, msgOk := msgLayer.(*omci.MibResetResponse) |
| 249 | if !msgOk { |
| 250 | logger.Error("Omci Msg layer could not be assigned") |
| 251 | return |
| 252 | } |
| 253 | logger.Debugw("MibResetResponse Data", log.Fields{"data-fields": msgObj}) |
| 254 | if msgObj.Result != me.Success { |
| 255 | logger.Errorw("Omci MibResetResponse Error - strange - what to do?", log.Fields{"Error": msgObj.Result}) |
| 256 | return |
| 257 | } |
| 258 | onuDeviceEntry.PDevOmciCC.sendMibUpload(context.TODO(), ConstDefaultOmciTimeout, true) |
| 259 | case omci.MibUploadResponseType: |
| 260 | msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadResponse) |
| 261 | if msgLayer == nil { |
| 262 | logger.Error("Omci Msg layer could not be detected") |
| 263 | return |
| 264 | } |
| 265 | msgObj, msgOk := msgLayer.(*omci.MibUploadResponse) |
| 266 | if !msgOk { |
| 267 | logger.Error("Omci Msg layer could not be assigned") |
| 268 | return |
| 269 | } |
Holger Hildebrandt | 24d5195 | 2020-05-04 14:03:42 +0000 | [diff] [blame] | 270 | logger.Debugw("MibUploadResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj}) |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 271 | /* to be verified / reworked !!! */ |
| 272 | onuDeviceEntry.PDevOmciCC.uploadNoOfCmds = msgObj.NumberOfCommands |
| 273 | if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds { |
| 274 | onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true) |
| 275 | } else { |
Holger Hildebrandt | 24d5195 | 2020-05-04 14:03:42 +0000 | [diff] [blame] | 276 | logger.Error("Invalid number of commands received for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "uploadNoOfCmds": onuDeviceEntry.PDevOmciCC.uploadNoOfCmds}) |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 277 | //TODO right action? |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 278 | onuDeviceEntry.pMibUploadFsm.pFsm.Event("timeout") |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 279 | } |
| 280 | case omci.MibUploadNextResponseType: |
| 281 | msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadNextResponse) |
| 282 | if msgLayer == nil { |
| 283 | logger.Error("Omci Msg layer could not be detected") |
| 284 | return |
| 285 | } |
| 286 | msgObj, msgOk := msgLayer.(*omci.MibUploadNextResponse) |
| 287 | if !msgOk { |
| 288 | logger.Error("Omci Msg layer could not be assigned") |
| 289 | return |
| 290 | } |
Holger Hildebrandt | 24d5195 | 2020-05-04 14:03:42 +0000 | [diff] [blame] | 291 | logger.Debugw("MibUploadNextResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj}) |
| 292 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 293 | meClassId := msgObj.ReportedME.GetClassID() |
| 294 | meEntityId := msgObj.ReportedME.GetEntityID() |
| 295 | meAttributes := msgObj.ReportedME.GetAttributeValueMap() |
| 296 | |
| 297 | onuDeviceEntry.pOnuDB.StoreMe(meClassId, meEntityId, meAttributes) |
Holger Hildebrandt | 24d5195 | 2020-05-04 14:03:42 +0000 | [diff] [blame] | 298 | |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 299 | if onuDeviceEntry.PDevOmciCC.uploadSequNo < onuDeviceEntry.PDevOmciCC.uploadNoOfCmds { |
| 300 | onuDeviceEntry.PDevOmciCC.sendMibUploadNext(context.TODO(), ConstDefaultOmciTimeout, true) |
| 301 | } else { |
| 302 | //TODO |
Holger Hildebrandt | 9ac0d0f | 2020-05-13 11:22:02 +0000 | [diff] [blame] | 303 | onuDeviceEntry.pOnuDB.LogMeDb() |
| 304 | onuDeviceEntry.pMibUploadFsm.pFsm.Event("success") |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame^] | 309 | func (onuDeviceEntry *OnuDeviceEntry) newKVClient(storeType string, address string, timeout int) (kvstore.Client, error) { |
| 310 | logger.Infow("kv-store-type", log.Fields{"store": storeType}) |
| 311 | switch storeType { |
| 312 | case "consul": |
| 313 | return kvstore.NewConsulClient(address, timeout) |
| 314 | case "etcd": |
| 315 | return kvstore.NewEtcdClient(address, timeout, log.FatalLevel) |
| 316 | } |
| 317 | return nil, errors.New("unsupported-kv-store") |
| 318 | } |
| 319 | |
| 320 | func (onuDeviceEntry *OnuDeviceEntry) SetKVClient(backend string, Host string, Port int, BasePathKvStore string) *db.Backend { |
| 321 | logger.Debugw("SetKVClient with params:", log.Fields{"backend": backend, "Host": Host, "Port": Port, |
| 322 | "BasePathKvStore": BasePathKvStore, "deviceId": onuDeviceEntry.deviceID}) |
| 323 | |
| 324 | addr := Host + ":" + strconv.Itoa(Port) |
| 325 | // TODO : Make sure direct call to NewBackend is working fine with backend , currently there is some |
| 326 | // issue between kv store and backend , core is not calling NewBackend directly |
| 327 | kvClient, err := onuDeviceEntry.newKVClient(backend, addr, KvstoreTimeout) |
| 328 | if err != nil { |
| 329 | logger.Fatalw("Failed to init KV client\n", log.Fields{"err": err}) |
| 330 | return nil |
| 331 | } |
| 332 | |
| 333 | kvbackend := &db.Backend{ |
| 334 | Client: kvClient, |
| 335 | StoreType: backend, |
| 336 | Host: Host, |
| 337 | Port: Port, |
| 338 | Timeout: KvstoreTimeout, |
| 339 | PathPrefix: BasePathKvStore} |
| 340 | |
| 341 | return kvbackend |
| 342 | } |
| 343 | |
| 344 | func IsSupportedClassId(meClassId me.ClassID) bool { |
| 345 | for _, v := range supportedClassIds { |
| 346 | if v == meClassId { |
| 347 | return true |
| 348 | } |
| 349 | } |
| 350 | return false |
| 351 | } |
| 352 | |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 353 | func (onuDeviceEntry *OnuDeviceEntry) MibDbVolatileDict() error { |
| 354 | logger.Debug("MibVolatileDict- running from default Entry code") |
| 355 | return errors.New("not_implemented") |
| 356 | } |
| 357 | |
| 358 | // func (onuDeviceEntry *OnuDeviceEntry) MibTemplateTask() error { |
| 359 | // return errors.New("not_implemented") |
| 360 | // } |
| 361 | // func (onuDeviceEntry *OnuDeviceEntry) MibUploadTask() error { |
| 362 | // return errors.New("not_implemented") |
| 363 | // } |
| 364 | // func (onuDeviceEntry *OnuDeviceEntry) GetMdsTask() error { |
| 365 | // return errors.New("not_implemented") |
| 366 | // } |
| 367 | // func (onuDeviceEntry *OnuDeviceEntry) MibResyncTask() error { |
| 368 | // return errors.New("not_implemented") |
| 369 | // } |
| 370 | // func (onuDeviceEntry *OnuDeviceEntry) MibReconcileTask() error { |
| 371 | // return errors.New("not_implemented") |
| 372 | // } |