Skip to content

Instantly share code, notes, and snippets.

@Mierdin
Created March 3, 2015 23:05
Show Gist options
  • Select an option

  • Save Mierdin/ccf78adeb42f8dc46f6e to your computer and use it in GitHub Desktop.

Select an option

Save Mierdin/ccf78adeb42f8dc46f6e to your computer and use it in GitHub Desktop.
<configuration>
{%- if bgp %}
<routing-options>
<autonomous-system operation="replace">
<as-number>{{ bgp.as }}</as-number>
</autonomous-system>
</routing-options>
<protocols>
<bgp operation="replace">
{%- if bgp.advertise is defined %}
<export>BGP_NETWORK</export>
{%- endif %}
{% for groupname, grouplist in bgp.groups.iteritems() %}
<group>
<name>{{ groupname }}</name>
<type>external</type>
{% for neighbor in grouplist %}
<neighbor>
<name>{{ neighbor.addr }}</name>
<peer-as>{{ neighbor.as }}</peer-as>
</neighbor>
{% endfor %}
</group>
{% endfor %}
</bgp>
</protocols>
{%- if bgp.advertise is defined %}
<policy-options operation="replace">
<policy-statement>
<name>BGP_NETWORK</name>
<term>
<name>1</name>
<from>
{% for prefix in bgp.advertise %}
<route-filter>
<address>{{ prefix }}</address>
<exact/>
</route-filter>
{% endfor %}
</from>
<then>
<accept/>
</then>
</term>
</policy-statement>
</policy-options>
{%- endif %}
{%- endif %}
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment