From 47d63bcd06e3385949ec9c74d7fe9200c58bd65a Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Thu, 17 Nov 2022 20:42:51 +0800 Subject: [PATCH] [SAI PTF] SAI PTF docker support sai-ptf v2 (#12719) * [SAI PTF] SAI PTF docker support sai-ptf v2 Publish the sai-ptf docker. Take part of the change from previous PR #11610 (already reverted as some cache issue) Cause in #11610, added two new target in it, one is sai-ptf another one is syncd-rpc with sai-ptf v2, to make the upgrade with more clear target, use this one take the sai-ptf one. Test one: NOSTRETCH=y NOJESSIE=y make configure PLATFORM=vs NOSTRETCH=y NOJESSIE=y NOBULLSEYE=y SAITHRIFT_V2=y make target/docker-ptf-sai.gz Signed-off-by: richardyu-ms * remove useless change Signed-off-by: richardyu-ms * remove useless parameters Signed-off-by: richardyu-ms * remove useless change Signed-off-by: richardyu-ms * Update azure-pipelines-build.yml remove a useless option Signed-off-by: richardyu-ms --- .azure-pipelines/azure-pipelines-build.yml | 1 + .azure-pipelines/build-template.yml | 1 + dockers/docker-ptf-sai/Dockerfile.j2 | 6 +++++- platform/vs/docker-ptf-sai.mk | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index e8e74e8d18..c5f2706658 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -121,6 +121,7 @@ jobs: mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz fi make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz + make $BUILD_OPTIONS target/docker-ptf-sai.gz if [ $(Build.Reason) != 'PullRequest' ];then gzip -kd target/sonic-vs.img.gz SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make sonic-slave-run diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 2665f46452..e1188924a1 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -92,6 +92,7 @@ jobs: fi make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz + make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-ptf-sai.gz else if [ ${{ parameters.dbg_image }} == true ]; then make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) INSTALL_DEBUG_TOOLS=y target/sonic-${{ parameters.platform }}.bin && \ diff --git a/dockers/docker-ptf-sai/Dockerfile.j2 b/dockers/docker-ptf-sai/Dockerfile.j2 index d68b39abb0..778a32669f 100644 --- a/dockers/docker-ptf-sai/Dockerfile.j2 +++ b/dockers/docker-ptf-sai/Dockerfile.j2 @@ -16,7 +16,6 @@ RUN pip3 install crc16 \ getmac \ packet_helper \ psutil \ - scapy==2.4.4 \ scapy_helper \ pysubnettree \ xmlrunner @@ -39,3 +38,8 @@ RUN dpkg -r python-ptf RUN git clone https://github.com/p4lang/ptf.git \ && cd ptf \ && python3.7 setup.py install --single-version-externally-managed --record /tmp/ptf_install.txt + +run echo "declare -x LANG=\"C.UTF-8\"" >> /root/.bashrc +run echo "declare -x LC_ALL=\"C.UTF-8\"" >> /root/.bashrc +run echo "declare -x PYTHONIOENCODING=\"UTF-8\"" >> /root/.bashrc +run echo "declare -x VIRTUAL_ENV=\"/root/env-python3\"" >> /root/.bashrc diff --git a/platform/vs/docker-ptf-sai.mk b/platform/vs/docker-ptf-sai.mk index d3463c5a09..17fce00c1f 100644 --- a/platform/vs/docker-ptf-sai.mk +++ b/platform/vs/docker-ptf-sai.mk @@ -3,7 +3,7 @@ DOCKER_PTF_SAI = docker-ptf-sai.gz DOCKER_PTF_BASE = docker-ptf.gz $(DOCKER_PTF_SAI)_PATH = $(DOCKERS_PATH)/docker-ptf-sai -$(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_2) $(PYTHON3_THRIFT_2) +$(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_0_14_1) $(PYTHON3_THRIFT_0_14_1) $(DOCKER_PTF_SAI)_LOAD_DOCKERS += $(DOCKER_PTF_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_PTF_SAI) SONIC_BUSTER_DOCKERS += $(DOCKER_PTF_SAI)