Skip to content

Commit

Permalink
Merged PR 6851858: [Storage BE] BGP policy fixes - do not advertise l…
Browse files Browse the repository at this point in the history
…oopback

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
  • Loading branch information
neethajohn committed Oct 5, 2022
1 parent a11f33f commit 5255a09
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 20 deletions.
4 changes: 2 additions & 2 deletions dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% endif %}
!
{# advertise loopback #}
{% if is_storage_device != 'true' or DEVICE_METADATA['localhost']['type'] not in 'BackEnd' %}
{% if is_storage_device != 'true' or 'BackEnd' not in DEVICE_METADATA['localhost']['type'] %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
{% endif %}
{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
{% endif %}
!
{% if is_storage_device != 'true' or DEVICE_METADATA['localhost']['type'] not in 'BackEnd' %}
{% if is_storage_device != 'true' or 'BackEnd' not in DEVICE_METADATA['localhost']['type'] %}
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
address-family ipv6
{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
address-family ipv4 unicast
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} activate
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} soft-reconfiguration inbound
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map FROM_TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} in
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map FROM_TIER0_V4 in
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} route-map TO_TIER0_V4 out
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} send-community
neighbor TIER0_V4_DEPLOYMENT_ID_{{ neighbor_deployment_id }} maximum-prefix 12000 90 warning-only
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!
! template: bgpd/templates/general/instance.conf.j2
!
! template: bgpd/templates/msft.general/v4.tor/instance.conf.j2
! template: bgpd/templates/msft.general/v4.tor.storage.backend/instance.conf.j2
!
neighbor 11.11.11.11 remote-as 11111
neighbor 11.11.11.11 description neig_device
Expand All @@ -10,7 +10,7 @@
!
neighbor 11.11.11.11 shutdown
!
! end of template: bgpd/templates/msft.general/v4.tor/instance.conf.j2
! end of template: bgpd/templates/msft.general/v4.tor.storage.backend/instance.conf.j2
!
! end of template: bgpd/templates/general/instance.conf.j2
!
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": {
"neig_device": {
"type": "ToRRouter"
"type": "BackEndLeafRouter"
}
},
"constants": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
address-family ipv4 unicast
neighbor TIER0_V4_DEPLOYMENT_ID_3 activate
neighbor TIER0_V4_DEPLOYMENT_ID_3 soft-reconfiguration inbound
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map FROM_TIER0_V4_DEPLOYMENT_ID_3 in
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map FROM_TIER0_V4 in
neighbor TIER0_V4_DEPLOYMENT_ID_3 route-map TO_TIER0_V4 out
neighbor TIER0_V4_DEPLOYMENT_ID_3 send-community
neighbor TIER0_V4_DEPLOYMENT_ID_3 maximum-prefix 12000 90 warning-only
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
!
! template: bgpd/templates/general/peer-group.conf.j2
! template: bgpd/templates/msft.general/v4.tor.storage.backend/peer-group.conf.j2
!
! template: bgpd/templates/msft.general/v4.tor.backend/peer-group.conf.j2
!
neighbor FE_TIER0_V4 peer-group
neighbor TIER1_V4 peer-group
address-family ipv4 unicast
neighbor FE_TIER0_V4 activate
neighbor FE_TIER0_V4 soft-reconfiguration inbound
neighbor FE_TIER0_V4 route-map FROM_FE_TIER0_V4 in
neighbor FE_TIER0_V4 route-map TO_FE_TIER0_V4 out
neighbor FE_TIER0_V4 send-community
neighbor FE_TIER0_V4 maximum-prefix 12000 90 warning-only
neighbor TIER1_V4 activate
neighbor TIER1_V4 soft-reconfiguration inbound
neighbor TIER1_V4 route-map FROM_TIER1_V4 in
neighbor TIER1_V4 route-map TO_TIER1_V4 out
neighbor TIER1_V4 send-community
neighbor TIER1_V4 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v4.tor.backend/peer-group.conf.j2
!
! end of template: bgpd/templates/general/peer-group.conf.j2
! end of template: bgpd/templates/msft.general/v4.tor.storage.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
!
!
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
!
!
bgp router-id 55.55.55.55
!
!
!
network 10.10.10.1/24
!
!
!
address-family ipv4
maximum-paths 64
exit-address-family
address-family ipv6
maximum-paths 64
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"type": "BackEndToRRouter",
"storage_device": "true"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {}
},
"constants": {
"bgp": {
"multipath_relax": {},
"graceful_restart": {
"enabled": true,
"restart_time": 480
},
"maximum_paths": {
"enabled": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
!
!
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
!
!
bgp router-id 55.55.55.55
!
!
!
!
!
!
address-family ipv4
maximum-paths 64
exit-address-family
address-family ipv6
maximum-paths 64
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"type": "BackEndLeafRouter",
"storage_device": "true"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {}
},
"constants": {
"bgp": {
"multipath_relax": {},
"graceful_restart": {
"enabled": true
},
"maximum_paths": {
"enabled": true
}
}
}
}
12 changes: 12 additions & 0 deletions src/sonic-bgpcfgd/tests/test_sonic-cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ def test_bgpd_lo_ipv6_conf_base():
"bgpd.main.conf.j2/base.json",
"bgpd.main.conf.j2/base.conf")

def test_bgpd_main_storage_be_tor():
run_test("Storage BE ToR bgpd.main.conf.j2",
"bgpd/bgpd.main.conf.j2",
"bgpd.main.conf.j2/stbk_t0.json",
"bgpd.main.conf.j2/stbk_t0.conf")

def test_bgpd_main_storage_be_t1():
run_test("Storage BE T1 bgpd.main.conf.j2",
"bgpd/bgpd.main.conf.j2",
"bgpd.main.conf.j2/stbk_t1.json",
"bgpd.main.conf.j2/stbk_t1.conf")

def test_tsa_isolate():
run_test("tsa/bgpd.tsa.isolate.conf.j2",
"bgpd/tsa/bgpd.tsa.isolate.conf.j2",
Expand Down

0 comments on commit 5255a09

Please sign in to comment.