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

fix(agw): Modified code to replace state_teid_hash list to protobuf map in spgw task #13843

Merged
merged 6 commits into from
Oct 12, 2022

Conversation

rsarwad
Copy link
Contributor

@rsarwad rsarwad commented Sep 5, 2022

Signed-off-by: Rashmi rashmi.sarwad@radisys.com

Summary

fix(agw): Modified code to replace state_teid_hash list to protobuf map in spgw task

The test case, TestUEContextConversion was failing because in function, proto_to_ue() after fetching ue and bearer details, it inserts bearer contexts to map with unique teid. While simulating this test case, bearer contexts were created with same teid. Due to which test case was failing. Fixed the issue by assigning unique teid to bearer contexts

Test Plan

Executed s1ap sanity test suite and unit test cases.

…ap in spgw task

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad requested review from a team and ssanadhya September 5, 2022 12:37
@pull-request-size pull-request-size bot added the size/L Denotes a Pull Request that changes 100-499 lines. label Sep 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 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

@github-actions github-actions bot added the component: agw Access gateway-related issue label Sep 5, 2022
@@ -54,7 +48,7 @@ void delete_pending_procedures(
base_proc1 = base_proc2;
}
LIST_INIT(ctx_p->pending_procedures);
free_wrapper((void**)&ctx_p->pending_procedures);
free_cpp_wrapper((void**)&ctx_p->pending_procedures);
Copy link
Contributor

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]

delete_pending_procedures(
&(context_p->sgw_eps_bearer_context_information));

free_cpp_wrapper((void**)ptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix lint warning

@@ -1475,7 +1475,7 @@ void sgw_s8_proc_s11_create_bearer_rsp(
if (pgw_ni_cbr_proc && (LIST_EMPTY(pgw_ni_cbr_proc->pending_eps_bearers))) {
pgw_base_proc_t* base_proc1 = LIST_FIRST(sgw_context_p->pending_procedures);
LIST_REMOVE(base_proc1, entries);
free_wrapper((void**)&sgw_context_p->pending_procedures);
free_cpp_wrapper((void**)&sgw_context_p->pending_procedures);
Copy link
Contributor

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix lint warning

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

feg-workflow

    2 files  203 suites   40s ⏱️
374 tests 374 ✔️ 0 💤 0
388 runs  388 ✔️ 0 💤 0

Results for commit 3526b94.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

dp-workflow

14 tests   14 ✔️  3m 2s ⏱️
  1 suites    0 💤
  1 files      0

Results for commit 3526b94.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

agw-workflow

615 tests   611 ✔️  4m 55s ⏱️
    2 suites      4 💤
    2 files        0

Results for commit 3526b94.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@pruthvihebbani pruthvihebbani left a comment

Choose a reason for hiding this comment

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

Left a minor comment

(void (*)(void**))pgw_lite_cm_free_apn, b);
bdestroy_wrapper(&b);

if (new_bearer_context_information->pgw_eps_bearer_context_information.apns ==
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is APN collection getting created now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @pruthvihebbani, this removed code was not used so I cleaned it up. The apn information is available within pdn session, https://github.com/magma/magma/blob/master/lte/gateway/c/core/oai/lib/3gpp/3gpp_23.401.h#L122

…w_teid_hl

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
status_code_e rc = RETURNok;
hash_table_ts_t* hashtblP = NULL;
uint32_t num_elements = 0;
state_teid_map_t* state_teid_map = nullptr;
s_plus_p_gw_eps_bearer_context_information_t* spgw_ctxt_p = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
s_plus_p_gw_eps_bearer_context_information_t* spgw_ctxt_p = NULL;
s_plus_p_gw_eps_bearer_context_information_t* spgw_ctxt_p = nullptr;

for (auto itr = state_teid_map->map->begin();
itr != state_teid_map->map->end(); itr++) {
if (!is_lbi_found) {
state_teid_map->get(itr->first, &spgw_ctxt_p);
if (spgw_ctxt_p != NULL) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (spgw_ctxt_p != NULL) {
if (spgw_ctxt_p != nullptr) {

for (auto itr = state_teid_map->map->begin();
itr != state_teid_map->map->end(); itr++) {
if (!is_lbi_found) {
state_teid_map->get(itr->first, &spgw_ctxt_p);
if (spgw_ctxt_p != NULL) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (spgw_ctxt_p != NULL) {
if (spgw_ctxt_p != nullptr) {

delete_pending_procedures(
&(context_p->sgw_eps_bearer_context_information));

free_cpp_wrapper((void**)ptr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix lint warning

@@ -1475,7 +1475,7 @@ void sgw_s8_proc_s11_create_bearer_rsp(
if (pgw_ni_cbr_proc && (LIST_EMPTY(pgw_ni_cbr_proc->pending_eps_bearers))) {
pgw_base_proc_t* base_proc1 = LIST_FIRST(sgw_context_p->pending_procedures);
LIST_REMOVE(base_proc1, entries);
free_wrapper((void**)&sgw_context_p->pending_procedures);
free_cpp_wrapper((void**)&sgw_context_p->pending_procedures);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix lint warning

…w_teid_hl

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…w_teid_hl

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@@ -1635,8 +1635,9 @@ status_code_e sgw_handle_nw_initiated_actv_bearer_rsp(
pgw_base_proc_t* base_proc1 = LIST_FIRST(
spgw_context->sgw_eps_bearer_context_information.pending_procedures);
LIST_REMOVE(base_proc1, entries);
free_wrapper((void**)&spgw_context->sgw_eps_bearer_context_information
.pending_procedures);
delete spgw_context->sgw_eps_bearer_context_information.pending_procedures;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we use free_cpp_wrapper here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's possible to use free_cpp_wrapper and corrected it now

@@ -1983,7 +1984,8 @@ void handle_failed_create_bearer_response(
pgw_base_proc_t* base_proc1 =
LIST_FIRST(sgw_context_p->pending_procedures);
LIST_REMOVE(base_proc1, entries);
free_wrapper((void**)&sgw_context_p->pending_procedures);
delete sgw_context_p->pending_procedures;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use free_cpp_wrapper

free_wrapper((void**)&pgw_ni_cbr_proc->pending_eps_bearers);
free_cpp_wrapper(
reinterpret_cast<void**>(&sgw_context_p->pending_procedures));
free_wrapper(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be free_cpp_wrapper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this PR, for pending_eps_bearers memory is allocated with calloc. But in next PR I have changed to new()

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Copy link
Collaborator

@ssanadhya ssanadhya left a comment

Choose a reason for hiding this comment

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

Lgtm

@ssanadhya ssanadhya enabled auto-merge (squash) October 12, 2022 05:17
@ssanadhya ssanadhya merged commit 634f31c into magma:master Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: agw Access gateway-related issue size/L Denotes a Pull Request that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants