commit | ad7456523decde24e81d283286ad97ed2f1d94d0 | [log] [tgz] |
---|---|---|
author | William Kurkian <wkurkian@cisco.com> | Wed Mar 20 08:45:51 2019 -0400 |
committer | William Kurkian <wkurkian@cisco.com> | Thu Mar 21 09:59:47 2019 -0400 |
tree | 635ad5f1cbd17864698c61aa8a96dc8afbce8d4c | |
parent | 4604c420350ad23077667455bf42e2eaa14ac5c4 [diff] |
VOL-1460 Implemented a new approach to protos where go stubs are not committed to the repo. There are new instructions for clients consuming these protos in Go. Also removed vendor directory and dep, as it isn't really needed at this point. Implemented a test to check if protos match up with go files. This is run with make test. This works by generating them and checking this created any more untracked or unstaged changes. It requires you to commit your changes locally to pass. This process to should be run by jenkins to validate a commit. A consistent version of protoc must be used, which the Makefile checks for. Change-Id: I8de28c515a9535e33909cbbd158fa046f96f3b1f
Protobuf files used by VOLTHA.
Currently this is used to generate both go and python.
Protobuf definition files are located in protos/voltha_protos
directory. This directory heirarchy and import scheme is required to allow the python code generated by the GRPC compiler to have the correct import paths.
NOTE: The
protos/google/api
directory has files copied from the Google APIs, and is only included for initial compilation of the VOLTHA protobuf files - these API's should be installed independently via either the python googleapis-common-protos package or the golang go-genproto repo.
Get the Voltha-protos repository:
git clone https://gerrit.opencord.org/voltha-protos cd voltha-protos
After installing Go on the MAC, the GOPATH environment variable should be set to ~/go. Create a symbolic link in the $GOPATH/src tree to the voltha-go repository:
mkdir $GOPATH/src/github.com/opencord ln -s ~/repos/voltha-protos $GOPATH/src/github.com/opencord/voltha-protos
cd $GOPATH/src/github.com/opencord/voltha-protos go get github.com/golang/protobuf/ cd $GOPATH/github.com/golang/protobuf git checkout v1.3.1
cd ~/repos/voltha-protos/ make build
use dist/*.tar.gz for local python imports use go/ for local go imports
Installation: pip install voltha-protos
Use: from voltha_protos import voltha_pb2
go get github.com/opencord/voltha-protos cd $GOPATH/github.com/opencord/voltha-protos make build
protos should be importable from github.com/opencord/voltha-protos/go/packagename
To use the libraries, import protos with the root path github.com/opencord/voltha-protos/go/
make test
will run tests for all languages.