VOL-3720: Support access to raw packet data at msg-layer
Change-Id: Ib2bf03e091cce3c803dd76d777f81db360ba2a1c
diff --git a/VERSION b/VERSION
index 9f40a87..d183d4a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.15.4
\ No newline at end of file
+0.16.0
\ No newline at end of file
diff --git a/mebase.go b/mebase.go
index 750233d..ec1b08c 100644
--- a/mebase.go
+++ b/mebase.go
@@ -65,11 +65,11 @@
}
// DecodeFromBytes decodes the given bytes into this layer
-func (msg *MeBasePacket) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
+func (msg *MeBasePacket) DecodeFromBytes(data []byte, p gopacket.PacketBuilder, contentSize int) error {
// Note: Base OMCI frame already checked for frame with at least 10 octets
msg.EntityClass = me.ClassID(binary.BigEndian.Uint16(data[0:]))
msg.EntityInstance = binary.BigEndian.Uint16(data[2:])
- msg.BaseLayer = layers.BaseLayer{Contents: data[:4], Payload: data[4:]}
+ msg.BaseLayer = layers.BaseLayer{Contents: data[:contentSize], Payload: data[contentSize:]}
return nil
}
diff --git a/messagetypes.go b/messagetypes.go
index 6776b06..40923ab 100644
--- a/messagetypes.go
+++ b/messagetypes.go
@@ -184,7 +184,7 @@
// DecodeFromBytes decodes the given bytes of a Create Request into this layer
func (omci *CreateRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -271,7 +271,7 @@
// DecodeFromBytes decodes the given bytes of a Create Response into this layer
func (omci *CreateResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 3)
if err != nil {
return err
}
@@ -341,7 +341,7 @@
// DecodeFromBytes decodes the given bytes of a Delete Request into this layer
func (omci *DeleteRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -397,7 +397,7 @@
// DecodeFromBytes decodes the given bytes of a Delete Response into this layer
func (omci *DeleteResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -460,7 +460,7 @@
// DecodeFromBytes decodes the given bytes of a Set Request into this layer
func (omci *SetRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -567,7 +567,7 @@
// DecodeFromBytes decodes the given bytes of a Set Response into this layer
func (omci *SetResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 5)
if err != nil {
return err
}
@@ -636,7 +636,7 @@
// DecodeFromBytes decodes the given bytes of a Get Request into this layer
func (omci *GetRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -703,7 +703,7 @@
// DecodeFromBytes decodes the given bytes of a Get Response into this layer
func (omci *GetResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 3)
if err != nil {
return err
}
@@ -870,7 +870,7 @@
// DecodeFromBytes decodes the given bytes of a Get All Alarms Request into this layer
func (omci *GetAllAlarmsRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -948,7 +948,7 @@
// DecodeFromBytes decodes the given bytes of a Get All Alarms Response into this layer
func (omci *GetAllAlarmsResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -1021,7 +1021,7 @@
// DecodeFromBytes decodes the given bytes of a Get All Alarms Next Request into this layer
func (omci *GetAllAlarmsNextRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -1097,7 +1097,7 @@
// DecodeFromBytes decodes the given bytes of a Get All Alarms Next Response into this layer
func (omci *GetAllAlarmsNextResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 4 + 28)
if err != nil {
return err
}
@@ -1173,7 +1173,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Upload Request into this layer
func (omci *MibUploadRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -1240,7 +1240,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Upload Response into this layer
func (omci *MibUploadResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -1313,7 +1313,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Upload Next Request into this layer
func (omci *MibUploadNextRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -1386,7 +1386,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Upload Next Response into this layer
func (omci *MibUploadNextResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 6)
if err != nil {
return err
}
@@ -1457,7 +1457,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Reset Request into this layer
func (omci *MibResetRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -1511,7 +1511,7 @@
// DecodeFromBytes decodes the given bytes of a MIB Reset Response into this layer
func (omci *MibResetResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -1684,7 +1684,7 @@
// DecodeFromBytes decodes the given bytes of an Alarm Notification into this layer
func (omci *AlarmNotificationMsg) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 28)
if err != nil {
return err
}
@@ -1770,7 +1770,7 @@
// DecodeFromBytes decodes the given bytes of an Attribute Value Change notification into this layer
func (omci *AttributeValueChangeMsg) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -1855,7 +1855,7 @@
// DecodeFromBytes decodes the given bytes of a Test Request into this layer
func (omci *TestRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 5)
if err != nil {
return err
}
@@ -1891,7 +1891,7 @@
// DecodeFromBytes decodes the given bytes of a Test Response into this layer
func (omci *TestResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -1931,7 +1931,7 @@
// DecodeFromBytes decodes the given bytes of a Start Software Download Request into this layer
func (omci *StartSoftwareDownloadRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 4)
if err != nil {
return err
}
@@ -2033,7 +2033,7 @@
// DecodeFromBytes decodes the given bytes of a Start Software Download Response into this layer
func (omci *StartSoftwareDownloadResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 3)
if err != nil {
return err
}
@@ -2155,7 +2155,7 @@
// DecodeFromBytes decodes the given bytes of a Download Section Request into this layer
func (omci *DownloadSectionRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -2228,7 +2228,7 @@
// DecodeFromBytes decodes the given bytes of a Download Section Response into this layer
func (omci *DownloadSectionResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -2313,7 +2313,7 @@
// DecodeFromBytes decodes the given bytes of an End Software Download Request into this layer
func (omci *EndSoftwareDownloadRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 7)
if err != nil {
return err
}
@@ -2406,7 +2406,7 @@
// DecodeFromBytes decodes the given bytes of an End Software Download Response into this layer
func (omci *EndSoftwareDownloadResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -2525,7 +2525,7 @@
// DecodeFromBytes decodes the given bytes of an Activate Software Request into this layer
func (omci *ActivateSoftwareRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -2604,7 +2604,7 @@
// DecodeFromBytes decodes the given bytes of an Activate Softwre Response into this layer
func (omci *ActivateSoftwareResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -2682,7 +2682,7 @@
// DecodeFromBytes decodes the given bytes of a Commit Software Request into this layer
func (omci *CommitSoftwareRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -2744,7 +2744,7 @@
// DecodeFromBytes decodes the given bytes of a Commit Softwar Response into this layer
func (omci *CommitSoftwareResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -2813,7 +2813,7 @@
// DecodeFromBytes decodes the given bytes of a Synchronize Time Request into this layer
func (omci *SynchronizeTimeRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 7)
if err != nil {
return err
}
@@ -2893,7 +2893,7 @@
// DecodeFromBytes decodes the given bytes of a Synchronize Time Response into this layer
func (omci *SynchronizeTimeResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -2981,7 +2981,7 @@
// DecodeFromBytes decodes the given bytes of a Reboot Request into this layer
func (omci *RebootRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -3052,7 +3052,7 @@
// DecodeFromBytes decodes the given bytes of a Reboot Response into this layer
func (omci *RebootResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 1)
if err != nil {
return err
}
@@ -3123,7 +3123,7 @@
// DecodeFromBytes decodes the given bytes of a Get Next Request into this layer
func (omci *GetNextRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 4)
if err != nil {
return err
}
@@ -3194,7 +3194,7 @@
// DecodeFromBytes decodes the given bytes of a Get Next Response into this layer
func (omci *GetNextResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 3)
if err != nil {
return err
}
@@ -3312,7 +3312,7 @@
// DecodeFromBytes decodes the given bytes of a Test Result Notification into this layer
func (omci *TestResultMsg) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4)
if err != nil {
return err
}
@@ -3350,7 +3350,7 @@
// DecodeFromBytes decodes the given bytes of a Get Current Data Request into this layer
func (omci *GetCurrentDataRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 2)
if err != nil {
return err
}
@@ -3416,7 +3416,7 @@
// DecodeFromBytes decodes the given bytes of a Get Current Data Respnse into this layer
func (omci *GetCurrentDataResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 4 + 3)
if err != nil {
return err
}
@@ -3503,7 +3503,7 @@
// DecodeFromBytes decodes the given bytes of a Set Table Request into this layer
func (omci *SetTableRequest) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 6 + 2)
if err != nil {
return err
}
@@ -3540,7 +3540,7 @@
// DecodeFromBytes decodes the given bytes of a Set Table Response into this layer
func (omci *SetTableResponse) DecodeFromBytes(data []byte, p gopacket.PacketBuilder) error {
// Common ClassID/EntityID decode in msgBase
- err := omci.MeBasePacket.DecodeFromBytes(data, p)
+ err := omci.MeBasePacket.DecodeFromBytes(data, p, 6 + 1)
if err != nil {
return err
}
diff --git a/omci.go b/omci.go
index 3904352..e347b48 100644
--- a/omci.go
+++ b/omci.go
@@ -113,8 +113,8 @@
MessageType MessageType
DeviceIdentifier DeviceIdent
ResponseExpected bool // Significant for Download Section Request only
- Payload []byte
- padding []byte
+ Payload []byte // TODO: Deprecated. Use layers.BaseLayer.Payload
+ padding []byte // TODO: Deprecated. Never Used
Length uint16
MIC uint32
}
@@ -137,7 +137,7 @@
// LayerContents returns the OMCI specific layer information
func (omci *OMCI) LayerContents() []byte {
- b := make([]byte, 8)
+ b := make([]byte, 4)
binary.BigEndian.PutUint16(b, omci.TransactionID)
b[2] = byte(omci.MessageType)
b[3] = byte(omci.DeviceIdentifier)
@@ -252,7 +252,7 @@
//return errors.New(msg)
}
}
- omci.BaseLayer = layers.BaseLayer{data[:4], data[4:]}
+ omci.BaseLayer = layers.BaseLayer{data[:4], data[4:omci.Length]}
p.AddLayer(omci)
nextLayer, err := MsgTypeToNextLayer(omci.MessageType)
if err != nil {
diff --git a/omci_test.go b/omci_test.go
index d49f3cd..a775358 100644
--- a/omci_test.go
+++ b/omci_test.go
@@ -1091,28 +1091,59 @@
cid := 0x25
eid := 1
mask := 0x8000
- hdr := "00032e0a00020000002500018000"
- trailer := "0000002828ce00e2"
- attr := "0102030405060708090A0B0C0D0E0F101112131415161718191A"
- msg := hdr + attr + trailer
+ omci_hdr := "00032e0a"
+ msg_hdr := "00020000002500018000"
+ attr := "0102030405060708090A0B0C0D0E0F101112131415161718191A"
+ trailer := "0000002828ce00e2"
+ msg := omci_hdr + msg_hdr + attr + trailer
data, err := stringToPacket(msg)
assert.NoError(t, err)
- packet := gopacket.NewPacket(data, LayerTypeOMCI, gopacket.NoCopy)
+ // Decode packet (lazy this time)
+ packet := gopacket.NewPacket(data, LayerTypeOMCI, gopacket.Lazy)
assert.NotNil(t, packet)
+ // OMCI Layer Contents are the
+ // - TCI (2 bytes)
+ // - Msg Type (1 byte)
+ // - Device Ident (1 byte)
+ //
+ // payload is remaining layers (less optional length and MIC)
+
omciLayer := packet.Layer(LayerTypeOMCI)
assert.NotNil(t, packet)
+ contents := omciLayer.LayerContents()
+ payload := omciLayer.LayerPayload()
+ assert.NotNil(t, contents)
+ assert.NotNil(t, payload)
+ assert.Equal(t, len(omci_hdr) / 2, len(contents))
+ assert.Equal(t, (len(msg_hdr) + len(attr)) / 2, len(payload))
+
omciMsg, ok := omciLayer.(*OMCI)
assert.True(t, ok)
assert.Equal(t, omciMsg.TransactionID, uint16(tid))
assert.Equal(t, omciMsg.MessageType, MibUploadNextResponseType)
assert.Equal(t, omciMsg.Length, uint16(40))
+ // Message Layer contents for a MIB upload next response are the
+ // - ONU Data Class/Instance (4 bytes)
+ // - Reported Managed Entity Class/Instance (4 bytes)
+ // - Attribute Mask (2 bytes)
+ //
+ // Message Layer payload for a MIB upload next response are the attributes
+ // and zero-padding (but not length & MIC)
+
msgLayer := packet.Layer(LayerTypeMibUploadNextResponse)
assert.NotNil(t, msgLayer)
+ contents = msgLayer.LayerContents()
+ payload = msgLayer.LayerPayload()
+ assert.NotNil(t, contents)
+ assert.NotNil(t, payload)
+ assert.Equal(t, len(msg_hdr) / 2, len(contents))
+ assert.Equal(t, len(attr) / 2, len(payload))
+
uploadResponse, ok2 := msgLayer.(*MibUploadNextResponse)
assert.True(t, ok2)
assert.NotNil(t, uploadResponse)