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

Subnet routes refactoring #205

Open
wants to merge 8 commits into
base: stable/yoga-m3
Choose a base branch
from

Conversation

BenjaminLudwigSAP
Copy link
Collaborator

@BenjaminLudwigSAP BenjaminLudwigSAP commented Feb 28, 2023

Currently waiting for fix of member/SelfIP conflict (which already includes some heavy L2 refactoring)

This PR follows up on #204.
So far it stacks onto (i.e. includes) #204, but I will rebase it onto stable/yoga-m3 once #204 is merged.

route_on_active implies that this option is for turning on and off
provisioning of routes to active devices. It's the opposite however -
turning on and off provisioning to passive devices.
all(... for x in []) yields True, which is desired here, but can still
be unexpected behavior to a reader. An explicit check for [] helps
readability without changing behavior.
- Clearer variable names

- Sections with section header comments

- More efficient decision logic
  So far we're iterating over all routes and `continue` when we want
  to skip a route. But multiple checks require iterating over all
  networks and/or subnets.
  - Every check has to iterate over networks separately
  - `continue` can't be used to ignore routes unless we iterate over
    networks using list comprehension
  So put decision logic into a function ignore_route. In it we iterate
  over networks once. If a route is to be ignored (i. e. spared from
  deletion) we can return immediately, no matter how deeply nested the
  current for-loop is.

- Fix formatting
Since subnet deletion was separated out into the CleanupSubnetRoutes
function in c81eb89 it makes sense to keep the names more in line with
the naming convention used for other tasks that separate between
creation and deletion
@BenjaminLudwigSAP BenjaminLudwigSAP marked this pull request as ready for review March 10, 2023 12:32
Copy link
Collaborator

@notandy notandy left a comment

Choose a reason for hiding this comment

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

Rename SyncSubnetRoutes to EnsureSubnetRoutes

<- the name change is not justified since the subnet routes are still removed by the same function - and in fact the same function could also cleanup by providing it an empty selfip array which makes the new "cleanup" function redundant.

Base automatically changed from subnet-routes to stable/yoga-m3 March 28, 2023 11:34
@BenjaminLudwigSAP BenjaminLudwigSAP self-assigned this Apr 12, 2023
@BenjaminLudwigSAP BenjaminLudwigSAP added refactoring No functionality change, only code improvement rescheduling Relevant for rescheduling semantics in some way labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring No functionality change, only code improvement rescheduling Relevant for rescheduling semantics in some way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants