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

Multiple Templates per router #308

Open
jjavierweb opened this issue Oct 21, 2020 · 10 comments
Open

Multiple Templates per router #308

jjavierweb opened this issue Oct 21, 2020 · 10 comments
Assignees
Labels
status: accepted type: enhancement Issue is considered as an enhancement to the code, so it is not a regression nor a blocking issue

Comments

@jjavierweb
Copy link
Contributor

Environment

  • Python version:
  • Peering Manager version:

Proposed Functionality

It would be nice if we could assign multiple templates to routers, and at the time of deployment all templates would be fusion on a single configuration, this would allow creating independent templates for route-maps or prefix-list while also providing all the regular neighbors and such

Use Case

performing a large configuration where multiple AS numbers require specific route-maps or prefix-lists, a template for each is created, and then all templates are rendered into a single configuration for deployment

External Dependencies

@mngan
Copy link
Contributor

mngan commented Oct 21, 2020

Could you clarify what you mean "a template for each"? Each AS? I think I know what you mean, but just want to make sure I understand.

There have been some suggestions to use configuration contexts. It is possible that such a thing could contain this information per ASN (or per object type). So you don't necessarily need to use a separate template for this information. It sounds like you just want a place to store this static information that will get included into the templates.

@rlanyi
Copy link

rlanyi commented Oct 25, 2020

I have a similar use case for this: I don't want to push very-very long prefix-lists to a router every time when I create a peering session. If I could have one template for BGP sessions and another for prefix-lists then I could apply them with different frequency. (E.g. by creating multiple cron jobs for each configuration templates.)

So besides the behaviour that @jjavierweb mentioned above where multiple assigned configurations would be merged for a specific router, it would be nice to have the possibility to generate configuration with one selected configuration template for that router as well.

@jjavierweb
Copy link
Contributor Author

@mngan I mean for example I want to have a template for creating prefix lists, another template for creating route-maps and another template for creating community lists
that what I meant by a template for each is created, rather than a template for AS

@nido009
Copy link

nido009 commented Jan 25, 2021

another idea would be to add the ability to link policies to and communities to routers and enhance policies with it's own set of templates to push policies to routers instead of heaving to put them into the general template and adding them in dhe policies section.

@jamesditrapani
Copy link
Contributor

I think @nido009 has probably hit the nail on the head here, sounds like the best way to do it. I'll take a look into what the options are

@jamesditrapani jamesditrapani added the type: enhancement Issue is considered as an enhancement to the code, so it is not a regression nor a blocking issue label Apr 22, 2021
@jamesditrapani jamesditrapani added this to To do in Templating/Notification via automation Apr 28, 2021
@stale stale bot added the status: wontfix Not an issue, no fix to be done, no code to be changed label Jul 12, 2021
@peering-manager peering-manager deleted a comment from stale bot Jul 12, 2021
@stale stale bot removed the status: wontfix Not an issue, no fix to be done, no code to be changed label Jul 12, 2021
@falz
Copy link

falz commented Mar 29, 2022

While I gave the obligatory thumbs up and the suggestion that @nido009 made does seem quite logical, it could also be limiting.

Expanding this further, perhaps instead of having a 1:1 jinja template for a 'thing', perhaps consider implementing it as 1:many. This could fit either scenario - if it stays device-centric, one could have however many templates as you want (although I'm unsure how they all merge together, if they do at all)

This could apply to the template-per-thing idea as well - policies, communities, peers.

However, this strays away from the original suggestion which is specific to prefix-lists - what would those link to? There's nothing prefix-list-ey inside Peering Manager currently, and it seems like that's the thing with most churn, so why bother updating all static policies that refer to prefix lists when one can just update only the prefix lists.

@gmazoyer
Copy link
Member

Another thing we want to look at, is adding a function, to the templating system, to include a template into another one. So one might create a bunch of templates, then another one which includes the previous ones in the order the user wants.

The final template would look like:

{% include "bgp-sessions" %}
{% include "bgp-policies" %}
{% include "prefix-lists" %}
...

@wtremmel
Copy link
Contributor

wtremmel commented May 22, 2022 via email

@falz
Copy link

falz commented May 22, 2022

This would make sense, especially if the templates can be named arbitrarily and referred to arbitrarily, that way anyone could get as granular as they want with includes.

@gmazoyer gmazoyer self-assigned this May 26, 2022
@gmazoyer
Copy link
Member

Inclusion tags added in 9ce109d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted type: enhancement Issue is considered as an enhancement to the code, so it is not a regression nor a blocking issue
Development

No branches or pull requests

8 participants