diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index a244e86693..b4f6d880e8 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -32,7 +32,12 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi ! {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export +{% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %} + on-match next +route-map HIDE_INTERNAL permit 20 + set community {{ constants.bgp.peers.internal.community }} additive +{% endif %} {% set multi_asic = True %} ! {% endif %} diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index cf73bf4369..9797a3e3c7 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -39,7 +39,11 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 5 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export + on-match next +route-map HIDE_INTERNAL permit 20 + set community 1234:5678 additive +! ! ! router bgp 55555 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json index bc266ed704..34fdbe7244 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json @@ -29,6 +29,11 @@ "enabled": true, "ipv4": 32, "ipv6": 32 + }, + "peers": { + "internal": { + "community": "1234:5678" + } } } } diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index 341753f6b7..584a00bb9d 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -17,7 +17,8 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 15 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export +! ! ! router bgp 55555 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index d1ac9b6ea3..083d8c20dc 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -17,7 +17,8 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 15 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export +! ! ! router bgp 55555 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 5fa2ab0a8e..bf526235fe 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -53,7 +53,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 10.10.10.1/24 ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 5 permit fc01::1/64 ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! router bgp 55555 ! diff --git a/src/sonic-config-engine/tests/sample_output/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/bgpd_frr_backend_asic.conf index 976295e7e1..27dca115de 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd_frr_backend_asic.conf @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100 diff --git a/src/sonic-config-engine/tests/sample_output/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/bgpd_frr_frontend_asic.conf index 0e9ce753ec..36ae34705c 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd_frr_frontend_asic.conf @@ -35,7 +35,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! route-map HIDE_INTERNAL permit 10 - set community local-AS + set community no-export ! ! router bgp 65100