Skip to content

Commit

Permalink
[saiserver]: add saiserver for broadcom, mellanox, cavium
Browse files Browse the repository at this point in the history
  • Loading branch information
lguohan committed Mar 4, 2017
1 parent b9c6245 commit 5fa370b
Show file tree
Hide file tree
Showing 28 changed files with 178 additions and 98 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
26 changes: 0 additions & 26 deletions dockers/docker-saiserver-brcm/Dockerfile

This file was deleted.

30 changes: 0 additions & 30 deletions dockers/docker-saiserver-cavm/Dockerfile

This file was deleted.

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

This file was deleted.

7 changes: 7 additions & 0 deletions platform/broadcom/docker-saiserver-brcm.mk
Original file line number Diff line number Diff line change
@@ -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)
34 changes: 34 additions & 0 deletions platform/broadcom/docker-saiserver-brcm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 6 additions & 2 deletions platform/broadcom/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
1 change: 1 addition & 0 deletions platform/broadcom/sai.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 7 additions & 0 deletions platform/cavium/docker-saiserver-cavm.mk
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 35 additions & 0 deletions platform/cavium/docker-saiserver-cavm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion platform/cavium/rules.mk
Original file line number Diff line number Diff line change
@@ -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)

7 changes: 7 additions & 0 deletions platform/mellanox/docker-saiserver-mlnx.mk
Original file line number Diff line number Diff line change
@@ -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)
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-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"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion platform/mellanox/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions rules/functions
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
7 changes: 7 additions & 0 deletions rules/saiserver.mk
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions src/saiserver/Makefile
Original file line number Diff line number Diff line change
@@ -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)/

0 comments on commit 5fa370b

Please sign in to comment.