dnpeers.conf.j2 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {% if dn_peers is defined %}{% for item in dn_peers %}
  2. {% if not item.enabled %}/*{% endif %}
  3. protocol bgp {{ item.name }} from {{ item.template }} {
  4. neighbor {{ item.neighbor }} as {{ item.neighbor_asn }};
  5. {% if item.bfd is defined and item.bfd %}
  6. bfd graceful;
  7. {% endif %}
  8. {% if item.gtsm is defined and item.gtsm %}
  9. ttl security on;
  10. {% endif %}
  11. {% if item.password is defined %}
  12. password "{{ item.password }}";
  13. {% endif %}
  14. {% if 'ipv4' in item.protocols %}
  15. ipv4 {
  16. import {% if item.restrict is defined and item.restrict %}filter { if (bgp_path.last != bgp_path.first) then reject; {% else %}where {% endif %}
  17. dn42_import_filter({{ item.bgp_communities.latency }},{{ item.bgp_communities.bandwidth }},{{ item.bgp_communities.encryption }});
  18. {% if item.restrict is defined and item.restrict %}};{% endif %}
  19. export {% if item.restrict is defined and item.restrict %}filter { bgp_community.add((65535, 65283)); {% else %}where {% endif %}
  20. dn42_export_filter({{ item.bgp_communities.latency }},{{ item.bgp_communities.bandwidth }},{{ item.bgp_communities.encryption }});
  21. {% if item.restrict is defined and item.restrict %}};{% endif %}
  22. };
  23. {% endif %}
  24. {% if 'ipv6' in item.protocols %}
  25. ipv6 {
  26. import {% if item.restrict is defined and item.restrict %}filter { if (bgp_path.last != bgp_path.first) then reject; {% else %}where {% endif %}
  27. dn42_import_filter({{ item.bgp_communities.latency }},{{ item.bgp_communities.bandwidth }},{{ item.bgp_communities.encryption }});
  28. {% if item.restrict is defined and item.restrict %}};{% endif %}
  29. export {% if item.restrict is defined and item.restrict %}filter { bgp_community.add((65535, 65283)); {% else %}where {% endif %}
  30. dn42_export_filter({{ item.bgp_communities.latency }},{{ item.bgp_communities.bandwidth }},{{ item.bgp_communities.encryption }});
  31. {% if item.restrict is defined and item.restrict %}};{% endif %}
  32. };
  33. {% endif %}
  34. }
  35. {% if not item.enabled %}*/{% endif %}
  36. {% endfor %}{% endif %}