[VOL-4692] BBSIM: OMCI extended message set - support get requests

Change-Id: I41f139558df5913cccab3ba3b8f7eb147e72ebbd
diff --git a/VERSION b/VERSION
index e0a6b34..456e5c4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.12.5
+1.12.6
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 1d61773..9178491 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -1393,7 +1393,7 @@
 		log.WithFields(log.Fields{
 			"IntfId":       onu.PonPortID,
 			"SerialNumber": onu.Sn(),
-			"omciPacket":   omcilib.HexDecode(omci_msg.Pkt),
+			"omciPacket":   hex.EncodeToString(omci_msg.Pkt),
 			"err":          err.Error(),
 		}).Error("cannot-parse-OMCI-packet")
 		return nil, fmt.Errorf("olt-received-malformed-omci-packet")
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 595cd0a..593be6a 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -1281,7 +1281,7 @@
 	onuLogger.WithFields(log.Fields{
 		"IntfId":       o.PonPortID,
 		"SerialNumber": o.Sn(),
-		"omciPacket":   indication.OmciInd.Pkt,
+		"omciPacket":   hex.EncodeToString(indication.OmciInd.Pkt),
 		"transCorrId":  txId,
 	}).Trace("omci-message-sent")
 	return nil
diff --git a/internal/common/omci/get.go b/internal/common/omci/get.go
index 6d83495..71d7d87 100644
--- a/internal/common/omci/get.go
+++ b/internal/common/omci/get.go
@@ -54,47 +54,53 @@
 		return nil, err
 	}
 	omciLogger.WithFields(log.Fields{
+		"DeviceIdent":    omciMsg.DeviceIdentifier,
 		"EntityClass":    msgObj.EntityClass,
 		"EntityInstance": msgObj.EntityInstance,
 		"AttributeMask":  fmt.Sprintf("%x", msgObj.AttributeMask),
 	}).Trace("received-omci-get-request")
 
 	var response *omci.GetResponse
+
+	isExtended := false
+	if omciMsg.DeviceIdentifier == omci.ExtendedIdent {
+		isExtended = true
+	}
 	switch msgObj.EntityClass {
 	case me.Onu2GClassID:
-		response = createOnu2gResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createOnu2gResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.OnuGClassID:
-		response = createOnugResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuSn)
+		response = createOnugResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance, onuSn)
 	case me.SoftwareImageClassID:
-		response = createSoftwareImageResponse(msgObj.AttributeMask, msgObj.EntityInstance,
+		response = createSoftwareImageResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance,
 			activeImageEntityId, committedImageEntityId, standbyImageVersion, activeImageVersion, committedImageVersion)
 	case me.IpHostConfigDataClassID:
-		response = createIpHostResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createIpHostResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.VoipConfigDataClassID:
-		response = createVoipConfigDataResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createVoipConfigDataResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.UniGClassID:
-		response = createUnigResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
+		response = createUnigResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
 	case me.PhysicalPathTerminationPointEthernetUniClassID:
-		response = createPptpEthernetResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
+		response = createPptpEthernetResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
 	case me.PhysicalPathTerminationPointPotsUniClassID:
-		response = createPptpPotsResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
+		response = createPptpPotsResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance, onuDown)
 	case me.AniGClassID:
-		response = createAnigResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createAnigResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.OnuDataClassID:
-		response = createOnuDataResponse(msgObj.AttributeMask, msgObj.EntityInstance, mds)
+		response = createOnuDataResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance, mds)
 	case me.EthernetFramePerformanceMonitoringHistoryDataUpstreamClassID:
