Skip to content

Latest commit

 

History

History
88 lines (65 loc) · 2.77 KB

developer-guide.md

File metadata and controls

88 lines (65 loc) · 2.77 KB

Developer guide

New Features or Improvements to the BESS pipeline

The BESS source used by UPF is part of this repository under bess/. Make BESS pipeline changes in that directory and submit them through the UPF review and CI process.

The root Dockerfile compiles the source in bess/ and produces the upf-bess image. It is no longer necessary to clone BESS separately and build a standalone bess_build image.

Build both UPF images with the default architecture selection:

CPU=native make docker-build

To build only the BESS-based datapath image, or to select a deployment CPU architecture, use DOCKER_TARGETS and CPU:

DOCKER_TARGETS=bess CPU=haswell make docker-build
DOCKER_TARGETS=bess CPU=ivybridge make docker-build

The default CPU=native is intended for development. Select a named CPU only when the target deployment requires it.

For changes that affect BESS protobuf definitions, regenerate both consumers:

make pb
make py-pb

make pb writes the Go bindings in pfcpiface/bess_pb, which are committed. It uses the pinned protoc, protoc-gen-go and protoc-gen-go-grpc versions in the protoc-go and protoc-gen stages of the Dockerfile, and only needs the .proto files, so it doesn't build BESS. Commit its output unchanged: golangci-lint and the pre-commit hooks leave *.pb.go files alone, and CI fails if the committed bindings differ from what make pb produces. After changing a pinned version, run make pb and commit the result. make py-pb writes the Python bindings that the PTF tests use into ptf/lib; they aren't committed.

Run the UPF test suites as appropriate:

make test
make test-integration

UPF CI runs the BESS source build, BESS tests, and BESS formatting checks when files under bess/ change.

Testing local Go dependencies

The upf repository relies on some external Go dependencies, which are not mature yet (e.g. pfcpsim). It's often needed to extend those dependencies first, before adding a new feature to the PFCP Agent. However, when using Go modules and containerized environment, it's hard to test work-in-progress (WIP) changes to local dependencies. Therefore, this repository comes up with a way to use Go vendoring, instead of Go modules, for development purposes.

To use a local Go dependency add the replace directive to go.mod. An example:

replace github.com/omec-project/pfcpsim v1.3.1 => ../pfcpsim

Then, to build the Docker image using the local dependency:

DOCKER_BUILD_ARGS="--build-arg GOFLAGS=-mod=vendor" make docker-build

To run E2E integration tests with the local dependency:

DOCKER_BUILD_ARGS="--build-arg GOFLAGS=-mod=vendor" make test-integration