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

Impossible to use BBP RouteMapEntry call_action and exit_policy #122

Open
Mathieu-COSYNS-Student opened this issue Dec 3, 2022 · 0 comments

Comments

@Mathieu-COSYNS-Student
Copy link
Contributor

As mentioned in #107 and #99. I don't think that in interface to configure BGP route maps is good.

I was looking for a way to configure exit_policy. I was not able to find a method in bgp.py to do that so I build a work around.

  def route_map_add_exit_policy(
                                router: RouterDescription,
                                route_map_name: str,
                                route_map_order: str,
                                exit_policy: Optional[str] = None):
      """
      ipmininet does not have a interface to add exit policies on route maps!
      This is a hacky why to do it.
      """
      route_maps = router.get_config(BGP).topo.getNodeInfo(
          router, 'bgp_route_maps', list)

      for route_map in route_maps:
          if route_map_name == route_map.name:
              for order, route_map_entry in route_map.entries.items():
                  if route_map_order == order:
                      route_map_entry.exit_policy = exit_policy

When I configure a router with this function and I start, an error occurs.

Couldnt render a config file( bgpd.mako )

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/ipmininet/router/config/base.py", line 334, in render
    cfg_content[filename] = template.render(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/mako/template.py", line 473, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/local/lib/python3.8/dist-packages/mako/runtime.py", line 878, in _render
    _render_context(
  File "/usr/local/lib/python3.8/dist-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/local/lib/python3.8/dist-packages/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ipmininet/router/config/templates/bgpd.mako", line 104, in render_body
    on-match ${rm.exit_policy}
AttributeError: 'RouteMap' object has no attribute 'exit_policy'
Mathieu-COSYNS-Student added a commit to Mathieu-COSYNS-Student/ipmininet that referenced this issue Dec 3, 2022
jadinm pushed a commit that referenced this issue Jan 18, 2023
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

1 participant