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

chore(pipelined): datapath refactor inout #12495

Merged
merged 6 commits into from May 5, 2022

Conversation

nstng
Copy link
Contributor

@nstng nstng commented Apr 19, 2022

Summary

See #12072.

Done in pairing with @vktng

This PR is best reviewed commit by commit

  1. Add ingress, middle and egress controller and super class mandatory_service. This is basically copying logic from inout.py to the three (+1 super class) new files. Note that for read- and reviewability code was just copied without any refactoring.
  2. Switch sudo unit tests to using the new controllers
  3. Make rpc servicer using new controllers.
  4. Remove inout controller and use constants from new controllers.
  5. Adapt documentation.
  6. Reflect changes here in Bazel.

Open questions:

Test Plan

Additional Information

  • This change is backwards-breaking

@pull-request-size pull-request-size bot added the size/XXL Denotes a Pull Request that changes 1000+ lines. label Apr 19, 2022
@github-actions
Copy link
Contributor

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 component: agw Access gateway-related issue component: docs Documentation-related issue labels Apr 19, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 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 Apr 19, 2022

Oops! Looks like you failed the Markdown lint check.

Howto

♻️ Updated: ✅ The check is passing the Markdown lint check after the last commit.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2022

feg-workflow

    2 files  202 suites   39s ⏱️
371 tests 371 ✔️ 0 💤 0
385 runs  385 ✔️ 0 💤 0

Results for commit 72107cb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2022

agw-workflow

     77 files     122 suites   7m 40s ⏱️
1 158 tests 1 149 ✔️ 9 💤 0
1 159 runs  1 150 ✔️ 9 💤 0

Results for commit 72107cb.

♻️ This comment has been updated with latest results.

@nstng nstng force-pushed the datapath_refactor_inout branch 3 times, most recently from ad0537c to 928db64 Compare April 19, 2022 18:17
@nstng nstng assigned nstng and vktng Apr 20, 2022
@nstng nstng marked this pull request as ready for review April 20, 2022 12:56
@nstng nstng requested review from a team, hcgatewood, koolzz and pshelar April 20, 2022 12:56
from ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls


class MandatoryController(RestartMixin, MagmaController):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm I'm not sure why we're adding unnecessary inheritance here, whats the purpose of MandatoryController class?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shouldn't introduce this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is the common logic used in the three new controllers - would you prefer to handle this in a util class? (at least the ryu annotated functions would need to be duplicated in ingress, middle and egress apps).

Copy link
Contributor

@koolzz koolzz Apr 20, 2022

Choose a reason for hiding this comment

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

Yeah we already have a MagmaController class, lets either put stuff there(only if its applicable to all controllers) or duplicate the code

Copy link
Contributor Author

@nstng nstng Apr 21, 2022

Choose a reason for hiding this comment

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

Hi Nick, MagmaController is super class of a lot of apps so we should not move the common logic for ingress, middle and egress there. We will remove the new abstract controller and inline the code.

f.e this seems to be only used in middle

_get_vlan_egress_flow_msgs is used in middle and egress and please note that this does not belong to the class MandatoryController - this is the same patter as in inout.py before. We will move it to a util file/module.

Copy link
Contributor Author

@nstng nstng Apr 21, 2022

Choose a reason for hiding this comment

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

pushed - running integ test on fork to be sure
https://github.com/nstng/magma/actions/runs/2203084202

Copy link
Member

@themarwhal themarwhal left a comment

Choose a reason for hiding this comment

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

doc changes seem reasonable, I'll let the pipelined codeowners validate the correctness :D Also, out of scope for this PR but is the diagram better handled with mermaid? (https://mermaid-js.github.io/mermaid/#/)

flows.delete_all_flows_from_table(datapath, self.tbl_num)


