ffrl.conf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #
  2. # FFRL upstream (Salt maanged)
  3. #
  4. {%- set ifaces = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}) %}
  5. {%- set sessions = salt['ffho_net.get_ffrl_bgp_config'](ifaces, proto) %}
  6. {%- set te_community_map_ffrl = salt['pillar.get']('te:community_map:' ~ grains['id'] ~ ':ffrl', [])|sort %}
  7. filter ffrl_in {
  8. if net ~ [
  9. {%- if proto == 'v4'%}
  10. 0.0.0.0/0
  11. {%- else %}
  12. ::/0
  13. {%- endif %}
  14. ] then {
  15. # Rewrite BGP next hop to loopback IP so we don't have to
  16. # include transfer networks to AS201701 in IGP.
  17. bgp_next_hop = LO_IP;
  18. accept;
  19. }
  20. reject;
  21. };
  22. filter ffrl_out {
  23. {%- if proto == 'v4'%}
  24. if proto != "p_nat" then
  25. reject;
  26. if net ~ [
  27. 185.66.194.80/29+,
  28. 185.66.194.84/31+, # FRA-IPs
  29. 185.66.195.94/31+ # BER-IPs
  30. {%- else %}
  31. if net ~ [
  32. 2a03:2260:2342::/48{48,56}
  33. {%- endif %}
  34. ] then {
  35. # Is there an export restriction for this route?
  36. if (EXPORT_RESTRICT ~ bgp_community) then {
  37. {%- for community in te_community_map_ffrl %}
  38. if ({{ community }} ~ bgp_community) then
  39. accept;
  40. {%- endfor %}
  41. }
  42. # No export restriction, go ahead
  43. else {
  44. accept;
  45. }
  46. }
  47. reject;
  48. };
  49. {%- if proto == 'v4' %}
  50. protocol direct p_nat {
  51. interface "nat";
  52. }
  53. {%- endif %}
  54. define AS_FFRL = 201701;
  55. template bgp as201701 {
  56. import filter ffrl_in;
  57. export filter ffrl_out;
  58. local as 65132;
  59. preference 200;
  60. }
  61. {% for session in sessions|sort %}
  62. {%- set session_config = sessions.get (session) %}
  63. {%- set bgp_local_pref = session_config.get ('bgp_local_pref') %}
  64. protocol bgp {{ session }} from as201701 {
  65. source address {{ session_config.get ('local') }};
  66. neighbor {{ session_config.get ('neighbor') }} as AS_FFRL;
  67. {%- if bgp_local_pref %}
  68. default bgp_local_pref {{ bgp_local_pref }};
  69. {%- endif %}
  70. }
  71. {% endfor %}