-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from Raguideau/test3
add pdu session release command test
- Loading branch information
Showing
15 changed files
with
262 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* © Copyright 2023 Hewlett Packard Enterprise Development LP | ||
*/ | ||
package builder | ||
|
||
import ( | ||
"my5G-RANTester/test/aio5gc/context" | ||
"my5G-RANTester/test/aio5gc/lib/tools" | ||
|
||
"github.com/free5gc/nas" | ||
"github.com/free5gc/nas/nasMessage" | ||
) | ||
|
||
func PDUSessionReleaseCommand(ue *context.UEContext, smContext context.SmContext, cause uint8) (msg []byte, err error) { | ||
nasMsg := buildPDUSessionReleaseCommand(ue, smContext, cause) | ||
nasPdu, err := nasMsg.PlainNasEncode() | ||
if err != nil { | ||
return nil, err | ||
} | ||
nasMsg, err = buildDLNASTransport(ue, nasPdu, uint8(smContext.GetPduSessionId())) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return tools.Encode(ue, nasMsg) | ||
} | ||
|
||
func buildPDUSessionReleaseCommand(ue *context.UEContext, smContext context.SmContext, cause uint8) *nas.Message { | ||
m := nas.NewMessage() | ||
m.GsmMessage = nas.NewGsmMessage() | ||
m.GsmHeader.SetMessageType(nas.MsgTypePDUSessionReleaseCommand) | ||
m.GsmHeader.SetExtendedProtocolDiscriminator(nasMessage.Epd5GSSessionManagementMessage) | ||
m.PDUSessionReleaseCommand = nasMessage.NewPDUSessionReleaseCommand(0x0) | ||
pDUSessionReleaseCommand := m.PDUSessionReleaseCommand | ||
|
||
pDUSessionReleaseCommand.SetMessageType(nas.MsgTypePDUSessionReleaseCommand) | ||
pDUSessionReleaseCommand.SetExtendedProtocolDiscriminator(nasMessage.Epd5GSSessionManagementMessage) | ||
pDUSessionReleaseCommand.SetPDUSessionID(uint8(smContext.GetPduSessionId())) | ||
|
||
pDUSessionReleaseCommand.SetPTI(smContext.GetPti()) | ||
pDUSessionReleaseCommand.SetCauseValue(cause) | ||
|
||
return m | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
test/aio5gc/msg/ngap/builder/pduSessionRessourceRelease.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* © Copyright 2023 Hewlett Packard Enterprise Development LP | ||
*/ | ||
package builder | ||
|
||
import ( | ||
"my5G-RANTester/lib/aper" | ||
"my5G-RANTester/lib/ngap" | ||
"my5G-RANTester/lib/ngap/ngapType" | ||
"my5G-RANTester/test/aio5gc/context" | ||
) | ||
|
||
func PDUSessionResourceRelease(nasPdu []byte, ue *context.UEContext, sessionId int32) ([]byte, error) { | ||
message, err := buildPDUSessionResourceRelease(nasPdu, ue, sessionId) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return ngap.Encoder(message) | ||
} | ||
|
||
func buildPDUSessionResourceRelease(nasPdu []byte, ue *context.UEContext, sessionId int32) (ngapType.NGAPPDU, error) { | ||
var pdu ngapType.NGAPPDU | ||
pdu.Present = ngapType.NGAPPDUPresentInitiatingMessage | ||
pdu.InitiatingMessage = new(ngapType.InitiatingMessage) | ||
|
||
initiatingMessage := pdu.InitiatingMessage | ||
initiatingMessage.ProcedureCode.Value = ngapType.ProcedureCodePDUSessionResourceRelease | ||
initiatingMessage.Criticality.Value = ngapType.CriticalityPresentReject | ||
initiatingMessage.Value.Present = ngapType.InitiatingMessagePresentPDUSessionResourceReleaseCommand | ||
initiatingMessage.Value.PDUSessionResourceReleaseCommand = new(ngapType.PDUSessionResourceReleaseCommand) | ||
|
||
pDUSessionResourceReleaseCommand := initiatingMessage.Value.PDUSessionResourceReleaseCommand | ||
PDUSessionResourceReleaseCommandIEs := &pDUSessionResourceReleaseCommand.ProtocolIEs | ||
|
||
// AMFUENGAPID | ||
ie := ngapType.PDUSessionResourceReleaseCommandIEs{} | ||
ie.Id.Value = ngapType.ProtocolIEIDAMFUENGAPID | ||
ie.Criticality.Value = ngapType.CriticalityPresentReject | ||
ie.Value.Present = ngapType.PDUSessionResourceReleaseCommandIEsPresentAMFUENGAPID | ||
ie.Value.AMFUENGAPID = new(ngapType.AMFUENGAPID) | ||
|
||
aMFUENGAPID := ie.Value.AMFUENGAPID | ||
aMFUENGAPID.Value = ue.GetAmfNgapId() | ||
|
||
PDUSessionResourceReleaseCommandIEs.List = append(PDUSessionResourceReleaseCommandIEs.List, ie) | ||
|
||
// RANUENGAPID | ||
ie = ngapType.PDUSessionResourceReleaseCommandIEs{} | ||
ie.Id.Value = ngapType.ProtocolIEIDRANUENGAPID | ||
ie.Criticality.Value = ngapType.CriticalityPresentReject | ||
ie.Value.Present = ngapType.PDUSessionResourceReleaseCommandIEsPresentRANUENGAPID | ||
ie.Value.RANUENGAPID = new(ngapType.RANUENGAPID) | ||
|
||
rANUENGAPID := ie.Value.RANUENGAPID | ||
rANUENGAPID.Value = ue.GetRanNgapId() | ||
|
||
PDUSessionResourceReleaseCommandIEs.List = append(PDUSessionResourceReleaseCommandIEs.List, ie) | ||
|
||
ie = ngapType.PDUSessionResourceReleaseCommandIEs{} | ||
ie.Id.Value = ngapType.ProtocolIEIDNASPDU | ||
ie.Criticality.Value = ngapType.CriticalityPresentIgnore | ||
ie.Value.Present = ngapType.PDUSessionResourceReleaseCommandIEsPresentNASPDU | ||
ie.Value.NASPDU = new(ngapType.NASPDU) | ||
|
||
ie.Value.NASPDU.Value = nasPdu | ||
|
||
PDUSessionResourceReleaseCommandIEs.List = append(PDUSessionResourceReleaseCommandIEs.List, ie) | ||
|
||
// PDUSessionResourceToReleaseListRelCmd | ||
ie = ngapType.PDUSessionResourceReleaseCommandIEs{} | ||
ie.Id.Value = ngapType.ProtocolIEIDPDUSessionResourceToReleaseListRelCmd | ||
ie.Criticality.Value = ngapType.CriticalityPresentReject | ||
ie.Value.Present = ngapType.PDUSessionResourceReleaseCommandIEsPresentPDUSessionResourceToReleaseListRelCmd | ||
|
||
pduSessionResourceReleasedList := ngapType.PDUSessionResourceToReleaseListRelCmd{} | ||
var item ngapType.PDUSessionResourceToReleaseItemRelCmd | ||
item.PDUSessionID.Value = int64(sessionId) | ||
|
||
pduSessionResourceReleaseCommandTransfer := ngapType.PDUSessionResourceReleaseCommandTransfer{ | ||
Cause: ngapType.Cause{ | ||
Present: ngapType.CausePresentNas, | ||
Nas: &ngapType.CauseNas{ | ||
Value: ngapType.CauseNasPresentNormalRelease, | ||
}, | ||
}, | ||
} | ||
buf, err := aper.MarshalWithParams(pduSessionResourceReleaseCommandTransfer, "valueExt") | ||
if err != nil { | ||
return ngapType.NGAPPDU{}, err | ||
} | ||
item.PDUSessionResourceReleaseCommandTransfer = buf | ||
pduSessionResourceReleasedList.List = append(pduSessionResourceReleasedList.List, item) | ||
|
||
ie.Value.PDUSessionResourceToReleaseListRelCmd = &pduSessionResourceReleasedList | ||
PDUSessionResourceReleaseCommandIEs.List = append(PDUSessionResourceReleaseCommandIEs.List, ie) | ||
|
||
return pdu, nil | ||
} |
Oops, something went wrong.