def _get_vlan_egress_flow_msgs(
Copy link
Contributor

Choose a reason for hiding this comment

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

f.e this seems to be only used in middle

from ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls


class MandatoryController(RestartMixin, MagmaController):
Copy link
Contributor

@koolzz koolzz Apr 20, 2022

Choose a reason for hiding this comment

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

Yeah we already have a MagmaController class, lets either put stuff there(only if its applicable to all controllers) or duplicate the code

@nstng nstng linked an issue Apr 21, 2022 that may be closed by this pull request
@nstng nstng requested a review from sebathomas April 21, 2022 06:49
@nstng nstng force-pushed the datapath_refactor_inout branch 2 times, most recently from c17ab9a to c9adac6 Compare April 21, 2022 16:19
@nstng nstng requested a review from a team April 21, 2022 16:19
@nstng nstng requested a review from LKreutzer April 21, 2022 16:19
@nstng
Copy link
Contributor Author

nstng commented Apr 21, 2022

FYI for reviewers: added an additional commit for Bazel adaptions. Reason: the pipelined bazelification was merged after this PR was created and the changes here need to be reflected in Bazel.

Copy link
Contributor

@sebathomas sebathomas left a comment

Choose a reason for hiding this comment

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

Looking good, just a minor point.

lte/gateway/python/magma/pipelined/service_manager.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Neudrino Neudrino left a comment

Choose a reason for hiding this comment

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

Only reviewed the "docs" change, which LGTM.

@Neudrino
Copy link
Contributor

Neudrino commented Apr 29, 2022

Afaiks there would be review needed again from @koolzz or @pshelar.
Could you review again, please, as this is blocking the next PR #12566 already.

@@ -0,0 +1,91 @@
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this file up one directory and rename it to vlan_utils.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 pushed

Copy link
Contributor

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

I have one nit please fix before merging. Otherwise looks really clean, thanks for working on it!
@pshelar give this a quick glance through maybe

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
…ess controller

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
…ller

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
…middle and egress controllers

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
…f date register table - reg10->reg12)

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
priority=priority, output_reg=output_reg, output_port=out_port,
),
)
return msgs
Copy link
Contributor

Choose a reason for hiding this comment

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

did you ran non-nat datapath tests from S1AP integ tests with this PR?

Copy link
Contributor Author

@nstng nstng May 1, 2022

Choose a reason for hiding this comment

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

@pshelar, we run all tests in the "lte integ tests" workflow. Last run on fork: https://github.com/nstng/magma/runs/6115971885?check_suite_focus=true
Edit latest run: https://github.com/nstng/magma/actions/runs/2252702388

Copy link
Contributor

Choose a reason for hiding this comment

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

I dont see test_attach_detach_non_nat_dp_ul_tcp.py in the test log, can you check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test_attach_detach_non_nat_dp_ul_tcp.py is in the NON_SANITY_TESTS list. It looks like the NON_SANITY_TESTS are not executed with the LTE integ-tests workflow. I do not see them executed anywhere automatically. Do you happen to know if this is intentionally?
I will execute them manually - but this will take some time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets move this test to 'PRECOMMIT_TESTS' set.
cc: @ssanadhya

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pshelar executed the tests locally - test_attach_detach_non_nat_dp_ul_tcp.py was successful.

In general the tests seem to be very flaky (on a fresh vm setup). I still do not have all tests green. Do you have an opinion if one of the following tests might be relevant for the change?:

test_s1_handover_ping_pong.py
test_activate_deactivate_multiple_dedicated.py
test_sctp_shutdown_while_mme_is_stopped.py
test_secondary_pdn_with_dedicated_bearer_multiple_services_restart.py
test_3495_timer_for_dedicated_bearer_with_mme_restart.py
test_no_attach_complete_with_mme_restart.py

Copy link
Contributor

Choose a reason for hiding this comment

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

these are not related datapath, so we can ignore it.

@prabinakpattnaik
Copy link
Contributor

Looks good to me for these changes.

)
return msgs

def _install_default_flows(self, datapath):
Copy link
Contributor

Choose a reason for hiding this comment

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

function, _install_default_flows() is duplicated in ingress, middle and egress, can we move it to base calss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pshelar: base.py is the super class of other controllers too. And those other controllers also have _install_default_flows() - but these are diverging implementations. Do we really want to implement _install_default_flows() of ingress, middle and egress in base.py and let all other controllers override this function?
Another approach would be to add an inheritance layer between base.py and ingress, middle and egress and put common logic there - this was already discussed with @koolzz above - this has the downside of adding inheritance complexity to the model.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, thats fine.

chan = self._msg_hub.send(default_msgs, datapath)
self._wait_for_responses(chan, len(default_msgs))

def _wait_for_responses(self, chan, response_count):
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, this function can be moved to base class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See answer above - additionally this function is not used by a lot of controllers that extend base.by.

if not result.ok():
return fail(result.exception())

def cleanup_on_disconnect(self, datapath):
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See answers above.

Copy link
Contributor

@pshelar pshelar left a comment

Choose a reason for hiding this comment

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

Thanks for working on this.

@pshelar pshelar merged commit d18ba2f into magma:master May 5, 2022
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
* chore(pipelined): split up controllers from inout are added

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

* chore(pipelined): inout (sudo unit) tests use ingress, middle and egress controller

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

* chore(pipelined): rpc servicer uses ingress, middle and egress controller

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

* chore(pipelined): inout is removed and logic is switched to ingress, middle and egress controllers

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

* chore(pipelined): pipelined documentation is updated (including out of date register table - reg10->reg12)

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

* chore(pipelined): bazel is adapted to use the new services

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
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 component: docs Documentation-related issue size/XXL Denotes a Pull Request that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

datapath: Refactor in-out controller into three separate controllers
9 participants