Skip to content

Commit

Permalink
Use syncd-rpc for docker-syncd-rpc (#522)
Browse files Browse the repository at this point in the history
* Use syncd rpc for docker-syncd-rpc. Create docker-syncd-rpc for cavium and centec
  • Loading branch information
pavel-shirshov authored Apr 20, 2017
1 parent d30fbf1 commit 2c4c6e9
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 12 deletions.
2 changes: 1 addition & 1 deletion platform/broadcom/docker-syncd-brcm-rpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc.gz
$(DOCKER_SYNCD_BRCM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm-rpc
$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD) $(LIBTHRIFT)
$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT)
$(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD)
$(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BRCM)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC)
2 changes: 1 addition & 1 deletion platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN apt-get update \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /deps
&& rm -rf /root/deps

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
Expand Down
2 changes: 1 addition & 1 deletion platform/broadcom/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \
$(DOCKER_SYNCD_BRCM_RPC)

# Inject brcm sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV)
$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM)

# Runtime dependency on brcm sai is set only for syncd
$(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI)
7 changes: 7 additions & 0 deletions platform/cavium/docker-syncd-cavm-rpc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# docker image for cavium syncd with rpc

DOCKER_SYNCD_CAVM_RPC = docker-syncd-cavm-rpc.gz
$(DOCKER_SYNCD_CAVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm-rpc
$(DOCKER_SYNCD_CAVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS)
$(DOCKER_SYNCD_CAVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CAVM)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC)
56 changes: 56 additions & 0 deletions platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM docker-syncd-cavm

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

COPY \
{% for deb in docker_syncd_cavm_rpc_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN dpkg -P syncd

RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \
{% for deb in docker_syncd_cavm_rpc_debs.split(' ') -%}
dpkg_apt debs/{{ deb }}{{'; '}}
{%- endfor %}

## Pre-install the fundamental packages
RUN apt-get update \
&& apt-get -y install \
net-tools \
python-pip \
build-essential \
libssl-dev \
libffi-dev \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
&& mkdir -p build \
&& cmake . \
&& make install \
&& ldconfig \
&& cd .. \
&& rm -fr nanomsg-1.0.0 \
&& rm -f 1.0.0.tar.gz \
&& pip install cffi==1.7.0 \
&& pip install --upgrade cffi==1.7.0 \
&& pip install nnpy \
&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf

RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh

ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
10 changes: 10 additions & 0 deletions platform/cavium/docker-syncd-cavm-rpc/ptf_nn_agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:ptf_nn_agent]
command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400
process_name=ptf_nn_agent
stdout_logfile=/tmp/ptf_nn_agent.out.log
stderr_logfile=/tmp/ptf_nn_agent.err.log
redirect_stderr=false
autostart=true
autorestart=true
startsecs=1
numprocs=1
2 changes: 2 additions & 0 deletions platform/cavium/docker-syncd-cavm-rpc/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[supervisord]
nodaemon=true
6 changes: 4 additions & 2 deletions platform/cavium/rules.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include $(PLATFORM_PATH)/cavm-sai.mk
include $(PLATFORM_PATH)/docker-syncd-cavm.mk
include $(PLATFORM_PATH)/docker-syncd-cavm-rpc.mk
include $(PLATFORM_PATH)/docker-orchagent-cavm.mk
include $(PLATFORM_PATH)/cavm-platform-modules.mk
include $(PLATFORM_PATH)/cavm-xpnet.mk
Expand All @@ -8,10 +9,11 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/python-saithrift.mk

SONIC_ALL += $(SONIC_ONE_IMAGE) \
$(DOCKER_FPM)
$(DOCKER_FPM) \
$(DOCKER_SYNCD_CAVM_RPC)

# Inject cavium sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI)
$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAITHRIFT_DEV_CAVM)

# Runtime dependency on cavium sai is set only for syncd
$(SYNCD)_RDEPENDS += $(CAVM_SAI)
Expand Down
7 changes: 7 additions & 0 deletions platform/centec/docker-syncd-centec-rpc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# docker image for centec syncd with rpc

DOCKER_SYNCD_CENTEC_RPC = docker-syncd-centec-rpc.gz
$(DOCKER_SYNCD_CENTEC_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec-rpc
$(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT)
$(DOCKER_SYNCD_CENTEC_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CENTEC)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC)
56 changes: 56 additions & 0 deletions platform/centec/docker-syncd-centec-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM docker-syncd-centec

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

COPY \
{% for deb in docker_syncd_centec_rpc_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN dpkg -P syncd

RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \
{% for deb in docker_syncd_centec_rpc_debs.split(' ') -%}
dpkg_apt debs/{{ deb }}{{'; '}}
{%- endfor %}

## Pre-install the fundamental packages
RUN apt-get update \
&& apt-get -y install \
net-tools \
python-pip \
build-essential \
libssl-dev \
libffi-dev \
python-dev \
wget \
cmake \
supervisor \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
&& mkdir -p build \
&& cmake . \
&& make install \
&& ldconfig \
&& cd .. \
&& rm -fr nanomsg-1.0.0 \
&& rm -f 1.0.0.tar.gz \
&& pip install cffi==1.7.0 \
&& pip install --upgrade cffi==1.7.0 \
&& pip install nnpy \
&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf

RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh

ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
10 changes: 10 additions & 0 deletions platform/centec/docker-syncd-centec-rpc/ptf_nn_agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:ptf_nn_agent]
command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400
process_name=ptf_nn_agent
stdout_logfile=/tmp/ptf_nn_agent.out.log
stderr_logfile=/tmp/ptf_nn_agent.err.log
redirect_stderr=false
autostart=true
autorestart=true
startsecs=1
numprocs=1
2 changes: 2 additions & 0 deletions platform/centec/docker-syncd-centec-rpc/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[supervisord]
nodaemon=true
6 changes: 4 additions & 2 deletions platform/centec/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/docker-orchagent-centec.mk
include $(PLATFORM_PATH)/docker-syncd-centec.mk
include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/python-saithrift.mk

SONIC_ALL += $(SONIC_ONE_IMAGE)
SONIC_ALL += $(SONIC_ONE_IMAGE) \
$(DOCKER_SYNCD_CENTEC_RPC)

# Inject centec sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI)
$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI) $(LIBSAITHRIFT_DEV_CENTEC)

# Runtime dependency on centec sai is set only for syncd
$(SYNCD)_RDEPENDS += $(CENTEC_SAI)
2 changes: 1 addition & 1 deletion platform/mellanox/docker-syncd-mlnx-rpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz
$(DOCKER_SYNCD_MLNX_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx-rpc
$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD) $(LIBTHRIFT)
$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT)
$(DOCKER_SYNCD_MLNX_RPC)_FILES += $(MLNX_FW)
$(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC)
2 changes: 1 addition & 1 deletion platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN apt-get update \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /deps
&& rm -rf /root/deps

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf
Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \
$(DOCKER_SYNCD_MLNX_RPC)

# Inject mlnx sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI)
$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV_MLNX)

# Runtime dependency on mlnx sai is set only for syncd
$(SYNCD)_RDEPENDS += $(MLNX_SAI)
6 changes: 5 additions & 1 deletion rules/sairedis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LIBSAIREDIS = libsairedis_1.0.0_amd64.deb
$(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis
$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV)
$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBTHRIFT_DEV)
$(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON)
SONIC_DPKG_DEBS += $(LIBSAIREDIS)

Expand All @@ -13,6 +13,10 @@ SYNCD = syncd_1.0.0_amd64.deb
$(SYNCD)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD)))

SYNCD_RPC = syncd-rpc_1.0.0_amd64.deb
$(SYNCD_RPC)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_RPC)))

LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA)))

Expand Down
2 changes: 1 addition & 1 deletion src/sonic-sairedis

0 comments on commit 2c4c6e9

Please sign in to comment.