-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic SAI Thrift server (#203)
Signed-off-by: Yurii Lisovskyi <[email protected]>
- Loading branch information
1 parent
424897e
commit 1f0699b
Showing
8 changed files
with
228 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[eventlistener:dependent-startup] | ||
command=python3 -m supervisord_dependent_startup | ||
autostart=true | ||
autorestart=unexpected | ||
startretries=0 | ||
exitcodes=0,3 | ||
events=PROCESS_STATE | ||
buffer_size=1024 | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n -iNONE | ||
priority=1 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
|
||
[program:saiserver] | ||
command=/usr/sbin/saiserver -f /usr/share/sonic/hwsku/port_config.ini -p /usr/share/sonic/hwsku/sai.profile | ||
priority=3 | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
FROM debian:buster-slim | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY sai.env / | ||
|
||
# Install generic packages | ||
RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ | ||
apt-utils \ | ||
vim \ | ||
curl \ | ||
wget \ | ||
iproute2 \ | ||
unzip \ | ||
git \ | ||
procps \ | ||
build-essential \ | ||
graphviz \ | ||
doxygen \ | ||
aspell \ | ||
python3-pip \ | ||
rsyslog \ | ||
supervisor | ||
|
||
# Add support for supervisord to handle startup dependencies | ||
RUN pip3 install supervisord-dependent-startup==1.4.0 | ||
|
||
# Install generic packages | ||
RUN apt-get install -y \ | ||
libtemplate-perl \ | ||
libconst-fast-perl \ | ||
libmoosex-aliases-perl \ | ||
libnamespace-autoclean-perl \ | ||
libgetopt-long-descriptive-perl \ | ||
aspell-en bison flex g++ \ | ||
libboost-all-dev libevent-dev libssl-dev \ | ||
libpython3-dev libpcap-dev | ||
|
||
WORKDIR /sai | ||
|
||
RUN apt-get install -y pkg-config \ | ||
&& wget "http://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz" \ | ||
&& tar -xf thrift-0.11.0.tar.gz \ | ||
&& cd thrift-0.11.0 \ | ||
&& ./bootstrap.sh \ | ||
&& ./configure --prefix=/usr --with-cpp --with-python \ | ||
--with-qt4=no --with-qt5=no --with-csharp=no --with-java=no --with-erlang=no \ | ||
--with-nodejs=no --with-lua=no --with-per=no --with-php=no --with-dart=no \ | ||
--with-ruby=no --with-haskell=no --with-go=no --with-rs=no --with-haxe=no \ | ||
--with-dotnetcore=no --with-d=no \ | ||
&& make && make install \ | ||
&& pip3 install ctypesgen lib/py \ | ||
&& cd /sai \ | ||
&& rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz ; | ||
|
||
ENV SAITHRIFTV2=y | ||
ENV GEN_SAIRPC_OPTS="-cve" | ||
ENV SAIRPC_EXTRA_LIBS="-L/usr/local/lib/ -lpthread" | ||
|
||
RUN git clone https://github.com/opencomputeproject/SAI.git \ | ||
&& cd SAI && git fetch origin \ | ||
&& . /sai.env \ | ||
&& git checkout ${SAI_ID} \ | ||
&& cd meta \ | ||
&& make all libsaimetadata.so libsai.so \ | ||
&& cp libsaimetadata.so /usr/lib \ | ||
&& cp libsai.so /usr/lib \ | ||
&& cd .. \ | ||
&& mkdir /usr/include/sai/ \ | ||
&& cp ./inc/sai*.h /usr/include/sai/ \ | ||
&& cp ./experimental/sai*.h /usr/include/sai/ \ | ||
&& make saithrift-install | ||
|
||
WORKDIR /sai-challenger | ||
|
||
COPY configs/server/supervisord.conf.thrift /etc/supervisor/conf.d/supervisord.conf | ||
|
||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
FROM debian:buster-slim | ||
|
||
RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian buster-backports main" >> /etc/apt/sources.list | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY sai.env / | ||
|
||
# Install generic packages | ||
RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \ | ||
apt-utils \ | ||
vim \ | ||
curl \ | ||
wget \ | ||
iproute2 \ | ||
unzip \ | ||
git \ | ||
procps \ | ||
build-essential \ | ||
graphviz \ | ||
doxygen \ | ||
aspell \ | ||
python3-pip \ | ||
rsyslog \ | ||
supervisor | ||
|
||
# Add support for supervisord to handle startup dependencies | ||
RUN pip3 install supervisord-dependent-startup==1.4.0 | ||
|
||
# Install generic packages | ||
RUN apt-get install -y \ | ||
libtemplate-perl \ | ||
libconst-fast-perl \ | ||
libmoosex-aliases-perl \ | ||
libnamespace-autoclean-perl \ | ||
libgetopt-long-descriptive-perl \ | ||
aspell-en bison flex g++ \ | ||
libboost-all-dev libevent-dev libssl-dev \ | ||
libpython3-dev libpcap-dev | ||
|
||
WORKDIR /sai | ||
|
||
RUN apt-get install -y thrift-compiler libthrift-dev libthrift-0.11.0 \ | ||
&& pip3 install ctypesgen thrift==0.11.0 ; | ||
|
||
ENV SAITHRIFTV2=y | ||
ENV GEN_SAIRPC_OPTS="-cve" | ||
ENV SAIRPC_EXTRA_LIBS="-L/usr/local/lib/ -lpthread" | ||
|
||
RUN git clone https://github.com/opencomputeproject/SAI.git \ | ||
&& cd SAI && git fetch origin \ | ||
&& . /sai.env \ | ||
&& git checkout ${SAI_ID} \ | ||
&& cd meta \ | ||
&& make all libsaimetadata.so libsai.so \ | ||
&& cp libsaimetadata.so /usr/lib \ | ||
&& cp libsai.so /usr/lib \ | ||
&& cd .. \ | ||
&& mkdir /usr/include/sai/ \ | ||
&& cp ./inc/sai*.h /usr/include/sai/ \ | ||
&& cp ./experimental/sai*.h /usr/include/sai/ \ | ||
&& make saithrift-install | ||
|
||
WORKDIR /sai-challenger | ||
|
||
COPY configs/server/supervisord.conf.thrift /etc/supervisor/conf.d/supervisord.conf | ||
|
||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ARG BASE_OS | ||
FROM sc-thrift-server-base:$BASE_OS | ||
|
||
COPY configs/sai.profile /usr/share/sonic/hwsku/ | ||
COPY configs/port_config.ini /usr/share/sonic/hwsku/ | ||
COPY configs/lanemap.ini /usr/share/sonic/hwsku/ | ||
|
||
WORKDIR / | ||
|
||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters