[sonic-frr]: FRR 4.0 integration with SONiC (#2099)
* FRR 4.0 integration with SONiC -- Uses SONiC FRR repo frr/4.0 (which has SONiC support) to build image -- Makefile changes to make frr4.0 builtable. -- Updated/Added FRR configuration files -- bgpd jinja template fixes To build SONiC images with FRR4.0, simply edit rules/config file and change routing stack to following: SONIC_ROUTING_STACK = frr and then build images as usual. * Used integrated-vtysh-config in FRR Changed to single template: frr.conf.j2 for configuration and added tests
This commit is contained in:
parent
6ba2f97f1e
commit
673bb6580e
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -46,7 +46,7 @@
|
||||
url = https://github.com/Azure/sonic-platform-daemons
|
||||
[submodule "src/sonic-frr/frr"]
|
||||
path = src/sonic-frr/frr
|
||||
url = https://github.com/FRRouting/frr.git
|
||||
url = https://github.com/Azure/sonic-frr.git
|
||||
[submodule "platform/p4/p4-hlir/p4-hlir-v1.1"]
|
||||
path = platform/p4/p4-hlir/p4-hlir-v1.1
|
||||
url = https://github.com/p4lang/p4-hlir.git
|
||||
|
@ -33,7 +33,8 @@ RUN rm -rf /debs ~/.cache
|
||||
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
||||
COPY ["start.sh", "config.sh", "/usr/bin/"]
|
||||
COPY ["daemons", "/etc/frr/"]
|
||||
COPY ["debian.conf", "/etc/frr/"]
|
||||
COPY ["daemons.conf", "/etc/frr/"]
|
||||
COPY ["vtysh.conf", "/etc/frr/"]
|
||||
|
||||
ENTRYPOINT /usr/bin/config.sh \
|
||||
&& /usr/bin/start.sh \
|
||||
|
@ -1,101 +0,0 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block system_init %}
|
||||
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
||||
password zebra
|
||||
log syslog informational
|
||||
log facility local4
|
||||
! enable password {# {{ en_passwd }} TODO: param needed #}
|
||||
{% endblock system_init %}
|
||||
!
|
||||
{% block bgp_init %}
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
no bgp default ipv4-unicast
|
||||
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if prefix | ipv4 and name == 'Loopback0' %}
|
||||
bgp router-id {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{# advertise loopback #}
|
||||
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if prefix | ipv4 %}
|
||||
network {{ prefix | ip }}/32
|
||||
{% elif prefix | ipv6 %}
|
||||
address-family ipv6
|
||||
network {{ prefix | ip }}/128
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_init %}
|
||||
{% block vlan_advertisement %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE %}
|
||||
{% if prefix | ipv4 %}
|
||||
network {{ prefix }}
|
||||
{% elif prefix | ipv6 %}
|
||||
address-family ipv6
|
||||
network {{ prefix }}
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock vlan_advertisement %}
|
||||
{% block bgp_sessions %}
|
||||
{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %}
|
||||
{% if bgp_session['asn'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
||||
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
||||
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }}
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
neighbor {{ neighbor_addr }} allowas-in 1
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv4 %}
|
||||
address-family ipv4
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
{% if bgp_session['rrclient'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} route-reflector-client
|
||||
{% endif %}
|
||||
{% if bgp_session['nhopself'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self
|
||||
{% endif %}
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv6 %}
|
||||
address-family ipv6
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
{% if bgp_session['rrclient'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} route-reflector-client
|
||||
{% endif %}
|
||||
{% if bgp_session['nhopself'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self
|
||||
{% endif %}
|
||||
{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %}
|
||||
neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in
|
||||
{% endif %}
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_sessions %}
|
||||
!
|
||||
maximum-paths 64
|
||||
!
|
||||
route-map ISOLATE permit 10
|
||||
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
!
|
||||
route-map set-next-hop-global-v6 permit 10
|
||||
set ipv6 next-hop prefer-global
|
||||
!
|
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /etc/frr
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/frr.conf.j2 >/etc/frr/frr.conf
|
||||
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate
|
||||
chown root:root /usr/sbin/bgp-isolate
|
||||
@ -12,10 +11,5 @@ sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisol
|
||||
chown root:root /usr/sbin/bgp-unisolate
|
||||
chmod 0755 /usr/sbin/bgp-unisolate
|
||||
|
||||
# If there's an integrated-config file, go ahead and remote it
|
||||
if [ -f /etc/frr/frr.conf ]; then
|
||||
rm -rf /etc/frr/frr.conf
|
||||
fi
|
||||
|
||||
mkdir -p /var/sonic
|
||||
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
|
||||
|
@ -1,25 +1,25 @@
|
||||
# This file tells the quagga package which daemons to start.
|
||||
# This file tells the frr package which daemons to start.
|
||||
#
|
||||
# Entries are in the format: <daemon>=(yes|no|priority)
|
||||
# 0, "no" = disabled
|
||||
# 1, "yes" = highest priority
|
||||
# 2 .. 10 = lower priorities
|
||||
# Read /usr/share/doc/quagga/README.Debian for details.
|
||||
# Read /usr/share/doc/frr/README.Debian for details.
|
||||
#
|
||||
# Sample configurations for these daemons can be found in
|
||||
# /usr/share/doc/quagga/examples/.
|
||||
# /usr/share/doc/frr/examples/.
|
||||
#
|
||||
# ATTENTION:
|
||||
# ATTENTION:
|
||||
#
|
||||
# When activation a daemon at the first time, a config file, even if it is
|
||||
# empty, has to be present *and* be owned by the user and group "quagga", else
|
||||
# the daemon will not be started by /etc/init.d/quagga. The permissions should
|
||||
# empty, has to be present *and* be owned by the user and group "frr", else
|
||||
# the daemon will not be started by /etc/init.d/frr. The permissions should
|
||||
# be u=rw,g=r,o=.
|
||||
# When using "vtysh" such a config file is also needed. It should be owned by
|
||||
# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too.
|
||||
# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too.
|
||||
#
|
||||
# The watchquagga daemon is always started. Per default in monitoring-only but
|
||||
# that can be changed via /etc/quagga/debian.conf.
|
||||
# The watchfrr daemon is always started. Per default in monitoring-only but
|
||||
# that can be changed via /etc/frr/daemons.conf.
|
||||
#
|
||||
zebra=yes
|
||||
bgpd=yes
|
||||
@ -28,4 +28,9 @@ ospf6d=no
|
||||
ripd=no
|
||||
ripngd=no
|
||||
isisd=no
|
||||
pimd=no
|
||||
ldpd=no
|
||||
nhrpd=no
|
||||
eigrpd=no
|
||||
babeld=no
|
||||
sharpd=no
|
||||
|
@ -14,7 +14,15 @@ isisd_options=" --daemon -A 127.0.0.1"
|
||||
pimd_options=" --daemon -A 127.0.0.1"
|
||||
ldpd_options=" --daemon -A 127.0.0.1"
|
||||
nhrpd_options=" --daemon -A 127.0.0.1"
|
||||
eigrpd_options=" --daemon -A 127.0.0.1"
|
||||
babeld_options=" --daemon -A 127.0.0.1"
|
||||
sharpd_options=" --daemon -A 127.0.0.1"
|
||||
|
||||
# The list of daemons to watch is automatically generated by the init script.
|
||||
watchfrr_enable=yes
|
||||
watchfrr_options=(-adz -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30)
|
||||
watchfrr_options=(-d -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30)
|
||||
|
||||
# If valgrind_enable is 'yes' the frr daemons will be started via valgrind.
|
||||
# The use case for doing so is tracking down memory leaks, etc in frr.
|
||||
valgrind_enable=no
|
||||
valgrind=/usr/bin/valgrind
|
209
dockers/docker-fpm-frr/frr.conf.j2
Normal file
209
dockers/docker-fpm-frr/frr.conf.j2
Normal file
@ -0,0 +1,209 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/frr/frr.conf.j2 with config DB data
|
||||
! file: frr.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block system_init %}
|
||||
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
||||
password zebra
|
||||
log syslog informational
|
||||
log facility local4
|
||||
! enable password {# {{ en_passwd }} TODO: param needed #}
|
||||
{% endblock system_init %}
|
||||
!
|
||||
{% block interfaces %}
|
||||
! Enable link-detect (default disabled)
|
||||
{% for (name, prefix) in INTERFACE %}
|
||||
interface {{ name }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% for pc in PORTCHANNEL %}
|
||||
interface {{ pc }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% endblock interfaces %}
|
||||
!
|
||||
{% block default_route %}
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
{% for (name, prefix) in MGMT_INTERFACE %}
|
||||
{% if prefix | ipv4 %}
|
||||
ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock default_route %}
|
||||
!
|
||||
{% block source_loopback %}
|
||||
{% set lo_ipv4_addrs = [] %}
|
||||
{% set lo_ipv6_addrs = [] %}
|
||||
{% if LOOPBACK_INTERFACE %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if name == 'Loopback0' %}
|
||||
{% if prefix | ipv6 %}
|
||||
{% if lo_ipv6_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if lo_ipv4_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
! Set ip source to loopback for bgp learned routes
|
||||
route-map RM_SET_SRC permit 10
|
||||
set src {{ lo_ipv4_addrs[0] | ip }}
|
||||
!
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
route-map RM_SET_SRC6 permit 10
|
||||
set src {{ lo_ipv6_addrs[0] | ip }}
|
||||
!
|
||||
{% endif %}
|
||||
ip protocol bgp route-map RM_SET_SRC
|
||||
!
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
ipv6 protocol bgp route-map RM_SET_SRC6
|
||||
!
|
||||
{% endif %}
|
||||
{% endblock source_loopback %}
|
||||
!
|
||||
{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %}
|
||||
{% block bgp_init %}
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
route-map FROM_BGP_SPEAKER_V4 permit 10
|
||||
!
|
||||
route-map TO_BGP_SPEAKER_V4 deny 10
|
||||
!
|
||||
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
no bgp default ipv4-unicast
|
||||
{# Advertise graceful restart capability for ToR #}
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
bgp graceful-restart
|
||||
{% endif %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if prefix | ipv4 and name == 'Loopback0' %}
|
||||
bgp router-id {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{# advertise loopback #}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if prefix | ipv4 and name == 'Loopback0' %}
|
||||
network {{ prefix | ip }}/32
|
||||
{% elif prefix | ipv6 and name == 'Loopback0' %}
|
||||
address-family ipv6
|
||||
network {{ prefix | ip }}/128
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_init %}
|
||||
{% endif %}
|
||||
{% block vlan_advertisement %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE %}
|
||||
{% if prefix | ipv4 %}
|
||||
network {{ prefix }}
|
||||
{% elif prefix | ipv6 %}
|
||||
address-family ipv6
|
||||
network {{ prefix }}
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock vlan_advertisement %}
|
||||
{% block bgp_sessions %}
|
||||
{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %}
|
||||
{% if bgp_session['asn'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
||||
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
||||
{# set the bgp neighbor timers if they have not default values #}
|
||||
{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60)
|
||||
or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %}
|
||||
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }}
|
||||
{% endif %}
|
||||
{% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %}
|
||||
neighbor {{ neighbor_addr }} shutdown
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv4 %}
|
||||
address-family ipv4
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
neighbor {{ neighbor_addr }} allowas-in 1
|
||||
{% endif %}
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
neighbor {{ neighbor_addr }} soft-reconfiguration inbound
|
||||
{% if bgp_session['rrclient'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} route-reflector-client
|
||||
{% endif %}
|
||||
{% if bgp_session['nhopself'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self
|
||||
{% endif %}
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv6 %}
|
||||
address-family ipv6
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
neighbor {{ neighbor_addr }} allowas-in 1
|
||||
{% endif %}
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
neighbor {{ neighbor_addr }} soft-reconfiguration inbound
|
||||
{% if bgp_session['rrclient'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} route-reflector-client
|
||||
{% endif %}
|
||||
{% if bgp_session['nhopself'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self
|
||||
{% endif %}
|
||||
{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %}
|
||||
neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in
|
||||
{% endif %}
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_sessions %}
|
||||
{% block bgp_peers_with_range %}
|
||||
{% if BGP_PEER_RANGE %}
|
||||
{% for bgp_peer in BGP_PEER_RANGE.values() %}
|
||||
neighbor {{ bgp_peer['name'] }} peer-group
|
||||
neighbor {{ bgp_peer['name'] }} passive
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }}
|
||||
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if name == 'Loopback1' %}
|
||||
neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for ip_range in bgp_peer['ip_range'] %}
|
||||
bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }}
|
||||
{% endfor %}
|
||||
address-family ipv4
|
||||
neighbor {{ bgp_peer['name'] }} activate
|
||||
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
||||
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
||||
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
neighbor {{ bgp_peer['name'] }} activate
|
||||
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock bgp_peers_with_range %}
|
||||
!
|
||||
{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %}
|
||||
maximum-paths 64
|
||||
!
|
||||
route-map ISOLATE permit 10
|
||||
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
{% endif %}
|
||||
!
|
||||
route-map set-next-hop-global-v6 permit 10
|
||||
set ipv6 next-hop prefer-global
|
||||
!
|
1
dockers/docker-fpm-frr/vtysh.conf
Normal file
1
dockers/docker-fpm-frr/vtysh.conf
Normal file
@ -0,0 +1 @@
|
||||
service integrated-vtysh-config
|
@ -1,74 +0,0 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/zebra.conf.j2 using config DB data
|
||||
! file: zebra.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block sys_init %}
|
||||
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
||||
password zebra
|
||||
enable password zebra
|
||||
{% endblock sys_init %}
|
||||
!
|
||||
{% block interfaces %}
|
||||
! Enable link-detect (default disabled)
|
||||
{% for (name, prefix) in INTERFACE %}
|
||||
interface {{ name }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% for pc in PORTCHANNEL %}
|
||||
interface {{ pc }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% endblock interfaces %}
|
||||
!
|
||||
{% block default_route %}
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
{% for (name, prefix) in MGMT_INTERFACE %}
|
||||
{% if prefix | ipv4 %}
|
||||
ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock default_route %}
|
||||
!
|
||||
{% block source_loopback %}
|
||||
{% set lo_ipv4_addrs = [] %}
|
||||
{% set lo_ipv6_addrs = [] %}
|
||||
{% if LOOPBACK_INTERFACE %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if prefix | ipv6 %}
|
||||
{% if lo_ipv6_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if lo_ipv4_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
! Set ip source to loopback for bgp learned routes
|
||||
route-map RM_SET_SRC permit 10
|
||||
set src {{ lo_ipv4_addrs[0] | ip }}
|
||||
!
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
route-map RM_SET_SRC6 permit 10
|
||||
set src {{ lo_ipv6_addrs[0] | ip }}
|
||||
!
|
||||
{% endif %}
|
||||
ip protocol bgp route-map RM_SET_SRC
|
||||
!
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
ipv6 protocol bgp route-map RM_SET_SRC6
|
||||
!
|
||||
{% endif %}
|
||||
{% endblock source_loopback %}
|
||||
!
|
||||
{% block logging %}
|
||||
log syslog informational
|
||||
log facility local4
|
||||
{% endblock logging %}
|
||||
!
|
||||
|
@ -45,8 +45,8 @@ DEFAULT_PASSWORD = YourPaSsWoRd
|
||||
# SONIC_INSTALL_DEBUG_TOOLS = y
|
||||
|
||||
# SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane.
|
||||
# Quagga will be the default routing-stack for all the SONiC platforms. Other supported
|
||||
# routing-stacks: frr, gobgp.
|
||||
# Supported routing stacks on SONiC are:
|
||||
# routing-stacks: quagga, frr.
|
||||
SONIC_ROUTING_STACK = quagga
|
||||
|
||||
# ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes.
|
||||
|
@ -1,9 +1,9 @@
|
||||
# FRRouting (frr) package
|
||||
|
||||
FRR_VERSION = 3.0
|
||||
FRR_VERSION = 4.0
|
||||
export FRR_VERSION
|
||||
|
||||
FRR = frr_$(FRR_VERSION)_amd64.deb
|
||||
FRR = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb
|
||||
$(FRR)_DEPENDS += $(LIBSNMP_DEV)
|
||||
$(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr
|
||||
SONIC_MAKE_DEBS += $(FRR)
|
||||
|
@ -63,6 +63,7 @@ RUN apt-get update && apt-get install -y \
|
||||
libjson0-dev \
|
||||
libsystemd-dev \
|
||||
python-ipaddr \
|
||||
install-info \
|
||||
# For libnl3 (local) build
|
||||
cdbs \
|
||||
# For SAI meta build
|
||||
|
136
src/sonic-config-engine/tests/sample_output/frr.conf
Normal file
136
src/sonic-config-engine/tests/sample_output/frr.conf
Normal file
@ -0,0 +1,136 @@
|
||||
!
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/frr/frr.conf.j2 with config DB data
|
||||
! file: frr.conf
|
||||
!
|
||||
!
|
||||
hostname switch-t0
|
||||
password zebra
|
||||
log syslog informational
|
||||
log facility local4
|
||||
! enable password !
|
||||
! Enable link-detect (default disabled)
|
||||
interface PortChannel01
|
||||
link-detect
|
||||
!
|
||||
interface PortChannel02
|
||||
link-detect
|
||||
!
|
||||
interface PortChannel03
|
||||
link-detect
|
||||
!
|
||||
interface PortChannel04
|
||||
link-detect
|
||||
!
|
||||
!
|
||||
! 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
|
||||
!
|
||||
! Set ip source to loopback for bgp learned routes
|
||||
route-map RM_SET_SRC permit 10
|
||||
set src 10.1.0.32
|
||||
!
|
||||
|
||||
route-map RM_SET_SRC6 permit 10
|
||||
set src fc00:1::32
|
||||
!
|
||||
ip protocol bgp route-map RM_SET_SRC
|
||||
!
|
||||
ipv6 protocol bgp route-map RM_SET_SRC6
|
||||
!
|
||||
!
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
route-map FROM_BGP_SPEAKER_V4 permit 10
|
||||
!
|
||||
route-map TO_BGP_SPEAKER_V4 deny 10
|
||||
!
|
||||
router bgp 65100
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
no bgp default ipv4-unicast
|
||||
bgp graceful-restart
|
||||
bgp router-id 10.1.0.32
|
||||
network 10.1.0.32/32
|
||||
address-family ipv6
|
||||
network fc00:1::32/128
|
||||
exit-address-family
|
||||
network 192.168.0.1/27
|
||||
neighbor 10.0.0.57 remote-as 64600
|
||||
neighbor 10.0.0.57 description ARISTA01T1
|
||||
address-family ipv4
|
||||
neighbor 10.0.0.57 allowas-in 1
|
||||
neighbor 10.0.0.57 activate
|
||||
neighbor 10.0.0.57 soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor 10.0.0.59 remote-as 64600
|
||||
neighbor 10.0.0.59 description ARISTA02T1
|
||||
address-family ipv4
|
||||
neighbor 10.0.0.59 allowas-in 1
|
||||
neighbor 10.0.0.59 activate
|
||||
neighbor 10.0.0.59 soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor 10.0.0.61 remote-as 64600
|
||||
neighbor 10.0.0.61 description ARISTA03T1
|
||||
address-family ipv4
|
||||
neighbor 10.0.0.61 allowas-in 1
|
||||
neighbor 10.0.0.61 activate
|
||||
neighbor 10.0.0.61 soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor 10.0.0.63 remote-as 64600
|
||||
neighbor 10.0.0.63 description ARISTA04T1
|
||||
address-family ipv4
|
||||
neighbor 10.0.0.63 allowas-in 1
|
||||
neighbor 10.0.0.63 activate
|
||||
neighbor 10.0.0.63 soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor fc00::7a remote-as 64600
|
||||
neighbor fc00::7a description ARISTA03T1
|
||||
address-family ipv6
|
||||
neighbor fc00::7a allowas-in 1
|
||||
neighbor fc00::7a activate
|
||||
neighbor fc00::7a soft-reconfiguration inbound
|
||||
neighbor fc00::7a route-map set-next-hop-global-v6 in
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor fc00::7e remote-as 64600
|
||||
neighbor fc00::7e description ARISTA04T1
|
||||
address-family ipv6
|
||||
neighbor fc00::7e allowas-in 1
|
||||
neighbor fc00::7e activate
|
||||
neighbor fc00::7e soft-reconfiguration inbound
|
||||
neighbor fc00::7e route-map set-next-hop-global-v6 in
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor fc00::72 remote-as 64600
|
||||
neighbor fc00::72 description ARISTA01T1
|
||||
address-family ipv6
|
||||
neighbor fc00::72 allowas-in 1
|
||||
neighbor fc00::72 activate
|
||||
neighbor fc00::72 soft-reconfiguration inbound
|
||||
neighbor fc00::72 route-map set-next-hop-global-v6 in
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
neighbor fc00::76 remote-as 64600
|
||||
neighbor fc00::76 description ARISTA02T1
|
||||
address-family ipv6
|
||||
neighbor fc00::76 allowas-in 1
|
||||
neighbor fc00::76 activate
|
||||
neighbor fc00::76 soft-reconfiguration inbound
|
||||
neighbor fc00::76 route-map set-next-hop-global-v6 in
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
!
|
||||
maximum-paths 64
|
||||
!
|
||||
route-map ISOLATE permit 10
|
||||
set as-path prepend 65100
|
||||
!
|
||||
route-map set-next-hop-global-v6 permit 10
|
||||
set ipv6 next-hop prefer-global
|
||||
!
|
@ -64,17 +64,23 @@ class TestJ2Files(TestCase):
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file))
|
||||
|
||||
def test_bgpd(self):
|
||||
def test_bgpd_quagga(self):
|
||||
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'bgpd.conf.j2')
|
||||
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd.conf'), self.output_file))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf'), self.output_file))
|
||||
|
||||
def test_zebra(self):
|
||||
def test_zebra_quagga(self):
|
||||
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'zebra.conf.j2')
|
||||
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'zebra.conf'), self.output_file))
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'zebra_quagga.conf'), self.output_file))
|
||||
|
||||
def test_config_frr(self):
|
||||
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', 'frr.conf.j2')
|
||||
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'frr.conf'), self.output_file))
|
||||
|
||||
def test_teamd(self):
|
||||
|
||||
|
@ -2,18 +2,40 @@
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = frr_$(FRR_VERSION)_amd64.deb
|
||||
MAIN_TARGET = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# Replacing frr's rules/install files with SONiC's own versions to activate
|
||||
# specific knobs and adjust install process to address SONiC's needs.
|
||||
cp sonic_frr.rules frr/debian/rules
|
||||
cp sonic_frr.install frr/debian/frr.install
|
||||
|
||||
# Build the package
|
||||
# Build the package
|
||||
pushd ./frr
|
||||
rm -f debian/*.debhelper.log
|
||||
|
||||
# clean up the previous build
|
||||
rm -rf debian
|
||||
rm frr*.tar.gz
|
||||
rm frr*.tar.xz
|
||||
rm frr*.dsc
|
||||
|
||||
# make a dist tarball
|
||||
./bootstrap.sh
|
||||
./configure
|
||||
make dist
|
||||
|
||||
# Create backports debian sources
|
||||
cp -a debianpkg debian
|
||||
make -f debian/rules backports
|
||||
|
||||
# new directory to build the package
|
||||
rm -rf frrpkg
|
||||
mkdir frrpkg
|
||||
cd frrpkg
|
||||
tar xf ../frr_*.orig.tar.gz
|
||||
cd frr*
|
||||
tar xf ../../frr_*sonic.debian8*.debian.tar.xz
|
||||
|
||||
# build package
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc
|
||||
cd ..
|
||||
mv $* $(DEST)/
|
||||
|
||||
popd
|
||||
|
||||
mv $* $(DEST)/
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5424c62d6e9d574a00529edfc0a0b3bb3beb8811
|
||||
Subproject commit aaf54fda1378167d7ce317f5b4a16c3a61ef59eb
|
@ -1,23 +0,0 @@
|
||||
etc/frr/
|
||||
etc/init.d/
|
||||
usr/bin/vtysh
|
||||
usr/include/frr/
|
||||
usr/lib/
|
||||
tools/frr-reload.py usr/lib/frr/
|
||||
tools/frr usr/lib/frr
|
||||
usr/share/doc/frr/
|
||||
usr/share/man/man1/vtysh.1
|
||||
usr/share/man/man1/frr.1
|
||||
usr/share/man/man8
|
||||
usr/share/man/man8/bgpd.8
|
||||
usr/share/man/man8/ospf6d.8
|
||||
usr/share/man/man8/ospfd.8
|
||||
usr/share/man/man8/ripd.8
|
||||
usr/share/man/man8/ripngd.8
|
||||
usr/share/man/man8/zebra.8
|
||||
usr/share/man/man8/isisd.8
|
||||
usr/share/man/man8/watchfrr.8
|
||||
usr/share/snmp/mibs/
|
||||
cumulus/etc/* etc/
|
||||
tools/*.service lib/systemd/system
|
||||
debian/frr.conf usr/lib/tmpfiles.d
|
@ -1,99 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DH_VERBOSE=1
|
||||
export DEB_BUILD_HARDENING=1
|
||||
export DH_OPTIONS=-v
|
||||
|
||||
ifeq ($(WANT_SNMP), 1)
|
||||
USE_SNMP=--enable-snmp
|
||||
$(warning "DEBIAN: SNMP enabled, sorry for your inconvenience")
|
||||
else
|
||||
$(warning "DEBIAN: SNMP disabled, see README.Debian")
|
||||
endif
|
||||
|
||||
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
|
||||
DEBIAN_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
|
||||
endif
|
||||
|
||||
ifdef DEBIAN_JOBS
|
||||
MAKEFLAGS += -j$(DEBIAN_JOBS)
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing
|
||||
|
||||
override_dh_auto_configure:
|
||||
# Frr needs /proc to check some BSD vs Linux specific stuff.
|
||||
# Else it fails with an obscure error message pointing out that
|
||||
# IPCTL_FORWARDING is an undefined symbol which is not very helpful.
|
||||
@if ! [ -d /proc/1 ]; then \
|
||||
echo "./configure needs a mounted /proc"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
if ! [ -e config.status ]; then \
|
||||
dh_auto_configure -- \
|
||||
--enable-exampledir=/usr/share/doc/frr/examples/ \
|
||||
--localstatedir=/var/run/frr \
|
||||
--sbindir=/usr/lib/frr \
|
||||
--sysconfdir=/etc/frr \
|
||||
$(USE_SNMP) \
|
||||
--enable-vtysh=yes \
|
||||
--enable-isisd=yes \
|
||||
--enable-multipath=256 \
|
||||
--enable-user=frr \
|
||||
--enable-group=frr \
|
||||
--enable-vty-group=frrvty \
|
||||
--enable-configfile-mask=0640 \
|
||||
--enable-logfile-mask=0640 \
|
||||
--enable-werror \
|
||||
--enable-gcc-rdynamic \
|
||||
--with-libpam \
|
||||
--enable-systemd=yes \
|
||||
--enable-poll=yes \
|
||||
--enable-dependency-tracking \
|
||||
--enable-bgp-vnc=no \
|
||||
--enable-tcp-zebra \
|
||||
--enable-fpm; \
|
||||
fi
|
||||
|
||||
override_dh_auto_build:
|
||||
#dh_auto_build
|
||||
$(MAKE)
|
||||
dh_auto_build -- -C doc draft-zebra-00.txt
|
||||
|
||||
|
||||
# doc/ is a bit crazy
|
||||
ifeq ($(GENERATE_PDF), 1)
|
||||
dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf
|
||||
endif
|
||||
rm -vf doc/frr.info
|
||||
dh_auto_build -- -C doc frr.info
|
||||
rm -vf doc/frr.info.html*
|
||||
|
||||
override_dh_auto_test:
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install
|
||||
|
||||
# cleaning up the info dir
|
||||
rm -f debian/tmp/usr/share/info/dir*
|
||||
|
||||
# install config files
|
||||
mkdir -p debian/tmp/etc/frr/
|
||||
perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample*
|
||||
|
||||
# installing frr initialization script
|
||||
mkdir -p debian/tmp/etc/init.d/
|
||||
cp debian/tmp/usr/lib/frr/frr debian/tmp/etc/init.d/
|
||||
|
||||
# installing the Frr specific SNMP MIB
|
||||
ifeq ($(WANT_SNMP), 1)
|
||||
install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB
|
||||
else
|
||||
mkdir -p debian/tmp/usr/share/snmp/mibs/
|
||||
endif
|
||||
|
||||
# cleaning .la files
|
||||
sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
|
||||
|
Loading…
Reference in New Issue
Block a user