From 15ac9998bda7eab9e369d7ae8e2d9f4f3c82945a Mon Sep 17 00:00:00 2001 From: Myron Sosyak Date: Thu, 9 Sep 2021 09:22:21 -0700 Subject: [PATCH 1/2] Fix BFN syncd-rpc compilation --- platform/barefoot/docker-syncd-bfn-rpc.mk | 2 +- platform/barefoot/libsaithrift-dev.mk | 15 ++++++++------- platform/barefoot/rules.mk | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 1203c99aa7a5..ea9078efdef7 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_BFN_RPC = docker-syncd-bfn-rpc.gz $(DOCKER_SYNCD_BFN_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn-rpc -$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF) +$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT_0_13_0) $(PTF) $(DOCKER_SYNCD_BFN_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ diff --git a/platform/barefoot/libsaithrift-dev.mk b/platform/barefoot/libsaithrift-dev.mk index 0289a41b2910..5606213e9a1c 100644 --- a/platform/barefoot/libsaithrift-dev.mk +++ b/platform/barefoot/libsaithrift-dev.mk @@ -2,19 +2,20 @@ SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_13_0) $(LIBTHRIFT_DEV_0_13_0) $(PYTHON_THRIFT_0_13_0) $(THRIFT_COMPILER_0_13_0) $(BFN_SAI) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_13_0) $(BFN_SAI) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +SAISERVER = saiserver_$(SAI_VER)_$(CONFIGURED_ARCH).deb +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT_0_13_0) $(BFN_SAI) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 98dcef0f7b8a..9e154554e6b3 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -24,7 +24,8 @@ $(SYNCD)_DEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) $(SYNCD)_UNINSTALLS += $(BFN_SAI) ifeq ($(ENABLE_SYNCD_RPC),y) -$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) +$(SYNCD)_DEPENDS := $(filter-out $(LIBTHRIFT_DEV),$($(SYNCD)_DEPENDS)) +$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) $(LIBTHRIFT_0_13_0_DEV) endif # Runtime dependency on sai is set only for syncd From ebee3d1c775218abe30605e30db4a01256ca681c Mon Sep 17 00:00:00 2001 From: Myron Sosyak Date: Mon, 27 Sep 2021 07:24:16 -0700 Subject: [PATCH 2/2] Add docker-ptf under BFN platform --- dockers/docker-ptf/Dockerfile.j2 | 8 ++++++++ platform/barefoot/docker-ptf.dep | 9 +++++++++ platform/barefoot/docker-ptf.mk | 10 ++++++++++ platform/barefoot/rules.dep | 1 + platform/barefoot/rules.mk | 1 + 5 files changed, 29 insertions(+) create mode 100644 platform/barefoot/docker-ptf.dep create mode 100644 platform/barefoot/docker-ptf.mk create mode 100644 platform/barefoot/rules.dep diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index e14959d4f3be..339c5403bf2b 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -50,6 +50,9 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / python-libpcap \ python-scapy \ python-six \ + python3 \ + python3-dev \ + python3-six \ tacacs+ \ rsyslog \ ntp \ @@ -96,6 +99,11 @@ RUN rm -rf /debs \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ && pip install cffi \ + && pip install crc16 \ + && pip install netifaces \ + && pip install getmac \ + && pip install packet_helper \ + && pip install psutil \ && pip install nnpy \ && pip install dpkt \ && pip install ipaddress \ diff --git a/platform/barefoot/docker-ptf.dep b/platform/barefoot/docker-ptf.dep new file mode 100644 index 000000000000..1718a8b00389 --- /dev/null +++ b/platform/barefoot/docker-ptf.dep @@ -0,0 +1,9 @@ + +DPATH := $($(DOCKER_PTF)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/barefoot/docker-ptf.mk platform/barefoot/docker-ptf.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_PTF)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_PTF)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_PTF)_DEP_FILES := $(DEP_FILES) diff --git a/platform/barefoot/docker-ptf.mk b/platform/barefoot/docker-ptf.mk new file mode 100644 index 000000000000..cf88475a3d2d --- /dev/null +++ b/platform/barefoot/docker-ptf.mk @@ -0,0 +1,10 @@ +# docker image for docker-ptf + +DOCKER_PTF = docker-ptf.gz +$(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf +$(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT_0_13_0) $(PYTHON3_THRIFT_0_13_0) $(PTF) $(PYTHON_SAITHRIFT) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF) + +# ifneq ($(ENABLE_SYNCD_RPC),y) +# SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PTF) +# endif \ No newline at end of file diff --git a/platform/barefoot/rules.dep b/platform/barefoot/rules.dep new file mode 100644 index 000000000000..e4e2c14c2114 --- /dev/null +++ b/platform/barefoot/rules.dep @@ -0,0 +1 @@ +include $(PLATFORM_PATH)/docker-ptf.dep \ No newline at end of file diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 9e154554e6b3..5d4f9e83af51 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -14,6 +14,7 @@ include $(PLATFORM_PATH)/bfn-platform.mk #include $(PLATFORM_PATH)/bfn-platform-wnc.mk #include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk include $(PLATFORM_PATH)/bfn-modules.mk +include $(PLATFORM_PATH)/docker-ptf.mk SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \ $(DOCKER_FPM)