Conversation
|
example code for the following blog. |
Alonza0314
left a comment
There was a problem hiding this comment.
There are a log of logrus.Error in test procedure. Do these should be ignore even if got in error? If they should not be ignore, maybe we need to substitute them with return error and t.Fatal in the main test function.
This feature is implemented based on TS 23.502 4.9.1.3.2 step 3 and 12.
…te to public. Change variables' names starting with Upper case letter.
internal/sbi/processor/ue_context.go
Outdated
| pendingHOResponseChan := make(chan context.PendingHandoverResponse) | ||
| value, loaded := amfSelf.PendingHandovers.LoadOrStore(ue.Supi, pendingHOResponseChan) | ||
| if loaded { | ||
| logger.CommLog.Info("PendingHandoverResponse channel created by HandoverRequestAcknowledge handler.") | ||
| pendingHOResponseChan = value.(chan context.PendingHandoverResponse) | ||
| } |
There was a problem hiding this comment.
var pendingHOResponseChan chan context.PendingHandoverResponse
value, loaded := amfSelf.PendingHandovers.LoadOrStore(ue.Supi, pendingHOResponseChan)
if loaded {
logger.CommLog.Info("PendingHandoverResponse channel created by HandoverRequestAcknowledge handler.")
pendingHOResponseChan = value.(chan context.PendingHandoverResponse)
} else {
pendingHOResponseChan = make(chan context.PendingHandoverResponse)
}
internal/ngap/handler.go
Outdated
| amfSelf := amfUe.ServingAMF() | ||
|
|
||
| // Create channel if not exist | ||
| pendingHOResponseChan := make(chan context.PendingHandoverResponse) |
There was a problem hiding this comment.
var pendingHOResponseChan chan context.PendingHandoverResponse
value, loaded := amfSelf.PendingHandovers.LoadOrStore(ue.Supi, pendingHOResponseChan)
if loaded {
logger.CommLog.Info("PendingHandoverResponse channel created by HandoverRequestAcknowledge handler.")
pendingHOResponseChan = value.(chan context.PendingHandoverResponse)
} else {
// handle the error
}There was a problem hiding this comment.
If I understand correctly, the pendingHOResponseChan should be crated already when receiving the HO Req Ack.
Please add error handling for the case of PendingHandovers not loaded.
There was a problem hiding this comment.
Yes. The pendingHOResponseChan should be created in CreateUEContextProcedure() right after the HO Req is sent. In this case, the loaded is set to true, and the pendingHOResponseChan is replaced by the loaded value. Otherwise, the pendingHOResponseChan created here is stored to the sync.Map and used afterwards. That's why I think the error handling for the if statement is not needed.
internal/context/context.go
Outdated
| return true | ||
| }) | ||
| if isEmpty { | ||
| logger.CommLog.Warnf("AmfRanPool is empty\n") |
internal/ngap/handler.go
Outdated
| if sourceUe == nil { | ||
| // TODO: Send Namf_Communication_CreateUEContext Response to S-AMF | ||
| ran.Log.Error("handover between different Ue has not been implement yet") | ||
| var ueContextCreatedData models.UeContextCreatedData |
There was a problem hiding this comment.
add helper function to build the models.UeContextCreatedData from provided amfUeContext.
| return | ||
| // TODO: Send to T-AMF | ||
| // Described in (23.502 4.9.1.3.2) step 3.Namf_Communication_CreateUEContext Request | ||
| /* |
There was a problem hiding this comment.
Why did this section remain in comment condition? If it doesn't need now, please remove it or leave the comment with why you make it as comment.
| targetRanUe.Log = logger.NgapLog | ||
|
|
||
| // send Handover Request to target RAN | ||
| ngap_message.SendHandoverRequestWithAMFChange( |
There was a problem hiding this comment.
You called SendHandoverRequestWithAMFChange before the channel created. If the load section is quicker than you make the channel, it will result in panic or unexpected handover fail.
| } | ||
| } | ||
| return | ||
| return amPolicyReqTriggers |
There was a problem hiding this comment.
As we have define in line 650, this function will return the amPolicyReqTriggers automatically without specifying it at return statement.
| @@ -1490,7 +1490,38 @@ func handleHandoverRequestAcknowledgeMain(ran *context.AmfRan, | |||
| if sourceUe == nil { | |||
| // TODO: Send Namf_Communication_CreateUEContext Response to S-AMF | |||
There was a problem hiding this comment.
After implementation, this TODO line can be removed.
| } else { | ||
| logger.CommLog.Info("PendingHandoverResponse channel closed.") | ||
| } | ||
| case <-time.After(100 * time.Millisecond): |
There was a problem hiding this comment.
After the timeout case, I think we need some clear mechanism for removing created instances since the HO procedure is failed.
No description provided.