[VOL-3648] insert ONU interface lock thread before MIB download - version 0.1.13-dev140
Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: Ic2fd8cc2894680dc3973a3c3e047298ecfcd4e97
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 32039ab..13f5ec5 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -282,12 +282,12 @@
}
if dh.pOnuTP == nil {
//should normally not happen ...
- logger.Warnw("onuTechProf instance not set up for DLMsg request - ignoring request",
+ logger.Errorw("onuTechProf instance not set up for DLMsg request - ignoring request",
log.Fields{"device-id": dh.deviceID})
return fmt.Errorf("techProfile DLMsg request while onuTechProf instance not setup: %s", dh.deviceID)
}
if !dh.ReadyForSpecificOmciConfig {
- logger.Warnw("TechProf-set rejected: improper device state", log.Fields{"device-id": dh.deviceID,
+ logger.Errorw("TechProf-set rejected: improper device state", log.Fields{"device-id": dh.deviceID,
"device-state": dh.deviceReason})
return fmt.Errorf("improper device state %s on device %s", dh.deviceReason, dh.deviceID)
}
@@ -593,7 +593,7 @@
// for state checking compare also code here: processInterAdapterTechProfileDownloadReqMessage
// also abort for the other still possible flows here
if !dh.ReadyForSpecificOmciConfig {
- logger.Warnw("flow-add rejected: improper device state", log.Fields{"device-id": dh.deviceID,
+ logger.Errorw("flow-add rejected: improper device state", log.Fields{"device-id": dh.deviceID,
"last device-reason": dh.deviceReason})
return fmt.Errorf("improper device state on device %s", dh.deviceID)
}
@@ -1351,7 +1351,7 @@
// abort: system behavior is just unstable ...
return err
}
- //all stored persitent data are not valid anymore (loosing knowledge abouit the connected ONU)
+ //all stored persistent data are not valid anymore (loosing knowledge about the connected ONU)
_ = dh.deleteDevicePersistencyData() //ignore possible errors here and continue, hope is that data is synchronized with new ONU-Up
//deviceEntry stop without omciCC reset here, regarding the OMCI_CC still valid for this ONU
@@ -1446,7 +1446,7 @@
//VlanFilterFsm exists and was already started
pVlanFilterStatemachine := pVlanFilterFsm.pAdaptFsm.pFsm
if pVlanFilterStatemachine != nil {
- //reset of all Fsm is always accompagnied by global persistency data removal
+ //reset of all Fsm is always accompanied by global persistency data removal
// no need to remove specific data
pVlanFilterFsm.RequestClearPersistency(false)
//and reset the UniVlanConfig FSM
@@ -1460,7 +1460,7 @@
}
func (dh *deviceHandler) processMibDatabaseSyncEvent(devEvent OnuDeviceEvent) {
- logger.Debugw("MibInSync event received", log.Fields{"device-id": dh.deviceID})
+ logger.Debugw("MibInSync event received, adding uni ports and locking the ONU interfaces", log.Fields{"device-id": dh.deviceID})
if !dh.reconciling {
//initiate DevStateUpdate
if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "discovery-mibsync-complete"); err != nil {
@@ -1477,8 +1477,8 @@
//set internal state anyway - as it was done
dh.deviceReason = "discovery-mibsync-complete"
- i := uint8(0) //UNI Port limit: see MaxUnisPerOnu (by now 16) (OMCI supports max 255 p.b.)
pDevEntry := dh.getOnuDeviceEntry(false)
+ i := uint8(0) //UNI Port limit: see MaxUnisPerOnu (by now 16) (OMCI supports max 255 p.b.)
if unigInstKeys := pDevEntry.pOnuDB.getSortedInstKeys(me.UniGClassID); len(unigInstKeys) > 0 {
for _, mgmtEntityID := range unigInstKeys {
logger.Debugw("Add UNI port for stored UniG instance:", log.Fields{
@@ -1502,27 +1502,32 @@
if i == 0 {
logger.Warnw("No PPTP instances found", log.Fields{"device-id": dh.deviceID})
}
+ /* 200605: lock processing after initial MIBUpload removed now as the ONU should be in the lock state per default here */
+ /* 201117: build_dt-berlin-pod-openonugo_1T8GEM_voltha_DT_openonugo_master_test runs into error TC
+ * 'Test Disable ONUs and OLT Then Delete ONUs and OLT for DT' with Sercom ONU, which obviously needs
+ * disable/enable toggling here to allow traffic
+ * but moreover it might be useful for tracking the interface operState changes if this will be implemented,
+ * like the py comment says:
+ * # start by locking all the unis till mib sync and initial mib is downloaded
+ * # this way we can capture the port down/up events when we are ready
+ */
- /* 200605: lock processing after initial MIBUpload removed now as the ONU should be in the lock state per default here
- * left the code here as comment in case such processing should prove needed unexpectedly
- // Init Uni Ports to Admin locked state
- // maybe not really needed here as UNI ports should be locked by default, but still left as available in python code
- // *** should generate UniLockStateDone event *****
- if dh.pLockStateFsm == nil {
- dh.createUniLockFsm(true, UniLockStateDone)
- } else { //LockStateFSM already init
- dh.pLockStateFsm.SetSuccessEvent(UniLockStateDone)
- dh.runUniLockFsm(true)
- }
- }
- case UniLockStateDone:
- {
- logger.Infow("UniLockStateDone event: Starting MIB download", log.Fields{"device-id": dh.deviceID})
- * lockState processing commented out
- */
+ // Init Uni Ports to Admin locked state
+ // *** should generate UniLockStateDone event *****
+ if dh.pLockStateFsm == nil {
+ dh.createUniLockFsm(true, UniLockStateDone)
+ } else { //LockStateFSM already init
+ dh.pLockStateFsm.setSuccessEvent(UniLockStateDone)
+ dh.runUniLockFsm(true)
+ }
+}
+
+func (dh *deviceHandler) processUniLockStateDoneEvent(devEvent OnuDeviceEvent) {
+ logger.Infow("UniLockStateDone event: Starting MIB download", log.Fields{"device-id": dh.deviceID})
/* Mib download procedure -
***** should run over 'downloaded' state and generate MibDownloadDone event *****
*/
+ pDevEntry := dh.getOnuDeviceEntry(false)
pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
if pMibDlFsm != nil {
if pMibDlFsm.Is(dlStDisabled) {
@@ -1551,7 +1556,7 @@
}
func (dh *deviceHandler) processMibDownloadDoneEvent(devEvent OnuDeviceEvent) {
- logger.Debugw("MibDownloadDone event received", log.Fields{"device-id": dh.deviceID})
+ logger.Debugw("MibDownloadDone event received, unlocking the ONU interfaces", log.Fields{"device-id": dh.deviceID})
//initiate DevStateUpdate
if !dh.reconciling {
logger.Debugw("call DeviceStateUpdate upon mib-download done", log.Fields{"ConnectStatus": voltha.ConnectStatus_REACHABLE,
@@ -1748,6 +1753,10 @@
{
dh.processMibDatabaseSyncEvent(devEvent)
}
+ case UniLockStateDone:
+ {
+ dh.processUniLockStateDoneEvent(devEvent)
+ }
case MibDownloadDone:
{
dh.processMibDownloadDoneEvent(devEvent)
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index 2e19274..14550f6 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -483,7 +483,15 @@
defer wg.Done()
logger.Debugw("this would remove TP resources from ONU's UNI", log.Fields{
"device-id": onuTP.deviceID, "uniID": aUniID, "path": aPathString, "Resource": aResource})
- if cResourceTcont == aResource {
+ if cResourceGemPort == aResource {
+ logger.Debugw("remove GemPort from the list of existing ones of the TP", log.Fields{
+ "device-id": onuTP.deviceID, "uniID": aUniID, "path": aPathString, "entry": aEntryID})
+ // check if the requested GemPort exists in the DB
+ // check that the TpConfigRequest was done
+ // initiate OMCI GemPort related removal
+ // remove GemPort from config DB
+ // dev reason update? (for the moment not yet done here!)
+ } else { //if cResourceTcont == aResource {
//the TechProfile indicated by path is considered for removal
// by now we do not clear the OMCI related configuration (to be done later)
// so we use this position here just to remove the internal stored profile data