[docker-frr]: add static ipv6 loopback route to allow bgp to advertise prefix
frr does not advertise route if local route is not reachable, as a result loopback route /64 is not advertised to the neighbors. Add static route allows frr to advertise the route to its peers Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
parent
162f0fdfe1
commit
ed58684e36
@ -15,5 +15,7 @@ agentx
|
||||
!
|
||||
{% include "staticd/staticd.default_route.conf.j2" %}
|
||||
!
|
||||
{% include "staticd/staticd.loopback_route.conf.j2" %}
|
||||
!
|
||||
{% include "bgpd/bgpd.main.conf.j2" %}
|
||||
!
|
||||
|
@ -10,3 +10,5 @@
|
||||
!
|
||||
{% include "staticd.default_route.conf.j2" %}
|
||||
!
|
||||
{% include "staticd.loopback_route.conf.j2" %}
|
||||
!
|
||||
|
@ -0,0 +1,10 @@
|
||||
!
|
||||
{% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address, get_vnet_interfaces %}
|
||||
!
|
||||
{% block loopback_route %}
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
|
||||
ipv6 route {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | replace('/128', '/64') | ip_network }}/64 Loopback0
|
||||
{% endif %}
|
||||
{% endblock loopback_route %}
|
||||
!
|
@ -36,6 +36,11 @@ link-detect
|
||||
ip route 0.0.0.0/0 10.10.10.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00::/64 Loopback0
|
||||
!
|
||||
!!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
|
@ -17,3 +17,7 @@ log facility local4
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
ip route 0.0.0.0/0 10.10.10.1 200
|
||||
!!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
||||
|
@ -8,5 +8,8 @@
|
||||
"eth0|10.10.10.10/24": {
|
||||
"gwaddr": "10.10.10.1"
|
||||
}
|
||||
},
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|FC00:1::32/128": {}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|FC00:1::32/128": {}
|
||||
}
|
||||
}
|
@ -75,6 +75,12 @@ def test_staticd_default_route():
|
||||
"staticd/staticd.default_route.conf.json",
|
||||
"staticd/staticd.default_route.conf")
|
||||
|
||||
def test_staticd_loopback_route():
|
||||
run_test("staticd.loopback_route.conf.j2",
|
||||
"staticd/staticd.loopback_route.conf.j2",
|
||||
"staticd/staticd.loopback_route.conf.json",
|
||||
"staticd/staticd.loopback_route.conf")
|
||||
|
||||
def test_staticd():
|
||||
run_test("staticd.conf.j2",
|
||||
"staticd/staticd.conf.j2",
|
||||
|
@ -39,6 +39,11 @@ link-detect
|
||||
ip route 0.0.0.0/0 10.0.0.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
|
@ -18,3 +18,8 @@ log facility local4
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
ip route 0.0.0.0/0 10.0.0.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
||||
|
@ -39,6 +39,11 @@ link-detect
|
||||
ip route 0.0.0.0/0 10.0.0.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
|
@ -18,3 +18,8 @@ log facility local4
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
ip route 0.0.0.0/0 10.0.0.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00:1::/64 Loopback0
|
||||
!!
|
||||
|
@ -39,7 +39,12 @@ class TestCfgGen(TestCase):
|
||||
return output
|
||||
|
||||
def run_diff(self, file1, file2):
|
||||
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)
|
||||
output = subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)
|
||||
|
||||
if utils.PY3x:
|
||||
output = output.decode()
|
||||
|
||||
return output
|
||||
|
||||
def run_case(self, template, target):
|
||||
template_dir = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', "frr")
|
||||
@ -55,7 +60,6 @@ class TestCfgGen(TestCase):
|
||||
|
||||
return r, "Diff:\n" + diff_output
|
||||
|
||||
|
||||
def test_config_frr(self):
|
||||
self.assertTrue(*self.run_case('frr.conf.j2', 'frr.conf'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user