[VOL-5054] - Triage build for voltha-openolt-adapter

cmd/*.go
internal/pkg/*.go
pkg/mocks/*.go
=================
  o Run gofmt -w -s on all non-(vendor/) golang sources (~make lint).
  o Release triage jobs have been failing on unrelated source problems.

config.mk
makefiles/docker/
makefiles/etc/
makefiles/targets/
makefiles/virtualenv.mk
=======================
  o https://github.com/opencord/onf-make.git
  o Copy in library makefiles, esp docker/include.mk

Makefile
========
  o Refactor and replace inline GO= and docker macros with docker/include.
  o Added manual flag LOCAL_FIX_PERMS=1 to grant docker image write access.
  o Target: mod-update
    - Split logic into targets mod-tidy and mod-vendor.
    - Display a banner when target runs for readability.
    - Target lint-mod now calls mod-update VS inlining make mod tidy & vendor
  o Target: test
    - Split logic into 3 distinct targets now that stdout/stderr handled.
    - Improve error handling, fail early VS accumulating status then exit
    - Display a banner when targets process for log readability.
    - Define macros for *.out and *.xml to avoid repeating logfile paths.

Change-Id: Ia2eb999f6176ce2eb46e41f55aee74c05b5a4cd2
37 files changed
tree: 9bbf5b19d486200733ab5437add5876825bd8929
  1. .gitignore
  2. .gitreview
  3. .golangci.yml
  4. CODE_OF_CONDUCT.md
  5. Makefile
  6. README.md
  7. VERSION
  8. cmd/
  9. compose/
  10. config.mk
  11. docker/
  12. go.mod
  13. go.sum
  14. internal/
  15. makefiles/
  16. pkg/
  17. vendor/
README.md

OpenOLT adapter

The OpenOLT adapter connects the VOLTHA core to an OLT device running the OpenOLT agent.

Development make targets

The Makefile contains many commands that are useful in development:

% make help

build                     : Alias for 'docker build'
clean                     : Removes any local filesystem artifacts generated by a build
distclean                 : Removes any local filesystem artifacts generated by a build or test run
docker-build-profile      : Build openolt adapter docker image with profiling enabled
docker-build              : Build openolt adapter docker image
docker-kind-load          : Load docker images into a KinD cluster
docker-push               : Push the docker images to an external repository
help                      : Print help for each Makefile target
lint-dockerfile           : Perform static analysis on Dockerfile
lint-mod                  : Verify the Go dependencies
lint                      : Run all lint targets
local-lib-go              : Copies a local version of the voltha-lib-go dependency into the vendor directory
local-protos              : Copies a local version of the voltha-protos dependency into the vendor directory
mod-update                : Update go mod files
sca                       : Runs static code analysis with the golangci-lint tool
test                      : Run unit tests

Some highlights:

  • It's recommended that you run the lint, sca, and test targets before submitting code changes.

  • The docker-* targets for building and pushing Docker images depend on the variables DOCKER_REGISTRY, DOCKER_REPOSITORY, and DOCKER_TAG as described in the CORD documentation

  • If you make changes the dependencies in the go.mod file, you will need to run make mod-update to update the go.sum and vendor directory.

Building with a Local Copy of voltha-protos or voltha-lib-go

If you want to build/test using a local copy of the voltha-protos or voltha-lib-go libraries this can be accomplished by using the environment variables LOCAL_PROTOS and LOCAL_LIB_GO. These environment variables should be set to the filesystem path where the local source is located, e.g.:

export LOCAL_PROTOS=/path/to/voltha-protos
export LOCAL_LIB_GO=/path/to/voltha-lib-go

Then run make local-protos and/or make local-lib-go as is appropriate to copy them into the vendor directory.

NOTE: That the files in the vendor directory are no longer what is in the most recent commit, and it will take manual git intervention to put the original files back.