BGP community steering
This commit is contained in:
parent
4333fc6867
commit
72433c25f9
111
vyos.conf.j2
111
vyos.conf.j2
@ -1362,79 +1362,78 @@ policy {
|
|||||||
|
|
||||||
{% if 'community_affects_route_maps' in pillar and 'site_codes' in pillar and 'community_affects_prepend_asn' in pillar %}
|
{% if 'community_affects_route_maps' in pillar and 'site_codes' in pillar and 'community_affects_prepend_asn' in pillar %}
|
||||||
{% for route_map_prefix,community_suffixes in pillar.get('community_affects',{}).items() %}
|
{% for route_map_prefix,community_suffixes in pillar.get('community_affects',{}).items() %}
|
||||||
{% for community_suffix in community_suffixes %}
|
{% for digit in "01239" %}
|
||||||
{% for digit in "01239" %}
|
community-list community_affects_65XX{{ digit }}_{{ route_map_prefix }} {
|
||||||
community-list community_affects_65XX{{ digit }}_{{ community_suffix }} {
|
{% for community_suffix in ["0"] + community_suffixes %}
|
||||||
|
{% set loop_parent = loop %}
|
||||||
{% for site_code in ['00'] + pillar['site_codes'] %}
|
{% for site_code in ['00'] + pillar['site_codes'] %}
|
||||||
rule {{ loop.index }} {
|
rule {{ loop_parent.index0 * 10 + loop.index }} {
|
||||||
action 'permit'
|
action 'permit'
|
||||||
regex 65{{ site_code }}{{ digit }}:{{ community_suffix }}
|
regex 65{{ site_code }}{{ digit }}:{{ community_suffix }}
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
{% endfor %}
|
||||||
{% endfor %}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for af in ['IPv4','IPv6'] %}
|
{% for af in ['IPv4','IPv6'] %}
|
||||||
{% for rm in pillar['community_affects_route_maps'] %}
|
{% for rm in pillar['community_affects_route_maps'] %}
|
||||||
route-map {{ route_map_prefix }}-{{ rm }}-{{ af }} {
|
route-map {{ route_map_prefix }}-{{ rm }}-{{ af }} {
|
||||||
{% for community_suffix in community_suffixes %}
|
rule {{ loop.index*10 }} {
|
||||||
rule {{ loop.index*10 }} {
|
match {
|
||||||
match {
|
community {
|
||||||
community {
|
community-list community_affects_65XX0_{{ route_map_prefix }}
|
||||||
community-list community_affects_65XX0_{{ community_suffix }}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
action deny
|
|
||||||
}
|
}
|
||||||
rule {{ loop.index*10 + 1 }} {
|
action deny
|
||||||
match {
|
}
|
||||||
community {
|
rule {{ loop.index*10 + 1 }} {
|
||||||
community-list community_affects_65XX1_{{ community_suffix }}
|
match {
|
||||||
}
|
community {
|
||||||
|
community-list community_affects_65XX1_{{ route_map_prefix }}
|
||||||
}
|
}
|
||||||
set {
|
|
||||||
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }}"
|
|
||||||
}
|
|
||||||
call {{ rm }}-{{ af }}
|
|
||||||
action permit
|
|
||||||
}
|
}
|
||||||
rule {{ loop.index*10 + 2 }} {
|
set {
|
||||||
match {
|
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }}"
|
||||||
community {
|
|
||||||
community-list community_affects_65XX2_{{ community_suffix }}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }}"
|
|
||||||
}
|
|
||||||
call {{ rm }}-{{ af }}
|
|
||||||
action permit
|
|
||||||
}
|
}
|
||||||
rule {{ loop.index*10 + 3 }} {
|
call {{ rm }}-{{ af }}
|
||||||
match {
|
action permit
|
||||||
community {
|
}
|
||||||
community-list community_affects_65XX3_{{ community_suffix }}
|
rule {{ loop.index*10 + 2 }} {
|
||||||
}
|
match {
|
||||||
|
community {
|
||||||
|
community-list community_affects_65XX2_{{ route_map_prefix }}
|
||||||
}
|
}
|
||||||
set {
|
|
||||||
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }}"
|
|
||||||
}
|
|
||||||
call {{ rm }}-{{ af }}
|
|
||||||
action permit
|
|
||||||
}
|
}
|
||||||
rule {{ loop.index*10 + 9 }} {
|
set {
|
||||||
match {
|
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }}"
|
||||||
community {
|
|
||||||
community-list community_affects_65XX9_{{ community_suffix }}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
community "additive no-export"
|
|
||||||
}
|
|
||||||
call {{ rm }}-{{ af }}
|
|
||||||
action permit
|
|
||||||
}
|
}
|
||||||
{% endfor %}
|
call {{ rm }}-{{ af }}
|
||||||
|
action permit
|
||||||
|
}
|
||||||
|
rule {{ loop.index*10 + 3 }} {
|
||||||
|
match {
|
||||||
|
community {
|
||||||
|
community-list community_affects_65XX3_{{ route_map_prefix }}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
as-path-prepend "{{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }} {{ pillar['community_affects_prepend_asn'] }}"
|
||||||
|
}
|
||||||
|
call {{ rm }}-{{ af }}
|
||||||
|
action permit
|
||||||
|
}
|
||||||
|
rule {{ loop.index*10 + 9 }} {
|
||||||
|
match {
|
||||||
|
community {
|
||||||
|
community-list community_affects_65XX9_{{ route_map_prefix }}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
community "additive no-export"
|
||||||
|
}
|
||||||
|
call {{ rm }}-{{ af }}
|
||||||
|
action permit
|
||||||
|
}
|
||||||
rule 65535 {
|
rule 65535 {
|
||||||
match {
|
match {
|
||||||
{% if af == "IPv4" %}
|
{% if af == "IPv4" %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user