[build]: Adding support for Free-Range-Routing stack. (#510)
- Extending SONiC building infrastructure to provide users with greater flexibility, by allowing them to elect a routing-stack different than the default one (quagga). The desired routing-stack will be defined in rules/config file. - As part of these changes I'm adding support for Free-Range-Routing (FRR) stack. Quagga will continue to be the default routing-stack. Signed-off-by: Rodny Molina <rodny@linkedin.com>
This commit is contained in:
parent
ea51e1c241
commit
d30fbf1d72
32
dockers/docker-fpm-frr/Dockerfile.j2
Normal file
32
dockers/docker-fpm-frr/Dockerfile.j2
Normal file
@ -0,0 +1,32 @@
|
||||
FROM docker-config-engine
|
||||
|
||||
## Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute
|
||||
|
||||
COPY \
|
||||
{% for deb in docker_fpm_frr_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor -%}
|
||||
debs/
|
||||
|
||||
RUN dpkg -i \
|
||||
{% for deb in docker_fpm_frr_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor %}
|
||||
|
||||
## Clean up
|
||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||
RUN rm -rf /debs
|
||||
|
||||
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
||||
COPY ["start.sh", "config.sh", "/usr/bin/"]
|
||||
COPY ["daemons", "/etc/frr/"]
|
||||
COPY ["debian.conf", "/etc/frr/"]
|
||||
|
||||
ENTRYPOINT /usr/bin/config.sh \
|
||||
&& /usr/bin/start.sh \
|
||||
&& /bin/bash
|
64
dockers/docker-fpm-frr/bgpd.conf.j2
Normal file
64
dockers/docker-fpm-frr/bgpd.conf.j2
Normal file
@ -0,0 +1,64 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py
|
||||
! file: bgpd.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block system_init %}
|
||||
hostname {{ inventory_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 {{ minigraph_bgp_asn }}
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
|
||||
bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }}
|
||||
{# advertise loopback #}
|
||||
{% for lo in minigraph_lo_interfaces %}
|
||||
{% if lo['addr'] | ipv4 %}
|
||||
network {{ lo['addr'] }}/32
|
||||
{% elif lo['addr'] | ipv6 %}
|
||||
address-family ipv6
|
||||
network {{ lo['addr'] }}/128
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_init %}
|
||||
{% block vlan_advertisement %}
|
||||
{% for vlan_interface in minigraph_vlan_interfaces %}
|
||||
network {{ vlan_interface['subnet'] }}
|
||||
{% endfor %}
|
||||
{% endblock vlan_advertisement %}
|
||||
{% block bgp_sessions %}
|
||||
{% for bgp_session in minigraph_bgp %}
|
||||
{% if bgp_session['asn'] != 0 %}
|
||||
neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }}
|
||||
neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }}
|
||||
{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %}
|
||||
neighbor {{ bgp_session['addr'] }} allowas-in 1
|
||||
{% endif %}
|
||||
{% if bgp_session['addr'] | ipv6 %}
|
||||
address-family ipv6
|
||||
neighbor {{ bgp_session['addr'] }} activate
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_sessions %}
|
||||
!
|
||||
maximum-paths 64
|
||||
!
|
||||
route-map ISOLATE permit 10
|
||||
set as-path prepend {{ minigraph_bgp_asn }}
|
||||
!
|
17
dockers/docker-fpm-frr/config.sh
Executable file
17
dockers/docker-fpm-frr/config.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /etc/frr
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf
|
||||
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate
|
||||
chown root:root /usr/sbin/bgp-isolate
|
||||
chmod 0755 /usr/sbin/bgp-isolate
|
||||
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate
|
||||
chown root:root /usr/sbin/bgp-unisolate
|
||||
chmod 0755 /usr/sbin/bgp-unisolate
|
||||
|
||||
mkdir -p /var/sonic
|
||||
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
|
||||
|
20
dockers/docker-fpm-frr/debian.conf
Normal file
20
dockers/docker-fpm-frr/debian.conf
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# If this option is set the /etc/init.d/frr script automatically loads
|
||||
# the config via "vtysh -b" when the servers are started.
|
||||
# Check /etc/pam.d/frr if you intend to use "vtysh"!
|
||||
#
|
||||
vtysh_enable=yes
|
||||
zebra_options=" -s 90000000 --daemon -A 127.0.0.1 -M fpm"
|
||||
bgpd_options=" --daemon -A 127.0.0.1"
|
||||
ospfd_options=" --daemon -A 127.0.0.1"
|
||||
ospf6d_options=" --daemon -A ::1"
|
||||
ripd_options=" --daemon -A 127.0.0.1"
|
||||
ripngd_options=" --daemon -A ::1"
|
||||
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"
|
||||
|
||||
# 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)
|
6
dockers/docker-fpm-frr/start.sh
Executable file
6
dockers/docker-fpm-frr/start.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -f /var/run/rsyslogd.pid
|
||||
service rsyslog start
|
||||
service frr start
|
||||
fpmsyncd &
|
66
dockers/docker-fpm-frr/zebra.conf.j2
Normal file
66
dockers/docker-fpm-frr/zebra.conf.j2
Normal file
@ -0,0 +1,66 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py
|
||||
! file: zebra.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block sys_init %}
|
||||
hostname {{ inventory_hostname }}
|
||||
password zebra
|
||||
enable password zebra
|
||||
{% endblock sys_init %}
|
||||
!
|
||||
{% block interfaces %}
|
||||
! Enable link-detect (default disabled)
|
||||
{% for interface in minigraph_interfaces %}
|
||||
interface {{ interface['alias'] }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% for interface in minigraph_portchannel_interfaces %}
|
||||
interface {{ interface['name'] }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% endblock interfaces %}
|
||||
!
|
||||
{% block default_route %}
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200
|
||||
{% endblock default_route %}
|
||||
!
|
||||
{% block source_loopback %}
|
||||
! Set ip source to loopback for bgp learned routes
|
||||
route-map RM_SET_SRC permit 10
|
||||
set src {{ minigraph_lo_interfaces[0]['addr'] }}
|
||||
!
|
||||
{% set lo_ipv6_addrs = [] %}
|
||||
{% if minigraph_lo_interfaces is defined %}
|
||||
{% for interface in minigraph_lo_interfaces %}
|
||||
{% if interface['addr'] is defined and interface['addr']|ipv6 %}
|
||||
{% if lo_ipv6_addrs.append(interface['addr']) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
route-map RM_SET_SRC6 permit 10
|
||||
set src {{ lo_ipv6_addrs[0] }}
|
||||
!
|
||||
{% 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 %}
|
||||
!
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM docker-fpm
|
||||
FROM docker-fpm-quagga
|
||||
|
||||
## Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
@ -8,13 +8,13 @@ RUN apt-get update
|
||||
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4
|
||||
|
||||
COPY \
|
||||
{% for deb in docker_fpm_debs.split(' ') -%}
|
||||
{% for deb in docker_fpm_quagga_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor -%}
|
||||
debs/
|
||||
|
||||
RUN dpkg -i \
|
||||
{% for deb in docker_fpm_debs.split(' ') -%}
|
||||
{% for deb in docker_fpm_quagga_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor %}
|
||||
|
2
dockers/docker-fpm-quagga/base_image_files/vtysh
Executable file
2
dockers/docker-fpm-quagga/base_image_files/vtysh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
docker exec -i bgp vtysh "$@"
|
31
dockers/docker-fpm-quagga/daemons
Normal file
31
dockers/docker-fpm-quagga/daemons
Normal file
@ -0,0 +1,31 @@
|
||||
# This file tells the quagga 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.
|
||||
#
|
||||
# Sample configurations for these daemons can be found in
|
||||
# /usr/share/doc/quagga/examples/.
|
||||
#
|
||||
# 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
|
||||
# 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.
|
||||
#
|
||||
# The watchquagga daemon is always started. Per default in monitoring-only but
|
||||
# that can be changed via /etc/quagga/debian.conf.
|
||||
#
|
||||
zebra=yes
|
||||
bgpd=yes
|
||||
ospfd=no
|
||||
ospf6d=no
|
||||
ripd=no
|
||||
ripngd=no
|
||||
isisd=no
|
||||
babeld=no
|
20
dockers/docker-fpm-quagga/isolate.j2
Executable file
20
dockers/docker-fpm-quagga/isolate.j2
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
## vtysh only accepts script in stdin, so cannot be directly used in shebang
|
||||
## Cut the tail of this script and feed vtysh stdin
|
||||
sed -n -e '9,$p' < "$0" | vtysh "$@"
|
||||
## Exit with vtysh return code
|
||||
exit $?
|
||||
|
||||
## vtysh script start from next line, which line number MUST eqaul in 'sed' command above
|
||||
|
||||
configure terminal
|
||||
router bgp {{ minigraph_bgp_asn }}
|
||||
{% for bgp_session in minigraph_bgp %}
|
||||
neighbor {{ bgp_session['addr'] }} route-map ISOLATE out
|
||||
{% endfor %}
|
||||
exit
|
||||
exit
|
||||
|
||||
{% for bgp_session in minigraph_bgp %}
|
||||
clear ip bgp {{ bgp_session['addr'] }} soft out
|
||||
{% endfor %}
|
20
dockers/docker-fpm-quagga/unisolate.j2
Executable file
20
dockers/docker-fpm-quagga/unisolate.j2
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
## vtysh only accepts script in stdin, so cannot be directly used in shebang
|
||||
## Cut the tail of this script and feed vtysh stdin
|
||||
sed -n -e '9,$p' < "$0" | vtysh "$@"
|
||||
## Exit with vtysh return code
|
||||
exit $?
|
||||
|
||||
## vtysh script start from next line, which line number MUST eqaul in 'sed' command above
|
||||
|
||||
configure terminal
|
||||
router bgp {{ minigraph_bgp_asn }}
|
||||
{% for bgp_session in minigraph_bgp %}
|
||||
no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out
|
||||
{% endfor %}
|
||||
exit
|
||||
exit
|
||||
|
||||
{% for bgp_session in minigraph_bgp %}
|
||||
clear ip bgp {{ bgp_session['addr'] }} soft out
|
||||
{% endfor %}
|
@ -21,7 +21,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv
|
||||
SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE)
|
||||
|
||||
SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \
|
||||
$(DOCKER_FPM_GOBGP) \
|
||||
$(DOCKER_FPM) \
|
||||
$(DOCKER_SYNCD_BRCM_RPC)
|
||||
|
||||
# Inject brcm sai into sairedis
|
||||
|
@ -8,7 +8,7 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk
|
||||
include $(PLATFORM_PATH)/python-saithrift.mk
|
||||
|
||||
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
||||
$(DOCKER_FPM_GOBGP)
|
||||
$(DOCKER_FPM)
|
||||
|
||||
# Inject cavium sai into sairedis
|
||||
$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI)
|
||||
|
@ -11,7 +11,7 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk
|
||||
include $(PLATFORM_PATH)/python-saithrift.mk
|
||||
|
||||
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
||||
$(DOCKER_FPM_GOBGP) \
|
||||
$(DOCKER_FPM) \
|
||||
$(DOCKER_SYNCD_MLNX_RPC)
|
||||
|
||||
# Inject mlnx sai into sairedis
|
||||
|
@ -2,6 +2,15 @@
|
||||
|
||||
DOCKER_SONIC_P4 = docker-sonic-p4.gz
|
||||
$(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4
|
||||
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(QUAGGA) $(LIBTEAMDCT) $(LIBTEAM_UTILS)
|
||||
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS)
|
||||
|
||||
ifeq ($(ROUTING_STACK), quagga)
|
||||
$(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA)
|
||||
else ifeq ($(ROUTING_STACK), frr)
|
||||
$(DOCKER_SONIC_P4)_DEPENDS += $(FRR)
|
||||
else
|
||||
$(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP)
|
||||
endif
|
||||
|
||||
$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4)
|
||||
|
@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server
|
||||
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server libc-ares2 iproute
|
||||
|
||||
COPY \
|
||||
{% for deb in docker_sonic_p4_debs.split(' ') -%}
|
||||
|
@ -41,3 +41,8 @@ DEFAULT_PASSWORD = YourPaSsWoRd
|
||||
# SONIC_CONFIG_DEBUG - install debug packages
|
||||
# Uncomment next line to enable:
|
||||
# SONIC_CONFIG_DEBUG = 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.
|
||||
SONIC_ROUTING_STACK = quagga
|
||||
|
14
rules/docker-fpm-frr.mk
Normal file
14
rules/docker-fpm-frr.mk
Normal file
@ -0,0 +1,14 @@
|
||||
# docker image for fpm-frr
|
||||
|
||||
DOCKER_FPM_FRR = docker-fpm-frr.gz
|
||||
$(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr
|
||||
$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS)
|
||||
$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
|
||||
|
||||
$(DOCKER_FPM_FRR)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM_FRR)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
|
||||
$(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
|
||||
|
@ -3,7 +3,7 @@
|
||||
DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz
|
||||
$(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp
|
||||
$(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP)
|
||||
$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM)
|
||||
$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP)
|
||||
|
||||
$(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp
|
||||
|
13
rules/docker-fpm-quagga.mk
Normal file
13
rules/docker-fpm-quagga.mk
Normal file
@ -0,0 +1,13 @@
|
||||
# docker image for fpm-quagga
|
||||
|
||||
DOCKER_FPM_QUAGGA = docker-fpm-quagga.gz
|
||||
$(DOCKER_FPM_QUAGGA)_PATH = $(DOCKERS_PATH)/docker-fpm-quagga
|
||||
$(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS)
|
||||
$(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA)
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM_QUAGGA)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_FPM_QUAGGA)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
|
@ -1,14 +1,9 @@
|
||||
# docker image for fpm
|
||||
# Docker-fpm rule-file is simply a wrapper containing routing-stack selection logic.
|
||||
|
||||
DOCKER_FPM = docker-fpm.gz
|
||||
$(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm
|
||||
$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS)
|
||||
$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM)
|
||||
|
||||
$(DOCKER_FPM)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
|
||||
$(DOCKER_FPM)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
|
||||
ifeq ($(SONIC_ROUTING_STACK), quagga)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA)
|
||||
else ifeq ($(SONIC_ROUTING_STACK), frr)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
|
||||
else
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP)
|
||||
endif
|
||||
|
9
rules/frr.mk
Normal file
9
rules/frr.mk
Normal file
@ -0,0 +1,9 @@
|
||||
# FRRouting (frr) package
|
||||
|
||||
FRR_VERSION = 3.0
|
||||
export FRR_VERSION
|
||||
|
||||
FRR = frr_$(FRR_VERSION)_amd64.deb
|
||||
$(FRR)_DEPENDS += $(LIBSNMP_DEV)
|
||||
$(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr
|
||||
SONIC_MAKE_DEBS += $(FRR)
|
12
slave.mk
12
slave.mk
@ -69,6 +69,18 @@ endif
|
||||
|
||||
MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS)
|
||||
|
||||
###############################################################################
|
||||
## Dumping key config attributes associated to current building exercise
|
||||
###############################################################################
|
||||
|
||||
ifndef $(CONFIGURED_PLATFORM)
|
||||
$(info CONFIGURED_PLATFORM is $(CONFIGURED_PLATFORM))
|
||||
endif
|
||||
|
||||
ifndef $(SONIC_ROUTING_STACK)
|
||||
$(info ROUTING_STACK is $(SONIC_ROUTING_STACK))
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
## Generic rules section
|
||||
## All rules must go after includes for propper targets expansion
|
||||
|
@ -55,6 +55,14 @@ RUN apt-get clean && apt-get update && apt-get install -y \
|
||||
libpcre3-dev \
|
||||
gawk \
|
||||
chrpath \
|
||||
# For frr build
|
||||
libc-ares-dev \
|
||||
hardening-wrapper \
|
||||
libsnmp-dev \
|
||||
libjson0 \
|
||||
libjson0-dev \
|
||||
libsystemd-dev \
|
||||
python-ipaddr \
|
||||
# For libnl3 (local) build
|
||||
cdbs \
|
||||
# For SAI meta build
|
||||
|
24
src/sonic-frr/Makefile
Normal file
24
src/sonic-frr/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = frr_$(FRR_VERSION)_amd64.deb
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
# Cloning FRR repo if not already done
|
||||
if [ ! -d "frr" ]; then \
|
||||
git clone -b stable/$(FRR_VERSION) https://github.com/FRRouting/frr.git; \
|
||||
fi
|
||||
|
||||
# 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
|
||||
pushd ./frr
|
||||
rm -f debian/*.debhelper.log
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc
|
||||
popd
|
||||
|
||||
mv $* $(DEST)/
|
23
src/sonic-frr/sonic_frr.install
Normal file
23
src/sonic-frr/sonic_frr.install
Normal file
@ -0,0 +1,23 @@
|
||||
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
|
99
src/sonic-frr/sonic_frr.rules
Executable file
99
src/sonic-frr/sonic_frr.rules
Executable file
@ -0,0 +1,99 @@
|
||||
#!/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