Skip to content

Commit

Permalink
Add bmp dynamic feature switch in frr side config.
Browse files Browse the repository at this point in the history
  • Loading branch information
FengPan-Frank committed Nov 22, 2024
1 parent aa9a13b commit c0ab71a
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
bgp graceful-restart select-defer-time {{ constants.bgp.graceful_restart.select_defer_time | default(45) }}
{% endif %}
!
{# set bmp info #}
{% if (FEATURE is defined) and ('bmp' in FEATURE) and ('state' in FEATURE['bmp']) and FEATURE['bmp']['state'] == 'enabled' %}
!
bmp mirror buffer-limit 4294967214
bmp targets sonic-bmp
bmp stats interval 1000
bmp monitor ipv4 unicast pre-policy
bmp monitor ipv6 unicast pre-policy
bmp connect 127.0.0.1 port 5000 min-retry 1000 max-retry 2000
!
!
{% endif %}
{# set router-id #}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
{% if 'bgp_router_id' in DEVICE_METADATA['localhost'] %}
Expand Down
4 changes: 4 additions & 0 deletions dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ dependent_startup_wait_for=zebra:running
{% endif %}

[program:bgpd]
{% if FEATURE.bmp is defined and FEATURE.bmp.state == "enabled" %}
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp -M bmp
{% else %}
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp
{% endif %}
priority=5
stopsignal=KILL
autostart=false
Expand Down
88 changes: 88 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_bmp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
!
! template: bgpd/bgpd.conf.j2
!
!
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
! generated by templates/quagga/bgpd.conf.j2 with config DB data
! file: bgpd.conf
!
!
! template: common/daemons.common.conf.j2
!
hostname switch-t0
password zebra
enable password zebra
!
log syslog informational
log facility local4
!
! end of template: common/daemons.common.conf.j2!
agentx
!
!
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 192.168.0.0/27
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27
!
!
!
router bgp 65100
!
bgp log-neighbor-changes
bgp suppress-fib-pending
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp graceful-restart preserve-fw-state
bgp graceful-restart select-defer-time 45
!
!
bmp mirror buffer-limit 4294967214
bmp targets sonic-bmp
bmp stats interval 1000
bmp monitor ipv4 unicast pre-policy
bmp monitor ipv6 unicast pre-policy
bmp connect 127.0.0.1 port 5000 min-retry 1000 max-retry 2000
!
!
bgp router-id 10.1.0.32
!
network 10.1.0.32/32
!
address-family ipv6
network fc00:1::32/64
exit-address-family
!
network 192.168.0.1/27
network 192.168.200.1/27
!
!
!
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
!!
! end of template: bgpd/bgpd.conf.j2
!
88 changes: 88 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_bmp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
!
! template: bgpd/bgpd.conf.j2
!
!
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
! generated by templates/quagga/bgpd.conf.j2 with config DB data
! file: bgpd.conf
!
!
! template: common/daemons.common.conf.j2
!
hostname switch-t0
password zebra
enable password zebra
!
log syslog informational
log facility local4
!
! end of template: common/daemons.common.conf.j2!
agentx
!
!
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 192.168.0.0/27
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27
!
!
!
router bgp 65100
!
bgp log-neighbor-changes
bgp suppress-fib-pending
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp graceful-restart preserve-fw-state
bgp graceful-restart select-defer-time 45
!
!
bmp mirror buffer-limit 4294967214
bmp targets sonic-bmp
bmp stats interval 1000
bmp monitor ipv4 unicast pre-policy
bmp monitor ipv6 unicast pre-policy
bmp connect 127.0.0.1 port 5000 min-retry 1000 max-retry 2000
!
!
bgp router-id 10.1.0.32
!
network 10.1.0.32/32
!
address-family ipv6
network fc00:1::32/64
exit-address-family
!
network 192.168.0.1/27
network 192.168.200.1/27
!
!
!
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
!!
! end of template: bgpd/bgpd.conf.j2
!
4 changes: 4 additions & 0 deletions src/sonic-config-engine/tests/test_frr.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ def test_bgpd_frr_dualtor(self):
def test_zebra_frr_dualtor(self):
extra_data = {"DEVICE_METADATA": {"localhost": {"subtype": "DualToR"}}}
self.assertTrue(*self.run_case('zebra/zebra.conf.j2', 'zebra_frr_dualtor.conf', extra_data=extra_data))

def test_bgpd_frr_bmp(self):
extra_data = {"FEATURE": {"bmp": {"state": "enabled"}}}
self.assertTrue(*self.run_case('bgpd/bgpd.conf.j2', 'bgpd_frr_bmp.conf', extra_data=extra_data))

0 comments on commit c0ab71a

Please sign in to comment.