Skip to content

Commit

Permalink
[Mellanox][SAISERVER] Support Mellanox saiserverv1 and saiserverv2 do…
Browse files Browse the repository at this point in the history
…cker (sonic-net#9686)

* support saiserverv1 and saiserverv2 docker

* add saiserver into buster and revert some changes

* update thrift version
  • Loading branch information
RyoYang authored Mar 10, 2022
1 parent 8601709 commit c8db7a2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
9 changes: 5 additions & 4 deletions platform/mellanox/docker-saiserver-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
#
# docker image for mlnx saiserver

DOCKER_SAISERVER_MLNX = docker-saiserver-mlnx.gz
DOCKER_SAISERVER_MLNX = docker-saiserver$(SAITHRIFT_VER)-mlnx.gz
$(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx
$(DOCKER_SAISERVER_MLNX)_DEPENDS += $(SAISERVER) $(PYTHON_SDK_API)
$(DOCKER_SAISERVER_MLNX)_PYTHON_DEBS += $(MLNX_SFPD)
$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX)
SONIC_STRETCH_DOCKERS += $(DOCKER_SAISERVER_MLNX)
SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_MLNX)

$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER)

$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver
$(DOCKER_SAISERVER_MLNX)_RUN_OPT += --privileged -t
$(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
Expand Down
19 changes: 8 additions & 11 deletions platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
## See the License for the specific language governing permissions and
## limitations under the License.
##
FROM docker-config-engine-stretch
{% from "dockers/dockerfile-macros.j2" import install_debian_packages %}
FROM docker-config-engine-buster

ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf

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

RUN apt-get update
## Pre-install the fundamental packages
RUN apt-get update \
&& apt-get -y install \
gdb \
libboost-atomic1.71.0

COPY \
{% for deb in docker_saiserver_mlnx_debs.split(' ') -%}
Expand All @@ -38,15 +43,7 @@ debs/

RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto

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

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

COPY ["start.sh", "/usr/bin/"]

Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/docker-saiserver-mlnx/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ stdout_logfile=syslog
stderr_logfile=syslog

[program:saiserver]
command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
command=/usr/sbin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini
priority=3
autostart=false
autorestart=false
Expand Down
23 changes: 16 additions & 7 deletions platform/mellanox/libsaithrift-dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,28 @@

SAI_VER = 0.9.4

LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb
LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb
$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV)
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI)
ifeq ($(SAITHRIFT_V2),y)
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER)
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1)
$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2
else
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER)
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT)
endif
$(LIBSAITHRIFT_DEV)_DEPENDS += $(MLNX_SAI) $(MLNX_SAI_DEV)
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(MLNX_SAI)

SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV)

PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb
PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT)))

SAISERVER = saiserver_$(SAI_VER)_amd64.deb
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI)
SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb
$(SAISERVER)_RDEPENDS += $(LIBSAITHRIFT_DEV)
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER)))

SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb
SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb
$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER)
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG)))

0 comments on commit c8db7a2

Please sign in to comment.