Skip to content

Commit

Permalink
Redo SR Linux BGP template to make IBGP and EBGP behavior somewhat co…
Browse files Browse the repository at this point in the history
…nsistent
  • Loading branch information
ipspace committed Aug 27, 2024
1 parent 128a131 commit 8ea58d1
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 145 deletions.
39 changes: 15 additions & 24 deletions netsim/ansible/templates/bgp/srlinux.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,23 @@ updates:
- path: /routing-policy/policy[name=accept_all]
value:
default-action:
policy-result: "accept"
policy-result: accept

{% if bgp.next_hop_self|default(False) %}
{#
Define a policy to set next hop to self (loopback) when exporting received EBGP routes
#}
{% for af in ['ipv4','ipv6'] if af in loopback %}
- path: /routing-policy/policy[name=next_hop_self_ebgp_{{af}}]
- path: /routing-policy/community-set[name=ibgp-mark]
value:
default-action:
policy-result: "accept"
statement:
- name: set-nh-on-ebgp-routes
match:
protocol: bgp
bgp:
as-path-length:
value: 1
operator: "ge"
action:
policy-result: "accept"
bgp:
next-hop:
set: "{{ loopback[af] | ipaddr('address') }}"
{% endfor %}
{% endif %}
member: [ "65536:0:65536" ]

- path: /routing-policy/policy[name=ibgp-mark]
value:
default-action:
policy-result: reject
statement:
- name: mark-ibgp-routes
action:
bgp:
communities:
add: ibgp-mark
policy-result: accept

{% from "srlinux.macro.j2" import bgp_config with context %}
{{ bgp_config('default',bgp.as,bgp.router_id,bgp,{ 'af' : af }) }}
Loading

0 comments on commit 8ea58d1

Please sign in to comment.