Skip to content

feat(amf): Added Implicit Deregistration Support#11995

Merged
rsarwad merged 3 commits intomagma:masterfrom
Lkishor123:LKishor123/implicit_deregistration
Mar 28, 2022
Merged

feat(amf): Added Implicit Deregistration Support#11995
rsarwad merged 3 commits intomagma:masterfrom
Lkishor123:LKishor123/implicit_deregistration

Conversation

@Lkishor123
Copy link
Copy Markdown
Contributor

@Lkishor123 Lkishor123 commented Mar 7, 2022

Signed-off-by: LKishor123 [email protected]

Summary

  1. Removed additional maps which were storing redundant information
  • ue_context_map (already having state_ue_map), amf_supi_guti_map (already existing maps can be used)
  1. 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)

  2. Introduced new create_new_registration_info

  • For storing the information of new registration when their is already a registred UE
  • This will also trigger amf_nas_proc_implicit_deregister_ue_ind
  1. Introduced new function proc_new_registration_req() that will be triggered at the end
    of implicit_deregistration

  2. Added the handling of context release complete message

  3. Corrected the usage for cm_state (connection Management) to track GNB connectivity.
    This will also be used for triggere

  4. Flattned the Ngcause and replaced with simple enums n2cause

  5. Code re-organization and new lookup functions

Test Plan

Unit Testcases added:

  • ImplicitDeregDuplicateSuciReg
  • ServiceRequestWrongTMSI
  • SctpShutWithServiceRequest
  • ServiceRequestSignalWithPDU

Additional Information

  • This change is backwards-breaking

@Lkishor123 Lkishor123 requested review from a team and pruthvihebbani March 7, 2022 13:35
@pull-request-size pull-request-size bot added the size/XXL Denotes a Pull Request that changes 1000+ lines. label Mar 7, 2022
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 7, 2022

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@Lkishor123 Lkishor123 marked this pull request as draft March 7, 2022 13:35
@github-actions github-actions bot added the component: agw Access gateway-related issue label Mar 7, 2022
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 7, 2022

feg-workflow

    2 files  202 suites   33s ⏱️
362 tests 362 ✔️ 0 💤 0
376 runs  376 ✔️ 0 💤 0

Results for commit 52cef39.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 7, 2022

agw-workflow

     71 files     101 suites   6m 4s ⏱️
1 016 tests 1 006 ✔️ 9 💤 0  1 🔥
1 017 runs  1 007 ✔️ 9 💤 0  1 🔥

For more details on these errors, see this check.

Results for commit b62411d.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

@uri200 uri200 left a comment

Choose a reason for hiding this comment

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

please divide this PR into smaller PRs

@Lkishor123
Copy link
Copy Markdown
Contributor Author

Lkishor123 commented Mar 10, 2022

please divide this PR into smaller PRs

@uri200 thanks for the input.
This PR turned out as a feature and all components are tightly coupled. As it is related to connection management, all the related state machines has to be synced. Breaking it into smaller PRs was having an impact on regression suit, specially in service request handling. We tried it but overall regression results were getting impacted, hence we kept as single PR.

@Lkishor123 Lkishor123 marked this pull request as ready for review March 10, 2022 19:28
Comment thread lte/gateway/c/core/oai/test/amf/amf_app_test_util.h Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/amf_cn.cpp Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/amf_cn.cpp
Comment thread lte/gateway/c/core/oai/tasks/amf/amf_cn.cpp
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp
Copy link
Copy Markdown
Contributor

@rsarwad rsarwad left a comment

Choose a reason for hiding this comment

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

Left some comments on this PR

Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp Outdated
m5gmm_state_t mm_state;
int rc = RETURNerror;

rc = amf_get_ue_context_mm_state(ue_id, &mm_state);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can minimize the statements

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With minimum statement; the above statements can be written as
if ((amf_get_ue_context_mm_state(ue_id, &mm_state)) != RETURNok) {
return false;
}

Comment thread lte/gateway/c/core/oai/test/amf/test_amf_encode_decode.cpp Outdated
ula_ans = util_amf_send_s6a_ula(IMSI_STR);

int rc = amf_handle_s6a_update_location_ans(&ula_ans);
EXPECT_TRUE(rc == RETURNok);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are changes planed for this and it is planned for a upcoming PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please add TODO statement and as part of new PR, you can remove TODO statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sizeof(ue_auth_response_hexbuf));
EXPECT_TRUE(rc == RETURNok);

/* Send uplink nas message for security mode complete response from UE */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

General comment, use // for single line comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#define T3586_DEFAULT_VALUE 0 // TODO-RECHECK
#define T3589_DEFAULT_VALUE 0 // TODO-RECHECK
#define T3595_DEFAULT_VALUE 0
#define IMPLICIT_DEREG_TIMER 30
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you rename to IMPLICIT_DEREG_TIMER_VALUE.
Implicit detach timer value is 30 or the value of T3512 timer + 4 minutes

Copy link
Copy Markdown
Contributor Author

@Lkishor123 Lkishor123 Mar 16, 2022

Choose a reason for hiding this comment

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

Yes agreed, we will raise a new PR. Raised a zenhub task for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if (amf_ctx_p) {
rc = amf_proc_deregistration_request(ue_id, &params);
} else {
OAILOG_ERROR(LOG_NAS_AMF, "Error: amf_ctx does not exits");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you include ue_ngap_id while logging

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

General comment: While logging if amf context have valid imsi64 then use OAILOG_ERROR_UE with appropriate log level

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread lte/gateway/c/core/oai/tasks/amf/amf_cn.cpp
Comment thread lte/gateway/c/core/oai/tasks/amf/nas_proc.cpp Outdated
Comment thread lte/gateway/c/core/oai/include/ngap_messages_types.h Outdated
Comment thread lte/gateway/c/core/oai/tasks/amf/amf_app_defs.h Outdated
@rsarwad
Copy link
Copy Markdown
Contributor

rsarwad commented Mar 17, 2022

@Lkishor123 Lkishor123 added the ready2merge This PR is ready to be merged (is approved and passes all required checks) label Mar 17, 2022
@Lkishor123
Copy link
Copy Markdown
Contributor Author

Lkishor123 commented Mar 21, 2022

@Lkishor123 Lkishor123 requested a review from rsarwad March 23, 2022 08:21
NGAP_NAS_UE_NOT_AVAILABLE_FOR_PS,
NGAP_USER_INACTIVITY
};
} n2cause;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you rename to n2cause_e to indicate as enum

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

m_rc is not required here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For pointer, it's preferred as ue_context_p

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix the cpp warning

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed.

** **
** **
***************************************************************************/
ue_m5gmm_context_s* amf_ue_context_exists_gnb_ue_ngap_id(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can be implemented something similar to amf_ue_context_exists_amf_ue_ngap_id() to decrease the number of lines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

@rsarwad rsarwad Mar 24, 2022

Choose a reason for hiding this comment

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

This statement is not required because anyway m5_implicit_deregistration_timer.id gets updated while starting the timer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add OAILOG_FUNC_IN and OAILOG_FUNC_OUT and for successful case, there is no return statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Module name should be LOG_AMF_APP.
General comment is to use appropriate module name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed.

amf_ue_context_exists_amf_ue_ngap_id(ue_id);

if (ue_context_p == NULL) {
return RETURNerror;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use OAI provided macros while retuning

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed.

amf_ue_context_exists_amf_ue_ngap_id(ue_id);

if (ue_context_p == NULL) {
return RETURNerror;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed.

@Lkishor123 Lkishor123 requested a review from rsarwad March 24, 2022 15:15
Copy link
Copy Markdown
Contributor

@rsarwad rsarwad left a comment

Choose a reason for hiding this comment

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

LGTM

sreedharkumartn added a commit to sreedharkumartn/magma that referenced this pull request Mar 25, 2022
@rsarwad rsarwad merged commit 4144e58 into magma:master Mar 28, 2022
@github-actions
Copy link
Copy Markdown
Contributor

Oops! Looks like you failed the Semantic PR check.

Howto

ardzoht pushed a commit that referenced this pull request Mar 30, 2022
* 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]>
sreedharkumartn added a commit to sreedharkumartn/magma that referenced this pull request Apr 12, 2022
@panyogesh panyogesh added the backport-v1.7 MME fixes to be backported for 1.7 label Apr 25, 2022
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v1.7 MME fixes to be backported for 1.7 component: agw Access gateway-related issue product: 5g sa ready2merge This PR is ready to be merged (is approved and passes all required checks) size/XXL Denotes a Pull Request that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants