Skip to content

Commit

Permalink
saithrift client & server integration with DASH bmv2 (Fix #131,158) (#…
Browse files Browse the repository at this point in the history
…164)

* Build sai-thrift server (not working yet). New dockerfile.

* Removed extraneous step.

* README

* Move Dockerfile under dockerfiles/

* Pass flags to saithrift-build, expecting opencomputeproject/SAI#1514 to merge eventually. Meanwhile can locally modify SAI makefiles.

* Fix CI files for new location of Docekrfile.bmv2, add CI for dash-saithrift docker.

* Fix CI workflow for new dockerfiles.

* Add line to trigger CI.

* Restore CI filename, try to get it to trigger.

* Rename CI file; modify DOckerfile to trigger; add docker targets to Makefile.

* Modify dockerfiles to trigger CI.

* Fix make target names in CI and Makefile

* Update CI to trigger on CI file changes itself.

* Trigger on CI file change.

* Remove thrift source from dash-saithrift-bldr docker image. New tag 220625.

* Enhance saithrift docker to handle dash sai header generation and libsai compilation.

* Remove thrift source and source tarball from docker image; copy python dist tarball to /usr/lib inside container so can be extracted for deployment to a host.

* Experimenting with reduced Dockerfiles.

* Makefile: p4 source dependencies. dash_pipeline.p4: egress_spec=ingress_spec, comments.

* Fix stray merge conflict.

* Fix merge conflict in CI file.

* Optimized docker build and run images by creating a dedicated gRPC library image and selectively copying to BMV2 builder/runtime image based on available p4lang docker image.

* FIx CI, Makefile for new docker images.

* Optimize dockerfiles, reduced to 3 images totalling ~2.7G, down from ~10G.

* Fix CI files, add Make targets; cleanup.

* CI files, badge

* CI files.

* Split up READMEs into smaller files. Diagram.

* READMEs, diagram, SHA version of p4c

* Add missing CI workflow (p4c); update main CI workflow to trigger on any dockerfile change.

* Fix make command in CI file.

* Pin the SHA version of p4lang/behavioral-model:latest.

* Ping SHA versions of Ubuntu used in base images.

* READMEs - workflows etc.

* README typos, clarifications.

* README

* Use dev fork of SAI which passes flags to gensairpc.pl per opencomputeproject/SAI#1514.
Once merged, we can change back to upstream branch of SAI.

* Use fork of SAI with fixes for sairpcgen Make flags, and sairpcgen templates which add static_cast to avoid type mismatches due to sai extensions.

* Add placeholder code for SAI fixed functions, -fpermissive to avoid enum Long error. TODO: P4RT libs missing, otherwise sai-thrift server builds.

* Progress on sai-thrift server, final saiserver linkage still has errors but was able to pass grpc/proto/pi libs into make.

* Created init_switch test program and make target to initialize bmv2 model (P4RUntime SetForwardingPipelineRequest) to allow explicit switch intialization via P4Runtime. Removed sudo from most Make commands. READMEs.

* Remove dependency to avoid rebuilding files while running test in CI. Delete stray file.

* README

* Build saithrift-bldr in Ubuntu-20.04 to avoid glibcc conflicts wth libgrpc etc. Modify sai-thrift Maefile to accomodate Python3 vs Python2.
TODO - saiserver builds but get errors in later stages of make saithrift-build target (ctypesgen...)

* Can build and run saithrift server. Fixed makefiles to call SAI makes with proper env vars etc., fixed install steps.

* Add sai-thrift-server to CI job.

* saithrift server starts up properly - added volume mounts to p4info

* Add DOCKER_FLAGS for sai targets

* Add sai-thrift-server CI test.

* Workaround for git repo ownership in CI.

* Correct trigger path for CI.

* Workaround for SAI submodule - fixed step name.

* Change dir into SAI/SAI to make safe directory

* Try safe directory from /dash

* Remove -u root from CI flags, remove git safe directory.

* ove lib dir creation to Makefile, remove from .pyu script - permission errors during CI.

* Add back -privileged flag

* ADd -u root to make sai in CI

* Change CI docker flags, use sudo for python script to overcome perms.

* Update SAI branch which fixes sairpcgen Makefiles (sai header include path).

* Remove experimental sudo from bash script, clean up overwrite options from python script (leave such things to makefiles.) Still struggling with perms issues in CI script.

* Try sudo in CI make sai step.

* Try -u root in CI file and git config --global --add safe.directory in Makefile

* Use "git config --global --add safe.directory /dash/dash-pipeline/SAI/SAI" per error message, even though it doesn't match actual path IMO.

* Try git config --global --add safe.directory '*' in Makefile.

* Temporarily skip make sai step, see if rest of pipeline runs.

* REstore CI script, try sudo workarounds in Makefile.

* fix chmod command

* Remove -u root, use sudo calling python script.

* fix chmod to a+rw and also commit bash script.

* chown and git safe dirs script attempt

* pass user to sudo

* export user

* FIx chown

* More wrappers and scripts to solve CI git ownership issues.

* REmove chown to try to fix "./checkenumlock.sh ...fatal: Unable to create '/dash/.git/modules/SAI/index.lock': Permission denied

* remove git safe dirs, getting lockfile error in CI

* REmove sudo calling python script; shotgun sudo for all CI steps.

* REstore sudo for py script; add -u root, --privileged to flags in CI

* Workaround, delete scripts in SAI/meta/Makefile which throw Git permission errors.

* Add sudo for sai-thrift-server target due to -u roots above. Got past git repo errors via previous commit, yay!

* Use sudo to avoid permissions problem in CI pipeline for SAI/rpc dir

* chown in sai-thrift Makefile to overcome CI perms issues.

* Change perms instead of chown in saithrift build.

* Add missing DOCKER_FLAGS to sai-thrift-server target

* Add DOCKER_FLAGS to CI step; remove obsolete wrapper scripts.

* Pass DOCKER_FLAGS to make target for sai-thrift-server test

* Use different SAI submodule branch (better name, synced to master). Add saithrift clean target to clean.

* Remove extraneous permissions workarounds.

* Update SAI submodule.

* Dockerfile for saithrift test clients.

* ADd CI for saithrift client docker

* Add prerequisite builds steps for sai-thrift-client. Update drawing.

* Build prerequisites first to make docker-saithrift-client

* Add missing requirements.txt, make targets.

* Progress with saithrift-client docker image, pytest, ptf test installation and skeletons.

* Refactor pytest to use common theift Client class; run sai client tests in CI. NOte - need sai_api_query impl to avoid sai thrift server crashes.

* Set docker flags for saithrift client test in CI

* Docs, diagrams. saithrift workflows.

* Use updated SAI dev branch to insert checks for NULL sai API funcs before calling them. Add simple test for switch attribute to prove thrift API working.

* Hand-modified sai_api_query to return SAI_API_DASH_VNET apis. Should be auto-generated.

* Use workaround for saithrift builder per opencomputeproject/SAI#1537. Reorganize nacent pytests to use fixtures to get saithrift client, put in directories, add custom markers, new README.

* mark vnet test x-fail for CI

* Update saithrift client docker image.

* Add empty README for saithrift/ptf

* Clean up make targets.

* Permissions fixes (manually, not merged). Add gdb to sai-thrift-server docker.

* Fix sai-thrift-server; got first RPC working (vnet). Slight refactoring of pytests (imports); fixed sai_api_query & made _impl structs non-static.

* Fix path for sai-thrift-server according to new -w path in Makefile

* Add CI triggers for all .py, .sh, .yml and requirements.txt. under test/ dir

* Update to snappi-0.7.38 for fix #153

* Temporary workaround for container permissions issues per #143. Executes chmod as required. Permanent fix will require some Docker mods.

* Update snappi to 0.7.38 in saithrift tests

* FIx dangling merge conflicts in README.

* s/sai-thrift/saithrift to for consistency.

* Delete sai_test which was accidentally copied from SAI repo.

* Fix #158 - libsai delete operation failure and log msg. THe test for error code was backwards and log message used same write updateType string for all operations. I fixed the compare and used a dynamic enum print method.

* Modify vnet pytest case to create/delete. README. Makefile polishing.

* Add more table create/deletes + cleanup to saithrift vnet test case

* Assign container names in ixia-c deployments (append username)

* Got preliminary PTF and Pytests including saithrift table accessors, packet echo tests. Removed ixia-c test as standalone test; now it runs as a pytest inside saithrift-client container so host tool installs are reduced (snappi, python, pip).

* Add back missing line to build saithrift server.

* Fix CI trigger, a prior merge messed this up.

* Add deploy-ixiac to Makefile deps and CI steps to support pytests.

* Refactor saithrift-client docker image into builder and runtime images; runtime client is always built locally, not pulled.
Change python requirements to hardlink to DASH/test/requirements.txt. Change DOckerfile name for consistency.

