ignore omci MibUploadNextResponse messages with table attributes (based on omci-lib update with VOL-4473)
Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: I78859c7d2b3187a13d2613b33072bfd347f210c5
diff --git a/VERSION b/VERSION
index ad4110f..3e3c2f1 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.1-dev251
+2.1.1
diff --git a/go.mod b/go.mod
index e66b850..bdc03e1 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@
github.com/golang/protobuf v1.5.2
github.com/google/gopacket v1.1.17
github.com/looplab/fsm v0.2.0
- github.com/opencord/omci-lib-go/v2 v2.1.2
+ github.com/opencord/omci-lib-go/v2 v2.1.3
github.com/opencord/voltha-lib-go/v7 v7.1.1
github.com/opencord/voltha-protos/v5 v5.1.0
github.com/stretchr/testify v1.7.0
diff --git a/go.sum b/go.sum
index 9ae0d04..965908d 100644
--- a/go.sum
+++ b/go.sum
@@ -190,8 +190,8 @@
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.14.0 h1:ep6kpPVwmr/nTbklSx2nrLNSIO62DoYAhnPNIMhK8gI=
github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
-github.com/opencord/omci-lib-go/v2 v2.1.2 h1:IgwSGEtM8zf/o8wrDLdY+q0WshDYwRwMGYeL35gMqVQ=
-github.com/opencord/omci-lib-go/v2 v2.1.2/go.mod h1:o1S/jhDLHNikFU7uG2TR5UOM5KmKlqwLlVncXi0FBYQ=
+github.com/opencord/omci-lib-go/v2 v2.1.3 h1:tUCzQXOJFQtPCVy8n71jpUAP4qFPYcu6XiHFuikJbdE=
+github.com/opencord/omci-lib-go/v2 v2.1.3/go.mod h1:o1S/jhDLHNikFU7uG2TR5UOM5KmKlqwLlVncXi0FBYQ=
github.com/opencord/voltha-lib-go/v7 v7.1.1 h1:GWh0Ix7A1gr3b9L7GNy5pSDkLaPyZzJk/4ZNsj/B3eg=
github.com/opencord/voltha-lib-go/v7 v7.1.1/go.mod h1:LjoFfwqdf/OHKUmzMqzBDGmoxfjmq9l/Y47yeBsK1xI=
github.com/opencord/voltha-protos/v5 v5.1.0 h1:pGClPJIVhuLiM0d01e3MdhGeSQwA6o6+XLAxv3f/Frk=
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index e5e047d..5c15ea7 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -30,6 +30,7 @@
"time"
+ "github.com/google/gopacket"
"github.com/opencord/omci-lib-go/v2"
me "github.com/opencord/omci-lib-go/v2/generated"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
@@ -532,45 +533,57 @@
func (oo *OnuDeviceEntry) handleOmciMibUploadNextResponseMessage(ctx context.Context, msg cmn.OmciMessage) {
msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadNextResponse)
- if msgLayer == nil {
- logger.Errorw(ctx, "Omci Msg layer could not be detected", log.Fields{"device-id": oo.deviceID})
- return
- }
- msgObj, msgOk := msgLayer.(*omci.MibUploadNextResponse)
- if !msgOk {
- logger.Errorw(ctx, "Omci Msg layer could not be assigned", log.Fields{"device-id": oo.deviceID})
- return
- }
- meName := msgObj.ReportedME.GetName()
- meClassID := msgObj.ReportedME.GetClassID()
- meEntityID := msgObj.ReportedME.GetEntityID()
-
- logger.Debugw(ctx, "MibUploadNextResponse Data for:", log.Fields{"device-id": oo.deviceID, "meName": meName, "data-fields": msgObj})
-
- if meName == devdb.CUnknownItuG988ManagedEntity || meName == devdb.CUnknownVendorSpecificManagedEntity {
- oo.pOnuDB.PutUnknownMe(ctx, devdb.UnknownMeName(meName), meClassID, meEntityID, msgObj.ReportedME.GetAttributeMask(), msgObj.BaseLayer.Payload)
- } else {
- //with relaxed decoding set in the OMCI-LIB we have the chance to detect if there are some unknown attributes appended which we cannot decode
- if unknownAttrLayer := (*msg.OmciPacket).Layer(omci.LayerTypeUnknownAttributes); unknownAttrLayer != nil {
- logger.Warnw(ctx, "MibUploadNextResponse contains unknown attributes", log.Fields{"device-id": oo.deviceID})
- if unknownAttributes, ok := unknownAttrLayer.(*omci.UnknownAttributes); ok {
- // provide a loop over several ME's here already in preparation of OMCI extended message format
- for _, unknown := range unknownAttributes.Attributes {
- unknownAttrClassID := unknown.EntityClass // ClassID
- unknownAttrInst := unknown.EntityInstance // uint16
- unknownAttrMask := unknown.AttributeMask // ui
- unknownAttrBlob := unknown.AttributeData // []byte
- logger.Warnw(ctx, "unknown attributes detected for", log.Fields{"device-id": oo.deviceID,
- "Me-ClassId": unknownAttrClassID, "Me-InstId": unknownAttrInst, "unknown mask": unknownAttrMask,
- "unknown attributes": unknownAttrBlob})
- //TODO!!! We have to find a way to put this extra information into the (MIB)DB, see below pOnuDB.PutMe
- // this probably requires an (add-on) extension in the DB, that should not harm any other (get) processing -> later as a second step
- } // for all included ME's with unknown attributes
- } else {
- logger.Errorw(ctx, "unknownAttrLayer could not be decoded", log.Fields{"device-id": oo.deviceID})
- }
+ if msgLayer != nil {
+ msgObj, msgOk := msgLayer.(*omci.MibUploadNextResponse)
+ if !msgOk {
+ logger.Errorw(ctx, "Omci Msg layer could not be assigned", log.Fields{"device-id": oo.deviceID})
+ return
}
- oo.pOnuDB.PutMe(ctx, meClassID, meEntityID, msgObj.ReportedME.GetAttributeValueMap())
+ meName := msgObj.ReportedME.GetName()
+ meClassID := msgObj.ReportedME.GetClassID()
+ meEntityID := msgObj.ReportedME.GetEntityID()
+
+ logger.Debugw(ctx, "MibUploadNextResponse Data for:", log.Fields{"device-id": oo.deviceID, "meName": meName, "data-fields": msgObj})
+
+ if meName == devdb.CUnknownItuG988ManagedEntity || meName == devdb.CUnknownVendorSpecificManagedEntity {
+ oo.pOnuDB.PutUnknownMe(ctx, devdb.UnknownMeName(meName), meClassID, meEntityID, msgObj.ReportedME.GetAttributeMask(), msgObj.BaseLayer.Payload)
+ } else {
+ //with relaxed decoding set in the OMCI-LIB we have the chance to detect if there are some unknown attributes appended which we cannot decode
+ if unknownAttrLayer := (*msg.OmciPacket).Layer(omci.LayerTypeUnknownAttributes); unknownAttrLayer != nil {
+ logger.Warnw(ctx, "MibUploadNextResponse contains unknown attributes", log.Fields{"device-id": oo.deviceID})
+ if unknownAttributes, ok := unknownAttrLayer.(*omci.UnknownAttributes); ok {
+ // provide a loop over several ME's here already in preparation of OMCI extended message format
+ for _, unknown := range unknownAttributes.Attributes {
+ unknownAttrClassID := unknown.EntityClass // ClassID
+ unknownAttrInst := unknown.EntityInstance // uint16
+ unknownAttrMask := unknown.AttributeMask // ui
+ unknownAttrBlob := unknown.AttributeData // []byte
+ logger.Warnw(ctx, "unknown attributes detected for", log.Fields{"device-id": oo.deviceID,
+ "Me-ClassId": unknownAttrClassID, "Me-InstId": unknownAttrInst, "unknown mask": unknownAttrMask,
+ "unknown attributes": unknownAttrBlob})
+ //TODO!!! We have to find a way to put this extra information into the (MIB)DB, see below pOnuDB.PutMe
+ // this probably requires an (add-on) extension in the DB, that should not harm any other (get) processing -> later as a second step
+ } // for all included ME's with unknown attributes
+ } else {
+ logger.Errorw(ctx, "unknownAttrLayer could not be decoded", log.Fields{"device-id": oo.deviceID})
+ }
+ }
+ oo.pOnuDB.PutMe(ctx, meClassID, meEntityID, msgObj.ReportedME.GetAttributeValueMap())
+ }
+ } else {
+ logger.Errorw(ctx, "Omci Msg layer could not be detected", log.Fields{"device-id": oo.deviceID})
+ //as long as omci-lib does not support decoding of table attribute as 'unknown/unspecified' attribute
+ // we have to verify, if this failure is from table attribute and try to go forward with ignoring the complete message
+ errLayer := (*msg.OmciPacket).Layer(gopacket.LayerTypeDecodeFailure)
+ if failure, decodeOk := errLayer.(*gopacket.DecodeFailure); decodeOk {
+ errMsg := failure.String()
+ if !strings.Contains(strings.ToLower(errMsg), "table decode") {
+ //something still unexected happened, needs deeper investigation - stop complete MIB upload process (timeout)
+ return
+ }
+ logger.Warnw(ctx, "Decode issue on received MibUploadNextResponse frame - found table attribute(s) (message ignored)",
+ log.Fields{"device-id": oo.deviceID, "issue": errMsg})
+ }
}
if oo.PDevOmciCC.UploadSequNo < oo.PDevOmciCC.UploadNoOfCmds {
_ = oo.PDevOmciCC.SendMibUploadNext(log.WithSpanFromContext(context.TODO(), ctx), oo.baseDeviceHandler.GetOmciTimeout(), true)
diff --git a/vendor/github.com/opencord/omci-lib-go/v2/VERSION b/vendor/github.com/opencord/omci-lib-go/v2/VERSION
index eca07e4..ac2cdeb 100644
--- a/vendor/github.com/opencord/omci-lib-go/v2/VERSION
+++ b/vendor/github.com/opencord/omci-lib-go/v2/VERSION
@@ -1 +1 @@
-2.1.2
+2.1.3
diff --git a/vendor/github.com/opencord/omci-lib-go/v2/generated/attribute.go b/vendor/github.com/opencord/omci-lib-go/v2/generated/attribute.go
index de20130..4956e89 100644
--- a/vendor/github.com/opencord/omci-lib-go/v2/generated/attribute.go
+++ b/vendor/github.com/opencord/omci-lib-go/v2/generated/attribute.go
@@ -377,7 +377,8 @@
// either Read and/or Write, never Set-by-Create
switch msgType {
default:
- return nil, fmt.Errorf("unsupported Message Type '%v' for table serialization", msgType)
+ return nil, fmt.Errorf("unsupported Message Type '%v/0x%02x' for table decode",
+ MsgType(msgType&MsgTypeMask), msgType)
case byte(Get) | AK: // Get Response
// Size
@@ -434,7 +435,8 @@
// either Read and/or Write, never Set-by-Create
switch msgType {
default:
- return 0, fmt.Errorf("unsupported Message Type '%v' for table serialization", msgType)
+ return 0, fmt.Errorf("unsupported Message Type '%v/0x%02x' for table serialization",
+ MsgType(msgType&MsgTypeMask), msgType)
case byte(Get) | AK: // Get Response
// Size
diff --git a/vendor/github.com/opencord/omci-lib-go/v2/generated/medef.go b/vendor/github.com/opencord/omci-lib-go/v2/generated/medef.go
index 6d2c2dd..4b2061a 100644
--- a/vendor/github.com/opencord/omci-lib-go/v2/generated/medef.go
+++ b/vendor/github.com/opencord/omci-lib-go/v2/generated/medef.go
@@ -117,7 +117,8 @@
if attrDef.IsTableAttribute() {
switch msgType {
default:
- return nil, fmt.Errorf("unsupported Message Type '%v' for table serialization", msgType)
+ return nil, fmt.Errorf("unsupported Message Type '%v/0x%02x' for table decode",
+ MsgType(msgType&MsgTypeMask), msgType)
case byte(Get) | AK: // Get Response
attrMap[name] = value
diff --git a/vendor/modules.txt b/vendor/modules.txt
index d8288c7..995062c 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -121,7 +121,7 @@
# github.com/looplab/fsm v0.2.0
## explicit
github.com/looplab/fsm
-# github.com/opencord/omci-lib-go/v2 v2.1.2
+# github.com/opencord/omci-lib-go/v2 v2.1.3
## explicit
github.com/opencord/omci-lib-go/v2
github.com/opencord/omci-lib-go/v2/generated