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

Update handler.go #113

Merged
merged 7 commits into from
Dec 26, 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
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
Copy link

@ss920386 ss920386 Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be also considered for line 1234 callback.SendN1MessageNotifyAtAMFReAllocation(ue, n1Message.Bytes(), &registerContext)? Otherwise, will RegAceept be sent by the current AMF even when it requests for AMF Re-allocation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leon777-coder, Please add error return after line 1234.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it what the line 1241 doing?

Whenever this handler reach the needSliceSelection state (which goes all the way down to the line 1234 if no error occurs), it will return nil there (the line 1241). No further operation will be executed. Not to mention RegAccept in this situation.

}
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 @@ -99,6 +99,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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this check added because you got the current AMF as the query response from NRF? If that is the case, I think it is the query condition that has an issue to be fixed. (The exclusion check is fine and can be kept here since it is impossible to communicate with AMF itself. Just want to make sure if the codes of querying the target AMF is correct or not.)

continue
}
ue.TargetAmfProfile = &nfProfile
amfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NAMF_COMM, models.NfServiceStatus_REGISTERED)
if amfUri != "" {
Expand Down