|
@@ -14,46 +14,12 @@ template bgp ibgp {
|
|
|
graceful restart yes;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-{#- Gather information for iBGP sessions #}
|
|
|
-{%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
|
|
|
-{%- set peers = [] %}
|
|
|
-{%- for node in salt['pillar.get']('nodes', [])|sort if node != grains['id'] %}
|
|
|
- {%- set peer_node_config = salt['pillar.get']('nodes:' ~ node) %}
|
|
|
- {%- set peer_roles = peer_node_config.get ('roles', []) %}
|
|
|
-
|
|
|
- {#- save peers node name, mangle . and - to _ to make bird happy #}
|
|
|
- {%- set peer_config = { 'node' : salt['ffho.re_replace']('[.-]', '_', node) } %}
|
|
|
- {%- if 'router' in peer_roles %}
|
|
|
- {#- Skip peer if neither we nor him are a RR #}
|
|
|
- {%- if 'routereflector' not in roles and 'routereflector' not in peer_roles %}
|
|
|
- {%- continue %}
|
|
|
- {%- endif %}
|
|
|
-
|
|
|
- {#- Don't try to set up sessions to VMs/devices which are "planned", "failed", "decomissioning" and "inventory" #}
|
|
|
- {%- if peer_node_config.get ('status', '') not in [ '', 'active', 'staged', 'offline' ] %}
|
|
|
- {%- continue %}
|
|
|
- {%- endif %}
|
|
|
-
|
|
|
- {#- Is our peer a route reflector? #}
|
|
|
- {%- if 'routereflector' in peer_roles %}
|
|
|
- {%- do peer_config.update ({'rr' : True }) %}
|
|
|
- {%- endif %}
|
|
|
-
|
|
|
- {#- get peers Lo IP #}
|
|
|
- {%- do peer_config.update ({ 'ip' : salt['ffho_net.get_primary_ip'] (peer_node_config, proto).ip }) %}
|
|
|
-
|
|
|
- {%- do peers.append (peer_config) %}
|
|
|
- {%- endif %}
|
|
|
-{%- endfor %}
|
|
|
-
|
|
|
-
|
|
|
-{#- configure iBGP sessions #}
|
|
|
+{%- set peers = salt['pillar.get']("nodes:" ~ grains.id ~ ":routing:bgp:internal:peers:" ~ family, []) %}
|
|
|
{% for peer_config in peers %}
|
|
|
protocol bgp {{ peer_config.get ('node') }} from ibgp {
|
|
|
neighbor {{ peer_config.get ('ip') }} as AS_OWN;
|
|
|
|
|
|
- {%- if 'routereflector' in roles and not 'rr' in peer_config %}
|
|
|
+ {%- if peer_config.get ('rr_client') %}
|
|
|
rr client;
|
|
|
{%- endif %}
|
|
|
}
|