Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate servingNetworkName from vPLMN instead of hPLMN #33

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/control_test_engine/gnb/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func (gnb *GNBContext) GetSliceInBytes() ([]byte, []byte) {
return sstBytes, nil
}

func (gnb *GNBContext) getMccAndMnc() (string, string) {
func (gnb *GNBContext) GetMccAndMnc() (string, string) {
return gnb.controlInfo.mcc, gnb.controlInfo.mnc
}

Expand Down
2 changes: 2 additions & 0 deletions internal/control_test_engine/gnb/context/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ type UEMessage struct {
ConnectionClosed bool
AmfId int64
Msin string
Mcc string
Mnc string
}
2 changes: 2 additions & 0 deletions internal/control_test_engine/gnb/nas/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func gnbListen(gnb *context.GNBContext) {
// select AMF and get sctp association
// make a tun interface
ue := gnb.NewGnBUe(message.GNBTx, message.GNBRx, message.Msin)
mcc, mnc := gnb.GetMccAndMnc()
message.GNBTx <- context.UEMessage{Mcc: mcc, Mnc: mnc}
ue.SetPduSessions(message.GNBPduSessions)

if ue == nil {
Expand Down
18 changes: 11 additions & 7 deletions internal/control_test_engine/ue/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type Amf struct {
amfSetId uint16
amfPointer uint8
amfUeId int64
mcc string
mnc string
}

type UEPDUSession struct {
Expand Down Expand Up @@ -165,9 +167,6 @@ func (ue *UEContext) NewRanUeContext(msin string,
}
}

// added snn.
ue.UeSecurity.Snn = ue.deriveSNN()

ue.scenarioChan = scenarioChan

// added initial state for MM(NULL)
Expand Down Expand Up @@ -377,12 +376,11 @@ func (pduSession *UEPDUSession) GetStateSM() int {
func (ue *UEContext) deriveSNN() string {
// 5G:mnc093.mcc208.3gppnetwork.org
var resu string
if len(ue.UeSecurity.mnc) == 2 {
resu = "5G:mnc0" + ue.UeSecurity.mnc + ".mcc" + ue.UeSecurity.mcc + ".3gppnetwork.org"
if len(ue.amfInfo.mnc) == 2 {
resu = "5G:mnc0" + ue.amfInfo.mnc + ".mcc" + ue.amfInfo.mcc + ".3gppnetwork.org"
} else {
resu = "5G:mnc" + ue.UeSecurity.mnc + ".mcc" + ue.UeSecurity.mcc + ".3gppnetwork.org"
resu = "5G:mnc" + ue.amfInfo.mnc + ".mcc" + ue.amfInfo.mcc + ".3gppnetwork.org"
}

return resu
}

Expand Down Expand Up @@ -506,6 +504,12 @@ func (ue *UEContext) GetAmfUeId() int64 {
return ue.amfInfo.amfUeId
}

func (ue *UEContext) SetAmfMccAndMnc(mcc string, mnc string) {
ue.amfInfo.mcc = mcc
ue.amfInfo.mnc = mnc
ue.UeSecurity.Snn = ue.deriveSNN()
}

func (ue *UEContext) Get5gGuti() [4]uint8 {
return ue.UeSecurity.Guti
}
Expand Down
2 changes: 2 additions & 0 deletions internal/control_test_engine/ue/nas/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ func InitConn(ue *context.UEContext, gnb *gnbContext.GNBContext) {

// Send channels to gNB
inboundChannel <- gnbContext.UEMessage{GNBTx: ue.GetGnbTx(), GNBRx: ue.GetGnbRx(), Msin: ue.GetMsin()}
msg := <-ue.GetGnbTx()
ue.SetAmfMccAndMnc(msg.Mcc, msg.Mnc)
}
5 changes: 4 additions & 1 deletion internal/control_test_engine/ue/ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ func gnbMsgHandler(msg context2.UEMessage, ue *context.UEContext) {
// handling NAS message.
ue.SetAmfUeId(msg.AmfId)
state.DispatchState(ue, msg.Nas)
} else {
} else if msg.GNBPduSessions[0] != nil {
// Setup PDU Session
serviceGtp.SetupGtpInterface(ue, msg)
} else {
log.Error("[UE] Received unknown message from gNodeB", msg)
}
}

Expand Down
Loading