[VOL-3413] Create mib-template file for bbsim-onu using UpperCamelCase naming convention of omci-lib-go
device_handler.go: redundant comments deleted
Signed-off-by: Holger Hildebrandt <holger.hildebrandt@adtran.com>
Change-Id: Id582569e552f8e8bfc72540395afd5926e5a4380
diff --git a/internal/pkg/onuadaptercore/mib_sync.go b/internal/pkg/onuadaptercore/mib_sync.go
index cc589b8..e1e5f9d 100644
--- a/internal/pkg/onuadaptercore/mib_sync.go
+++ b/internal/pkg/onuadaptercore/mib_sync.go
@@ -166,8 +166,8 @@
logger.Debugw("MibSync FSM - secondLevelKey is a number and a valid EntityId", log.Fields{"meEntityId": meEntityId})
thirdLevelMap := secondLevelValue.(map[string]interface{})
for thirdLevelKey, thirdLevelValue := range thirdLevelMap {
- if thirdLevelKey == "attributes" {
- logger.Debugw("MibSync FSM - thirdLevelKey refers to attributes", log.Fields{"thirdLevelKey": thirdLevelKey})
+ if thirdLevelKey == "Attributes" {
+ logger.Debugw("MibSync FSM - thirdLevelKey refers to Attributes", log.Fields{"thirdLevelKey": thirdLevelKey})
attributesMap := thirdLevelValue.(map[string]interface{})
logger.Debugw("MibSync FSM - attributesMap", log.Fields{"attributesMap": attributesMap})
onuDeviceEntry.pOnuDB.PutMe(meClassId, meEntityId, attributesMap)
diff --git a/internal/pkg/onuadaptercore/omci_ani_config.go b/internal/pkg/onuadaptercore/omci_ani_config.go
index 6b5457c..f724e0f 100644
--- a/internal/pkg/onuadaptercore/omci_ani_config.go
+++ b/internal/pkg/onuadaptercore/omci_ani_config.go
@@ -253,20 +253,23 @@
if meAttributes := oFsm.pOnuDB.GetMe(me.PriorityQueueClassID, mgmtEntityId); meAttributes != nil {
returnVal := meAttributes["RelatedPort"]
if returnVal != nil {
- relatedPort := returnVal.(uint32)
- if relatedPort == usQrelPortMask {
- loGemPortAttribs.upQueueID = mgmtEntityId
- logger.Debugw("UpQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
- "upQueueID": strconv.FormatInt(int64(loGemPortAttribs.upQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
- usQueueFound = true
- } else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityId < 0x8000 {
- loGemPortAttribs.downQueueID = mgmtEntityId
- logger.Debugw("DownQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
- "downQueueID": strconv.FormatInt(int64(loGemPortAttribs.downQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
- dsQueueFound = true
- }
- if usQueueFound && dsQueueFound {
- break
+ if relatedPort, err := oFsm.pOnuDB.GetUint32Attrib(returnVal); err == nil {
+ if relatedPort == usQrelPortMask {
+ loGemPortAttribs.upQueueID = mgmtEntityId
+ logger.Debugw("UpQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
+ "upQueueID": strconv.FormatInt(int64(loGemPortAttribs.upQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
+ usQueueFound = true
+ } else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityId < 0x8000 {
+ loGemPortAttribs.downQueueID = mgmtEntityId
+ logger.Debugw("DownQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
+ "downQueueID": strconv.FormatInt(int64(loGemPortAttribs.downQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
+ dsQueueFound = true
+ }
+ if usQueueFound && dsQueueFound {
+ break
+ }
+ } else {
+ logger.Warnw("Could not convert attribute value", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
}
} else {
logger.Warnw("'relatedPort' not found in meAttributes:", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
@@ -284,11 +287,12 @@
loGemPortAttribs.weight = gemEntry.queueWeight
loGemPortAttribs.pbitString = gemEntry.pbitString
- logger.Debugw("prio-related GemPort attributes assigned:", log.Fields{
- "gemPortID": loGemPortAttribs.gemPortID,
- "upQueueID": loGemPortAttribs.upQueueID,
- "downQueueID": loGemPortAttribs.downQueueID,
- "pbitString": loGemPortAttribs.pbitString,
+ logger.Debugw("prio-related GemPort attributes:", log.Fields{
+ "gemPortID": loGemPortAttribs.gemPortID,
+ "upQueueID": loGemPortAttribs.upQueueID,
+ "downQueueID": loGemPortAttribs.downQueueID,
+ "pbitString": loGemPortAttribs.pbitString,
+ "prioQueueIndex": gemEntry.prioQueueIndex,
})
oFsm.gemPortAttribsSlice = append(oFsm.gemPortAttribsSlice, loGemPortAttribs)
diff --git a/internal/pkg/onuadaptercore/onu_device_db.go b/internal/pkg/onuadaptercore/onu_device_db.go
index 63ad543..aa12728 100644
--- a/internal/pkg/onuadaptercore/onu_device_db.go
+++ b/internal/pkg/onuadaptercore/onu_device_db.go
@@ -19,6 +19,8 @@
import (
"context"
+ "fmt"
+ "reflect"
"sort"
me "github.com/opencord/omci-lib-go/generated"
@@ -87,6 +89,19 @@
}
}
+func (onuDeviceDB *OnuDeviceDB) GetUint32Attrib(meAttribute interface{}) (uint32, error) {
+
+ switch reflect.TypeOf(meAttribute).Kind() {
+ case reflect.Float64:
+ //JSON numbers by default are unmarshaled into values of float64 type if type information is not present
+ return uint32(meAttribute.(float64)), nil
+ case reflect.Uint32:
+ return uint32(meAttribute.(uint32)), nil
+ default:
+ return uint32(0), fmt.Errorf(fmt.Sprintf("wrong interface-type received-%s", onuDeviceDB.pOnuDeviceEntry.deviceID))
+ }
+}
+
func (onuDeviceDB *OnuDeviceDB) GetSortedInstKeys(meClassID me.ClassID) []uint16 {
var meInstKeys []uint16
diff --git a/internal/pkg/onuadaptercore/onu_device_entry.go b/internal/pkg/onuadaptercore/onu_device_entry.go
index 7c7e3d1..a29bf05 100644
--- a/internal/pkg/onuadaptercore/onu_device_entry.go
+++ b/internal/pkg/onuadaptercore/onu_device_entry.go
@@ -20,9 +20,10 @@
import (
"context"
"errors"
+ "time"
+
"github.com/opencord/omci-lib-go"
me "github.com/opencord/omci-lib-go/generated"
- "time"
//"sync"
//"time"
@@ -101,7 +102,7 @@
)
const (
- cBasePathMibTemplateKvStore = "service/voltha/omci_mibs/templates"
+ cBasePathMibTemplateKvStore = "service/voltha/omci_mibs/go_templates"
cSuffixMibTemplateKvStore = "%s/%s/%s"
)