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

set_local_pref not flexible enough #99

Open
fldardenne opened this issue Nov 16, 2020 · 2 comments
Open

set_local_pref not flexible enough #99

fldardenne opened this issue Nov 16, 2020 · 2 comments

Comments

@fldardenne
Copy link
Contributor

Hi,

The set_local_pref function from bgp.py aims to change the local-preference attribute if the route matches the community or an AccessList.

def set_local_pref(self, local_pref: int, from_peer: str,

To do so, the function creates a route-map in the router and links this route-map with the "from_peer" neighbor.

However, I noticed some problems:

  • The new route-map linked to the neighbor blocks all the other routes that do not match the CommunityList/AccessList.
  • We cannot set the same route-map with different orders.
  • If we try to set multiple local-pref with multiple Communities, it does not add a new route-map with different orders but appends the new "match" condition and appends the new "set local-preference" in the existing route-map.

What I suggest as a solution and that I applied in the project is to give more flexibility to this function :

  • An optional parameter to define the name, the function will format it as "name+adressFamily". If None is given, take the actual strategy (check if an existing route-map can take the "match" and the "set local-preference" - if not, a new route-map with the name rm%d is created)
  • An optional parameter to define the order (actually hardcoded to 10)

With those two new parameters, the user can now define a succession of route-maps to define multiple local-pref matching some communities and finally set a default local-pref so that these route maps do not block others route.

If this solution is accepted, I can do a pull request for my implementation to solve these issues. If a better solution is proposed, I am willing to volunteer for the implementation of that one.

@fldardenne fldardenne changed the title set_local_pref do not work set_local_pref not enough flexible Nov 16, 2020
@fldardenne fldardenne changed the title set_local_pref not enough flexible set_local_pref not flexible enough Nov 16, 2020
@fldardenne
Copy link
Contributor Author

fldardenne commented Nov 16, 2020

An optional parameter to define the order (actually hardcoded to 10)

But when creating a new route-map (let's call it rm11), the first route-map order should be set to 10. Or it will not be linked to the neighbor due to the bgpd.mako condition.

% if rm.neighbor.family == af.name and rm.order == 10:

Then afterward, the user can create other rm11 route-map with different order.

@jadinm
Copy link
Collaborator

jadinm commented Dec 1, 2020

Hello,

However, I noticed some problems:

  • The new route-map linked to the neighbor blocks all the other routes that do not match the CommunityList/AccessList.
  • We cannot set the same route-map with different orders.
  • If we try to set multiple local-pref with multiple Communities, it does not add a new route-map with different orders but appends the new "match" condition and appends the new "set local-preference" in the existing route-map.

Could you provide a minimal example for each of the issues that you noted ?
For instance, a minimal topology with two BGP routers and maybe show the configuration that is produced.

Then, it would be easier to understand what the problem is and I will be able to provide feedback on your suggested solution ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants