commit | f98ca1386c16a1c767dc8642cae9d1bdae8ec43a | [log] [tgz] |
---|---|---|
author | Devmalya Paul <Devmalya.Paul@radisys.com> | Tue Jul 09 06:14:19 2019 -0400 |
committer | Devmalya Paul <Devmalya.Paul@radisys.com> | Thu Jul 11 02:33:07 2019 -0400 |
tree | ab0d2ec9272915f5ee6797a7d9fb53ebf36eba09 | |
parent | 1b65c91b0e9c3e99ecfb9b182e5b43abeb38b4a2 [diff] |
VOL-1537 : Create the Alarm Framework in golang openolt adapter events.proto file have been updated to support the use of generic event format instead of separate alarms and KPIs for use in the openOLT adapter. This change also retains the old alarm defination which is beign used in python based OpenOLT adapter in VOLTHA 2.X This change needs to be merged first as this is a dependency for the golang OpenOLT adapter to build successfully. Change-Id: Iabd7dc17b65d56cfd4cd19c87fde4596719c6672
Protobuf files used by VOLTHA.
Currently this is used to generate both Golang and Python protobufs and gRPC stubs.
The testing process is dependent on specific versions of the protobuf tools, so make sure to use the versions of protoc
and protoc-gen-go
specified below.
Protobuf definition files are located in protos/voltha_protos
directory. This directory hierarchy 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:
mkdir -p ~/source cd ~/source git clone https://gerrit.opencord.org/voltha-protos cd voltha-protos
After installing Go on a Mac or Linux environment, the GOPATH environment variable needs be set. These instructions assume it's ~/go
.
Create a symbolic link in the $GOPATH/src tree to the voltha-go repository:
mkdir -p $GOPATH/src/github.com/opencord ln -s ~/source/voltha-protos $GOPATH/src/github.com/opencord/voltha-protos
Checkout and go install correct version of protoc-gen-go:
GIT_TAG="v1.3.1" go get -d -u github.com/golang/protobuf/protoc-gen-go git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG go install github.com/golang/protobuf/protoc-gen-go
Install the protobuf compiler (protoc) 3.7.0 either manually or via the Makefile target (if on Linux amd64). Then build the python and golang stubs:
cd $GOPATH/src/github.com/opencord/voltha-protos make install-protoc make build
use dist/*.tar.gz for local python imports use go/ for local go imports
Installation from Pypi:
pip install voltha-protos
or from a local build:
pip install ~/source/voltha-protos/dist/*.tar.gz
To use it within your code (for example)
from voltha_protos import voltha_pb2
go get github.com/opencord/voltha-protos cd $GOPATH/github.com/opencord/voltha-protos make build
Protos are 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.