-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile_xbgp
140 lines (119 loc) · 4.42 KB
/
Dockerfile_xbgp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
FROM ubuntu:20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git \
cmake doxygen valgrind clang autoconf flex bison libreadline-dev \
automake libtool make texinfo pkg-config libpam0g-dev python3-pytest \
libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \
install-info build-essential libsystemd-dev libsnmp-dev perl \
libcap-dev python2 libpcre3-dev libtool m4 debhelper devscripts \
iproute2 llvm libffi-dev
WORKDIR /opt
## Installing manual dependencies
# 1. json-c
RUN git clone https://github.com/json-c/json-c.git jsonc
WORKDIR /opt/jsonc
RUN git checkout json-c-0.15
RUN mkdir build
WORKDIR /opt/jsonc/build
RUN cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
.. && make && make install
WORKDIR /opt
# 2. libyang
RUN git clone https://github.com/CESNET/libyang libyang
WORKDIR /opt/libyang
RUN git checkout debian/libyang-0.16.105-2
RUN mkdir build
WORKDIR /opt/libyang/build
RUN cmake -D CMAKE_BUILD_TYPE:String="Release" \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DENABLE_LYD_PRIV=ON .. && \
make && make install
# libxbgp
WORKDIR /opt
RUN git clone https://github.com/pluginized-protocols/libxbgp.git libxbgp
WORKDIR /opt/libxbgp
RUN git submodule update --init --recursive
RUN make
# Plugins folder
WORKDIR /opt
RUN git clone https://github.com/pluginized-protocols/xbgp_plugins.git xbgp_plugins
WORKDIR /opt/xbgp_plugins
RUN make LIBXBGP=/opt/libxbgp/include
# xbgp_bird
WORKDIR /opt
RUN git clone https://github.com/pluginized-protocols/xbgp_bird.git xbgp_bird
WORKDIR /opt/xbgp_bird
RUN git checkout xbgp_compliant
RUN autoreconf -i && \
./configure \
--prefix=/usr \
--sysconfdir=/etc/bird \
--localstatedir=/var/run/bird \
--runstatedir=/var/run/bird \
LIBUBPF=/opt/libxbgp \
HUBPF=/opt/libxbgp/include \
XBGP=/opt/xbgp_plugins && \
make && make install
# xbgp_frrouting
# preparing dependencies for FRRouting
RUN groupadd -r -g 92 frr
RUN groupadd -r -g 85 frrvty
RUN adduser --system --ingroup frr --home /var/run/frr/ \
--gecos "FRR suite" --shell /sbin/nologin frr
RUN usermod -a -G frrvty frr
WORKDIR /opt
RUN git clone https://github.com/pluginized-protocols/xbgp_frr.git xbgp_frr
WORKDIR /opt/xbgp_frr
RUN git checkout stable/7.3-xbgp
RUN ./bootstrap.sh && ./configure \
--prefix=/usr \
--includedir=\${prefix}/include \
--enable-exampledir=\${prefix}/share/doc/frr/examples \
--bindir=\${prefix}/bin \
--sbindir=\${prefix}/lib/frr \
--libdir=\${prefix}/lib/frr \
--libexecdir=\${prefix}/lib/frr \
--localstatedir=/var/run/frr \
--sysconfdir=/etc/frr \
--with-moduledir=\${prefix}/lib/frr/modules \
--with-libyang-pluginsdir=\${prefix}/lib/frr/libyang_plugins \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-snmp=agentx \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--with-pkg-extra-version=-xbgp \
--enable-systemd=yes \
UBPF_LIB=/opt/libxbgp \
UBPF_INC=/opt/libxbgp/include \
XBGP_INC=/opt/xbgp_plugins && \
make && make install
RUN install -m 775 -o frr -g frr -d /var/log/frr && \
install -m 775 -o frr -g frrvty -d /etc/frr && \
install -m 755 -o frr -g frrvty -d /etc/frr/plugins && \
install -m 640 -o frr -g frrvty tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf && \
install -m 640 -o frr -g frr tools/etc/frr/frr.conf /etc/frr/frr.conf && \
install -m 640 -o frr -g frr tools/etc/frr/daemons.conf /etc/frr/daemons.conf && \
install -m 640 -o frr -g frr tools/etc/frr/manifest.json /etc/frr/plugins/manifest.json && \
install -m 640 -o frr -g frr tools/etc/frr/extra_conf.json /etc/frr/plugins/extra_conf.json && \
install -m 640 -o frr -g frr tools/etc/frr/daemons /etc/frr/daemons
# this helper is used to launch the protocol of your choice
# Usage example :
# ./xproto frr start # will launch frrouting
#
# USAGE: xproto [frr|bird] [start|stop]
COPY ./xproto /usr/bin/xproto
# This is an example
# We now show how to load a plugin on FRR BGP at startup time
# first you'll need a manifest that will contains pluginst to be loaded
# We will use the one located at /opt/xbgp_plugins/hello_world/manifest.json
RUN cp /opt/xbgp_plugins/hello_world/manifest.json /etc/frr/plugins/manifest.conf
# we add the compiled plugin to the same folder as the manifest
RUN cp /opt/xbgp_plugins/hello_world/reject_route_attr_42.o /etc/frr/plugins
WORKDIR /root
CMD /bin/bash