From 5fa370b8f8c8fba4fe59ef58ce20d380e66480e7 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 4 Mar 2017 09:43:48 +0000 Subject: [PATCH] [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)/