feat(amf): Added Implicit Deregistration Support#11995
feat(amf): Added Implicit Deregistration Support#11995rsarwad merged 3 commits intomagma:masterfrom Lkishor123:LKishor123/implicit_deregistration
Conversation
|
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
uri200
left a comment
There was a problem hiding this comment.
please divide this PR into smaller PRs
@uri200 thanks for the input. |
rsarwad
left a comment
There was a problem hiding this comment.
Left some comments on this PR
| m5gmm_state_t mm_state; | ||
| int rc = RETURNerror; | ||
|
|
||
| rc = amf_get_ue_context_mm_state(ue_id, &mm_state); |
There was a problem hiding this comment.
You can minimize the statements
There was a problem hiding this comment.
There are some cleanups required on the Unit Tests and we will take it up in subsequent PR. Also can you please elaborate your suggestion You can minimize the statements, Thanks.
There was a problem hiding this comment.
With minimum statement; the above statements can be written as
if ((amf_get_ue_context_mm_state(ue_id, &mm_state)) != RETURNok) {
return false;
}
| ula_ans = util_amf_send_s6a_ula(IMSI_STR); | ||
|
|
||
| int rc = amf_handle_s6a_update_location_ans(&ula_ans); | ||
| EXPECT_TRUE(rc == RETURNok); |
There was a problem hiding this comment.
We can add some more checks like apn sent in ULA matches with updated UE context.
If we don't send apn; what is expected.
There was a problem hiding this comment.
There are changes planed for this and it is planned for a upcoming PR.
There was a problem hiding this comment.
Could you please add TODO statement and as part of new PR, you can remove TODO statement
There was a problem hiding this comment.
| sizeof(ue_auth_response_hexbuf)); | ||
| EXPECT_TRUE(rc == RETURNok); | ||
|
|
||
| /* Send uplink nas message for security mode complete response from UE */ |
There was a problem hiding this comment.
General comment, use // for single line comment
There was a problem hiding this comment.
| #define T3586_DEFAULT_VALUE 0 // TODO-RECHECK | ||
| #define T3589_DEFAULT_VALUE 0 // TODO-RECHECK | ||
| #define T3595_DEFAULT_VALUE 0 | ||
| #define IMPLICIT_DEREG_TIMER 30 |
There was a problem hiding this comment.
Could you rename to IMPLICIT_DEREG_TIMER_VALUE.
Implicit detach timer value is 30 or the value of T3512 timer + 4 minutes
There was a problem hiding this comment.
Yes agreed, we will raise a new PR. Raised a zenhub task for this.
There was a problem hiding this comment.
| if (amf_ctx_p) { | ||
| rc = amf_proc_deregistration_request(ue_id, ¶ms); | ||
| } else { | ||
| OAILOG_ERROR(LOG_NAS_AMF, "Error: amf_ctx does not exits"); |
There was a problem hiding this comment.
Can you include ue_ngap_id while logging
There was a problem hiding this comment.
General comment: While logging if amf context have valid imsi64 then use OAILOG_ERROR_UE with appropriate log level
There was a problem hiding this comment.
|
LGTM and hoping remaining comments would be taken care in https://app.zenhub.com/workspaces/magma--5g-sa-60871e99b9326f001696b1ee/issues/magma/magma/12156 |
@ulaskozat , @rsarwad please merge the PR. |
| NGAP_NAS_UE_NOT_AVAILABLE_FOR_PS, | ||
| NGAP_USER_INACTIVITY | ||
| }; | ||
| } n2cause; |
There was a problem hiding this comment.
Could you rename to n2cause_e to indicate as enum
There was a problem hiding this comment.
Comment addressed.
| if ((amf_ue_ngap_id != INVALID_AMF_UE_NGAP_ID) && (imsi != 0)) { | ||
| m_rc = amf_ue_context_p->imsi_amf_ue_id_htbl.remove( | ||
| ue_context_p->amf_context.imsi64); | ||
| m_rc = amf_ue_context_p->imsi_amf_ue_id_htbl.remove( |
There was a problem hiding this comment.
Removal of imsi from imsi_amf_ue_id_htbl, should be under below condition, because if we update gnb_ngap_id_key, we don't return from there so we will hit this statement and removes the entry from hash list.
There was a problem hiding this comment.
Comment addressed.
| amf_ue_context_t* const amf_ue_context_p, const guti_m5_t* const guti_p) { | ||
| magma::map_rc_t m_rc = magma::MAP_OK; | ||
| uint64_t amf_ue_ngap_id64 = 0; | ||
| ue_m5gmm_context_t* ue_context = NULL; |
There was a problem hiding this comment.
For pointer, it's preferred as ue_context_p
There was a problem hiding this comment.
Comment addressed.
| amf_ue_context_t* const amf_ue_context_p, | ||
| struct ue_m5gmm_context_s* ue_context_p, m5gcm_state_t new_cm_state) { | ||
| // Function is used to update UE's Signaling Connection State | ||
| hashtable_rc_t hash_rc = HASH_TABLE_OK; |
There was a problem hiding this comment.
Comment addressed.
| ** ** | ||
| ** ** | ||
| ***************************************************************************/ | ||
| ue_m5gmm_context_s* amf_ue_context_exists_gnb_ue_ngap_id( |
There was a problem hiding this comment.
Can be implemented something similar to amf_ue_context_exists_amf_ue_ngap_id() to decrease the number of lines
There was a problem hiding this comment.
Comment addressed.
| if (ue_context_p->m5_implicit_deregistration_timer.id != | ||
| NAS5G_TIMER_INACTIVE_ID) { | ||
| amf_app_stop_timer(ue_context_p->m5_implicit_deregistration_timer.id); | ||
| ue_context_p->m5_implicit_deregistration_timer.id = NAS5G_TIMER_INACTIVE_ID; |
There was a problem hiding this comment.
This statement is not required because anyway m5_implicit_deregistration_timer.id gets updated while starting the timer
There was a problem hiding this comment.
Comment addressed.
| amf_ue_context_p->tun11_ue_context_htbl.remove(ue_context_p->amf_teid_n11); | ||
| // Api for release UE context | ||
| void amf_ctx_release_ue_context(ue_m5gmm_context_s* ue_context_p, | ||
| n2cause n2_cause) { |
There was a problem hiding this comment.
Add OAILOG_FUNC_IN and OAILOG_FUNC_OUT and for successful case, there is no return statement
There was a problem hiding this comment.
Comment addressed.
| "Ue Context Release Timer: ue_amf_context is NULL for " | ||
| "ue id: " AMF_UE_NGAP_ID_FMT "\n", | ||
| ue_id); | ||
| OAILOG_FUNC_RETURN(LOG_NAS_AMF, RETURNok); |
There was a problem hiding this comment.
Module name should be LOG_AMF_APP.
General comment is to use appropriate module name
There was a problem hiding this comment.
Comment addressed.
| amf_ue_context_exists_amf_ue_ngap_id(ue_id); | ||
|
|
||
| if (ue_context_p == NULL) { | ||
| return RETURNerror; |
There was a problem hiding this comment.
Use OAI provided macros while retuning
There was a problem hiding this comment.
Comment addressed.
| amf_ue_context_exists_amf_ue_ngap_id(ue_id); | ||
|
|
||
| if (ue_context_p == NULL) { | ||
| return RETURNerror; |
There was a problem hiding this comment.
Comment addressed.
| int amf_proc_registration_abort(amf_context_t* amf_ctx, | ||
| struct ue_m5gmm_context_s* ue_amf_context); | ||
|
|
||
| // Fetch the ue contet from imsi |
There was a problem hiding this comment.
Comment addressed.
Signed-off-by: LKishor123 <[email protected]> Signed-off-by: LKishor123 <[email protected]>
Signed-off-by: LKishor123 <[email protected]>
Signed-off-by: LKishor123 <[email protected]>
Signed-off-by: sreedharkumartn <[email protected]>
|
Oops! Looks like you failed the Howto
|
* feat(amf): Added Implicit Deregistration Support Signed-off-by: LKishor123 <[email protected]> Signed-off-by: LKishor123 <[email protected]> * fix(amf): fixed incorrect flag for implicit deregistration Signed-off-by: LKishor123 <[email protected]> * fix(amf): Review comments addressed Signed-off-by: LKishor123 <[email protected]>
Signed-off-by: sreedharkumartn <[email protected]>
* feat(amf): Added Implicit Deregistration Support Signed-off-by: LKishor123 <[email protected]> Signed-off-by: LKishor123 <[email protected]> * fix(amf): fixed incorrect flag for implicit deregistration Signed-off-by: LKishor123 <[email protected]> * fix(amf): Review comments addressed Signed-off-by: LKishor123 <[email protected]>
Signed-off-by: LKishor123 [email protected]
Summary
Introduced amf_nas_proc_implicit_deregister_ue_ind() for cleaning the older UE when
getting a new registration from same (without deregistration)
Functions : amf_nas_proc_implicit_deregister_ue_ind,
amf_cn_implicit_deregister_ue,
Introduced the related timers (mobile rechability and implicit deregistration)
Introduced new create_new_registration_info
Introduced new function proc_new_registration_req() that will be triggered at the end
of implicit_deregistration
Added the handling of context release complete message
Corrected the usage for cm_state (connection Management) to track GNB connectivity.
This will also be used for triggere
Flattned the Ngcause and replaced with simple enums n2cause
Code re-organization and new lookup functions
Test Plan
Unit Testcases added:
Additional Information