* Create tests/libsai dir and move "C++" tests there; fix typo in CI file.

* Defer deploying ixia-c until PTF tests complete to see if CI tests fail less often, suspect CI runner limits are being strained. Tests fail sometimes w/o reason.

* Moved saithrift tests under tests/ for consistency.

* FIx path, paste errors which run tests.

* Move requirements.txt to hardlink under tests (was under saithrift). Delete obs file.

* READMEs (saithrift test framework), Makefile (fix dev tests).

* READMEs - test workflows.

* Fix paste error - README

* READMEs - workflows. Diagram. Remove "make run-test," replaced by "make libsai-test."

* Fix CI action; READMEs polish.

* Minor README improvements; fix URL, diagrams (sirius->dash); improve Quick-start instructions.

* Add back URL.

* REmove python, pip install deps.

* READMEs; move saithrift test scripts into subdirs; change verify_packets() to verify_packet() to avoid failing due to junk entering veths from host network.

* Change CI job title Sirius->DASH

* Update SAI submodule to rescind changes to SAI include paths for sairpcgen, wasn't needed after all.

Co-authored-by: Chris Sommers <[email protected]>
  • Loading branch information
chrispsommers and chrispsommers authored Aug 2, 2022
1 parent eddbc03 commit 263ef61
Show file tree
Hide file tree
Showing 62 changed files with 1,956 additions and 421 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/dash-bmv2-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ "**" ]
paths:
- '.github/workflows/dash-ci.yml'
- '.github/workflows/dash-bmv2-ci.yml'
- 'test/**.py'
- 'test/**requirements.txt'
- 'test/**.sh'
Expand All @@ -19,7 +19,7 @@ on:
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/dash-ci.yml'
- '.github/workflows/dash-bmv2-ci.yml'
- 'test/**.py'
- 'test/**requirements.txt'
- 'test/**.sh'
Expand All @@ -35,7 +35,7 @@ on:

jobs:
build:
name: Build and Test Sirius Pipeline
name: Build and Test DASH Pipeline
runs-on: ubuntu-20.04
env:
docker_fg_flags: -u root --privileged
Expand All @@ -46,25 +46,35 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Pull docker p4c image
run: make docker-pull-dash-p4c
run: make docker-pull-dash-p4c
- name: Build P4 software switch (bmv2) and P4Info
run: DOCKER_FLAGS=$docker_fg_flags make p4
run: DOCKER_FLAGS=$docker_fg_flags make p4
- name: Install SAI submodule
run: git submodule update --init
run: git submodule update --init
- name: Pull docker saithrift-bldr image
run: make docker-pull-saithrift-bldr
run: make docker-pull-saithrift-bldr
- name: Generate SAI API
run: DOCKER_FLAGS=$docker_fg_flags make sai
run: DOCKER_FLAGS=$docker_fg_flags make sai
- name: Generate saithrift-server
run: DOCKER_FLAGS=$docker_fg_flags make saithrift-server
- name: Generate saithrift-client local docker
run: DOCKER_FLAGS=$docker_fg_flags make docker-saithrift-client
- name: Pull docker bmv2-bldr image
run: make docker-pull-bmv2-bldr
run: make docker-pull-bmv2-bldr
- name: Build libsai c++ tests
run: DOCKER_FLAGS=$docker_fg_flags make test
run: DOCKER_FLAGS=$docker_fg_flags make test
- name: Prepare network
run: DOCKER_FLAGS=$docker_fg_flags make network
run: DOCKER_FLAGS=$docker_fg_flags make network
- name: Run P4 software switch (bmv2) with P4Runtime
run: DOCKER_FLAGS=$docker_bg_flags make run-switch
- name: Test SAI library
run: DOCKER_FLAGS=$docker_fg_flags make run-test
- name: Ixia-c Traffic Generator test
run: make run-ixiac-test
run: DOCKER_FLAGS=$docker_bg_flags make run-switch
- name: Test SAI library over P4RT to switch
run: DOCKER_FLAGS=$docker_fg_flags make run-libsai-test
- name: Run saithrift server
run: DOCKER_FLAGS=$docker_bg_flags make run-saithrift-server
- name: Run PTF Tests
run: DOCKER_FLAGS=$docker_fg_flags make run-saithrift-ptftests
- name: Deploy ixia-c Traffic Generator
run: DOCKER_FLAGS=$docker_fg_flags make deploy-ixiac
- name: Run Pytests
run: DOCKER_FLAGS=$docker_fg_flags make run-saithrift-pytests

50 changes: 50 additions & 0 deletions .github/workflows/dash-saithrift-client-bldr-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: DASH-docker-saithrift-client-bldr-image

on:
push:
branches: [ "**" ]
paths:
- '.github/workflows/dash-saithrift-client-bldr-docker.yml'
- '.github/workflows/dash-saithrift-client-bldr-docker.yml'
- 'dash-pipeline/Makefile'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client-bldr'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/dash-saithrift-client-bldr-docker.yml'
- 'dash-pipeline/Makefile'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client-bldr'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
workflow_dispatch:

jobs:
build:
name: Build dash-saithrift-client-bldr-image
runs-on: ubuntu-20.04
env:
docker_fg_flags: -u root --privileged
docker_bg_flags: -d -u root --privileged
defaults:
run:
working-directory: ./dash-pipeline
steps:
- uses: actions/checkout@v3
- name: Pull docker p4c image
run: make docker-pull-dash-p4c
- name: Build P4 software switch (bmv2) and P4Info
run: DOCKER_FLAGS=$docker_fg_flags make p4
- name: Install SAI submodule
run: git submodule update --init
- name: Build docker saithrift-bldr image
run: make docker-saithrift-bldr
- name: Generate SAI API
run: DOCKER_FLAGS=$docker_fg_flags make sai
- name: Generate SAI-Thrift client and server code and libs
run: DOCKER_FLAGS=$docker_fg_flags make saithrift-server
- name: Build saithrift client docker image
run: DOCKER_FLAGS=$docker_fg_flags make docker-saithrift-client-bldr
51 changes: 51 additions & 0 deletions .github/workflows/dash-saithrift-client-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: DASH-docker-saithrift-client-image

on:
push:
branches: [ "**" ]
paths:
- '.github/workflows/dash-saithrift-client-docker.yml'
- 'dash-pipeline/Makefile'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/dash-saithrift-client-docker.yml'
- 'dash-pipeline/Makefile'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client-bldr'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-client'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
workflow_dispatch:

jobs:
build:
name: Build dash-saithrift-client-image
runs-on: ubuntu-20.04
env:
docker_fg_flags: -u root --privileged
docker_bg_flags: -d -u root --privileged
defaults:
run:
working-directory: ./dash-pipeline
steps:
- uses: actions/checkout@v3
- name: Pull docker p4c image
run: make docker-pull-dash-p4c
- name: Build P4 software switch (bmv2) and P4Info
run: DOCKER_FLAGS=$docker_fg_flags make p4
- name: Install SAI submodule
run: git submodule update --init
- name: Build docker saithrift-bldr image
run: make docker-saithrift-bldr
- name: Generate SAI API
run: DOCKER_FLAGS=$docker_fg_flags make sai
- name: Generate SAI-Thrift client and server code and libs
run: DOCKER_FLAGS=$docker_fg_flags make saithrift-server
- name: Build saithrift client docker image
run: DOCKER_FLAGS=$docker_fg_flags make docker-saithrift-client
8 changes: 4 additions & 4 deletions .github/workflows/dash-saithrift-docker.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: DASH-docker-saithrift-build-image
name: DASH-docker-saithrift-bldr-build-image

on:
push:
branches: [ "**" ]
paths:
- '.github/workflows/dash-saithrift-docker.yml'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/dash-saithrift-docker.yml'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift'
- 'dash-pipeline/dockerfiles/Dockerfile.saithrift-bldr'
- 'dash-pipeline/.dockerignore'
- 'dash-pipeline/dockerfiles/.dockerignore'
workflow_dispatch:

jobs:
build:
name: Build docker dash-saithrift image
name: Build docker dash-saithrift-bldr image
runs-on: ubuntu-20.04
defaults:
run:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*.bkp
*.log
*.pcap
__pycache__/
.pytest_cache/
dash-pipeline/bmv2/dash_pipeline.bmv2/
dash-pipeline/SAI/lib/
dash-pipeline/SAI/lib/
dash-pipeline/SAI/rpc/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "SAI"]
path = dash-pipeline/SAI/SAI
url = https://github.com/chrispsommers/SAI.git
branch = add-gensairpc-flags
branch = saithriftv2-check-null-sai-apis
18 changes: 9 additions & 9 deletions assets/CI-badge-failing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions assets/CI-badge-passing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/scapy-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion dash-pipeline/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*
*.bkp
*.log
*.pcap
__pycache__/
.pytest_cache/
Loading

0 comments on commit 263ef61

Please sign in to comment.