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

Send Deregistration Notify before UDM modifies the UE context #25

Merged
merged 6 commits into from
Oct 12, 2023
Merged
Changes from 3 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
25 changes: 18 additions & 7 deletions internal/sbi/producer/ue_context_management.go
Copy link
Collaborator

Choose a reason for hiding this comment

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

In HandleRegistrationAmf3gppAccessRequest():

	// step 3: handle the message
	header, response, problemDetails := RegistrationAmf3gppAccessProcedure(registerRequest, ueID)
	// step 4: process the return value from step 3
	if response != nil {
		if header != nil {
			// status code is based on SPEC, and option headers
			return httpwrapper.NewResponse(http.StatusCreated, header, response)
		}
		return httpwrapper.NewResponse(http.StatusOK, nil, response)
	} else if problemDetails != nil {
	...

Copy link
Collaborator

Choose a reason for hiding this comment

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

@YouShengLiu you missed this patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will supplement it.

Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ func RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegi
) {
// TODO: EPS interworking with N26 is not supported yet in this stage
var oldAmf3GppAccessRegContext *models.Amf3GppAccessRegistration
var ue *udm_context.UdmUeContext

if udm_context.Getself().UdmAmf3gppRegContextExists(ueID) {
ue, _ := udm_context.Getself().UdmUeFindBySupi(ueID)
ue, _ = udm_context.Getself().UdmUeFindBySupi(ueID)
oldAmf3GppAccessRegContext = ue.Amf3GppAccessRegistration
}

Expand Down Expand Up @@ -248,13 +250,22 @@ func RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegi
// TS 23.502 4.2.2.2.2 14d: UDM initiate a Nudm_UECM_DeregistrationNotification to the old AMF
// corresponding to the same (e.g. 3GPP) access, if one exists
if oldAmf3GppAccessRegContext != nil {
deregistData := models.DeregistrationData{
DeregReason: models.DeregistrationReason_SUBSCRIPTION_WITHDRAWN,
AccessType: models.AccessType__3_GPP_ACCESS,
}
callback.SendOnDeregistrationNotification(ueID, oldAmf3GppAccessRegContext.DeregCallbackUri,
deregistData) // Deregistration Notify Triggered
if !ue.SameAsStoredGUAMI3gpp(*oldAmf3GppAccessRegContext.Guami) {
deregistData := models.DeregistrationData{
Copy link
Collaborator

@tim-ywliu tim-ywliu Oct 11, 2023

Choose a reason for hiding this comment

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

modify as below:

                        // Based on TS 23.502 4.2.2.2.2, If the serving NF removal reason indicated by the UDM is Initial Registration,
                        // the old AMF invokes the Nsmf_PDUSession_ReleaseSMContext (SM Context ID). Thus we give different
                        // dereg cause based on registration parameter from serving AMF
                        deregReason := models.DeregistrationReason_UE_REGISTRATION_AREA_CHANGE
                        if request.InitialRegistrationInd {
                                deregReason = models.DeregistrationReason_UE_INITIAL_REGISTRATION
                        }

                        deregistData := models.DeregistrationData{
                                DeregReason: deregReason,
                                AccessType:  models.AccessType__3_GPP_ACCESS,
                        }

DeregReason: models.DeregistrationReason_SUBSCRIPTION_WITHDRAWN,
AccessType: models.AccessType__3_GPP_ACCESS,
}

logger.UecmLog.Infof("Send DeregNotify to old AMF GUAMI=%v", oldAmf3GppAccessRegContext.Guami)
Copy link
Collaborator

Choose a reason for hiding this comment

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

move this logger into go routine.

go func() {
pd := callback.SendOnDeregistrationNotification(ueID,
oldAmf3GppAccessRegContext.DeregCallbackUri,
deregistData) // Deregistration Notify Triggered
if pd != nil {
logger.UecmLog.Errorf("RegistrationAmf3gppAccess: send DeregNotify fail %v", pd)
}
}()
}
return nil, nil, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be

return nil, &registerRequest, nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will modify it.

} else {
header = make(http.Header)
Expand Down