Skip to content

Commit

Permalink
Add some fields validation from my5G-RANTester + support for Identity…
Browse files Browse the repository at this point in the history
…Request (SUCI) and send ConfigurateUpdateComplete after a ConfigurationUpdateCommand
  • Loading branch information
linouxis9 committed Dec 6, 2023
1 parent d4270d3 commit b0537f7
Show file tree
Hide file tree
Showing 17 changed files with 550 additions and 30 deletions.
17 changes: 7 additions & 10 deletions internal/common/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ func SimulateSingleUE(simConfig UESimulationConfig, wg *sync.WaitGroup) {

ueCfg.GNodeB.PlmnList.GnbId = gnbIdGenerator(simConfig.UeId%numGnb + 1)

// If there is currently a coroutine handling current UE
// kill it, before creating a new coroutine with same UE
// Use case: Registration of N UEs in loop, when loop = true
if simConfig.ScenarioChan != nil {
simConfig.ScenarioChan <- procedures.UeTesterMessage{Type: procedures.Kill}
close(simConfig.ScenarioChan)
}

// Launch a coroutine to handle UE's individual scenario
go func(scenarioChan chan procedures.UeTesterMessage, ueId int) {
wg.Add(1)
Expand Down Expand Up @@ -152,15 +144,20 @@ func SimulateSingleUE(simConfig UESimulationConfig, wg *sync.WaitGroup) {
for loop {
select {
case <-deregistrationChannel:
ueRx <- procedures.UeTesterMessage{Type: procedures.Terminate}
ueRx = nil
if ueRx != nil {
ueRx <- procedures.UeTesterMessage{Type: procedures.Terminate}
ueRx = nil
}
case <-handoverChannel:
if ueRx != nil {
ueRx <- procedures.UeTesterMessage{Type: procedures.Handover, GnbChan: simConfig.Gnbs[gnbIdGenerator((ueId+1)%numGnb+1)].GetInboundChannel()}
}
case msg := <-scenarioChan:
if ueRx != nil {
ueRx <- msg
if msg.Type == procedures.Terminate || msg.Type == procedures.Kill {
ueRx = nil
}
}
case msg := <-ueTx:
log.Info("[UE] Switched from state ", state, " to state ", msg.StateChange)
Expand Down
6 changes: 4 additions & 2 deletions internal/control_test_engine/gnb/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ func (gnb *GNBContext) DeleteGnBUe(ue *GNBUe) {
}
}
ue.Lock()
close(ue.gnbTx)
ue.gnbTx = nil
if ue.gnbTx != nil {
close(ue.gnbTx)
ue.gnbTx = nil
}
ue.Unlock()
}

Expand Down
2 changes: 1 addition & 1 deletion internal/control_test_engine/gnb/nas/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func processingConn(ue *context.GNBUe, gnb *context.GNBContext) {
gnbUeContext.SetStateDown()
gnb.DeleteGnBUe(ue)
} else if message.IsNas {
go nas.Dispatch(ue, message.Nas, gnb)
nas.Dispatch(ue, message.Nas, gnb)
} else if message.AmfId >= 0 {
log.Info("[GNB] Received incoming handover for UE")
gnbUeContext.SetStateReady()
Expand Down
2 changes: 1 addition & 1 deletion internal/control_test_engine/gnb/ngap/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Dispatch(amf *context.GNBAmf, gnb *context.GNBContext, message []byte) {
case ngapType.ProcedureCodeAMFConfigurationUpdate:
// handler NGAP AMF Configuration Update
log.Info("[GNB][NGAP] Receive AMF Configuration Update")
handler.HandlerAmfConfiguratonUpdate(amf, gnb, ngapMsg)
handler.HandlerAmfConfigurationUpdate(amf, gnb, ngapMsg)

case ngapType.ProcedureCodeErrorIndication:
// handler Error Indicator
Expand Down
2 changes: 1 addition & 1 deletion internal/control_test_engine/gnb/ngap/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func HandlerUeContextReleaseCommand(gnb *context.GNBContext, message *ngapType.N
log.Info("[GNB][NGAP] Releasing UE Context, cause: ", causeToString(cause))
}

func HandlerAmfConfiguratonUpdate(amf *context.GNBAmf, gnb *context.GNBContext, message *ngapType.NGAPPDU) {
func HandlerAmfConfigurationUpdate(amf *context.GNBAmf, gnb *context.GNBContext, message *ngapType.NGAPPDU) {

// TODO: Implement update AMF Context from AMFConfigurationUpdate
_ = message.InitiatingMessage.Value.AMFConfigurationUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func buildPDUSessionReleaseResponse(amfUeNgapID, ranUeNgapID int64, pduSessionId
pDUSessionResourceReleasedItemRelRes := ngapType.PDUSessionResourceReleasedItemRelRes{}

pDUSessionResourceReleasedItemRelRes.PDUSessionID = pduSessionId
pDUSessionResourceReleasedItemRelRes.PDUSessionResourceReleaseResponseTransfer = []byte{00}

pDUSessionResourceReleasedListRelRes.List = append(pDUSessionResourceReleasedListRelRes.List, pDUSessionResourceReleasedItemRelRes)
}
Expand Down
13 changes: 10 additions & 3 deletions internal/control_test_engine/ue/context/context.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* SPDX-License-Identifier: Apache-2.0
* © Copyright 2023 Hewlett Packard Enterprise Development LP
*/

package context

import (
Expand Down Expand Up @@ -700,9 +705,11 @@ func (ue *UEContext) Terminate() {
}

ue.Lock()
close(ue.gnbRx)
ue.gnbRx = nil
ue.Unlock()
if ue.gnbRx != nil {
close(ue.gnbRx)
ue.gnbRx = nil
ue.Unlock()
}
close(ue.scenarioChan)

log.Info("[UE] UE Terminated")
Expand Down
3 changes: 2 additions & 1 deletion internal/control_test_engine/ue/nas/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func DispatchNas(ue *context.UEContext, message []byte) {
case nas.MsgTypeIdentityRequest:
log.Info("[UE][NAS] Receive Identify Request")
// handler identity request.
handler.HandlerIdentityRequest(ue, m)

case nas.MsgTypeSecurityModeCommand:
// handler security mode command.
Expand All @@ -155,7 +156,7 @@ func DispatchNas(ue *context.UEContext, message []byte) {

case nas.MsgTypeConfigurationUpdateCommand:
log.Info("[UE][NAS] Receive Configuration Update Command")
log.Info("[UE][NAS] ", ue.GetSupi(), " was succesfully registered")
handler.HandlerConfigurationUpdateCommand(ue, m)

case nas.MsgTypeDLNASTransport:
// handler DL NAS Transport.
Expand Down
Loading

0 comments on commit b0537f7

Please sign in to comment.