ibgp_sessions_down_ok.txt.tmpl 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #
  2. # BGP sessions which are OK to be down (Salt managed)
  3. #
  4. {#- Gather information for iBGP sessions #}
  5. {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  6. {%- set inactive_peers = [] %}
  7. {%- for node in salt['pillar.get']('nodes', [])|sort if node != grains['id'] %}
  8. {%- set peer_node_config = salt['pillar.get']('nodes:' ~ node) %}
  9. {%- set peer_roles = peer_node_config.get ('roles', []) %}
  10. {#- Skip peer if it ain't no router #}
  11. {%- if 'router' not in peer_roles %}
  12. {%- continue %}
  13. {%- endif %}
  14. {#- Skip peer if neither we nor him are a RR #}
  15. {%- if 'routereflector' not in roles and 'routereflector' not in peer_roles %}
  16. {%- continue %}
  17. {%- endif %}
  18. {%- if peer_node_config.get ('status', '') not in [ '', 'active' ] %}
  19. {#- save peers node name, mangle . and - to _ to make bird happy #}
  20. {%- set peer_name = salt['ffho.re_replace']('[.-]', '_', node) %}
  21. {%- do inactive_peers.append (peer_name) %}
  22. {%- endif %}
  23. {%- endfor %}
  24. {% for peer in inactive_peers %}
  25. {{ peer }}
  26. {%- endfor %}