blob: a08e03ff437cdd0182b72fab362079baf5411b64 [file] [log] [blame]
Holger Hildebrandtfa074992020-03-27 15:42:06 +00001/*
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
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +000017//Package adaptercoreonu provides the utility for onu devices, flows and statistics
18package adaptercoreonu
Holger Hildebrandtfa074992020-03-27 15:42:06 +000019
20import (
21 "context"
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000022 "errors"
23
Holger Hildebrandtfa074992020-03-27 15:42:06 +000024 //"sync"
25 //"time"
26
27 "github.com/looplab/fsm"
28 "github.com/opencord/voltha-lib-go/v3/pkg/adapters/adapterif"
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000029 "github.com/opencord/voltha-lib-go/v3/pkg/db"
Holger Hildebrandtfa074992020-03-27 15:42:06 +000030
31 //"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
32 "github.com/opencord/voltha-lib-go/v3/pkg/log"
33 //ic "github.com/opencord/voltha-protos/v3/go/inter_container"
34 //"github.com/opencord/voltha-protos/v3/go/openflow_13"
35 //"github.com/opencord/voltha-protos/v3/go/voltha"
36)
37
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000038const (
mpagenkoaf801632020-07-03 10:00:42 +000039 cBasePathMibTemplateKvStore = "service/voltha/omci_mibs/templates"
40 cSuffixMibTemplateKvStore = "%s/%s/%s"
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000041)
42
Holger Hildebrandtfa074992020-03-27 15:42:06 +000043type OnuDeviceEvent int
44
45const (
46 // Events of interest to Device Adapters and OpenOMCI State Machines
47 DeviceStatusInit OnuDeviceEvent = 0 // OnuDeviceEntry default start state
48 MibDatabaseSync OnuDeviceEvent = 1 // MIB database sync (upload done)
49 OmciCapabilitiesDone OnuDeviceEvent = 2 // OMCI ME and message type capabilities known
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +000050 MibDownloadDone OnuDeviceEvent = 3 // MIB database sync (upload done)
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000051 UniLockStateDone OnuDeviceEvent = 4 // Uni ports admin set to lock
52 UniUnlockStateDone OnuDeviceEvent = 5 // Uni ports admin set to unlock
53 UniAdminStateDone OnuDeviceEvent = 6 // Uni ports admin set done - general
54 PortLinkUp OnuDeviceEvent = 7 // Port link state change
55 PortLinkDw OnuDeviceEvent = 8 // Port link state change
mpagenko3dbcdd22020-07-22 07:38:45 +000056 OmciAniConfigDone OnuDeviceEvent = 9 // AniSide config according to TechProfile done
Holger Hildebrandtfa074992020-03-27 15:42:06 +000057 // Add other events here as needed (alarms separate???)
58)
59
60type activityDescr struct {
61 databaseClass func() error
62 advertiseEvents bool
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +000063 auditDelay uint16
Holger Hildebrandtfa074992020-03-27 15:42:06 +000064 //tasks map[string]func() error
65}
66type OmciDeviceFsms map[string]activityDescr
67
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +000068type AdapterFsm struct {
69 fsmName string
70 deviceID string
71 commChan chan Message
72 pFsm *fsm.FSM
73}
74
75func NewAdapterFsm(a_name string, a_deviceID string, a_commChannel chan Message) *AdapterFsm {
76 aFsm := &AdapterFsm{
77 fsmName: a_name,
78 deviceID: a_deviceID,
79 commChan: a_commChannel,
80 }
81 return aFsm
82}
83
84//Start starts (logs) the omci agent
85func (oo *AdapterFsm) logFsmStateChange(e *fsm.Event) {
86 logger.Debugw("FSM state change", log.Fields{"device-id": oo.deviceID, "FSM name": oo.fsmName,
87 "event name": string(e.Event), "src state": string(e.Src), "dst state": string(e.Dst)})
88}
89
Holger Hildebrandtfa074992020-03-27 15:42:06 +000090//OntDeviceEntry structure holds information about the attached FSM'as and their communication
Holger Hildebrandtc54939a2020-06-17 08:14:27 +000091
92const (
93 FirstSwImageMeId = 0
94 SecondSwImageMeId = 1
95)
96const OnugMeId = 0
97const Onu2gMeId = 0
98const IpHostConfigDataMeId = 1
99const OnugSerialNumberLen = 8
100const OmciMacAddressLen = 6
101
102type SwImages struct {
103 version string
104 isActive uint8
105}
106
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000107type OnuDeviceEntry struct {
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000108 deviceID string
109 baseDeviceHandler *DeviceHandler
110 coreProxy adapterif.CoreProxy
111 adapterProxy adapterif.AdapterProxy
112 started bool
113 PDevOmciCC *OmciCC
114 pOnuDB *OnuDeviceDB
115 mibTemplateKVStore *db.Backend
116 vendorID string
117 serialNumber string
118 equipmentID string
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000119 swImages [SecondSwImageMeId + 1]SwImages
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000120 activeSwVersion string
121 macAddress string
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000122 //lockDeviceEntries sync.RWMutex
123 mibDbClass func() error
124 supportedFsms OmciDeviceFsms
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000125 devState OnuDeviceEvent
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000126 // for mibUpload
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000127 mibAuditDelay uint16
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000128
129 // for mibUpload
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000130 pMibUploadFsm *AdapterFsm //could be handled dynamically and more general as pAdapterFsm - perhaps later
131 // for mibDownload
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000132 pMibDownloadFsm *AdapterFsm //could be handled dynamically and more general as pAdapterFsm - perhaps later
133 //remark: general usage of pAdapterFsm would require generalization of commChan usage and internal event setting
134 // within the FSM event procedures
Holger Hildebrandtdd23cc22020-05-19 13:32:18 +0000135 omciMessageReceived chan bool //seperate channel needed by DownloadFsm
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000136}
137
138//OnuDeviceEntry returns a new instance of a OnuDeviceEntry
139//mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000140func NewOnuDeviceEntry(ctx context.Context, device_id string, kVStoreHost string, kVStorePort int, kvStoreType string, device_Handler *DeviceHandler,
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000141 core_proxy adapterif.CoreProxy, adapter_proxy adapterif.AdapterProxy,
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000142 supported_Fsms_Ptr *OmciDeviceFsms) *OnuDeviceEntry {
143 logger.Infow("init-onuDeviceEntry", log.Fields{"deviceId": device_id})
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000144 var onuDeviceEntry OnuDeviceEntry
145 onuDeviceEntry.started = false
146 onuDeviceEntry.deviceID = device_id
147 onuDeviceEntry.baseDeviceHandler = device_Handler
148 onuDeviceEntry.coreProxy = core_proxy
149 onuDeviceEntry.adapterProxy = adapter_proxy
150 onuDeviceEntry.devState = DeviceStatusInit
151 //openomciagent.lockDeviceHandlersMap = sync.RWMutex{}
152 //OMCI related databases are on a per-agent basis. State machines and tasks
153 //are per ONU Vendor
154 //
155 // MIB Synchronization Database - possible overloading from arguments
156 if supported_Fsms_Ptr != nil {
157 onuDeviceEntry.supportedFsms = *supported_Fsms_Ptr
158 } else {
159 //var mibSyncFsm = NewMibSynchronizer()
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000160 // use some internaö defaults, if not defined from outside
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000161 onuDeviceEntry.supportedFsms = OmciDeviceFsms{
162 "mib-synchronizer": {
163 //mibSyncFsm, // Implements the MIB synchronization state machine
164 onuDeviceEntry.MibDbVolatileDict, // Implements volatile ME MIB database
165 true, // Advertise events on OpenOMCI event bus
166 60, // Time to wait between MIB audits. 0 to disable audits.
167 // map[string]func() error{
168 // "mib-upload": onuDeviceEntry.MibUploadTask,
169 // "mib-template": onuDeviceEntry.MibTemplateTask,
170 // "get-mds": onuDeviceEntry.GetMdsTask,
171 // "mib-audit": onuDeviceEntry.GetMdsTask,
172 // "mib-resync": onuDeviceEntry.MibResyncTask,
173 // "mib-reconcile": onuDeviceEntry.MibReconcileTask,
174 // },
175 },
176 }
177 }
178 onuDeviceEntry.mibDbClass = onuDeviceEntry.supportedFsms["mib-synchronizer"].databaseClass
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000179 logger.Debug("access2mibDbClass")
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000180 go onuDeviceEntry.mibDbClass()
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000181 onuDeviceEntry.mibAuditDelay = onuDeviceEntry.supportedFsms["mib-synchronizer"].auditDelay
182 logger.Debugw("MibAudit is set to", log.Fields{"Delay": onuDeviceEntry.mibAuditDelay})
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000183
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000184 // Omci related Mib upload sync state machine
185 mibUploadChan := make(chan Message, 2048)
186 onuDeviceEntry.pMibUploadFsm = NewAdapterFsm("MibUpload", device_id, mibUploadChan)
187 onuDeviceEntry.pMibUploadFsm.pFsm = fsm.NewFSM(
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000188 "disabled",
189 fsm.Events{
190
191 {Name: "start", Src: []string{"disabled"}, Dst: "starting"},
192
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000193 {Name: "reset_mib", Src: []string{"starting"}, Dst: "resetting_mib"},
194 {Name: "get_vendor_and_serial", Src: []string{"resetting_mib"}, Dst: "getting_vendor_and_serial"},
195 {Name: "get_equipment_id", Src: []string{"getting_vendor_and_serial"}, Dst: "getting_equipment_id"},
196 {Name: "get_first_sw_version", Src: []string{"getting_equipment_id"}, Dst: "getting_first_sw_version"},
197 {Name: "get_second_sw_version", Src: []string{"getting_first_sw_version"}, Dst: "getting_second_sw_version"},
198 {Name: "get_mac_address", Src: []string{"getting_second_sw_version"}, Dst: "getting_mac_address"},
199 {Name: "get_mib_template", Src: []string{"getting_mac_address"}, Dst: "getting_mib_template"},
200
201 {Name: "upload_mib", Src: []string{"getting_mib_template"}, Dst: "uploading"},
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000202 {Name: "examine_mds", Src: []string{"starting"}, Dst: "examining_mds"},
203
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000204 {Name: "success", Src: []string{"getting_mib_template"}, Dst: "in_sync"},
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000205 {Name: "success", Src: []string{"uploading"}, Dst: "in_sync"},
206
207 {Name: "success", Src: []string{"examining_mds"}, Dst: "in_sync"},
208 {Name: "mismatch", Src: []string{"examining_mds"}, Dst: "resynchronizing"},
209
210 {Name: "audit_mib", Src: []string{"in_sync"}, Dst: "auditing"},
211
212 {Name: "success", Src: []string{"out_of_sync"}, Dst: "in_sync"},
213 {Name: "audit_mib", Src: []string{"out_of_sync"}, Dst: "auditing"},
214
215 {Name: "success", Src: []string{"auditing"}, Dst: "in_sync"},
216 {Name: "mismatch", Src: []string{"auditing"}, Dst: "resynchronizing"},
217 {Name: "force_resync", Src: []string{"auditing"}, Dst: "resynchronizing"},
218
219 {Name: "success", Src: []string{"resynchronizing"}, Dst: "in_sync"},
220 {Name: "diffs_found", Src: []string{"resynchronizing"}, Dst: "out_of_sync"},
221
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000222 {Name: "timeout", Src: []string{"reset_mib", "get_vendor_and_serial", "get_equipment_id", "get_first_sw_version", "get_mac_address",
223 "get_mib_template", "uploading", "resynchronizing", "examining_mds", "in_sync", "out_of_sync", "auditing"}, Dst: "starting"},
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000224
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000225 {Name: "stop", Src: []string{"starting", "reset_mib", "get_vendor_and_serial", "get_equipment_id", "get_first_sw_version", "get_mac_address",
226 "get_mib_template", "uploading", "resynchronizing", "examining_mds", "in_sync", "out_of_sync", "auditing"}, Dst: "disabled"},
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000227 },
228
229 fsm.Callbacks{
Holger Hildebrandtc54939a2020-06-17 08:14:27 +0000230 "enter_state": func(e *fsm.Event) { onuDeviceEntry.pMibUploadFsm.logFsmStateChange(e) },
231 "enter_starting": func(e *fsm.Event) { onuDeviceEntry.enterStartingState(e) },
232 "enter_resetting_mib": func(e *fsm.Event) { onuDeviceEntry.enterResettingMibState(e) },
233 "enter_getting_vendor_and_serial": func(e *fsm.Event) { onuDeviceEntry.enterGettingVendorAndSerialState(e) },
234 "enter_getting_equipment_id": func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIdState(e) },
235 "enter_getting_first_sw_version": func(e *fsm.Event) { onuDeviceEntry.enterGettingFirstSwVersionState(e) },
236 "enter_getting_second_sw_version": func(e *fsm.Event) { onuDeviceEntry.enterGettingSecondSwVersionState(e) },
237 "enter_getting_mac_address": func(e *fsm.Event) { onuDeviceEntry.enterGettingMacAddressState(e) },
238 "enter_getting_mib_template": func(e *fsm.Event) { onuDeviceEntry.enterGettingMibTemplate(e) },
239 "enter_uploading": func(e *fsm.Event) { onuDeviceEntry.enterUploadingState(e) },
240 "enter_examining_mds": func(e *fsm.Event) { onuDeviceEntry.enterExaminingMdsState(e) },
241 "enter_resynchronizing": func(e *fsm.Event) { onuDeviceEntry.enterResynchronizingState(e) },
242 "enter_auditing": func(e *fsm.Event) { onuDeviceEntry.enterAuditingState(e) },
243 "enter_out_of_sync": func(e *fsm.Event) { onuDeviceEntry.enterOutOfSyncState(e) },
244 "enter_in_sync": func(e *fsm.Event) { onuDeviceEntry.enterInSyncState(e) },
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000245 },
246 )
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000247 // Omci related Mib download state machine
248 mibDownloadChan := make(chan Message, 2048)
249 onuDeviceEntry.pMibDownloadFsm = NewAdapterFsm("MibDownload", device_id, mibDownloadChan)
250 onuDeviceEntry.pMibDownloadFsm.pFsm = fsm.NewFSM(
251 "disabled",
252 fsm.Events{
253
254 {Name: "start", Src: []string{"disabled"}, Dst: "starting"},
255
Holger Hildebrandtdd23cc22020-05-19 13:32:18 +0000256 {Name: "create_gal", Src: []string{"starting"}, Dst: "creatingGal"},
257 {Name: "rx_gal_resp", Src: []string{"creatingGal"}, Dst: "settingOnu2g"},
258 {Name: "rx_onu2g_resp", Src: []string{"settingOnu2g"}, Dst: "bridgeInit"},
259 // the bridge state is used for multi ME config for alle UNI related ports
260 // maybe such could be reflected in the state machine as well (port number parametrized)
261 // but that looks not straightforward here - so we keep it simple here for the beginning(?)
262 {Name: "rx_bridge_resp", Src: []string{"bridgeInit"}, Dst: "downloaded"},
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000263
Holger Hildebrandtdd23cc22020-05-19 13:32:18 +0000264 {Name: "timeout_simple", Src: []string{"creatingGal", "settingOnu2g"}, Dst: "starting"},
265 {Name: "timeout_bridge", Src: []string{"bridgeInit"}, Dst: "starting"},
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000266
Holger Hildebrandtdd23cc22020-05-19 13:32:18 +0000267 {Name: "reset", Src: []string{"starting", "creatingGal", "settingOnu2g",
268 "bridgeInit", "downloaded"}, Dst: "resetting"},
269 // exceptional treatment for all states except "resetting"
270 {Name: "restart", Src: []string{"starting", "creatingGal", "settingOnu2g",
271 "bridgeInit", "downloaded", "resetting"}, Dst: "disabled"},
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000272 },
273
274 fsm.Callbacks{
Holger Hildebrandtdd23cc22020-05-19 13:32:18 +0000275 "enter_state": func(e *fsm.Event) { onuDeviceEntry.pMibDownloadFsm.logFsmStateChange(e) },
276 "enter_starting": func(e *fsm.Event) { onuDeviceEntry.enterDLStartingState(e) },
277 "enter_creatingGal": func(e *fsm.Event) { onuDeviceEntry.enterCreatingGalState(e) },
278 "enter_settingOnu2g": func(e *fsm.Event) { onuDeviceEntry.enterSettingOnu2gState(e) },
279 "enter_bridgeInit": func(e *fsm.Event) { onuDeviceEntry.enterBridgeInitState(e) },
280 "enter_downloaded": func(e *fsm.Event) { onuDeviceEntry.enterDownloadedState(e) },
281 "enter_resetting": func(e *fsm.Event) { onuDeviceEntry.enterResettingState(e) },
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000282 },
283 )
284 if onuDeviceEntry.pMibDownloadFsm == nil || onuDeviceEntry.pMibDownloadFsm.pFsm == nil {
285 logger.Error("MibDownloadFsm could not be instantiated!!")
286 // some specifc error treatment - or waiting for crash ???
287 }
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000288
mpagenkoaf801632020-07-03 10:00:42 +0000289 onuDeviceEntry.mibTemplateKVStore = onuDeviceEntry.baseDeviceHandler.SetBackend(cBasePathMibTemplateKvStore)
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000290 if onuDeviceEntry.mibTemplateKVStore == nil {
mpagenkoaf801632020-07-03 10:00:42 +0000291 logger.Errorw("Failed to setup mibTemplateKVStore", log.Fields{"deviceID": device_id})
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000292 }
293
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000294 // Alarm Synchronization Database
295 //self._alarm_db = None
296 //self._alarm_database_cls = support_classes['alarm-synchronizer']['database']
297 return &onuDeviceEntry
298}
299
300//Start starts (logs) the omci agent
301func (oo *OnuDeviceEntry) Start(ctx context.Context) error {
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000302 logger.Info("starting-OnuDeviceEntry")
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000303
304 oo.PDevOmciCC = NewOmciCC(ctx, oo, oo.deviceID, oo.baseDeviceHandler,
305 oo.coreProxy, oo.adapterProxy)
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000306 if oo.PDevOmciCC == nil {
307 logger.Errorw("Could not create devOmciCc - abort", log.Fields{"for device": oo.deviceID})
308 return errors.New("Could not create devOmciCc")
309 }
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000310
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000311 oo.started = true
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000312 logger.Info("OnuDeviceEntry-started")
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000313 return nil
314}
315
316//Stop terminates the session
317func (oo *OnuDeviceEntry) Stop(ctx context.Context) error {
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000318 logger.Info("stopping-OnuDeviceEntry")
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000319 oo.started = false
320 //oo.exitChannel <- 1
mpagenko3af1f032020-06-10 08:53:41 +0000321 // maybe also the omciCC should be stopped here - for now not as no real processing is expected here - maybe needs consolidation
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000322 logger.Info("OnuDeviceEntry-stopped")
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000323 return nil
324}
325
326//Relay the InSync message via Handler to Rw core - Status update
327func (oo *OnuDeviceEntry) transferSystemEvent(dev_Event OnuDeviceEvent) error {
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000328 logger.Debugw("relaying system-event", log.Fields{"Event": dev_Event})
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000329 // decouple the handler transfer from further processing here
330 // TODO!!! check if really no synch is required within the system e.g. to ensure following steps ..
331 if dev_Event == MibDatabaseSync {
332 if oo.devState < MibDatabaseSync { //devState has not been synced yet
333 oo.devState = MibDatabaseSync
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000334 go oo.baseDeviceHandler.DeviceProcStatusUpdate(dev_Event)
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000335 //TODO!!! device control: next step: start MIB capability verification from here ?!!!
336 } else {
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000337 logger.Debugw("mibinsync-event in some already synced state - ignored", log.Fields{"state": oo.devState})
338 }
339 } else if dev_Event == MibDownloadDone {
340 if oo.devState < MibDownloadDone { //devState has not been synced yet
341 oo.devState = MibDownloadDone
Holger Hildebrandtccd390c2020-05-29 13:49:04 +0000342 go oo.baseDeviceHandler.DeviceProcStatusUpdate(dev_Event)
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000343 } else {
344 logger.Debugw("mibdownloaddone-event was already seen - ignored", log.Fields{"state": oo.devState})
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000345 }
346 } else {
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +0000347 logger.Warnw("device-event not yet handled", log.Fields{"state": dev_Event})
Holger Hildebrandtfa074992020-03-27 15:42:06 +0000348 }
349 return nil
350}