Skip to content

Commit a83edf1

Browse files
committed
bgp: T9013: Add BMP source-interface support
1 parent 9d0447f commit a83edf1

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

data/templates/frr/bgpd.frr.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ router bgp {{ system_as }} {{ 'vrf ' ~ vrf if vrf is vyos_defined }} {{ 'as-nota
538538
{% endif %}
539539
{% endif %}
540540
{% if bmp_config.address is vyos_defined %}
541-
bmp connect {{ bmp_config.address }} port {{ bmp_config.port }} min-retry {{ bmp_config.min_retry }} max-retry {{ bmp_config.max_retry }}
541+
bmp connect {{ bmp_config.address }} port {{ bmp_config.port }} min-retry {{ bmp_config.min_retry }} max-retry {{ bmp_config.max_retry }} {{ 'source-interface ' ~ bmp_config.source_interface if bmp_config.source_interface is vyos_defined }}
542542
{% endif %}
543543
{% endfor %}
544544
exit

interface-definitions/include/bgp/protocol-common-config.xml.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@
874874
<children>
875875
#include <include/address-ipv4-ipv6-single.xml.i>
876876
#include <include/port-number.xml.i>
877+
#include <include/source-interface.xml.i>
877878
<leafNode name="port">
878879
<defaultValue>5000</defaultValue>
879880
</leafNode>

smoketest/scripts/cli/test_protocols_bgp.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,7 @@ def test_bgp_99_bmp(self):
18521852
mirror_buffer = '32000000'
18531853
bmp_path = base_path + ['bmp']
18541854
target_path = bmp_path + ['target', target_name]
1855+
source_iface = 'eth0'
18551856

18561857
# by default the 'bmp' module not loaded for the bgpd expect Error
18571858
self.cli_set(bmp_path)
@@ -1879,6 +1880,7 @@ def test_bgp_99_bmp(self):
18791880

18801881
# config other bmp options
18811882
self.cli_set(target_path + ['address', target_address])
1883+
self.cli_set(target_path + ['source-interface', source_iface])
18821884
self.cli_set(bmp_path + ['mirror-buffer-limit', mirror_buffer])
18831885
self.cli_set(target_path + ['port', target_port])
18841886
self.cli_set(target_path + ['min-retry', min_retry])
@@ -1899,7 +1901,21 @@ def test_bgp_99_bmp(self):
18991901
self.assertIn(f'bmp monitor ipv6 unicast {monitor_ipv6}', frrconfig)
19001902
self.assertIn(f'bmp monitor ipv4 unicast loc-rib', frrconfig)
19011903
self.assertIn(f'bmp monitor ipv6 unicast loc-rib', frrconfig)
1902-
self.assertIn(f'bmp connect {target_address} port {target_port} min-retry {min_retry} max-retry {max_retry}', frrconfig)
1904+
self.assertIn(
1905+
f'bmp connect {target_address} port {target_port} min-retry {min_retry} max-retry {max_retry} source-interface {source_iface}',
1906+
frrconfig,
1907+
)
1908+
1909+
# verify source-interface is removed from FRR config after deletion
1910+
self.cli_delete(target_path + ['source-interface'])
1911+
self.cli_commit()
1912+
1913+
frrconfig = self.getFRRconfig(f'router bgp {ASN}', stop_section='^exit')
1914+
self.assertIn(
1915+
f'bmp connect {target_address} port {target_port} min-retry {min_retry} max-retry {max_retry}',
1916+
frrconfig,
1917+
)
1918+
self.assertNotIn('source-interface', frrconfig)
19031919

19041920
def test_bgp_100_link_state(self):
19051921
router_id = '127.0.0.1'

0 commit comments

Comments
 (0)