-		response = createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.EthernetFramePerformanceMonitoringHistoryDataDownstreamClassID:
-		response = createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.EthernetPerformanceMonitoringHistoryDataClassID:
-		response = createEthernetPerformanceMonitoringHistoryDataResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createEthernetPerformanceMonitoringHistoryDataResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.FecPerformanceMonitoringHistoryDataClassID:
-		response = createFecPerformanceMonitoringHistoryDataResponse(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createFecPerformanceMonitoringHistoryDataResponse(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.GemPortNetworkCtpPerformanceMonitoringHistoryDataClassID:
-		response = createGemPortNetworkCtpPerformanceMonitoringHistoryData(msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createGemPortNetworkCtpPerformanceMonitoringHistoryData(isExtended, msgObj.AttributeMask, msgObj.EntityInstance)
 	case me.EthernetFrameExtendedPmClassID,
 		me.EthernetFrameExtendedPm64BitClassID:
-		response = createEthernetFrameExtendedPmGetResponse(msgObj.EntityClass, msgObj.AttributeMask, msgObj.EntityInstance)
+		response = createEthernetFrameExtendedPmGetResponse(isExtended, msgObj.EntityClass, msgObj.AttributeMask, msgObj.EntityInstance)
 	default:
 		omciLogger.WithFields(log.Fields{
 			"EntityClass":    msgObj.EntityClass,
@@ -103,8 +109,16 @@
 		}).Warnf("do-not-know-how-to-handle-get-request-for-me-class")
 		return nil, nil
 	}
+	omciLayer := &omci.OMCI{
+		TransactionID:    omciMsg.TransactionID,
+		MessageType:      omci.GetResponseType,
+		DeviceIdentifier: omciMsg.DeviceIdentifier,
+	}
+	var options gopacket.SerializeOptions
+	options.FixLengths = true
 
-	pkt, err := Serialize(omci.GetResponseType, response, omciMsg.TransactionID)
+	buffer := gopacket.NewSerializeBuffer()
+	err = gopacket.SerializeLayers(buffer, options, omciLayer, response)
 	if err != nil {
 		omciLogger.WithFields(log.Fields{
 			"Err":  err,
@@ -112,6 +126,7 @@
 		}).Error("cannot-Serialize-GetResponse")
 		return nil, err
 	}
+	pkt := buffer.Bytes()
 
 	log.WithFields(log.Fields{
 		"TxID": strconv.FormatInt(int64(omciMsg.TransactionID), 16),
@@ -121,7 +136,7 @@
 	return pkt, nil
 }
 
-func createOnu2gResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createOnu2gResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 
 	managedEntity, meErr := me.NewOnu2G(me.ParamData{
 		EntityID: entityID,
@@ -151,7 +166,9 @@
 
 	return &omci.GetResponse{
 		MeBasePacket: omci.MeBasePacket{
-			EntityClass: me.Onu2GClassID,
+			EntityClass:    me.Onu2GClassID,
+			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -159,7 +176,7 @@
 	}
 }
 
-func createOnugResponse(attributeMask uint16, entityID uint16, onuSn *openolt.SerialNumber) *omci.GetResponse {
+func createOnugResponse(isExtended bool, attributeMask uint16, entityID uint16, onuSn *openolt.SerialNumber) *omci.GetResponse {
 
 	managedEntity, meErr := me.NewOnuG(me.ParamData{
 		EntityID: entityID,
@@ -188,27 +205,17 @@
 
 	return &omci.GetResponse{
 		MeBasePacket: omci.MeBasePacket{
-			EntityClass: me.OnuGClassID,
+			EntityClass:    me.OnuGClassID,
+			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
 		Result:        me.Success,
 	}
-
-	//return &omci.GetResponse{
-	//	MeBasePacket: omci.MeBasePacket{
-	//		EntityClass:    me.OnuGClassID,
-	//		EntityInstance: entityID,
-	//	},
-	//	Attributes: me.AttributeValueMap{
-	//
-	//	},
-	//	Result:        me.Success,
-	//	AttributeMask: attributeMask,
-	//}
 }
 
-func createSoftwareImageResponse(attributeMask uint16, entityInstance uint16, activeImageEntityId uint16,
+func createSoftwareImageResponse(isExtended bool, attributeMask uint16, entityInstance uint16, activeImageEntityId uint16,
 	committedImageEntityId uint16, standbyImageVersion string, activeImageVersion string, committedImageVersion string) *omci.GetResponse {
 
 	omciLogger.WithFields(log.Fields{
@@ -244,6 +251,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.SoftwareImageClassID,
 			EntityInstance: entityInstance,
+			Extended:       isExtended,
 		},
 		Attributes: me.AttributeValueMap{
 			me.ManagedEntityID:           0,
@@ -268,11 +276,12 @@
 	return res
 }
 
-func createIpHostResponse(attributeMask uint16, entityInstance uint16) *omci.GetResponse {
+func createIpHostResponse(isExtended bool, attributeMask uint16, entityInstance uint16) *omci.GetResponse {
 	return &omci.GetResponse{
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.IpHostConfigDataClassID,
 			EntityInstance: entityInstance,
+			Extended:       isExtended,
 		},
 		Attributes: me.AttributeValueMap{
 			me.ManagedEntityID:             0,
@@ -283,11 +292,12 @@
 	}
 }
 
-func createVoipConfigDataResponse(attributeMask uint16, entityInstance uint16) *omci.GetResponse {
+func createVoipConfigDataResponse(isExtended bool, attributeMask uint16, entityInstance uint16) *omci.GetResponse {
 	return &omci.GetResponse{
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.VoipConfigDataClassID,
 			EntityInstance: entityInstance,
+			Extended:       isExtended,
 		},
 		Attributes: me.AttributeValueMap{
 			me.ManagedEntityID: 0,
@@ -305,7 +315,7 @@
 	}
 }
 
-func createUnigResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
+func createUnigResponse(isExtended bool, attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
 	// Valid values for uni_admin_state are 0 (unlocks) and 1 (locks)
 	omciAdminState := 1
 	if !onuDown {
@@ -332,6 +342,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.UniGClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -339,7 +350,7 @@
 	}
 }
 
-func createPptpEthernetResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
+func createPptpEthernetResponse(isExtended bool, attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
 	// Valid values for oper_state are 0 (enabled) and 1 (disabled)
 	// Valid values for uni_admin_state are 0 (unlocks) and 1 (locks)
 	onuAdminState := 1
@@ -378,6 +389,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.PhysicalPathTerminationPointEthernetUniClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -385,7 +397,7 @@
 	}
 }
 
-func createPptpPotsResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
+func createPptpPotsResponse(isExtended bool, attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse {
 	// Valid values for oper_state are 0 (enabled) and 1 (disabled)
 	// Valid values for uni_admin_state are 0 (unlocks) and 1 (locks)
 	onuAdminState := 1
@@ -422,6 +434,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.PhysicalPathTerminationPointPotsUniClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -429,7 +442,7 @@
 	}
 }
 
-func createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewEthernetFramePerformanceMonitoringHistoryDataUpstream(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -462,6 +475,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.EthernetFramePerformanceMonitoringHistoryDataUpstreamClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -469,7 +483,7 @@
 	}
 }
 
-func createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewEthernetFramePerformanceMonitoringHistoryDataDownstream(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -502,6 +516,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.EthernetFramePerformanceMonitoringHistoryDataDownstreamClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -509,7 +524,7 @@
 	}
 }
 
-func createEthernetPerformanceMonitoringHistoryDataResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createEthernetPerformanceMonitoringHistoryDataResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewEthernetPerformanceMonitoringHistoryData(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -542,6 +557,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.EthernetPerformanceMonitoringHistoryDataClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -549,7 +565,7 @@
 	}
 }
 
-func createFecPerformanceMonitoringHistoryDataResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createFecPerformanceMonitoringHistoryDataResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewFecPerformanceMonitoringHistoryData(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -576,6 +592,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.FecPerformanceMonitoringHistoryDataClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -583,7 +600,7 @@
 	}
 }
 
-func createGemPortNetworkCtpPerformanceMonitoringHistoryData(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createGemPortNetworkCtpPerformanceMonitoringHistoryData(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewGemPortNetworkCtpPerformanceMonitoringHistoryData(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -607,6 +624,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.GemPortNetworkCtpPerformanceMonitoringHistoryDataClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -614,7 +632,7 @@
 	}
 }
 
-func createOnuDataResponse(attributeMask uint16, entityID uint16, mds uint8) *omci.GetResponse {
+func createOnuDataResponse(isExtended bool, attributeMask uint16, entityID uint16, mds uint8) *omci.GetResponse {
 	managedEntity, meErr := me.NewOnuData(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -632,6 +650,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.OnuDataClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -639,7 +658,7 @@
 	}
 }
 
-func createAnigResponse(attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createAnigResponse(isExtended bool, attributeMask uint16, entityID uint16) *omci.GetResponse {
 	managedEntity, meErr := me.NewAniG(me.ParamData{
 		EntityID: entityID,
 		Attributes: me.AttributeValueMap{
@@ -672,6 +691,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    me.AniGClassID,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
@@ -679,7 +699,7 @@
 	}
 }
 
-func createEthernetFrameExtendedPmGetResponse(meClass me.ClassID, attributeMask uint16, entityID uint16) *omci.GetResponse {
+func createEthernetFrameExtendedPmGetResponse(isExtended bool, meClass me.ClassID, attributeMask uint16, entityID uint16) *omci.GetResponse {
 
 	callback := me.NewEthernetFrameExtendedPm
 	if meClass != me.EthernetFrameExtendedPmClassID {
@@ -720,6 +740,7 @@
 		MeBasePacket: omci.MeBasePacket{
 			EntityClass:    meClass,
 			EntityInstance: entityID,
+			Extended:       isExtended,
 		},
 		Attributes:    managedEntity.GetAttributeValueMap(),
 		AttributeMask: attributeMask,
diff --git a/internal/common/omci/get_test.go b/internal/common/omci/get_test.go
index 60fd5ae..82bbe7a 100644
--- a/internal/common/omci/get_test.go
+++ b/internal/common/omci/get_test.go
@@ -82,55 +82,55 @@
 		want getWant
 	}{
 		{"getOnu2gResponse",
-			getArgs{createOnu2gResponse(57344, 10), 1},
+			getArgs{createOnu2gResponse(false, 57344, 10), 1},
 			getWant{1, map[string]interface{}{"OpticalNetworkUnitManagementAndControlChannelOmccVersion": uint8(180)}},
 		},
 		{"getOnugResponse",
-			getArgs{createOnugResponse(40960, 10, sn), 1},
+			getArgs{createOnugResponse(false, 40960, 10, sn), 1},
 			getWant{1, map[string]interface{}{}},
 		},
 		{"getOnuDataResponse",
-			getArgs{createOnuDataResponse(32768, 10, 129), 2},
+			getArgs{createOnuDataResponse(false, 32768, 10, 129), 2},
 			getWant{2, map[string]interface{}{"MibDataSync": uint8(129)}},
 		},
 		{"getGemPortNetworkCtpPerformanceMonitoringHistoryDataResponse",
-			getArgs{createGemPortNetworkCtpPerformanceMonitoringHistoryData(32768, 10), 2},
+			getArgs{createGemPortNetworkCtpPerformanceMonitoringHistoryData(false, 32768, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10)}},
 		},
 		{"getEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse",
-			getArgs{createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(32768, 10), 2},
+			getArgs{createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(false, 32768, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10)}},
 		},
 		{"getEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse",
-			getArgs{createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(32768, 10), 2},
+			getArgs{createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(false, 32768, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10)}},
 		},
 		{"getEthernetPerformanceMonitoringHistoryDataResponse",
-			getArgs{createEthernetPerformanceMonitoringHistoryDataResponse(32768, 10), 2},
+			getArgs{createEthernetPerformanceMonitoringHistoryDataResponse(false, 32768, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10)}},
 		},
 		{"getSoftwareImageResponse",
-			getArgs{createSoftwareImageResponse(61440, 0, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
+			getArgs{createSoftwareImageResponse(false, 61440, 0, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
 			getWant{2, map[string]interface{}{"IsCommitted": uint8(0), "IsActive": uint8(0)}},
 		},
 		{"getSoftwareImageResponseActiveCommitted",
-			getArgs{createSoftwareImageResponse(61440, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
+			getArgs{createSoftwareImageResponse(false, 61440, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
 			getWant{2, map[string]interface{}{"IsCommitted": uint8(1), "IsActive": uint8(1)}},
 		},
 		{"getSoftwareImageResponseVersion",
-			getArgs{createSoftwareImageResponse(61440, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
+			getArgs{createSoftwareImageResponse(false, 61440, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
 			getWant{2, map[string]interface{}{"Version": ToOctets("BBSM_IMG_00001", 14)}},
 		},
 		{"getSoftwareImageResponseProductCode",
-			getArgs{createSoftwareImageResponse(2048, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
+			getArgs{createSoftwareImageResponse(false, 2048, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
 			getWant{2, map[string]interface{}{"ProductCode": ToOctets("BBSIM-ONU", 25)}},
 		},
 		{"getSoftwareImageResponseActiveImageHash",
-			getArgs{createSoftwareImageResponse(1024, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
+			getArgs{createSoftwareImageResponse(false, 1024, 1, 1, 1, "BBSM_IMG_00000", "BBSM_IMG_00001", "BBSM_IMG_00001"), 2},
 			getWant{2, map[string]interface{}{"ImageHash": ToOctets("BBSM_IMG_00001", 25)}},
 		},
 		{"getEthernetFrameExtendedPMDataResponse",
-			getArgs{createEthernetFrameExtendedPmGetResponse(me.EthernetFrameExtendedPmClassID, 16128, 10), 2},
+			getArgs{createEthernetFrameExtendedPmGetResponse(false, me.EthernetFrameExtendedPmClassID, 16128, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10),
 				"DropEvents":       uint32(100),
 				"Octets":           uint32(101),
@@ -140,7 +140,7 @@
 				"CrcErroredFrames": uint32(105)}},
 		},
 		{"getEthernetFrameExtendedPM64BitDataResponse",
-			getArgs{createEthernetFrameExtendedPmGetResponse(me.EthernetFrameExtendedPm64BitClassID, 3, 10), 2},
+			getArgs{createEthernetFrameExtendedPmGetResponse(false, me.EthernetFrameExtendedPm64BitClassID, 3, 10), 2},
 			getWant{2, map[string]interface{}{"ManagedEntityId": uint16(10),
 				"Frames512To1023Octets":  uint64(112),
 				"Frames1024To1518Octets": uint64(113)}},
@@ -194,7 +194,7 @@
 		VendorId:       []byte("BBSM"),
 		VendorSpecific: []byte{0, byte(1 % 256), byte(1), byte(1)},
 	}
-	response := createOnugResponse(40960, 1, sn)
+	response := createOnugResponse(false, 40960, 1, sn)
 	data, _ := Serialize(omci.GetResponseType, response, 1)
 
 	omciMsg, omciPkt := omciBytesToMsg(t, data)
diff --git a/internal/common/omci/omci_base.go b/internal/common/omci/omci_base.go
index aa3a611..2c150a5 100644
--- a/internal/common/omci/omci_base.go
+++ b/internal/common/omci/omci_base.go
@@ -21,27 +21,43 @@
 	"encoding/hex"
 	"errors"
 	"fmt"
+
 	"github.com/google/gopacket"
 	"github.com/opencord/omci-lib-go/v2"
 	log "github.com/sirupsen/logrus"
 )
 
+const DeviceIdentifierPos = 3
+
 // ParseOpenOltOmciPacket receive an OMCI packet in the openolt format and returns
 // an OMCI Layer as per omci-lib-go
 func ParseOpenOltOmciPacket(pkt []byte) (gopacket.Packet, *omci.OMCI, error) {
 	rxMsg := HexDecode(pkt)
-
-	// NOTE this is may not be needed, VOLTHA sends the correct message
-	if len(rxMsg) >= 44 {
-		trailerLenData := rxMsg[42:44]
-		trailerLen := binary.BigEndian.Uint16(trailerLenData)
-		if trailerLen != 40 { // invalid base Format entry -> autocorrect
-			binary.BigEndian.PutUint16(rxMsg[42:44], 40)
-			omciLogger.Trace("cc-corrected-omci-message: trailer len inserted")
+	if len(rxMsg) < 10 {
+		omciLogger.WithFields(log.Fields{"Length": len(rxMsg)}).Error("received omci message is generally too small - abort")
+		return nil, nil, errors.New("received omci message is generally too small - abort")
+	}
+	if rxMsg[DeviceIdentifierPos] == byte(omci.BaselineIdent) {
+		// NOTE this is may not be needed, VOLTHA sends the correct message
+		if len(rxMsg) >= 44 {
+			trailerLenData := rxMsg[42:44]
+			trailerLen := binary.BigEndian.Uint16(trailerLenData)
+			if trailerLen != 40 { // invalid base Format entry -> autocorrect
+				binary.BigEndian.PutUint16(rxMsg[42:44], 40)
+				omciLogger.Trace("cc-corrected-omci-message: trailer len inserted")
+			}
+		} else {
+			omciLogger.WithFields(log.Fields{"Length": len(rxMsg)}).Error("received omci-message too small for OmciBaseFormat - abort")
+			return nil, nil, errors.New("received omci-message too small for OmciBaseFormat - abort")
+		}
+	} else if rxMsg[DeviceIdentifierPos] == byte(omci.ExtendedIdent) {
+		if len(rxMsg) > 1980 {
+			omciLogger.WithFields(log.Fields{"Length": len(rxMsg)}).Error("received omci-message with wrong length for OmciExtendedFormat - abort")
+			return nil, nil, errors.New("received omci-message with wrong length for OmciExtendedFormat - abort")
 		}
 	} else {
-		omciLogger.WithFields(log.Fields{"Length": len(rxMsg)}).Error("received omci-message too small for OmciBaseFormat - abort")
-		return nil, nil, errors.New("received omci-message too small for OmciBaseFormat - abort")
+		omciLogger.WithFields(log.Fields{"DeviceIdent": rxMsg[DeviceIdentifierPos]}).Error("received omci-message with wrong Device Identifier - abort")
+		return nil, nil, errors.New("received omci-message with wrong Device Identifier - abort")
 	}
 
 	packet := gopacket.NewPacket(rxMsg, omci.LayerTypeOMCI, gopacket.NoCopy)