Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FRR 4.0 integration with SONiC #2099

Merged
merged 2 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
64 changes: 58 additions & 6 deletions dockers/docker-fpm-frr/bgpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,40 @@ log facility local4
! enable password {# {{ en_passwd }} TODO: param needed #}
{% endblock system_init %}
!
{% 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
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
{# 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 %}
{% if prefix | ipv4 and name == 'Loopback0' %}
network {{ prefix | ip }}/32
{% elif prefix | ipv6 %}
{% 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 %}
Expand All @@ -56,13 +64,21 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% 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'] }}
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
neighbor {{ neighbor_addr }} allowas-in 1
{% 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 %}
Expand All @@ -74,7 +90,11 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% 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 %}
Expand All @@ -90,11 +110,43 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% 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
Expand Down
23 changes: 14 additions & 9 deletions dockers/docker-fpm-frr/daemons
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -28,4 +28,9 @@ ospf6d=no
ripd=no
ripngd=no
isisd=no
pimd=no
ldpd=no
nhrpd=no
eigrpd=no
babeld=no
sharpd=no
Original file line number Diff line number Diff line change
Expand Up @@ -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
Empty file.
12 changes: 7 additions & 5 deletions dockers/docker-fpm-frr/zebra.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200
{% 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) %}
{% if name == 'Loopback0' %}
{% if prefix | ipv6 %}
{% if lo_ipv6_addrs.append(prefix) %}
{% endif %}
{% else %}
{% if lo_ipv4_addrs.append(prefix) %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions rules/frr.mk
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions sonic-slave/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 30 additions & 8 deletions src/sonic-frr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)/
2 changes: 1 addition & 1 deletion src/sonic-frr/frr
Submodule frr updated from 5424c6 to aaf54f
23 changes: 0 additions & 23 deletions src/sonic-frr/sonic_frr.install

This file was deleted.

Loading