Skip to content

Commit 5255a09

Browse files
committed
Merged PR 6851858: [Storage BE] BGP policy fixes - do not advertise loopback
Fix errors introduced as part of https://msazure.visualstudio.com/One/_git/Networking-acs-buildimage/pullrequest/6564625?path=/dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v4.leaf.storage.backend/instance.conf.j2 * fix the route map for BT1 * fix the condition to not advertise loopback for storage BT0 and BT1 * add unit tests which can catch the loopback advertisement issue Verified by applying these templates on bt1 and bt0 of bz6prdstr12 and bgp sessions are up and routes are advertised as expected
1 parent a11f33f commit 5255a09

File tree

12 files changed

+158
-20
lines changed

12 files changed

+158
-20
lines changed

dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
9191
{% endif %}
9292
!
9393
{# advertise loopback #}
94-
{% if is_storage_device != 'true' or DEVICE_METADATA['localhost']['type'] not in 'BackEnd' %}
94+
{% if is_storage_device != 'true' or 'BackEnd' not in DEVICE_METADATA['localhost']['type'] %}
9595
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
9696
{% endif %}
9797
{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %}
9898
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
9999
{% endif %}
100100
!
101-
{% if is_storage_device != 'true' or DEVICE_METADATA['localhost']['type'] not in 'BackEnd' %}
101+
{% if is_storage_device != 'true' or 'BackEnd' not in DEVICE_METADATA['localhost']['type'] %}
102102
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
103103
address-family ipv6
104104
{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and

dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v4.leaf.storage.backend/peer-group.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
address-family ipv4 unicast
66
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} activate
77
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} soft-reconfiguration inbound
8-
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map FROM_TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} in
8+
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map FROM_TIER0_V4 in
99
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map TO_TIER0_V4 out
1010
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} send-community
1111
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} maximum-prefix 12000 90 warning-only
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!
22
! template: bgpd/templates/general/instance.conf.j2
33
!
4-
! template: bgpd/templates/msft.general/v4.tor/instance.conf.j2
4+
! template: bgpd/templates/msft.general/v4.tor.storage.backend/instance.conf.j2
55
!
66
neighbor 11.11.11.11 remote-as 11111
77
neighbor 11.11.11.11 description neig_device
@@ -10,7 +10,7 @@
1010
!
1111
neighbor 11.11.11.11 shutdown
1212
!
13-
! end of template: bgpd/templates/msft.general/v4.tor/instance.conf.j2
13+
! end of template: bgpd/templates/msft.general/v4.tor.storage.backend/instance.conf.j2
1414
!
1515
! end of template: bgpd/templates/general/instance.conf.j2
1616
!

