Skip to content

Commit

Permalink
Configure static interface routes (#2)
Browse files Browse the repository at this point in the history
* Configure static interface routes

* Fix model namespace

* Quote description
  • Loading branch information
mraerino authored Sep 5, 2024
1 parent 3180eca commit 4e71e87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core-router.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ endif %}

{%- endfor %}

{# static interface routes #}
{%- for intf in device.interfaces.filter(untagged_vlan__isnull=False) %}
{%- for pfx in ipam.Prefix.objects.filter(vlan_id=intf.untagged_vlan_id) %}
{%- if pfx.custom_field_data.get('use_interface_route', False) %}
set protocols static interface-route {{ pfx.prefix }} next-hop-interface {{ intf.name }}
{%- if pfx.description %} description "{{ pfx.description }}"{% endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}

{# BGP sessions #}
{%- for sess in netbox_bgp.BGPSession.objects.filter(device_id=device.id) %}
set protocols bgp {{ sess.local_as.asn }} neighbor {{ sess.remote_address.address }}
{%- endfor %}

0 comments on commit 4e71e87

Please sign in to comment.