Skip to content

Commit

Permalink
[docker-saiserver]: build docker-saiserver (#2244)
Browse files Browse the repository at this point in the history
* build docker-saiserver

Signed-off-by: Guohan Lu <gulv@microsoft.com>

* add docker saiserver mlnx/bfn/cavm

* set nephos to 1.3.5

Signed-off-by: Guohan Lu <gulv@microsoft.com>
  • Loading branch information
lguohan authored Nov 14, 2018
1 parent 47b0bfa commit 9f6f3e4
Show file tree
Hide file tree
Showing 43 changed files with 193 additions and 96 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ dockers/docker-snmp-sv2/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-sonic-mgmt/Dockerfile
dockers/docker-sonic-telemetry/Dockerfile
platform/*/docker-saiserver-*/Dockerfile
platform/*/docker-syncd-*/Dockerfile
platform/*/docker-syncd-*-rpc/Dockerfile
platform/vs/docker-sonic-vs/Dockerfile
Expand Down
27 changes: 0 additions & 27 deletions dockers/docker-saiserver-brcm/Dockerfile

This file was deleted.

38 changes: 0 additions & 38 deletions dockers/docker-saiserver-mlnx/Dockerfile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/broadcom/docker-ptf-brcm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

DOCKER_PTF_BRCM = docker-ptf-brcm.gz
$(DOCKER_PTF_BRCM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift
$(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT_BRCM)
$(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT)
$(DOCKER_PTF_BRCM)_LOAD_DOCKERS += $(DOCKER_PTF)
SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM)
18 changes: 18 additions & 0 deletions platform/broadcom/docker-saiserver-brcm.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# docker image for brcm saiserver

DOCKER_SAISERVER_BRCM = docker-saiserver-brcm.gz
$(DOCKER_SAISERVER_BRCM)_PATH = $(PLATFORM_PATH)/docker-saiserver-brcm
$(DOCKER_SAISERVER_BRCM)_DEPENDS += $(SAISERVER)
$(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD)
$(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM)

$(DOCKER_SAISERVER_BRCM)_CONTAINER_NAME = saiserver
$(DOCKER_SAISERVER_BRCM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd
$(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /host/warmboot:/var/warmboot

$(DOCKER_SAISERVER_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd
$(DOCKER_SAISERVER_BRCM)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh
36 changes: 36 additions & 0 deletions platform/broadcom/docker-saiserver-brcm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM docker-config-engine

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

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

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

## TODO: add kmod into Depends
RUN apt-get install -yf kmod

COPY ["files/dsserve", "files/bcmcmd", "start.sh", "bcmsh", "/usr/bin/"]
RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd

COPY ["profile.ini", "portmap.ini", "/etc/sai/"]

COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

ENTRYPOINT ["/usr/bin/supervisord"]
40 changes: 40 additions & 0 deletions platform/broadcom/docker-saiserver-brcm/bcmsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service
where:
-h show this help text
-t inactivity timeout in seconds (default 300 seconds, 0 for no timeout)
-q quite, no banner (default: verbose)"

banner="Press Enter to show prompt.
Press Ctrl+C to exit.
NOTICE: Only one bcmsh or bcmcmd can connect to the shell at same time.
"

# Default verbose
quiet=false
timeout=300

while getopts 'hqt:' option; do
case "$option" in
h) echo "$usage"
exit
;;
q) quiet=true
;;
t) timeout=$OPTARG
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
esac
done
shift $((OPTIND - 1))

if [ "$quiet" = false ]; then
echo "$banner"
fi

/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket

File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 18 additions & 5 deletions platform/broadcom/libsaithrift-dev.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# libsaithrift-dev package

LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_1.3.0_amd64.deb
$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV)
$(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM)
SAI_VER = 1.3.5

LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb
$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV)
$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV)

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

SAISERVER = saiserver_$(SAI_VER)_amd64.deb
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER)))

SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb
$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER)
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG)))
Empty file modified platform/broadcom/one-image.mk
100755 → 100644
Empty file.
Empty file modified platform/broadcom/platform-modules-accton.mk
100755 → 100644
Empty file.
Empty file modified platform/broadcom/platform-modules-quanta.mk
100755 → 100644
Empty file.
6 changes: 0 additions & 6 deletions platform/broadcom/python-saithrift.mk

This file was deleted.

4 changes: 2 additions & 2 deletions platform/broadcom/rules.mk
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ include $(PLATFORM_PATH)/platform-modules-quanta.mk
include $(PLATFORM_PATH)/docker-orchagent-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk
include $(PLATFORM_PATH)/docker-saiserver-brcm.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/raw-image.mk
include $(PLATFORM_PATH)/one-aboot.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/python-saithrift.mk
include $(PLATFORM_PATH)/docker-ptf-brcm.mk

BCMCMD = bcmcmd
Expand All @@ -33,7 +33,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \
$(DOCKER_FPM)

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

# Runtime dependency on brcm sai is set only for syncd
$(SYNCD)_RDEPENDS += $(BRCM_SAI)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion platform/mellanox/docker-ptf-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

DOCKER_PTF_MLNX = docker-ptf-mlnx.gz
$(DOCKER_PTF_MLNX)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift
$(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT_MLNX)
$(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT)
$(DOCKER_PTF_MLNX)_LOAD_DOCKERS += $(DOCKER_PTF)
SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX)
13 changes: 13 additions & 0 deletions platform/mellanox/docker-saiserver-mlnx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# docker image for mlnx saiserver

DOCKER_SAISERVER_MLNX = docker-saiserver-mlnx.gz
$(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx
$(DOCKER_SAISERVER_MLNX)_DEPENDS += $(SAISERVER) $(PYTHON_SDK_API) $(MLNX_SFPD) $(CRIU)
$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX)

$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver
$(DOCKER_SAISERVER_MLNX)_RUN_OPT += --net=host --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
$(DOCKER_SYNCD_MLNX)_RUN_OPT += --tmpfs /run/criu
36 changes: 36 additions & 0 deletions platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM docker-config-engine

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

COPY \
{% for deb in docker_saiserver_mlnx_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
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 %}

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

COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]

COPY ["profile.ini", "portmap.ini", "/etc/sai/"]

COPY ["sai_2700.xml", "/usr/share/"]

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

ENTRYPOINT ["/usr/bin/supervisord"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 18 additions & 5 deletions platform/mellanox/libsaithrift-dev.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# libsaithrift-dev package

LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_1.3.0_amd64.deb
$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV)
$(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI)
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX)
SAI_VER = 1.3.5

LIBSAITHRIFT_DEV = libsaithrift-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)
SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV)

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

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

SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb
$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER)
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG)))
6 changes: 0 additions & 6 deletions platform/mellanox/python-saithrift.mk

This file was deleted.

4 changes: 2 additions & 2 deletions platform/mellanox/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ include $(PLATFORM_PATH)/hw-management.mk
include $(PLATFORM_PATH)/docker-syncd-mlnx.mk
include $(PLATFORM_PATH)/docker-syncd-mlnx-rpc.mk
include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk
include $(PLATFORM_PATH)/docker-saiserver-mlnx.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/python-saithrift.mk
include $(PLATFORM_PATH)/docker-ptf-mlnx.mk
include $(PLATFORM_PATH)/mlnx-sfpd.mk

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

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

# Runtime dependency on mlnx sai is set only for syncd
$(SYNCD)_RDEPENDS += $(MLNX_SAI)
4 changes: 4 additions & 0 deletions platform/mellanox/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \

APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3)
$(APPLIBS)_RDEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3)
APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV)))
IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
Expand All @@ -22,10 +23,12 @@ SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV)))
SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(SX_EXAMPLES)_DEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS)
$(SX_EXAMPLES)_RDEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS)
SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV)))
SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(SX_GEN_UTILS)_DEPENDS += $(SX_COMPLIB)
$(SX_GEN_UTILS)_RDEPENDS += $(SX_COMPLIB)
SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV)))
SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
Expand All @@ -37,6 +40,7 @@ $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV)))
#packages that are required for runtime only
PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(PYTHON_SDK_API)_DEPENDS += $(APPLIBS) $(SXD_LIBS)
$(PYTHON_SDK_API)_RDEPENDS += $(APPLIBS) $(SXD_LIBS)
SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV)))
Expand Down
2 changes: 1 addition & 1 deletion platform/nephos/libsaithrift-dev.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libsaithrift-dev package

LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.3.0_amd64.deb
LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.3.5_amd64.deb
$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV)
$(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI)
Expand Down
2 changes: 1 addition & 1 deletion platform/nephos/python-saithrift.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-saithrift package

PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.3.0_amd64.deb
PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.3.5_amd64.deb
$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV)
SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS)
2 changes: 1 addition & 1 deletion src/sonic-sairedis

0 comments on commit 9f6f3e4

Please sign in to comment.