src/sonic-bgpcfgd/tests/data/msft.general/peer-group.conf/param_v4.tor.stbk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": {
99
"neig_device": {
10-
"type": "ToRRouter"
10+
"type": "BackEndLeafRouter"
1111
}
1212
},
1313
"constants": {

src/sonic-bgpcfgd/tests/data/msft.general/peer-group.conf/result_v4.leaf.tor.all_stbk.conf renamed to src/sonic-bgpcfgd/tests/data/msft.general/peer-group.conf/result_v4.leaf.storage.backend.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
address-family ipv4 unicast
88
neighbor TIER0_V4_DEPLOYMENT_ID_3 activate
99
neighbor TIER0_V4_DEPLOYMENT_ID_3 soft-reconfiguration inbound
10-
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map FROM_TIER0_V4_DEPLOYMENT_ID_3 in
10+
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map FROM_TIER0_V4 in
1111
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map TO_TIER0_V4 out
1212
neighbor TIER0_V4_DEPLOYMENT_ID_3 send-community
1313
neighbor TIER0_V4_DEPLOYMENT_ID_3 maximum-prefix 12000 90 warning-only
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
!
2-
! template: bgpd/templates/general/peer-group.conf.j2
2+
! template: bgpd/templates/msft.general/v4.tor.storage.backend/peer-group.conf.j2
33
!
4-
! template: bgpd/templates/msft.general/v4.tor.backend/peer-group.conf.j2
5-
!
6-
neighbor FE_TIER0_V4 peer-group
4+
neighbor TIER1_V4 peer-group
75
address-family ipv4 unicast
8-
neighbor FE_TIER0_V4 activate
9-
neighbor FE_TIER0_V4 soft-reconfiguration inbound
10-
neighbor FE_TIER0_V4 route-map FROM_FE_TIER0_V4 in
11-
neighbor FE_TIER0_V4 route-map TO_FE_TIER0_V4 out
12-
neighbor FE_TIER0_V4 send-community
13-
neighbor FE_TIER0_V4 maximum-prefix 12000 90 warning-only
6+
neighbor TIER1_V4 activate
7+
neighbor TIER1_V4 soft-reconfiguration inbound
8+
neighbor TIER1_V4 route-map FROM_TIER1_V4 in
9+
neighbor TIER1_V4 route-map TO_TIER1_V4 out
10+
neighbor TIER1_V4 send-community
11+
neighbor TIER1_V4 maximum-prefix 12000 90 warning-only
1412
exit-address-family
1513
!
16-
! end of template: bgpd/templates/msft.general/v4.tor.backend/peer-group.conf.j2
17-
!
18-
! end of template: bgpd/templates/general/peer-group.conf.j2
14+
! end of template: bgpd/templates/msft.general/v4.tor.storage.backend/peer-group.conf.j2
1915
!
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
!
2+
! template: bgpd/bgpd.main.conf.j2
3+
!
4+
! bgp multiple-instance
5+
!
6+
! BGP configuration
7+
!
8+
! TSA configuration
9+
!
10+
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
11+
!
12+
!
13+
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
14+
!
15+
!
16+
!
17+
!
18+
router bgp 55555
19+
!
20+
bgp log-neighbor-changes
21+
no bgp default ipv4-unicast
22+
no bgp ebgp-requires-policy
23+
!
24+
!
25+
!
26+
bgp router-id 55.55.55.55
27+
!
28+
!
29+
!
30+
network 10.10.10.1/24
31+
!
32+
!
33+
!
34+
address-family ipv4
35+
maximum-paths 64
36+
exit-address-family
37+
address-family ipv6
38+
maximum-paths 64
39+
exit-address-family
40+
!
41+
! end of template: bgpd/bgpd.main.conf.j2
42+
!
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"DEVICE_METADATA": {
3+
"localhost": {
4+
"bgp_asn": "55555",
5+
"type": "BackEndToRRouter",
6+
"storage_device": "true"
7+
}
8+
},
9+
"LOOPBACK_INTERFACE": {
10+
"Loopback0|55.55.55.55/32": {}
11+
},
12+
"VLAN_INTERFACE": {
13+
"Vlan10|10.10.10.1/24": {}
14+
},
15+
"constants": {
16+
"bgp": {
17+
"multipath_relax": {},
18+
"graceful_restart": {
19+
"enabled": true,
20+
"restart_time": 480
21+
},
22+
"maximum_paths": {
23+
"enabled": true
24+
}
25+
}
26+
}
27+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
!
2+
! template: bgpd/bgpd.main.conf.j2
3+
!
4+
! bgp multiple-instance
5+
!
6+
! BGP configuration
7+
!
8+
! TSA configuration
9+
!
10+
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
11+
!
12+
!
13+
!
14+
!
15+
router bgp 55555
16+
!
17+
bgp log-neighbor-changes
18+
no bgp default ipv4-unicast
19+
no bgp ebgp-requires-policy
20+
!
21+
!
22+
!
23+
bgp router-id 55.55.55.55
24+
!
25+
!
26+
!
27+
!
28+
!
29+
!
30+
address-family ipv4
31+
maximum-paths 64
32+
exit-address-family
33+
address-family ipv6
34+
maximum-paths 64
35+
exit-address-family
36+
!
37+
! end of template: bgpd/bgpd.main.conf.j2
38+
!

0 commit comments

Comments
 (0)