VOL-4338: Relaxed MIB Upload Next response decoding
Change-Id: I4c0db4d4786a1d8501daec18a6980821a9267b84
diff --git a/generated/me.go b/generated/me.go
index 8bec058..2d83255 100644
--- a/generated/me.go
+++ b/generated/me.go
@@ -286,15 +286,26 @@
entity.definition = meDefinition.definition
entity.attributeMask = binary.BigEndian.Uint16(data[4:6])
entity.attributes = make(map[string]interface{})
- entity.SetEntityID(entityID)
+ setErr := entity.SetEntityID(entityID)
+ if setErr != nil {
+ return setErr
+ }
packetAttributes, err := entity.DecodeAttributes(entity.GetAttributeMask(), data[6:], p, msgType)
+
+ // Decode packet attributes even if present in case relaxed attribute decoding is enabled.
+ if packetAttributes != nil {
+ for name, value := range packetAttributes {
+ entity.attributes[name] = value
+ }
+ }
if err != nil {
- return err
+ if attrError, ok := err.(*UnknownAttributeDecodeError); ok && GetRelaxedDecodeByOctetType(msgType) {
+ // Subtract off bad mask from what we computed
+ badMask := attrError.AttributeMask
+ entity.attributeMask &= ^badMask
+ }
}
- for name, value := range packetAttributes {
- entity.attributes[name] = value
- }
- return nil
+ return err
}
// SerializeTo serializes a Managed Entity into an octet stream