diff --git a/ie/apply_action.go b/ie/apply_action.go index c315354..14285d1 100644 --- a/ie/apply_action.go +++ b/ie/apply_action.go @@ -1,6 +1,136 @@ package ie +import ( + "bytes" + "encoding/binary" + "fmt" +) + type ApplyAction struct { IEType uint16 Length uint16 + DFRT bool + IPMD bool + IPMA bool + DUPL bool + NOCP bool + BUFF bool + FORW bool + DROP bool + DDPN bool + BDPN bool + EDRT bool +} + +func NewApplyAction(dfrt, ipmd, ipma, dupl, nocp, buff, forw, drop, ddpn, bdpn, edrt bool) ApplyAction { + return ApplyAction{ + IEType: uint16(ApplyActionIEType), + Length: 2, + DFRT: dfrt, + IPMD: ipmd, + IPMA: ipma, + DUPL: dupl, + NOCP: nocp, + BUFF: buff, + FORW: forw, + DROP: drop, + DDPN: ddpn, + BDPN: bdpn, + EDRT: edrt, + } +} + +func (applyaction ApplyAction) Serialize() []byte { + buf := new(bytes.Buffer) + + // Octets 1 to 2: Type + binary.Write(buf, binary.BigEndian, uint16(applyaction.IEType)) + + // Octets 3 to 4: Length + binary.Write(buf, binary.BigEndian, uint16(applyaction.Length)) + + // Octet 5: DFRT (bit 8), IPMD (bit 7), IPMA (bit 6), DUPL (bit 5), NOCP (bit 4), BUFF (bit 3), FORW (bit 2), DROP (bit 1) + var byte5 byte + if applyaction.DFRT { + byte5 |= 1 << 7 + } + if applyaction.IPMD { + byte5 |= 1 << 6 + } + if applyaction.IPMA { + byte5 |= 1 << 5 + } + if applyaction.DUPL { + byte5 |= 1 << 4 + } + if applyaction.NOCP { + byte5 |= 1 << 3 + } + if applyaction.BUFF { + byte5 |= 1 << 2 + } + if applyaction.FORW { + byte5 |= 1 << 1 + } + if applyaction.DROP { + byte5 |= 1 + } + buf.WriteByte(byte5) + + // Octet 6: Spare (bits 8 to 4), DDPN (bit 3), BDPN (bit 2), EDRT (bit 1) + var byte6 byte + if applyaction.DDPN { + byte6 |= 1 << 2 + } + if applyaction.BDPN { + byte6 |= 1 << 1 + } + if applyaction.EDRT { + byte6 |= 1 + } + buf.WriteByte(byte6) + + return buf.Bytes() +} + +func (applyaction ApplyAction) IsZeroValue() bool { + return applyaction.Length == 0 +} + +func DeserializeApplyAction(ieType uint16, ieLength uint16, ieValue []byte) (ApplyAction, error) { + var applyaction ApplyAction + + if ieType != uint16(ApplyActionIEType) { + return applyaction, fmt.Errorf("invalid IE type: expected %d, got %d", ApplyActionIEType, ieType) + } + + if ieLength != 2 { + return applyaction, fmt.Errorf("invalid length field for ApplyAction: expected 2, got %d", ieLength) + } + + if len(ieValue) != 2 { + return applyaction, fmt.Errorf("invalid length for ApplyAction: got %d bytes, want 2", len(ieValue)) + } + + applyaction.IEType = ieType + applyaction.Length = ieLength + + // Deserialize the first byte (Octet 5) + byte5 := ieValue[0] + applyaction.DFRT = byte5&(1<<7) != 0 + applyaction.IPMD = byte5&(1<<6) != 0 + applyaction.IPMA = byte5&(1<<5) != 0 + applyaction.DUPL = byte5&(1<<4) != 0 + applyaction.NOCP = byte5&(1<<3) != 0 + applyaction.BUFF = byte5&(1<<2) != 0 + applyaction.FORW = byte5&(1<<1) != 0 + applyaction.DROP = byte5&1 != 0 + + // Deserialize the second byte (Octet 6) + byte6 := ieValue[1] + applyaction.DDPN = byte6&(1<<2) != 0 + applyaction.BDPN = byte6&(1<<1) != 0 + applyaction.EDRT = byte6&1 != 0 + + return applyaction, nil } diff --git a/ie/apply_action_test.go b/ie/apply_action_test.go new file mode 100644 index 0000000..11cabb2 --- /dev/null +++ b/ie/apply_action_test.go @@ -0,0 +1,153 @@ +package ie_test + +import ( + "testing" + + "github.com/dot-5g/pfcp/ie" +) + +func TestGivenCorrectValuesWhenNewApplyActionThenFieldsSetCorrectly(t *testing.T) { + dfrt := true + ipmd := false + ipma := true + dupl := false + nocp := false + buff := true + forw := false + drop := true + ddpn := true + bdpn := true + edrt := false + + applyAction := ie.NewApplyAction(dfrt, ipmd, ipma, dupl, nocp, buff, forw, drop, ddpn, bdpn, edrt) + + if applyAction.IEType != 44 { + t.Errorf("Expected IEType 44, got %d", applyAction.IEType) + } + + if applyAction.Length != 2 { + t.Errorf("Expected Length 2, got %d", applyAction.Length) + } + + if applyAction.DFRT != dfrt { + t.Errorf("Expected DFRT %v, got %v", dfrt, applyAction.DFRT) + } + + if applyAction.IPMD != ipmd { + t.Errorf("Expected IPMD %v, got %v", ipmd, applyAction.IPMD) + } + + if applyAction.IPMA != ipma { + t.Errorf("Expected IPMA %v, got %v", ipma, applyAction.IPMA) + } + + if applyAction.DUPL != dupl { + t.Errorf("Expected DUPL %v, got %v", dupl, applyAction.DUPL) + } + + if applyAction.NOCP != nocp { + t.Errorf("Expected NOCP %v, got %v", nocp, applyAction.NOCP) + } + + if applyAction.BUFF != buff { + t.Errorf("Expected BUFF %v, got %v", buff, applyAction.BUFF) + } + + if applyAction.FORW != forw { + t.Errorf("Expected FORW %v, got %v", forw, applyAction.FORW) + } + + if applyAction.DROP != drop { + t.Errorf("Expected DROP %v, got %v", drop, applyAction.DROP) + } + + if applyAction.DDPN != ddpn { + t.Errorf("Expected DDPN %v, got %v", ddpn, applyAction.DDPN) + } + + if applyAction.BDPN != bdpn { + t.Errorf("Expected BDPN %v, got %v", bdpn, applyAction.BDPN) + } + + if applyAction.EDRT != edrt { + t.Errorf("Expected EDRT %v, got %v", edrt, applyAction.EDRT) + } + +} + +func TestGivenApplyActionSerializedWhenDeserializeThenFieldsSetCorrectly(t *testing.T) { + dfrt := true + ipmd := false + ipma := true + dupl := false + nocp := false + buff := true + forw := false + drop := true + ddpn := true + bdpn := true + edrt := false + + applyAction := ie.NewApplyAction(dfrt, ipmd, ipma, dupl, nocp, buff, forw, drop, ddpn, bdpn, edrt) + + serialized := applyAction.Serialize() + + deserialized, err := ie.DeserializeApplyAction(44, 2, serialized[4:]) + + if err != nil { + t.Fatalf("Error deserializing ApplyAction: %v", err) + } + + if deserialized.IEType != 44 { + t.Errorf("Expected IEType 44, got %d", deserialized.IEType) + } + + if deserialized.Length != 2 { + t.Errorf("Expected Length 2, got %d", deserialized.Length) + } + + if deserialized.DFRT != dfrt { + t.Errorf("Expected DFRT %v, got %v", dfrt, deserialized.DFRT) + } + + if deserialized.IPMD != ipmd { + t.Errorf("Expected IPMD %v, got %v", ipmd, deserialized.IPMD) + } + + if deserialized.IPMA != ipma { + t.Errorf("Expected IPMA %v, got %v", ipma, deserialized.IPMA) + } + + if deserialized.DUPL != dupl { + t.Errorf("Expected DUPL %v, got %v", dupl, deserialized.DUPL) + } + + if deserialized.NOCP != nocp { + t.Errorf("Expected NOCP %v, got %v", nocp, deserialized.NOCP) + } + + if deserialized.BUFF != buff { + t.Errorf("Expected BUFF %v, got %v", buff, deserialized.BUFF) + } + + if deserialized.FORW != forw { + t.Errorf("Expected FORW %v, got %v", forw, deserialized.FORW) + } + + if deserialized.DROP != drop { + t.Errorf("Expected DROP %v, got %v", drop, deserialized.DROP) + } + + if deserialized.DDPN != ddpn { + t.Errorf("Expected DDPN %v, got %v", ddpn, deserialized.DDPN) + } + + if deserialized.BDPN != bdpn { + t.Errorf("Expected BDPN %v, got %v", bdpn, deserialized.BDPN) + } + + if deserialized.EDRT != edrt { + t.Errorf("Expected EDRT %v, got %v", edrt, deserialized.EDRT) + } + +} diff --git a/ie/cause.go b/ie/cause.go index 21e7648..0524b7c 100644 --- a/ie/cause.go +++ b/ie/cause.go @@ -7,14 +7,14 @@ import ( ) type Cause struct { - IEtype uint16 + IEType uint16 Length uint16 Value uint8 } func NewCause(value int) Cause { return Cause{ - IEtype: uint16(CauseIEType), + IEType: uint16(CauseIEType), Length: 1, Value: uint8(value), } @@ -24,7 +24,7 @@ func (cause Cause) Serialize() []byte { buf := new(bytes.Buffer) // Octets 1 to 2: Type - binary.Write(buf, binary.BigEndian, uint16(cause.IEtype)) + binary.Write(buf, binary.BigEndian, uint16(cause.IEType)) // Octets 3 to 4: Length binary.Write(buf, binary.BigEndian, uint16(cause.Length)) @@ -55,7 +55,7 @@ func DeserializeCause(ieType uint16, ieLength uint16, ieValue []byte) (Cause, er } return Cause{ - IEtype: ieType, + IEType: ieType, Length: ieLength, Value: ieValue[0], }, nil diff --git a/ie/create_far.go b/ie/create_far.go index 8131f04..d1ab331 100644 --- a/ie/create_far.go +++ b/ie/create_far.go @@ -1,8 +1,103 @@ package ie +import ( + "bytes" + "encoding/binary" + "fmt" +) + type CreateFAR struct { IEType uint16 Length uint16 FARID FARID ApplyAction ApplyAction } + +func NewCreateFAR(farid FARID, applyaction ApplyAction) CreateFAR { + return CreateFAR{ + IEType: uint16(CreateFARIEType), + Length: farid.Length + applyaction.Length + 8, + FARID: farid, + ApplyAction: applyaction, + } +} + +func (createfar CreateFAR) Serialize() []byte { + + buf := new(bytes.Buffer) + + // Octets 1 to 2: Type + binary.Write(buf, binary.BigEndian, uint16(createfar.IEType)) + + // Octets 3 to 4: Length + binary.Write(buf, binary.BigEndian, uint16(createfar.Length)) + + // Octets 5 to n: FAR ID + serializedFARID := createfar.FARID.Serialize() + buf.Write(serializedFARID) + + // Octets n+1 to m: Apply Action + serializedApplyAction := createfar.ApplyAction.Serialize() + buf.Write(serializedApplyAction) + + return buf.Bytes() + +} + +func (createfar CreateFAR) IsZeroValue() bool { + return createfar.Length == 0 +} + +func DeserializeCreateFAR(ieType uint16, length uint16, value []byte) (CreateFAR, error) { + var createfar CreateFAR + + if len(value) < IEHeaderLength { + return createfar, fmt.Errorf("invalid length for CreateFAR: got %d bytes, want at least %d", len(value), IEHeaderLength) + } + + createfar.IEType = ieType + createfar.Length = length + + buffer := bytes.NewBuffer(value) + + // Deserialize FARID + if buffer.Len() < 2 { + return createfar, fmt.Errorf("not enough data for FARID type") + } + faridIEType := binary.BigEndian.Uint16(buffer.Next(2)) + + if buffer.Len() < 2 { + return createfar, fmt.Errorf("not enough data for FARID length") + } + + faridIELength := binary.BigEndian.Uint16(buffer.Next(2)) + faridIEValue := buffer.Next(int(faridIELength)) + + farid, err := DeserializeFARID(faridIEType, faridIELength, faridIEValue) + if err != nil { + return createfar, fmt.Errorf("failed to deserialize FARID: %v", err) + } + createfar.FARID = farid + + if buffer.Len() < 2 { + return createfar, fmt.Errorf("not enough data for ApplyAction type") + } + applyactionIEType := binary.BigEndian.Uint16(buffer.Next(2)) + + if buffer.Len() < 2 { + return createfar, fmt.Errorf("not enough data for ApplyAction length") + } + applyactionIELength := binary.BigEndian.Uint16(buffer.Next(2)) + + if buffer.Len() < int(applyactionIELength) { + return createfar, fmt.Errorf("not enough data for ApplyAction value, expected %d, got %d", applyactionIELength, buffer.Len()) + } + applyactionIEValue := buffer.Next(int(applyactionIELength)) + + applyaction, err := DeserializeApplyAction(applyactionIEType, applyactionIELength, applyactionIEValue) + if err != nil { + return createfar, fmt.Errorf("failed to deserialize ApplyAction: %v", err) + } + createfar.ApplyAction = applyaction + return createfar, nil +} diff --git a/ie/create_far_test.go b/ie/create_far_test.go new file mode 100644 index 0000000..6014395 --- /dev/null +++ b/ie/create_far_test.go @@ -0,0 +1,126 @@ +package ie_test + +import ( + "fmt" + "testing" + + "github.com/dot-5g/pfcp/ie" +) + +func TestGivenCorrectValuesWhenNewFarThenFieldsSetCorrectly(t *testing.T) { + farId := ie.NewFarID(1) + dfrt := false + ipmd := false + ipma := true + dupl := true + nocp := false + buff := true + forw := false + drop := true + ddpn := true + bdpn := true + edrt := false + applyAction := ie.NewApplyAction(dfrt, ipmd, ipma, dupl, nocp, buff, forw, drop, ddpn, bdpn, edrt) + + createFar := ie.NewCreateFAR(farId, applyAction) + + if createFar.IEType != 3 { + t.Errorf("Expected IEType 3, got %d", createFar.IEType) + } + + if createFar.Length != 14 { + t.Errorf("Expected Length 14, got %d", createFar.Length) + } + + if createFar.FARID.Value != 1 { + t.Errorf("Expected FARID 1, got %d", createFar.FARID.Value) + } + + if createFar.ApplyAction.DFRT != dfrt { + t.Errorf("Expected DFRT %v, got %v", dfrt, createFar.ApplyAction.DFRT) + } + + if createFar.ApplyAction.IPMD != ipmd { + t.Errorf("Expected IPMD %v, got %v", ipmd, createFar.ApplyAction.IPMD) + } + + if createFar.ApplyAction.IPMA != ipma { + t.Errorf("Expected IPMA %v, got %v", ipma, createFar.ApplyAction.IPMA) + } + + if createFar.ApplyAction.DUPL != dupl { + t.Errorf("Expected DUPL %v, got %v", dupl, createFar.ApplyAction.DUPL) + } + + if createFar.ApplyAction.NOCP != nocp { + t.Errorf("Expected NOCP %v, got %v", nocp, createFar.ApplyAction.NOCP) + } + + if createFar.ApplyAction.BUFF != buff { + t.Errorf("Expected BUFF %v, got %v", buff, createFar.ApplyAction.BUFF) + } + + if createFar.ApplyAction.FORW != forw { + t.Errorf("Expected FORW %v, got %v", forw, createFar.ApplyAction.FORW) + } + + if createFar.ApplyAction.DROP != drop { + t.Errorf("Expected DROP %v, got %v", drop, createFar.ApplyAction.DROP) + } + + if createFar.ApplyAction.DDPN != ddpn { + t.Errorf("Expected DDPN %v, got %v", ddpn, createFar.ApplyAction.DDPN) + } + + if createFar.ApplyAction.BDPN != bdpn { + t.Errorf("Expected BDPN %v, got %v", bdpn, createFar.ApplyAction.BDPN) + } + + if createFar.ApplyAction.EDRT != edrt { + t.Errorf("Expected EDRT %v, got %v", edrt, createFar.ApplyAction.EDRT) + } +} + +func TestGivenSerializedWhenDeserializeCreateFarThenFieldsSetCorrectly(t *testing.T) { + farId := ie.NewFarID(1) + dfrt := false + ipmd := false + ipma := true + dupl := true + nocp := false + buff := true + forw := false + drop := true + ddpn := true + bdpn := true + edrt := false + applyAction := ie.NewApplyAction(dfrt, ipmd, ipma, dupl, nocp, buff, forw, drop, ddpn, bdpn, edrt) + createFar := ie.NewCreateFAR(farId, applyAction) + + serialized := createFar.Serialize() + + fmt.Printf("Serialized: %v\n", serialized) + fmt.Printf("Length of serialized %d\n", len(serialized)) + + deserialized, err := ie.DeserializeCreateFAR(3, 14, serialized[4:]) + + if err != nil { + t.Fatalf("Error deserializing CreateFAR: %v", err) + } + + if deserialized.IEType != 3 { + t.Errorf("Expected IEType 3, got %d", deserialized.IEType) + } + + if deserialized.Length != 14 { + t.Errorf("Expected Length 14, got %d", deserialized.Length) + } + + if deserialized.FARID != farId { + t.Errorf("Expected FARID %v, got %v", farId, deserialized.FARID) + } + + if deserialized.ApplyAction != applyAction { + t.Errorf("Expected ApplyAction %v, got %v", applyAction, deserialized.ApplyAction) + } +} diff --git a/ie/create_pdr.go b/ie/create_pdr.go index f16a1d2..36531db 100644 --- a/ie/create_pdr.go +++ b/ie/create_pdr.go @@ -17,7 +17,7 @@ type CreatePDR struct { func NewCreatePDR(pdrID PDRID, precedence Precedence, pdi PDI) CreatePDR { return CreatePDR{ IEType: uint16(CreatePDRIEType), - Length: pdrID.Length + precedence.Length + pdi.Length + 6, + Length: pdrID.Length + precedence.Length + pdi.Length + 12, PDRID: pdrID, Precedence: precedence, PDI: pdi, diff --git a/ie/create_pdr_test.go b/ie/create_pdr_test.go index ffe7e14..66b92a3 100644 --- a/ie/create_pdr_test.go +++ b/ie/create_pdr_test.go @@ -1,23 +1,24 @@ -package ie +package ie_test import ( - "fmt" "testing" + + "github.com/dot-5g/pfcp/ie" ) func TestGivenCorrectParametersWhenNewCreatePDRThenFieldsSetCorrectly(t *testing.T) { - pdrID := NewPDRID(1) - precedence := NewPrecedence(1) - sourceInterface, _ := NewSourceInterface(1) - pdi := NewPDI(sourceInterface) - createPDR := NewCreatePDR(pdrID, precedence, pdi) + pdrID := ie.NewPDRID(1) + precedence := ie.NewPrecedence(1) + sourceInterface, _ := ie.NewSourceInterface(1) + pdi := ie.NewPDI(sourceInterface) + createPDR := ie.NewCreatePDR(pdrID, precedence, pdi) if createPDR.IEType != 1 { t.Errorf("Expected CreatePDR IEType 1, got %d", createPDR.IEType) } - if createPDR.Length != 17 { - t.Errorf("Expected CreatePDR length 17, got %d", createPDR.Length) + if createPDR.Length != 23 { + t.Errorf("Expected CreatePDR length 23, got %d", createPDR.Length) } if createPDR.PDRID != pdrID { @@ -34,23 +35,20 @@ func TestGivenCorrectParametersWhenNewCreatePDRThenFieldsSetCorrectly(t *testing } func TestGivenSerializedWhenDeserializeCreatePDRThenFieldsSetCorrectly(t *testing.T) { - pdrID := NewPDRID(1) - precedence := NewPrecedence(1) - sourceInterface, _ := NewSourceInterface(1) - pdi := NewPDI(sourceInterface) - createPDR := NewCreatePDR(pdrID, precedence, pdi) + pdrID := ie.NewPDRID(1) + precedence := ie.NewPrecedence(1) + sourceInterface, _ := ie.NewSourceInterface(1) + pdi := ie.NewPDI(sourceInterface) + createPDR := ie.NewCreatePDR(pdrID, precedence, pdi) serialized := createPDR.Serialize() - fmt.Printf("Serialized: %v\n", serialized) - deserialized, err := DeserializeCreatePDR(1, 17, serialized[4:]) + deserialized, err := ie.DeserializeCreatePDR(1, 17, serialized[4:]) if err != nil { t.Fatalf("Error deserializing CreatePDR: %v", err) } - fmt.Printf("Deserialized: %v\n", deserialized) - if deserialized.IEType != 1 { t.Errorf("Expected CreatePDR IEType 1, got %d", deserialized.IEType) } diff --git a/ie/farID.go b/ie/farID.go index 62143ca..fe3851a 100644 --- a/ie/farID.go +++ b/ie/farID.go @@ -44,6 +44,10 @@ func DeserializeFARID(ieType uint16, ieLength uint16, ieValue []byte) (FARID, er return FARID{}, fmt.Errorf("invalid length for FARID: got %d bytes, want 4", len(ieValue)) } + if ieType != uint16(FARIDIEType) { + return FARID{}, fmt.Errorf("invalid IE type for FARID: got %d, want %d", ieType, FARIDIEType) + } + return FARID{ IEType: ieType, Length: ieLength, diff --git a/ie/ie.go b/ie/ie.go index 3486102..4fa3f92 100644 --- a/ie/ie.go +++ b/ie/ie.go @@ -11,11 +11,13 @@ type IEType uint16 const ( CreatePDRIEType IEType = 1 + CreateFARIEType IEType = 3 PDIIEType IEType = 17 CauseIEType IEType = 19 SourceInterfaceIEType IEType = 20 PrecedenceIEType IEType = 29 UPFunctionFeaturesIEType IEType = 43 + ApplyActionIEType IEType = 44 PDRIDIEType IEType = 56 FSEIDIEType IEType = 57 NodeIDIEType IEType = 60 @@ -77,6 +79,10 @@ func ParseInformationElements(b []byte) ([]InformationElement, error) { ie, err = DeserializeCreatePDR(uint16(ieType), ieLength, ieValue) case FARIDIEType: ie, err = DeserializeFARID(uint16(ieType), ieLength, ieValue) + case ApplyActionIEType: + ie, err = DeserializeApplyAction(uint16(ieType), ieLength, ieValue) + // case CreateFARIEType: + // ie, err = DeserializeCreateFAR(uint16(ieType), ieLength, ieValue) default: err = fmt.Errorf("unknown IE type %d", ieType) } diff --git a/tests/pfcp_association_release_test.go b/tests/pfcp_association_release_test.go index 7c9031e..12b85b5 100644 --- a/tests/pfcp_association_release_test.go +++ b/tests/pfcp_association_release_test.go @@ -152,8 +152,8 @@ func PFCPAssociationReleaseResponse(t *testing.T) { t.Errorf("PFCP Association Release Response handler was called with wrong cause length.\n- Sent cause length: %v\n- Received cause length %v\n", cause.Length, pfcpAssociationReleaseResponseReceivedCause.Length) } - if pfcpAssociationReleaseResponseReceivedCause.IEtype != cause.IEtype { - t.Errorf("PFCP Association Release Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEtype, pfcpAssociationReleaseResponseReceivedCause.IEtype) + if pfcpAssociationReleaseResponseReceivedCause.IEType != cause.IEType { + t.Errorf("PFCP Association Release Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEType, pfcpAssociationReleaseResponseReceivedCause.IEType) } if pfcpAssociationReleaseResponseReceivedCause.Value != cause.Value { diff --git a/tests/pfcp_association_setup_test.go b/tests/pfcp_association_setup_test.go index 22c085e..e5ddab2 100644 --- a/tests/pfcp_association_setup_test.go +++ b/tests/pfcp_association_setup_test.go @@ -189,8 +189,8 @@ func PFCPAssociationSetupResponse(t *testing.T) { } } - if pfcpAssociationSetupResponseReceivedCause.IEtype != cause.IEtype { - t.Errorf("PFCP Association Setup Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEtype, pfcpAssociationSetupResponseReceivedCause.IEtype) + if pfcpAssociationSetupResponseReceivedCause.IEType != cause.IEType { + t.Errorf("PFCP Association Setup Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEType, pfcpAssociationSetupResponseReceivedCause.IEType) } if pfcpAssociationSetupResponseReceivedCause.Length != cause.Length { diff --git a/tests/pfcp_association_update_test.go b/tests/pfcp_association_update_test.go index 0f766ed..a088ce6 100644 --- a/tests/pfcp_association_update_test.go +++ b/tests/pfcp_association_update_test.go @@ -151,8 +151,8 @@ func PFCPAssociationUpdateResponse(t *testing.T) { t.Errorf("PFCP Association Update Response handler was called with wrong cause length.\n- Sent cause length: %v\n- Received cause length %v\n", cause.Length, pfcpAssociationUpdateResponseReceivedCause.Length) } - if pfcpAssociationUpdateResponseReceivedCause.IEtype != cause.IEtype { - t.Errorf("PFCP Association Update Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEtype, pfcpAssociationUpdateResponseReceivedCause.IEtype) + if pfcpAssociationUpdateResponseReceivedCause.IEType != cause.IEType { + t.Errorf("PFCP Association Update Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEType, pfcpAssociationUpdateResponseReceivedCause.IEType) } if pfcpAssociationUpdateResponseReceivedCause.Value != cause.Value { diff --git a/tests/pfcp_node_report_test.go b/tests/pfcp_node_report_test.go index 497d456..381538f 100644 --- a/tests/pfcp_node_report_test.go +++ b/tests/pfcp_node_report_test.go @@ -184,8 +184,8 @@ func PFCPNodeReportResponse(t *testing.T) { t.Errorf("PFCP Node Report Response handler was called with wrong cause length.\n- Sent cause length: %v\n- Received cause length %v\n", cause.Length, pfcpNodeReportResponseReceivedCause.Length) } - if pfcpNodeReportResponseReceivedCause.IEtype != cause.IEtype { - t.Errorf("PFCP Node Report Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEtype, pfcpNodeReportResponseReceivedCause.IEtype) + if pfcpNodeReportResponseReceivedCause.IEType != cause.IEType { + t.Errorf("PFCP Node Report Response handler was called with wrong cause type.\n- Sent cause type: %v\n- Received cause type %v\n", cause.IEType, pfcpNodeReportResponseReceivedCause.IEType) } if pfcpNodeReportResponseReceivedCause.Value != cause.Value {