From edf4520739cd698fc23db4e636f12f9d62f26277 Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Fri, 19 Jan 2024 02:05:18 +0000 Subject: [PATCH 1/6] Add VPP date-plane app TARGETS --- dash-pipeline/Makefile | 82 +++++++++++++++++++- dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env | 5 ++ dash-pipeline/dockerfiles/Dockerfile.vpp | 59 ++++++++++++++ 3 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env create mode 100644 dash-pipeline/dockerfiles/Dockerfile.vpp diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index 6b4c8cd40..4f8e59eef 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -4,17 +4,17 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) # "All" type targets for convenience -all:p4 sai saithrift-server docker-saithrift-client docker-saichallenger-client test +all:p4 sai saithrift-server docker-saithrift-client docker-saichallenger-client vpp test run-all-tests:run-libsai-test run-saithrift-client-tests run-saichallenger-tests run-saithrift-client-tests: run-saithrift-ptftests run-saithrift-pytests run-saithrift-client-dev-tests: run-saithrift-dev-ptftests run-saithrift-dev-pytests .PHONY:clean -clean: kill-all p4-clean sai-clean test-clean network-clean saithrift-server-clean +clean: kill-all p4-clean sai-clean test-clean network-clean saithrift-server-clean vpp-clean rm -rf $(P4_OUTDIR) -kill-all: kill-saithrift-server kill-switch undeploy-ixiac kill-saichallenger-client +kill-all: kill-saithrift-server kill-switch undeploy-ixiac kill-saichallenger-client kill-vpp PWD := $(realpath $(mkfile_dir)) DASH_USER ?=dashuser @@ -64,6 +64,10 @@ include dockerfiles/DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG.env # SAIChallenger Client image built locally with saithrift client libs + PTF & Pytest frameworks DOCKER_SAI_CHALLENGER_CLIENT_IMG ?= local/dash-saichallenger-client:latest +# Run/compile vpp +# include file defines DOCKER_VPP_IMG +include dockerfiles/DOCKER_VPP_IMG.env + # Set differently in CI scripts as needed, e.g. run switch container in -d mode DOCKER_FLAGS ?=-it @@ -251,6 +255,49 @@ run-saithrift-bldr-bash: $(DOCKER_RUN_SAITHRIFT_BLDR) \ /bin/bash +###################################### +# VPP date-plane app TARGETS +###################################### +DOCKER_RUN_VPP = docker run\ + $(DOCKER_FLAGS) \ + -v $(PWD)/bmv2:/bmv2 \ + -v $(PWD)/tests:/tests \ + -v $(PWD)/../:/dash \ + --network=host \ + -u $(HOST_USER):$(HOST_GROUP) \ + --rm \ + +.PHONY:vpp vpp-clean +vpp-clean: + $(DOCKER_RUN_VPP) \ + --name dash-vpp-$(USER) \ + -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ + make clean + +vpp: + @echo "Compile vpp for date-plane app ..." + $(DOCKER_RUN_VPP) \ + --name dash-vpp-$(USER) \ + -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ + make + +run-vpp-bash: + $(DOCKER_RUN_VPP) \ + --name dash-vpp-$(USER) \ + -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ + /bin/bash + +run-vpp: + $(DOCKER_RUN_VPP) \ + --privileged \ + -u root \ + --name dash-vpp-$(USER) \ + -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ + ./vpp.sh + +kill-vpp: + -docker kill dash-vpp-$(USER) + ###################################### # P4 Behavioral-model (switch) TARGETS ###################################### @@ -621,6 +668,35 @@ docker-publish-dash-grpc: docker push $(DOCKER_GRPC_IMG) [ -n $(DOCKER_GRPC_IMG_CTAG) ] && docker push $(DOCKER_GRPC_IMG_NAME):$(DOCKER_GRPC_IMG_CTAG) +############################### + +DOCKER_VPP_IMG_TAG = $(shell cat dockerfiles/Dockerfile.vpp | $(SHA1SUM)) +DOCKER_VPP_IMG = $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_TAG) + +docker-dash-vpp: + { [ x$(ENABLE_DOCKER_PULL) == xy ] && docker pull $(DOCKER_VPP_IMG); } || \ + docker build \ + -f dockerfiles/Dockerfile.vpp \ + -t $(DOCKER_VPP_IMG) \ + --build-arg user=$(DASH_USER) \ + --build-arg group=$(DASH_GROUP) \ + --build-arg uid=$(DASH_UID) \ + --build-arg guid=$(DASH_GUID) \ + --build-arg hostname=$(DASH_HOST) \ + --build-arg available_processors=$(shell nproc) \ + dockerfiles + [ -n $(DOCKER_VPP_IMG_CTAG) ] && \ + docker tag $(DOCKER_VPP_IMG) $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_CTAG) + +docker-pull-dash-vpp: + docker pull $(DOCKER_VPP_IMG) + +docker-publish-dash-vpp: + @echo "Publish $(DOCKER_VPP_IMG) - requires credentials, can only do from DASH repo, not a fork" + docker push $(DOCKER_VPP_IMG) + [ -n $(DOCKER_VPP_IMG_CTAG) ] && \ + docker push $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_CTAG) + ############################### # BMV2-PKTGEN NETWORKING TARGETS ############################### diff --git a/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env b/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env new file mode 100644 index 000000000..c41c6f902 --- /dev/null +++ b/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env @@ -0,0 +1,5 @@ +# Define docker image repo/name:tag +# Changing this will cause build/publish to occur in CI actions +export DASH_ACR_REGISTRY=sonicdash.azurecr.io +export DOCKER_VPP_IMG_NAME?=${DASH_ACR_REGISTRY}/dash-vpp-bldr +export DOCKER_VPP_IMG_CTAG?=240118 diff --git a/dash-pipeline/dockerfiles/Dockerfile.vpp b/dash-pipeline/dockerfiles/Dockerfile.vpp new file mode 100644 index 000000000..27dcb3662 --- /dev/null +++ b/dash-pipeline/dockerfiles/Dockerfile.vpp @@ -0,0 +1,59 @@ +# This Dockerfile builds an image used to compile vpp for dash date-plane app. +FROM amd64/ubuntu:20.04 +LABEL maintainer="SONIC-DASH Community" +LABEL description="DASH date-plane app using vpp" + +# Configure make to run as many parallel jobs as cores available +ARG available_processors +ARG MAKEFLAGS=-j$available_processors + +ARG CC=gcc +ARG CXX=g++ +# Set TZ to avoid interactive installer +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +ENV GIT_SSL_NO_VERIFY=true + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + sudo \ + iproute2 net-tools iputils-ping \ + make + +## Install vpp +RUN apt-get install -y curl +RUN curl -s https://packagecloud.io/install/repositories/fdio/release/script.deb.sh | bash -x +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + vpp vpp-plugin-core vpp-plugin-dpdk vpp-dbg vpp-dev + +# vpp development environment +RUN echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections +WORKDIR /var +RUN (git clone https://gerrit.fd.io/r/vpp && \ + cd vpp && UNATTENDED=y make install-dep) + + +WORKDIR / + +ARG user +ARG uid +ARG group +ARG guid +ARG hostname + +ENV BUILD_HOSTNAME $hostname +ENV USER $user + +RUN groupadd -f -r -g $guid $group +RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash +RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER $user + +CMD /bin/bash From 9074a98fc020b122e9eb483dd8b30140494f7eab Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Thu, 25 Jan 2024 08:21:09 +0000 Subject: [PATCH 2/6] Connect p4 pipeline to vpp via VPP_LINK --- dash-pipeline/Makefile | 31 ++++++++++++++++++++++++++---- dash-pipeline/disable_veth_ipv6.sh | 14 ++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index 4f8e59eef..aa350262f 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -1,5 +1,12 @@ SHELL = /bin/bash +HAVE_VPP ?= +ifeq ($(HAVE_VPP),y) +VPP_LINK = veth4 +VPP_LINK_PEER = veth5 +SWITCH_PORT_VPP = --interface 2@$(VPP_LINK) +endif + mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) @@ -283,17 +290,18 @@ vpp: run-vpp-bash: $(DOCKER_RUN_VPP) \ + --privileged \ --name dash-vpp-$(USER) \ -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ /bin/bash -run-vpp: +run-vpp: $(VPP_LINK) $(DOCKER_RUN_VPP) \ --privileged \ -u root \ --name dash-vpp-$(USER) \ -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ - ./vpp.sh + env HOST_INTERFACE=$(VPP_LINK_PEER) ./vpp.sh startup.conf kill-vpp: -docker kill dash-vpp-$(USER) @@ -314,6 +322,7 @@ run-switch: network simple_switch_grpc \ --interface 0@veth0 \ --interface 1@veth2 \ + $(SWITCH_PORT_VPP) \ --log-console \ --no-p4 @@ -701,7 +710,7 @@ docker-publish-dash-vpp: # BMV2-PKTGEN NETWORKING TARGETS ############################### -network:veth0 veth2 disable-ipv6 +network:veth0 veth2 $(VPP_LINK) disable-ipv6 veth0: /sys/class/net/veth0 /sys/class/net/veth0: @@ -720,13 +729,27 @@ veth2: /sys/class/net/veth2 sudo ip link set veth2 mtu 9500 sudo ip link set veth3 mtu 9500 +ifeq ($(HAVE_VPP),y) +$(VPP_LINK): /sys/class/net/$(VPP_LINK) +/sys/class/net/$(VPP_LINK): + sudo ip link add name $(VPP_LINK) type veth peer name $(VPP_LINK_PEER) + sudo ip link set dev $(VPP_LINK) up + sudo ip link set dev $(VPP_LINK_PEER) up + sudo ip link set $(VPP_LINK) mtu 9500 + sudo ip link set $(VPP_LINK_PEER) mtu 9500 +endif + disable-ipv6: - ./disable_veth_ipv6.sh + VPP_LINK=$(VPP_LINK) VPP_LINK_PEER=$(VPP_LINK_PEER) ./disable_veth_ipv6.sh # Delete veth's, test existence to avoid needless use of sudo network-clean: @-([ -e /sys/class/net/veth0 ] && sudo ip link delete dev veth0 && echo "Deleted veth0/1") || echo "No veth0, not deleting" @-([ -e /sys/class/net/veth2 ] && sudo ip link delete dev veth2 && echo "Deleted veth2/3") || echo "No veth2, not deleting" +ifeq ($(HAVE_VPP),y) + @-([ -e /sys/class/net/$(VPP_LINK) ] && sudo ip link delete dev $(VPP_LINK) \ + && echo "Deleted $(VPP_LINK)") || echo "No $(VPP_LINK), not deleting" +endif ############################### # IXIA-C TARGETS diff --git a/dash-pipeline/disable_veth_ipv6.sh b/dash-pipeline/disable_veth_ipv6.sh index 64bff490d..4e4ba9d6b 100755 --- a/dash-pipeline/disable_veth_ipv6.sh +++ b/dash-pipeline/disable_veth_ipv6.sh @@ -20,3 +20,17 @@ sudo sysctl net.ipv6.conf.veth3.autoconf=0 sudo sysctl net.ipv6.conf.veth3.accept_ra=0 sudo sysctl net.ipv6.conf.veth3.accept_ra_pinfo=0 sudo sysctl net.ipv6.conf.veth3.router_solicitations=0 + +if [ $VPP_LINK ]; then +sudo sysctl net.ipv6.conf.$VPP_LINK.autoconf=0 +sudo sysctl net.ipv6.conf.$VPP_LINK.accept_ra=0 +sudo sysctl net.ipv6.conf.$VPP_LINK.accept_ra_pinfo=0 +sudo sysctl net.ipv6.conf.$VPP_LINK.router_solicitations=0 +fi +if [ $VPP_LINK_PEER ]; then +sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.disable_ipv6=1 +sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.autoconf=0 +sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.accept_ra=0 +sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.accept_ra_pinfo=0 +sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.router_solicitations=0 +fi From d02668e96f56c194508a79db53467f4c4537ae0a Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Sat, 6 Jul 2024 15:54:42 +0000 Subject: [PATCH 3/6] Include SAI in docker vpp and add dash sai libs dependency on vpp --- dash-pipeline/Makefile | 3 +++ dash-pipeline/dockerfiles/Dockerfile.vpp | 29 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index aa350262f..fc387e1ef 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -268,6 +268,9 @@ run-saithrift-bldr-bash: DOCKER_RUN_VPP = docker run\ $(DOCKER_FLAGS) \ -v $(PWD)/bmv2:/bmv2 \ + -v $(PWD)/$(P4_OUTDIR)/dash_pipeline.json:/etc/dash/dash_pipeline.json \ + -v $(PWD)/$(P4_OUTDIR)/dash_pipeline_p4rt.txt:/etc/dash/dash_pipeline_p4rt.txt \ + -v $(PWD)/SAI:/SAI \ -v $(PWD)/tests:/tests \ -v $(PWD)/../:/dash \ --network=host \ diff --git a/dash-pipeline/dockerfiles/Dockerfile.vpp b/dash-pipeline/dockerfiles/Dockerfile.vpp index 27dcb3662..bc4292431 100644 --- a/dash-pipeline/dockerfiles/Dockerfile.vpp +++ b/dash-pipeline/dockerfiles/Dockerfile.vpp @@ -1,5 +1,6 @@ # This Dockerfile builds an image used to compile vpp for dash date-plane app. -FROM amd64/ubuntu:20.04 +FROM sonicdash.azurecr.io/dash-grpc:1.43.2 as grpc +FROM p4lang/behavioral-model@sha256:ce45720e28a96a50f275c1b511cd84c2558b62f2cf7a7e506765183bc3fb2e32 LABEL maintainer="SONIC-DASH Community" LABEL description="DASH date-plane app using vpp" @@ -7,6 +8,7 @@ LABEL description="DASH date-plane app using vpp" ARG available_processors ARG MAKEFLAGS=-j$available_processors +ARG sswitch_grpc=yes ARG CC=gcc ARG CXX=g++ # Set TZ to avoid interactive installer @@ -20,7 +22,9 @@ RUN apt-get update && \ build-essential \ autoconf \ libtool \ + libtool-bin \ pkg-config \ + patchelf \ sudo \ iproute2 net-tools iputils-ping \ make @@ -39,6 +43,29 @@ RUN (git clone https://gerrit.fd.io/r/vpp && \ cd vpp && UNATTENDED=y make install-dep) +WORKDIR /usr/local/lib/ + +# Copy libabsl .a files from p4pi, make shared lib for our use and delete .a's +COPY --from=grpc /usr/local/lib/lib*grpc*.so* \ + /usr/local/lib/libabsl*.so* \ + /usr/local/lib/libgpr*.so* \ + /usr/local/lib/libupb*.so* \ + /usr/local/lib/libre2*.so* \ + /usr/local/lib/libaddress_sorting*.so* \ + /usr/local/lib/libssl*.so* \ + /usr/local/lib/libcrypto*.so* \ + ./ + +# Specify dash sai libs dependency on vpp +RUN patchelf --set-rpath /SAI/lib /usr/bin/vpp +RUN patchelf --add-needed libsai.so \ + --add-needed libprotobuf.so \ + --add-needed libpiprotobuf.so \ + --add-needed libpiprotogrpc.so \ + --add-needed libgrpc++.so.1.43 \ + /usr/bin/vpp +RUN ldconfig + WORKDIR / ARG user From 0450d2f99c1b129aa2a7bcdbe63e0fec6c6dc439 Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Tue, 20 Aug 2024 17:43:58 +0000 Subject: [PATCH 4/6] Fix per comments --- dash-pipeline/Makefile | 8 ++++---- dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index fc387e1ef..df39811dc 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -1,7 +1,7 @@ SHELL = /bin/bash -HAVE_VPP ?= -ifeq ($(HAVE_VPP),y) +HAVE_DPAPP ?= +ifeq ($(HAVE_DPAPP),y) VPP_LINK = veth4 VPP_LINK_PEER = veth5 SWITCH_PORT_VPP = --interface 2@$(VPP_LINK) @@ -732,7 +732,7 @@ veth2: /sys/class/net/veth2 sudo ip link set veth2 mtu 9500 sudo ip link set veth3 mtu 9500 -ifeq ($(HAVE_VPP),y) +ifeq ($(HAVE_DPAPP),y) $(VPP_LINK): /sys/class/net/$(VPP_LINK) /sys/class/net/$(VPP_LINK): sudo ip link add name $(VPP_LINK) type veth peer name $(VPP_LINK_PEER) @@ -749,7 +749,7 @@ disable-ipv6: network-clean: @-([ -e /sys/class/net/veth0 ] && sudo ip link delete dev veth0 && echo "Deleted veth0/1") || echo "No veth0, not deleting" @-([ -e /sys/class/net/veth2 ] && sudo ip link delete dev veth2 && echo "Deleted veth2/3") || echo "No veth2, not deleting" -ifeq ($(HAVE_VPP),y) +ifeq ($(HAVE_DPAPP),y) @-([ -e /sys/class/net/$(VPP_LINK) ] && sudo ip link delete dev $(VPP_LINK) \ && echo "Deleted $(VPP_LINK)") || echo "No $(VPP_LINK), not deleting" endif diff --git a/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env b/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env index c41c6f902..4f62cc42c 100644 --- a/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env +++ b/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env @@ -2,4 +2,4 @@ # Changing this will cause build/publish to occur in CI actions export DASH_ACR_REGISTRY=sonicdash.azurecr.io export DOCKER_VPP_IMG_NAME?=${DASH_ACR_REGISTRY}/dash-vpp-bldr -export DOCKER_VPP_IMG_CTAG?=240118 +export DOCKER_VPP_IMG_CTAG?=240814 From 56b3974a272f058a4ad635aee55456e4a05dd83d Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Tue, 27 Aug 2024 09:05:47 +0000 Subject: [PATCH 5/6] Rename VPP/vpp to DPAPP/dpapp --- dash-pipeline/Makefile | 118 +++++++++--------- dash-pipeline/disable_veth_ipv6.sh | 22 ++-- ...OCKER_VPP_IMG.env => DOCKER_DPAPP_IMG.env} | 4 +- .../{Dockerfile.vpp => Dockerfile.dpapp} | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) rename dash-pipeline/dockerfiles/{DOCKER_VPP_IMG.env => DOCKER_DPAPP_IMG.env} (58%) rename dash-pipeline/dockerfiles/{Dockerfile.vpp => Dockerfile.dpapp} (96%) diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index df39811dc..daf3a7713 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -2,26 +2,26 @@ SHELL = /bin/bash HAVE_DPAPP ?= ifeq ($(HAVE_DPAPP),y) -VPP_LINK = veth4 -VPP_LINK_PEER = veth5 -SWITCH_PORT_VPP = --interface 2@$(VPP_LINK) +DPAPP_LINK = veth4 +DPAPP_LINK_PEER = veth5 +SWITCH_PORT_DPAPP = --interface 2@$(DPAPP_LINK) endif mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) # "All" type targets for convenience -all:p4 sai saithrift-server docker-saithrift-client docker-saichallenger-client vpp test +all:p4 sai dpapp saithrift-server docker-saithrift-client docker-saichallenger-client test run-all-tests:run-libsai-test run-saithrift-client-tests run-saichallenger-tests run-saithrift-client-tests: run-saithrift-ptftests run-saithrift-pytests run-saithrift-client-dev-tests: run-saithrift-dev-ptftests run-saithrift-dev-pytests .PHONY:clean -clean: kill-all p4-clean sai-clean test-clean network-clean saithrift-server-clean vpp-clean +clean: kill-all p4-clean sai-clean dpapp-clean test-clean network-clean saithrift-server-clean rm -rf $(P4_OUTDIR) -kill-all: kill-saithrift-server kill-switch undeploy-ixiac kill-saichallenger-client kill-vpp +kill-all: kill-saithrift-server kill-dpapp kill-switch undeploy-ixiac kill-saichallenger-client PWD := $(realpath $(mkfile_dir)) DASH_USER ?=dashuser @@ -71,9 +71,9 @@ include dockerfiles/DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG.env # SAIChallenger Client image built locally with saithrift client libs + PTF & Pytest frameworks DOCKER_SAI_CHALLENGER_CLIENT_IMG ?= local/dash-saichallenger-client:latest -# Run/compile vpp -# include file defines DOCKER_VPP_IMG -include dockerfiles/DOCKER_VPP_IMG.env +# Run/compile dpapp +# include file defines DOCKER_DPAPP_IMG +include dockerfiles/DOCKER_DPAPP_IMG.env # Set differently in CI scripts as needed, e.g. run switch container in -d mode DOCKER_FLAGS ?=-it @@ -263,9 +263,9 @@ run-saithrift-bldr-bash: /bin/bash ###################################### -# VPP date-plane app TARGETS +# bmv2 date-plane app TARGETS ###################################### -DOCKER_RUN_VPP = docker run\ +DOCKER_RUN_DPAPP = docker run\ $(DOCKER_FLAGS) \ -v $(PWD)/bmv2:/bmv2 \ -v $(PWD)/$(P4_OUTDIR)/dash_pipeline.json:/etc/dash/dash_pipeline.json \ @@ -277,37 +277,37 @@ DOCKER_RUN_VPP = docker run\ -u $(HOST_USER):$(HOST_GROUP) \ --rm \ -.PHONY:vpp vpp-clean -vpp-clean: - $(DOCKER_RUN_VPP) \ - --name dash-vpp-$(USER) \ - -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ +.PHONY:dpapp dpapp-clean +dpapp-clean: + $(DOCKER_RUN_DPAPP) \ + --name dash-dpapp-$(USER) \ + -w /dash/dash-pipeline/dpapp $(DOCKER_DPAPP_IMG) \ make clean -vpp: - @echo "Compile vpp for date-plane app ..." - $(DOCKER_RUN_VPP) \ - --name dash-vpp-$(USER) \ - -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ +dpapp: + @echo "Compile dpapp for date-plane app ..." + $(DOCKER_RUN_DPAPP) \ + --name dash-dpapp-$(USER) \ + -w /dash/dash-pipeline/dpapp $(DOCKER_DPAPP_IMG) \ make -run-vpp-bash: - $(DOCKER_RUN_VPP) \ +run-dpapp-bash: + $(DOCKER_RUN_DPAPP) \ --privileged \ - --name dash-vpp-$(USER) \ - -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ + --name dash-dpapp-$(USER) \ + -w /dash/dash-pipeline/dpapp $(DOCKER_DPAPP_IMG) \ /bin/bash -run-vpp: $(VPP_LINK) - $(DOCKER_RUN_VPP) \ +run-dpapp: $(DPAPP_LINK) + $(DOCKER_RUN_DPAPP) \ --privileged \ -u root \ - --name dash-vpp-$(USER) \ - -w /dash/dash-pipeline/vpp-plugin $(DOCKER_VPP_IMG) \ - env HOST_INTERFACE=$(VPP_LINK_PEER) ./vpp.sh startup.conf + --name dash-dpapp-$(USER) \ + -w /dash/dash-pipeline/dpapp $(DOCKER_DPAPP_IMG) \ + env HOST_INTERFACE=$(DPAPP_LINK_PEER) ./dpapp.sh startup.conf -kill-vpp: - -docker kill dash-vpp-$(USER) +kill-dpapp: + -docker kill dash-dpapp-$(USER) ###################################### # P4 Behavioral-model (switch) TARGETS @@ -325,7 +325,7 @@ run-switch: network simple_switch_grpc \ --interface 0@veth0 \ --interface 1@veth2 \ - $(SWITCH_PORT_VPP) \ + $(SWITCH_PORT_DPAPP) \ --log-console \ --no-p4 @@ -682,14 +682,14 @@ docker-publish-dash-grpc: ############################### -DOCKER_VPP_IMG_TAG = $(shell cat dockerfiles/Dockerfile.vpp | $(SHA1SUM)) -DOCKER_VPP_IMG = $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_TAG) +DOCKER_DPAPP_IMG_TAG = $(shell cat dockerfiles/Dockerfile.dpapp | $(SHA1SUM)) +DOCKER_DPAPP_IMG = $(DOCKER_DPAPP_IMG_NAME):$(DOCKER_DPAPP_IMG_TAG) -docker-dash-vpp: - { [ x$(ENABLE_DOCKER_PULL) == xy ] && docker pull $(DOCKER_VPP_IMG); } || \ +docker-dash-dpapp: + { [ x$(ENABLE_DOCKER_PULL) == xy ] && docker pull $(DOCKER_DPAPP_IMG); } || \ docker build \ - -f dockerfiles/Dockerfile.vpp \ - -t $(DOCKER_VPP_IMG) \ + -f dockerfiles/Dockerfile.dpapp \ + -t $(DOCKER_DPAPP_IMG) \ --build-arg user=$(DASH_USER) \ --build-arg group=$(DASH_GROUP) \ --build-arg uid=$(DASH_UID) \ @@ -697,23 +697,23 @@ docker-dash-vpp: --build-arg hostname=$(DASH_HOST) \ --build-arg available_processors=$(shell nproc) \ dockerfiles - [ -n $(DOCKER_VPP_IMG_CTAG) ] && \ - docker tag $(DOCKER_VPP_IMG) $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_CTAG) + [ -n $(DOCKER_DPAPP_IMG_CTAG) ] && \ + docker tag $(DOCKER_DPAPP_IMG) $(DOCKER_DPAPP_IMG_NAME):$(DOCKER_DPAPP_IMG_CTAG) -docker-pull-dash-vpp: - docker pull $(DOCKER_VPP_IMG) +docker-pull-dash-dpapp: + docker pull $(DOCKER_DPAPP_IMG) -docker-publish-dash-vpp: - @echo "Publish $(DOCKER_VPP_IMG) - requires credentials, can only do from DASH repo, not a fork" - docker push $(DOCKER_VPP_IMG) - [ -n $(DOCKER_VPP_IMG_CTAG) ] && \ - docker push $(DOCKER_VPP_IMG_NAME):$(DOCKER_VPP_IMG_CTAG) +docker-publish-dash-dpapp: + @echo "Publish $(DOCKER_DPAPP_IMG) - requires credentials, can only do from DASH repo, not a fork" + docker push $(DOCKER_DPAPP_IMG) + [ -n $(DOCKER_DPAPP_IMG_CTAG) ] && \ + docker push $(DOCKER_DPAPP_IMG_NAME):$(DOCKER_DPAPP_IMG_CTAG) ############################### # BMV2-PKTGEN NETWORKING TARGETS ############################### -network:veth0 veth2 $(VPP_LINK) disable-ipv6 +network:veth0 veth2 $(DPAPP_LINK) disable-ipv6 veth0: /sys/class/net/veth0 /sys/class/net/veth0: @@ -733,25 +733,25 @@ veth2: /sys/class/net/veth2 sudo ip link set veth3 mtu 9500 ifeq ($(HAVE_DPAPP),y) -$(VPP_LINK): /sys/class/net/$(VPP_LINK) -/sys/class/net/$(VPP_LINK): - sudo ip link add name $(VPP_LINK) type veth peer name $(VPP_LINK_PEER) - sudo ip link set dev $(VPP_LINK) up - sudo ip link set dev $(VPP_LINK_PEER) up - sudo ip link set $(VPP_LINK) mtu 9500 - sudo ip link set $(VPP_LINK_PEER) mtu 9500 +$(DPAPP_LINK): /sys/class/net/$(DPAPP_LINK) +/sys/class/net/$(DPAPP_LINK): + sudo ip link add name $(DPAPP_LINK) type veth peer name $(DPAPP_LINK_PEER) + sudo ip link set dev $(DPAPP_LINK) up + sudo ip link set dev $(DPAPP_LINK_PEER) up + sudo ip link set $(DPAPP_LINK) mtu 9500 + sudo ip link set $(DPAPP_LINK_PEER) mtu 9500 endif disable-ipv6: - VPP_LINK=$(VPP_LINK) VPP_LINK_PEER=$(VPP_LINK_PEER) ./disable_veth_ipv6.sh + DPAPP_LINK=$(DPAPP_LINK) DPAPP_LINK_PEER=$(DPAPP_LINK_PEER) ./disable_veth_ipv6.sh # Delete veth's, test existence to avoid needless use of sudo network-clean: @-([ -e /sys/class/net/veth0 ] && sudo ip link delete dev veth0 && echo "Deleted veth0/1") || echo "No veth0, not deleting" @-([ -e /sys/class/net/veth2 ] && sudo ip link delete dev veth2 && echo "Deleted veth2/3") || echo "No veth2, not deleting" ifeq ($(HAVE_DPAPP),y) - @-([ -e /sys/class/net/$(VPP_LINK) ] && sudo ip link delete dev $(VPP_LINK) \ - && echo "Deleted $(VPP_LINK)") || echo "No $(VPP_LINK), not deleting" + @-([ -e /sys/class/net/$(DPAPP_LINK) ] && sudo ip link delete dev $(DPAPP_LINK) \ + && echo "Deleted $(DPAPP_LINK)") || echo "No $(DPAPP_LINK), not deleting" endif ############################### diff --git a/dash-pipeline/disable_veth_ipv6.sh b/dash-pipeline/disable_veth_ipv6.sh index 4e4ba9d6b..6d88b1349 100755 --- a/dash-pipeline/disable_veth_ipv6.sh +++ b/dash-pipeline/disable_veth_ipv6.sh @@ -21,16 +21,16 @@ sudo sysctl net.ipv6.conf.veth3.accept_ra=0 sudo sysctl net.ipv6.conf.veth3.accept_ra_pinfo=0 sudo sysctl net.ipv6.conf.veth3.router_solicitations=0 -if [ $VPP_LINK ]; then -sudo sysctl net.ipv6.conf.$VPP_LINK.autoconf=0 -sudo sysctl net.ipv6.conf.$VPP_LINK.accept_ra=0 -sudo sysctl net.ipv6.conf.$VPP_LINK.accept_ra_pinfo=0 -sudo sysctl net.ipv6.conf.$VPP_LINK.router_solicitations=0 +if [ $DPAPP_LINK ]; then +sudo sysctl net.ipv6.conf.$DPAPP_LINK.autoconf=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK.accept_ra=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK.accept_ra_pinfo=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK.router_solicitations=0 fi -if [ $VPP_LINK_PEER ]; then -sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.disable_ipv6=1 -sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.autoconf=0 -sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.accept_ra=0 -sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.accept_ra_pinfo=0 -sudo sysctl net.ipv6.conf.$VPP_LINK_PEER.router_solicitations=0 +if [ $DPAPP_LINK_PEER ]; then +sudo sysctl net.ipv6.conf.$DPAPP_LINK_PEER.disable_ipv6=1 +sudo sysctl net.ipv6.conf.$DPAPP_LINK_PEER.autoconf=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK_PEER.accept_ra=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK_PEER.accept_ra_pinfo=0 +sudo sysctl net.ipv6.conf.$DPAPP_LINK_PEER.router_solicitations=0 fi diff --git a/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env b/dash-pipeline/dockerfiles/DOCKER_DPAPP_IMG.env similarity index 58% rename from dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env rename to dash-pipeline/dockerfiles/DOCKER_DPAPP_IMG.env index 4f62cc42c..a36e5dac8 100644 --- a/dash-pipeline/dockerfiles/DOCKER_VPP_IMG.env +++ b/dash-pipeline/dockerfiles/DOCKER_DPAPP_IMG.env @@ -1,5 +1,5 @@ # Define docker image repo/name:tag # Changing this will cause build/publish to occur in CI actions export DASH_ACR_REGISTRY=sonicdash.azurecr.io -export DOCKER_VPP_IMG_NAME?=${DASH_ACR_REGISTRY}/dash-vpp-bldr -export DOCKER_VPP_IMG_CTAG?=240814 +export DOCKER_DPAPP_IMG_NAME?=${DASH_ACR_REGISTRY}/dash-dpapp-bldr +export DOCKER_DPAPP_IMG_CTAG?=240827 diff --git a/dash-pipeline/dockerfiles/Dockerfile.vpp b/dash-pipeline/dockerfiles/Dockerfile.dpapp similarity index 96% rename from dash-pipeline/dockerfiles/Dockerfile.vpp rename to dash-pipeline/dockerfiles/Dockerfile.dpapp index bc4292431..0b90e0485 100644 --- a/dash-pipeline/dockerfiles/Dockerfile.vpp +++ b/dash-pipeline/dockerfiles/Dockerfile.dpapp @@ -1,4 +1,4 @@ -# This Dockerfile builds an image used to compile vpp for dash date-plane app. +# This Dockerfile builds an image used to compile/run dash date-plane app. FROM sonicdash.azurecr.io/dash-grpc:1.43.2 as grpc FROM p4lang/behavioral-model@sha256:ce45720e28a96a50f275c1b511cd84c2558b62f2cf7a7e506765183bc3fb2e32 LABEL maintainer="SONIC-DASH Community" From 0309554514304bce11ac65231ccbbdf182ab4a9d Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Thu, 29 Aug 2024 02:43:52 +0000 Subject: [PATCH 6/6] Not build dpapp by default --- dash-pipeline/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index daf3a7713..40cf83f46 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -11,17 +11,17 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) # "All" type targets for convenience -all:p4 sai dpapp saithrift-server docker-saithrift-client docker-saichallenger-client test +all:p4 sai saithrift-server docker-saithrift-client docker-saichallenger-client test run-all-tests:run-libsai-test run-saithrift-client-tests run-saichallenger-tests run-saithrift-client-tests: run-saithrift-ptftests run-saithrift-pytests run-saithrift-client-dev-tests: run-saithrift-dev-ptftests run-saithrift-dev-pytests .PHONY:clean -clean: kill-all p4-clean sai-clean dpapp-clean test-clean network-clean saithrift-server-clean +clean: kill-all p4-clean sai-clean test-clean network-clean saithrift-server-clean rm -rf $(P4_OUTDIR) -kill-all: kill-saithrift-server kill-dpapp kill-switch undeploy-ixiac kill-saichallenger-client +kill-all: kill-saithrift-server kill-switch undeploy-ixiac kill-saichallenger-client PWD := $(realpath $(mkfile_dir)) DASH_USER ?=dashuser