Skip to content

Commit

Permalink
Temporary workaround for container permissions issues per sonic-net#143
Browse files Browse the repository at this point in the history
…. Executes chmod as required. Permanent fix will require some Docker mods.
  • Loading branch information
chrispsommers committed Jul 20, 2022
1 parent 6fb9728 commit ad1c0ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
25 changes: 15 additions & 10 deletions dash-pipeline/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
SHELL = /bin/bash

all:p4 sai test
all:fix-perms p4 sai test

PWD := $(shell pwd)

.PHONY: fix-perms
fix-perms:
@echo "### Applying Fix permissions workaround..."
sudo chmod -R o+rw SAI/ bmv2/ tests/

# Default Docker images, override from env var
# https://hub.docker.com/r/p4lang/p4c
# p4lang version 971MB - works:
Expand Down Expand Up @@ -42,7 +47,7 @@ SAI/SAI:


.PHONY:clean
clean: kill-switch p4-clean sai-clean test-clean network-clean undeploy-ixiac
clean: fix-perms kill-switch p4-clean sai-clean test-clean network-clean undeploy-ixiac
rm -rf bmv2/dash_pipeline.bmv2
make -C tests/vnet_out clean

Expand All @@ -52,7 +57,7 @@ clean: kill-switch p4-clean sai-clean test-clean network-clean undeploy-ixiac

P4_ARTIFACTS=bmv2/dash_pipeline.bmv2/dash_pipeline.json bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt

p4: bmv2/dash_pipeline.bmv2/dash_pipeline.json
p4: fix-perms bmv2/dash_pipeline.bmv2/dash_pipeline.json

.PHONY:p4-clean
p4-clean:
Expand Down Expand Up @@ -89,27 +94,27 @@ $(P4_ARTIFACTS): $(P4_SRC)
# TODO - create separate rules for headers, libsai.so
.PHONY:sai

sai:sai-headers libsai
sai:fix-perms sai-headers libsai

sai-headers: p4 | SAI/SAI
sai-headers: fix-perms p4 | SAI/SAI
@echo "Generate SAI library headers and implementation..."
$(DOCKER_RUN) \
--name build_sai-$(USER) \
-w /SAI $(DOCKER_SAITHRIFT_BLDR_IMG) \
./generate_dash_api.sh

# TODO - add SAI header dependencies
libsai:
libsai: fix-perms
@echo "build libsai.so..."
$(DOCKER_RUN) -w /SAI/lib \
$(DOCKER_BMV2_BLDR_IMG) \
make

libsai-clean:
libsai-clean:fix-perms
-rm -rf SAI/lib/libsai.so

.PHONY:sai-clean
sai-clean: SAI/SAI libsai-clean
sai-clean: fix-perms SAI/SAI libsai-clean
@echo "Restoring SAI subdirectories to baseline..."
rm -rf SAI/SAI/inc SAI/SAI/experimental SAI/SAI/meta
cd SAI/SAI && git checkout -- inc experimental meta
Expand Down Expand Up @@ -149,7 +154,7 @@ DOCKER_RUN_SAITHRIFT =\
-v $(PWD)/..:/dash -w /dash/dash-pipeline/SAI/saithrift \
$(DOCKER_SAITHRIFT_BLDR_IMG) \

sai-thrift-server:
sai-thrift-server:fix-perms
$(DOCKER_RUN_SAITHRIFT) \
make $@

Expand Down Expand Up @@ -180,7 +185,7 @@ test-clean:


.PHONY:sai-test
sai-test:SAI/SAI SAI/lib/libsai.so
sai-test: fix-perms SAI/SAI SAI/lib/libsai.so
$(DOCKER_RUN) \
--name dash-build-test-$(USER) \
-w /tests $(DOCKER_BMV2_BLDR_IMG) \
Expand Down
11 changes: 11 additions & 0 deletions dash-pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ This is a P4 model of the DASH overlay pipeline which uses the [bmv2](https://gi
- [Install docker-compose](#install-docker-compose)

# Known Issues
<<<<<<< HEAD
* P4 code doesn't loop packets back to same port.
* P4 code mark-to-drop not set when meta.drop is set.
=======
* The vnet_out test via `make run-test` needs to be run to allow `run-ixiac-test` to pass.
* Prebuilt Docker image is too large , see [Desired Optimizations](#desired-optimizations).
* Docker images have permissions and ownership issues, see https://github.com/Azure/DASH/issues/143. Use `make fix-perms` as temporary workaround.

>>>>>>> 5928f61... Temporary workaround for container permissions issues per https://github.com/Azure/DASH/issues/143. Executes chmod as required. Permanent fix will require some Docker mods.
# TODOs
## Loose Ends
Small items to complete given the exsting features and state, e.g. excluing major roadmap items.
Expand Down Expand Up @@ -80,7 +87,11 @@ Eager to see it work? Try this:

In one terminal:
```
<<<<<<< HEAD
make clean all run-switch
=======
make clean && make all network run-switch
>>>>>>> 5928f61... Temporary workaround for container permissions issues per https://github.com/Azure/DASH/issues/143. Executes chmod as required. Permanent fix will require some Docker mods.
```
In another terminal:
```
Expand Down

0 comments on commit ad1c0ae

Please sign in to comment.