Skip to content

Commit

Permalink
Update handler.go (#113)
Browse files Browse the repository at this point in the history
* Update handler.go

* fix: target AMF should not be self

* style: linter error

* fix: typo

* fix: After SendRerouteNasRequest(), it should return err

* Update handler.go

return error added

* Update handler.go

line 1235
[return nill] deleted, since it will reach the following return

---------

Co-authored-by: brianchennn <[email protected]>
  • Loading branch information
Leon777-coder and brianchennn authored Dec 26, 2023
1 parent 7a721df commit 21aa437
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
21 changes: 16 additions & 5 deletions internal/gmm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,16 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
needSliceSelection = true
break
}

reqSnssai := models.Snssai{
Sst: requestedSnssai.ServingSnssai.Sst,
Sd: requestedSnssai.ServingSnssai.Sd,
}

if !amfSelf.InPlmnSupportList(reqSnssai) {
needSliceSelection = true
break
}
}

if needSliceSelection {
Expand Down Expand Up @@ -1161,12 +1171,12 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
// Step 6
searchTargetAmfQueryParam := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{}
if ue.NetworkSliceInfo != nil {
netwotkSliceInfo := ue.NetworkSliceInfo
if netwotkSliceInfo.TargetAmfSet != "" {
networkSliceInfo := ue.NetworkSliceInfo
if networkSliceInfo.TargetAmfSet != "" {
// TS 29.531
// TargetAmfSet format: ^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$
// mcc-mnc-amfRegionId(8 bit)-AmfSetId(10 bit)
targetAmfSetToken := strings.Split(netwotkSliceInfo.TargetAmfSet, "-")
targetAmfSetToken := strings.Split(networkSliceInfo.TargetAmfSet, "-")
guami := amfSelf.ServedGuamiList[0]
targetAmfPlmnId := models.PlmnId{
Mcc: targetAmfSetToken[0],
Expand All @@ -1182,9 +1192,9 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {

searchTargetAmfQueryParam.AmfRegionId = optional.NewString(targetAmfSetToken[2])
searchTargetAmfQueryParam.AmfSetId = optional.NewString(targetAmfSetToken[3])
} else if len(netwotkSliceInfo.CandidateAmfList) > 0 {
} else if len(networkSliceInfo.CandidateAmfList) > 0 {
// TODO: select candidate Amf based on local poilcy
searchTargetAmfQueryParam.TargetNfInstanceId = optional.NewInterface(netwotkSliceInfo.CandidateAmfList[0])
searchTargetAmfQueryParam.TargetNfInstanceId = optional.NewInterface(networkSliceInfo.CandidateAmfList[0])
}
}

Expand Down Expand Up @@ -1226,6 +1236,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
// Condition (B) Step 7: initial AMF can not find Target AMF via NRF -> Send Reroute NAS Request to RAN
allowedNssaiNgap := ngapConvert.AllowedNssaiToNgap(ue.AllowedNssai[anType])
ngap_message.SendRerouteNasRequest(ue, anType, nil, ue.RanUe[anType].InitialUEMessage, &allowedNssaiNgap)
return err
}
return nil
}
Expand Down
3 changes: 3 additions & 0 deletions internal/sbi/consumer/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func SearchAmfCommunicationInstance(ue *amf_context.AmfUe, nrfUri string, target
// select the first AMF, TODO: select base on other info
var amfUri string
for _, nfProfile := range resp.NfInstances {
if nfProfile.NfInstanceId == amf_context.GetSelf().NfId {
continue
}
ue.TargetAmfProfile = &nfProfile
amfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NAMF_COMM, models.NfServiceStatus_REGISTERED)
if amfUri != "" {
Expand Down

0 comments on commit 21aa437

Please sign in to comment.