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(mme): Fix network address in create bearer packet filter #12038

Merged
merged 4 commits into from Mar 11, 2022

Conversation

ssanadhya
Copy link
Collaborator

@ssanadhya ssanadhya commented Mar 9, 2022

Signed-off-by: Shruti Sanadhya ssanadhya@fb.com

Summary

The test case test_attach_detach_maxbearers_twopdns.py started failing after the changes in b4fc690 .
The new parseIpv4Network logic behaves differently from folly::IPAddress::tryCreateNetwork when the input address is of the form "192.168.129.42/16". Specifically, the output is:

  • folly::IPAddress::tryCreateNetwork("192.168.129.42/16") -> (192.168.0.0, 16)
  • parseIpv4Network("192.168.129.42/16") -> (192.168.129.42, 16)

Since the default downlink flow rules in s1ap_utils.py include rules for "192.168.129.42/32" and "192.168.129.42/16", the above logic , in addition with the overlapping port number range (as highlighted in #11969) , was causing an overlap on flow rules. This was causing the number of created rules to be 28, while the expected count was 33 ( = 1 default + 8 bearers * 4 rules_per_bearer).

This can be seen by dumping all the DL flows from OVS for test_attach_detach_maxbearers_twopdns.py on:

2d30661 , which shows 33 downlink flows

b4fc690, which shows 28 downlink flows

The changes in #11969 circumvent the issue by expanding the port number range so that the flow rules do not overlap, but the IP address match is still incorrect.

This change:

  1. fixes the logic in fillIpv4 to treat the IP address returned from parseipv4network as a string and apply the mask when copying that address into a packet filter.
  2. Adds a debug log in s1ap_utils.py to print the number of DL flows created vs expected
  3. Include the PDN count also in generating the unique port number for each bearer.

Test Plan

  • Functional test with test_attach_detach_maxbearers_twopdns.py
    Before the change, MME Debug log reports:
DEBUG UTIL tasks/grpc_service/SpgwServiceIm:0358  Network Address: 192.168.129.42 Network Mask: 255.255.0.0

After the change

DEBUG UTIL tasks/grpc_service/SpgwServiceIm:0359  Network Address: 192.168.0.0 Network Mask: 255.255.0.0
  • Sanity test
    make integ_test

@ssanadhya ssanadhya requested review from a team, VinashakAnkitAman and rsarwad March 9, 2022 23:27
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines. label Mar 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 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 Mar 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2022

Oops! Looks like you failed the Python Format Check.

Howto

♻️ Updated: ✅ The check is passing the Python Format Check after the last commit.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2022

feg-workflow

    2 files  202 suites   33s ⏱️
363 tests 363 ✔️ 0 💤 0
377 runs  377 ✔️ 0 💤 0

Results for commit 60b3f5c.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@ulaskozat ulaskozat left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2022

agw-workflow

  50 files    77 suites   5m 37s ⏱️
896 tests 887 ✔️ 9 💤 0
897 runs  888 ✔️ 9 💤 0

Results for commit 60b3f5c.

♻️ This comment has been updated with latest results.

@themarwhal
Copy link
Member

themarwhal commented Mar 10, 2022

We do have some unit test coverage for the parse function. Is it worth adding the previously failing test case here? https://sourcegraph.com/github.com/magma/magma/-/blob/lte/gateway/c/core/oai/test/spgw_task/test_spgw_service_impl.cpp?L27 or maybe it is the fill function that is in question here? I do not know, so I will defer to @LKreutzer who added the unit tests for this :)

Copy link
Contributor

@LKreutzer LKreutzer left a comment

Choose a reason for hiding this comment

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

LGTM. @themarwhal we will add some test cases (on Monday as I am travelling)!

@themarwhal
Copy link
Member

LGTM. @themarwhal we will add some test cases (on Monday as I am travelling)!

@LKreutzer thanks! sounds great :) Safe travels!

@ssanadhya ssanadhya added backport-v1.7 MME fixes to be backported for 1.7 and removed backported-v1.7 labels Mar 10, 2022
@ssanadhya
Copy link
Collaborator Author

LGTM. @themarwhal we will add some test cases (on Monday as I am travelling)!

Agree with @themarwhal , it will be good to add test coverage for the fill function here. I did not modify the parsing function since it is working correctly as a parser in this case. The logic has to be vetted in the fillIpv4 function. Thanks for taking this up @LKreutzer

@ssanadhya ssanadhya enabled auto-merge (squash) March 10, 2022 22:15
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
@ssanadhya ssanadhya merged commit 1ec2d50 into magma:master Mar 11, 2022
ardzoht pushed a commit that referenced this pull request Mar 30, 2022
* fix(mme): Fix network address in create bearer packet filter

Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
@ssanadhya ssanadhya deleted the maxbearer_twopdn_fix branch March 30, 2022 20:38
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
…2038)

* fix(mme): Fix network address in create bearer packet filter

Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
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 size/S Denotes a PR that changes 10-29 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants