-
Notifications
You must be signed in to change notification settings - Fork 128
test: HandleCreateUEContext #165
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
base: main
Are you sure you want to change the base?
Conversation
|
example code for the following blog. |
Alonza0314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Warnln to instead
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have define in line 650, this function will return the amPolicyReqTriggers automatically without specifying it at return statement.
|
|
||
| sourceUe := targetUe.SourceUe | ||
| if sourceUe == nil { | ||
| // TODO: Send Namf_Communication_CreateUEContext Response to S-AMF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the timeout case, I think we need some clear mechanism for removing created instances since the HO procedure is failed.
No description provided.