From 5fa370b8f8c8fba4fe59ef58ce20d380e66480e7 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 4 Mar 2017 09:43:48 +0000 Subject: [PATCH 1/3] [saiserver]: add saiserver for broadcom, mellanox, cavium --- .gitignore | 4 ++ dockers/docker-saiserver-brcm/Dockerfile | 26 ------------- dockers/docker-saiserver-cavm/Dockerfile | 30 --------------- dockers/docker-saiserver-mlnx/Dockerfile | 37 ------------------- platform/broadcom/docker-saiserver-brcm.mk | 7 ++++ .../docker-saiserver-brcm/Dockerfile.j2 | 34 +++++++++++++++++ .../docker-saiserver-brcm/portmap.ini | 0 .../docker-saiserver-brcm/profile.ini | 0 .../broadcom}/docker-saiserver-brcm/start.sh | 0 platform/broadcom/rules.mk | 8 +++- platform/broadcom/sai.mk | 1 + platform/cavium/docker-saiserver-cavm.mk | 7 ++++ .../docker-saiserver-cavm/Dockerfile.j2 | 35 ++++++++++++++++++ .../cavium}/docker-saiserver-cavm/portmap.ini | 0 .../cavium}/docker-saiserver-cavm/profile.ini | 0 .../cavium}/docker-saiserver-cavm/start.sh | 0 platform/cavium/rules.mk | 6 ++- platform/mellanox/docker-saiserver-mlnx.mk | 7 ++++ .../docker-saiserver-mlnx/Dockerfile.j2 | 36 ++++++++++++++++++ .../docker-saiserver-mlnx/portmap.ini | 0 .../docker-saiserver-mlnx/profile.ini | 0 .../docker-saiserver-mlnx/sai_2700.xml | 0 .../mellanox}/docker-saiserver-mlnx/start.sh | 0 platform/mellanox/rules.mk | 6 ++- rules/functions | 1 + rules/saiserver.mk | 7 ++++ slave.mk | 2 +- src/saiserver/Makefile | 22 +++++++++++ 28 files changed, 178 insertions(+), 98 deletions(-) delete mode 100755 dockers/docker-saiserver-brcm/Dockerfile delete mode 100644 dockers/docker-saiserver-cavm/Dockerfile delete mode 100755 dockers/docker-saiserver-mlnx/Dockerfile create mode 100644 platform/broadcom/docker-saiserver-brcm.mk create mode 100644 platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 rename {dockers => platform/broadcom}/docker-saiserver-brcm/portmap.ini (100%) rename {dockers => platform/broadcom}/docker-saiserver-brcm/profile.ini (100%) rename {dockers => platform/broadcom}/docker-saiserver-brcm/start.sh (100%) create mode 100644 platform/cavium/docker-saiserver-cavm.mk create mode 100644 platform/cavium/docker-saiserver-cavm/Dockerfile.j2 rename {dockers => platform/cavium}/docker-saiserver-cavm/portmap.ini (100%) rename {dockers => platform/cavium}/docker-saiserver-cavm/profile.ini (100%) rename {dockers => platform/cavium}/docker-saiserver-cavm/start.sh (100%) create mode 100644 platform/mellanox/docker-saiserver-mlnx.mk create mode 100755 platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 rename {dockers => platform/mellanox}/docker-saiserver-mlnx/portmap.ini (100%) rename {dockers => platform/mellanox}/docker-saiserver-mlnx/profile.ini (100%) rename {dockers => platform/mellanox}/docker-saiserver-mlnx/sai_2700.xml (100%) rename {dockers => platform/mellanox}/docker-saiserver-mlnx/start.sh (100%) create mode 100644 rules/saiserver.mk create mode 100644 src/saiserver/Makefile diff --git a/.gitignore b/.gitignore index ffcc741d83ef..53ad797e497c 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ src/sonic-device-data/src/device/ # Autogenerated Dockerfiles dockers/docker-database/Dockerfile dockers/docker-fpm/Dockerfile +dockers/docker-fpm-gobgp/Dockerfile dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile @@ -37,3 +38,6 @@ dockers/docker-teamd/Dockerfile dockers/docker-config-engine/Dockerfile dockers/docker-base/Dockerfile platform/broadcom/docker-syncd-brcm/Dockerfile +platform/broadcom/docker-saiserver-brcm/Dockerfile +platform/mellanox/docker-saiserver-mlnx/Dockerfile +platform/mellanox/docker-saiserver-cavm/Dockerfile diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile deleted file mode 100755 index 3482c2068bc5..000000000000 --- a/dockers/docker-saiserver-brcm/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -COPY ["deps/libsaibcm_*.deb","deps/libopennsl_*.deb","deps/python-sdk-api_*.deb", "deps/iproute2_*.deb", "deps/libthrift-0.9.3_*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libopennsl_*.deb \ - && dpkg_apt /deps/libsaibcm_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb - -COPY ["deps/saiserver", "start.sh", "/usr/bin/"] - -COPY ["profile.ini", "portmap.ini", "/etc/sai/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; rm -rf /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-cavm/Dockerfile b/dockers/docker-saiserver-cavm/Dockerfile deleted file mode 100644 index 2ee6b8ff38cd..000000000000 --- a/dockers/docker-saiserver-cavm/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ - -FROM docker-base - -RUN apt-get update \ - && apt-get install -y libsensors4-dev \ - python \ - python-dev - -COPY deps /root/deps - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /root/deps/xp-tools.deb \ - && dpkg_apt /root/deps/libsai.deb \ - && dpkg_apt /root/deps/sai.deb \ - && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /root/deps/libnl-3-200_*.deb \ - && dpkg_apt /root/deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /root/deps/libnl-route-3-200_*.deb - - -COPY ["deps/saiserver", "start.sh", "/usr/bin/"] - -COPY ["portmap.ini", "profile.ini", "/etc/sai/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile deleted file mode 100755 index 5f51f5598b18..000000000000 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/applibs_*.deb \ - && dpkg_apt /deps/applibs-dev_*.deb \ - && dpkg_apt /deps/sx-complib_*.deb \ - && dpkg_apt /deps/sxd-libs_*.deb \ - && dpkg_apt /deps/sx-scew_*.deb \ - && dpkg_apt /deps/sx-examples_*.deb \ - && dpkg_apt /deps/sx-gen-utils_*.deb \ - && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/iproute2_*.deb \ - && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb - -COPY ["deps/saiserver", "start.sh", "/usr/bin/"] - -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 /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/docker-saiserver-brcm.mk b/platform/broadcom/docker-saiserver-brcm.mk new file mode 100644 index 000000000000..cf1332406bd1 --- /dev/null +++ b/platform/broadcom/docker-saiserver-brcm.mk @@ -0,0 +1,7 @@ +# docker image for brcm saiserver + +DOCKER_SAISERVER_BRCM = docker-saiserver-brcm.gz +$(DOCKER_SAISERVER_BRCM)_PATH = $(PLATFORM_PATH)/docker-saiserver-brcm +$(DOCKER_SAISERVER_BRCM)_FILES += $(SAISERVER) $(DSSERVE) $(BCMCMD) +$(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM) diff --git a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 new file mode 100644 index 000000000000..68587f1e9645 --- /dev/null +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -0,0 +1,34 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +{% if docker_saiserver_brcm_debs.strip() -%} +COPY \ +{% for deb in docker_saiserver_brcm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_saiserver_brcm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} || apt-get -y install -f +{% endif %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["debs/saiserver", "debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd + +COPY ["profile.ini", "portmap.ini", "/etc/sai/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-brcm/portmap.ini b/platform/broadcom/docker-saiserver-brcm/portmap.ini similarity index 100% rename from dockers/docker-saiserver-brcm/portmap.ini rename to platform/broadcom/docker-saiserver-brcm/portmap.ini diff --git a/dockers/docker-saiserver-brcm/profile.ini b/platform/broadcom/docker-saiserver-brcm/profile.ini similarity index 100% rename from dockers/docker-saiserver-brcm/profile.ini rename to platform/broadcom/docker-saiserver-brcm/profile.ini diff --git a/dockers/docker-saiserver-brcm/start.sh b/platform/broadcom/docker-saiserver-brcm/start.sh similarity index 100% rename from dockers/docker-saiserver-brcm/start.sh rename to platform/broadcom/docker-saiserver-brcm/start.sh diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 37e18ba80285..5ba162a077f5 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -6,6 +6,7 @@ include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys-s9100.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk +include $(PLATFORM_PATH)/docker-saiserver-brcm.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-aboot.mk @@ -18,10 +19,13 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM_GOBGP) \ + $(DOCKER_SAISERVER_BRCM) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) +$(SAISERVER)_DEPENDS += $(BRCM_SAI_DEV) # Runtime dependency on brcm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) +$(SYNCD)_RDEPENDS += $(BRCM_SAI) +$(SAISERVER)_RDEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ace7617f7ff4..02defaf80cff 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -7,4 +7,5 @@ $(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsa SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) +$(BRCM_SAI)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/cavium/docker-saiserver-cavm.mk b/platform/cavium/docker-saiserver-cavm.mk new file mode 100644 index 000000000000..33adc02ce812 --- /dev/null +++ b/platform/cavium/docker-saiserver-cavm.mk @@ -0,0 +1,7 @@ +# docker image for cavm saiserver + +DOCKER_SAISERVER_CAVM = docker-saiserver-cavm.gz +$(DOCKER_SAISERVER_CAVM)_PATH = $(PLATFORM_PATH)/docker-saiserver-cavm +$(DOCKER_SAISERVER_CAVM)_FILES += $(SAISERVER) +$(DOCKER_SAISERVER_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_CAVM) diff --git a/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 b/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 new file mode 100644 index 000000000000..3394c7ca7317 --- /dev/null +++ b/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 @@ -0,0 +1,35 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y libsensors4-dev + +{% if docker_saiserver_cavm_debs.strip() -%} +COPY \ +{% for deb in docker_saiserver_cavm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_saiserver_cavm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} || apt-get -y install -f +{% endif %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["debs/saiserver", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/saiserver + +COPY ["profile.ini", "portmap.ini", "/etc/sai/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-cavm/portmap.ini b/platform/cavium/docker-saiserver-cavm/portmap.ini similarity index 100% rename from dockers/docker-saiserver-cavm/portmap.ini rename to platform/cavium/docker-saiserver-cavm/portmap.ini diff --git a/dockers/docker-saiserver-cavm/profile.ini b/platform/cavium/docker-saiserver-cavm/profile.ini similarity index 100% rename from dockers/docker-saiserver-cavm/profile.ini rename to platform/cavium/docker-saiserver-cavm/profile.ini diff --git a/dockers/docker-saiserver-cavm/start.sh b/platform/cavium/docker-saiserver-cavm/start.sh similarity index 100% rename from dockers/docker-saiserver-cavm/start.sh rename to platform/cavium/docker-saiserver-cavm/start.sh diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 05312066719f..c93fa19ea91b 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,15 +1,19 @@ include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk +include $(PLATFORM_PATH)/docker-saiserver-cavm.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk include $(PLATFORM_PATH)/one-image.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM_GOBGP) \ + $(DOCKER_SAISERVER_CAVM) # Inject cavium sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) +$(SAISERVER)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) # Runtime dependency on cavium sai is set only for syncd $(SYNCD)_RDEPENDS += $(CAVM_SAI) +$(SAISERVER)_RDEPENDS += $(CAVM_SAI) diff --git a/platform/mellanox/docker-saiserver-mlnx.mk b/platform/mellanox/docker-saiserver-mlnx.mk new file mode 100644 index 000000000000..7dbfa498e422 --- /dev/null +++ b/platform/mellanox/docker-saiserver-mlnx.mk @@ -0,0 +1,7 @@ +# docker image for mlnx saiserver + +DOCKER_SAISERVER_MLNX = docker-saiserver-mlnx.gz +$(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx +$(DOCKER_SAISERVER_MLNX)_FILES += $(SAISERVER) +$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX) diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 new file mode 100755 index 000000000000..632bbef99912 --- /dev/null +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -0,0 +1,36 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +{% if docker_saiserver_mlnx_debs.strip() -%} +COPY \ +{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} || apt-get -y install -f +{% endif %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["debs/saiserver", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/saiserver + +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 ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-mlnx/portmap.ini b/platform/mellanox/docker-saiserver-mlnx/portmap.ini similarity index 100% rename from dockers/docker-saiserver-mlnx/portmap.ini rename to platform/mellanox/docker-saiserver-mlnx/portmap.ini diff --git a/dockers/docker-saiserver-mlnx/profile.ini b/platform/mellanox/docker-saiserver-mlnx/profile.ini similarity index 100% rename from dockers/docker-saiserver-mlnx/profile.ini rename to platform/mellanox/docker-saiserver-mlnx/profile.ini diff --git a/dockers/docker-saiserver-mlnx/sai_2700.xml b/platform/mellanox/docker-saiserver-mlnx/sai_2700.xml similarity index 100% rename from dockers/docker-saiserver-mlnx/sai_2700.xml rename to platform/mellanox/docker-saiserver-mlnx/sai_2700.xml diff --git a/dockers/docker-saiserver-mlnx/start.sh b/platform/mellanox/docker-saiserver-mlnx/start.sh similarity index 100% rename from dockers/docker-saiserver-mlnx/start.sh rename to platform/mellanox/docker-saiserver-mlnx/start.sh diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 8bcb8d0278b4..c76c8ff3f185 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -4,14 +4,18 @@ include $(PLATFORM_PATH)/mft.mk include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk +include $(PLATFORM_PATH)/docker-saiserver-mlnx.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/one-image.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM_GOBGP) \ + $(DOCKER_SAISERVER_MLNX) \ # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) +$(SAISERVER)_DEPENDS += $(MLNX_SAI) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) +$(SAISERVER)_RDEPENDS += $(MLNX_SAI) diff --git a/rules/functions b/rules/functions index 4379d85c9ed8..76bce456bec0 100644 --- a/rules/functions +++ b/rules/functions @@ -109,3 +109,4 @@ endef ############################################################################### expand = $(foreach d,$(1),$(call expand,$($(d)_$(2)),$(2))) $(1) +expand_files = $(foreach d,$(1),$(call expand,$($(d)_$(2)),$(2))) diff --git a/rules/saiserver.mk b/rules/saiserver.mk new file mode 100644 index 000000000000..0a4265b9dcbf --- /dev/null +++ b/rules/saiserver.mk @@ -0,0 +1,7 @@ +# saiserver + +SAISERVER = saiserver +$(SAISERVER)_DEPENDS += $(THRIFT_COMPILER) $(LIBTHRIFT_DEV) +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) +$(SAISERVER)_SRC_PATH = $(SRC_PATH)/saiserver +SONIC_MAKE_DEBS += $(SAISERVER) diff --git a/slave.mk b/slave.mk index 456b73ec4680..2695127e4339 100644 --- a/slave.mk +++ b/slave.mk @@ -271,7 +271,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/debs $(LOG) sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs - $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS)) $(subst $(SPACE),\n,$(call expand_files,$($*.gz_FILES),RDEPENDS))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) diff --git a/src/saiserver/Makefile b/src/saiserver/Makefile new file mode 100644 index 000000000000..db7f6c871b9f --- /dev/null +++ b/src/saiserver/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = saiserver + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + + rm -rf SAI + git clone https://github.com/opencomputeproject/SAI + pushd SAI + git checkout origin/v0.9.4 -b v0.9.4 + + # Build the package + pushd test/saithrift + + make + + popd + popd + + mv ./SAI/test/saithrift/$* $(DEST)/ From 92d9a0bcd1e36a76c9d6ac35c7c6079190d3a12a Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 4 Mar 2017 11:00:54 +0000 Subject: [PATCH 2/3] remove trailing whitespaces for the debs --- dockers/docker-config-engine/Dockerfile.j2 | 4 ++-- dockers/docker-database/Dockerfile.j2 | 4 ++-- dockers/docker-fpm-gobgp/Dockerfile.j2 | 4 ++-- dockers/docker-fpm/Dockerfile.j2 | 4 ++-- dockers/docker-lldp-sv2/Dockerfile.j2 | 4 ++-- dockers/docker-orchagent/Dockerfile.j2 | 4 ++-- dockers/docker-ptf/Dockerfile.j2 | 4 ++-- dockers/docker-snmp-sv2/Dockerfile.j2 | 4 ++-- dockers/docker-teamd/Dockerfile.j2 | 4 ++-- platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 | 4 ++-- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 4 ++-- platform/cavium/docker-saiserver-cavm/Dockerfile.j2 | 4 ++-- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 4 ++-- platform/centec/docker-syncd-centec/Dockerfile.j2 | 4 ++-- platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 | 4 ++-- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 4 ++-- platform/p4/docker-sonic-p4/Dockerfile.j2 | 4 ++-- 17 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index 067983724014..02fb47072b27 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -9,13 +9,13 @@ RUN apt-get update RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml COPY \ -{% for deb in docker_config_engine_debs.split(' ') -%} +{% for deb in docker_config_engine_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_config_engine_debs.split(' ') -%} +{% for deb in docker_config_engine_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index af77177c58d0..ba6f6bbecbb4 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update COPY \ -{% for deb in docker_database_debs.split(' ') -%} +{% for deb in docker_database_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ @@ -16,7 +16,7 @@ debs/ RUN apt-get -y install libjemalloc1 RUN dpkg -i \ -{% for deb in docker_database_debs.split(' ') -%} +{% for deb in docker_database_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 3d89999d9758..ca072ac9df1a 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -6,13 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y supervisor COPY \ -{% for deb in docker_fpm_gobgp_debs.split(' ') -%} +{% for deb in docker_fpm_gobgp_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_fpm_gobgp_debs.split(' ') -%} +{% for deb in docker_fpm_gobgp_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index 65b9cfa3121a..2986595addfb 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -8,13 +8,13 @@ RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 COPY \ -{% for deb in docker_fpm_debs.split(' ') -%} +{% for deb in docker_fpm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_fpm_debs.split(' ') -%} +{% for deb in docker_fpm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 4ff66944fe07..7c76a653a173 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,7 +1,7 @@ FROM docker-config-engine COPY \ -{% for deb in docker_lldp_sv2_debs.split(' ') -%} +{% for deb in docker_lldp_sv2_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ @@ -18,7 +18,7 @@ RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent- ## Install LLDP Sync Daemon RUN dpkg -i \ -{% for deb in docker_lldp_sv2_debs.split(' ') -%} +{% for deb in docker_lldp_sv2_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 0376c2c4d86d..dda2f704e9e5 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -12,13 +12,13 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso RUN apt-get -y install libjemalloc1 COPY \ -{% for deb in docker_orchagent_debs.split(' ') -%} +{% for deb in docker_orchagent_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_orchagent_debs.split(' ') -%} +{% for deb in docker_orchagent_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 3f2f1cad8276..84e42a960327 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -4,7 +4,7 @@ MAINTAINER Pavel Shirshov ## Copy dependencies COPY \ -{% for deb in docker_ptf_debs.split(' ') -%} +{% for deb in docker_ptf_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ @@ -43,7 +43,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / libqt5network5 RUN dpkg -i \ -{% for deb in docker_ptf_debs.split(' ') -%} +{% for deb in docker_ptf_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index db5a6a574f48..dcec520d8ca2 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,7 +1,7 @@ FROM docker-config-engine COPY [ \ -{% for deb in docker_snmp_sv2_debs.split(' ') -%} +{% for deb in docker_snmp_sv2_debs.strip().split(' ') -%} "debs/{{ deb }}", {%- endfor %} \ "/debs/"] @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y supervisor \ libexpat1-dev \ curl gcc && \ dpkg -i \ -{% for deb in docker_snmp_sv2_debs.split(' ') -%} +{% for deb in docker_snmp_sv2_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} && \ rm -rf /debs && \ diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index b3f35dd3c2e5..d0c7af5e4ac6 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -7,13 +7,13 @@ RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 RUN apt-get -y install libjemalloc1 COPY \ -{% for deb in docker_teamd_debs.split(' ') -%} +{% for deb in docker_teamd_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_teamd_debs.split(' ') -%} +{% for deb in docker_teamd_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 index 68587f1e9645..63ed4aef0f82 100644 --- a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -7,13 +7,13 @@ RUN apt-get update {% if docker_saiserver_brcm_debs.strip() -%} COPY \ -{% for deb in docker_saiserver_brcm_debs.split(' ') -%} +{% for deb in docker_saiserver_brcm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_saiserver_brcm_debs.split(' ') -%} +{% for deb in docker_saiserver_brcm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} || apt-get -y install -f {% endif %} diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index ffe7b6c57397..86f989c4edbd 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -6,13 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update COPY \ -{% for deb in docker_syncd_brcm_debs.split(' ') -%} +{% for deb in docker_syncd_brcm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_syncd_brcm_debs.split(' ') -%} +{% for deb in docker_syncd_brcm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 b/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 index 3394c7ca7317..7620ae25e704 100644 --- a/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-saiserver-cavm/Dockerfile.j2 @@ -8,13 +8,13 @@ RUN apt-get update \ {% if docker_saiserver_cavm_debs.strip() -%} COPY \ -{% for deb in docker_saiserver_cavm_debs.split(' ') -%} +{% for deb in docker_saiserver_cavm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_saiserver_cavm_debs.split(' ') -%} +{% for deb in docker_saiserver_cavm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} || apt-get -y install -f {% endif %} diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 45b71e85129c..ea49116bd879 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update COPY \ -{% for deb in docker_syncd_cavm_debs.split(' ') -%} +{% for deb in docker_syncd_cavm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ @@ -14,7 +14,7 @@ debs/ RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 RUN dpkg -i \ -{% for deb in docker_syncd_cavm_debs.split(' ') -%} +{% for deb in docker_syncd_cavm_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 617143215a4d..2a614dd67f61 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -6,13 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update COPY \ -{% for deb in docker_syncd_centec_debs.split(' ') -%} +{% for deb in docker_syncd_centec_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_syncd_centec_debs.split(' ') -%} +{% for deb in docker_syncd_centec_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index 632bbef99912..c581eafd8c61 100755 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -7,13 +7,13 @@ RUN apt-get update {% if docker_saiserver_mlnx_debs.strip() -%} COPY \ -{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} +{% for deb in docker_saiserver_mlnx_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} +{% for deb in docker_saiserver_mlnx_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} || apt-get -y install -f {% endif %} diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index cd686802f907..7b2fca3db223 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update COPY \ -{% for deb in docker_syncd_mlnx_debs.split(' ') -%} +{% for deb in docker_syncd_mlnx_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ @@ -14,7 +14,7 @@ debs/ RUN apt-get install -y libxml2 RUN dpkg -i \ -{% for deb in docker_syncd_mlnx_debs.split(' ') -%} +{% for deb in docker_syncd_mlnx_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 97e3a56817e4..bdfdd4c81dc7 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -8,13 +8,13 @@ RUN apt-get update RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 COPY \ -{% for deb in docker_sonic_p4_debs.split(' ') -%} +{% for deb in docker_sonic_p4_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_sonic_p4_debs.split(' ') -%} +{% for deb in docker_sonic_p4_debs.strip().split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} From 4f31a843330af0d8df8169064fbbecf07ac8036b Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 4 Mar 2017 17:10:17 +0000 Subject: [PATCH 3/3] remove backslash for mellanox platform --- platform/mellanox/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index c76c8ff3f185..9621842cd2e6 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -10,7 +10,7 @@ include $(PLATFORM_PATH)/one-image.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM_GOBGP) \ - $(DOCKER_SAISERVER_MLNX) \ + $(DOCKER_SAISERVER_MLNX) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI)