This commit consists of:
1) Dockerizing the netconf server
2) Update proto2yang to support module imports
3) Provide a set of yang modules derived from the proto files in voltha.
These files as well as the slight mmodifications to the proto files are
provided in the experiments/netconf/proto2yang directory
4) Code to automatically pull proto files from voltha into the netconf server,
compiles them and produce the yang equivalent files.
5) Add a getvoltha netconf API to provide voltha state information (basic at
this time). There is potential to make this generic once we experiment
with additional APIs
Change-Id: I94f3a1f871b8025ad675d5f9b9b626d1be8b8d36
diff --git a/netconf/protos/Makefile b/netconf/protos/Makefile
index 2d9c069..008a531 100644
--- a/netconf/protos/Makefile
+++ b/netconf/protos/Makefile
@@ -20,14 +20,12 @@
$(error To get started, please source the env.sh file from Voltha top level directory)
endif
-# This makefile is used only to copy relevant *_pb2.py files from Voltha
-# to allow ofagent to function properly.
+default: build
PB2_FILES := \
- voltha_pb2.py \
- openflow_13_pb2.py
+ voltha_pb2.py
-TARGET_PROTO_DIR := $(VOLTHA_BASE)/ofagent/protos
+TARGET_PROTO_DIR := $(VOLTHA_BASE)/netconf/protos
SOURCE_PROTO_DIR := $(VOLTHA_BASE)/voltha/protos
build: copyfiles
@@ -35,3 +33,25 @@
copyfiles:
rsync -av --include '*/' --exclude='third_party/__init__.py' --include '*.py' --exclude='*' $(SOURCE_PROTO_DIR)/ $(TARGET_PROTO_DIR)
+
+PROTO_FILES := $(wildcard *.proto) $(wildcard third_party/google/api/*proto)
+PROTO_PB2_FILES := $(foreach f,$(PROTO_FILES),$(subst .proto,_pb2.py,$(f)))
+PROTO_DESC_FILES := $(foreach f,$(PROTO_FILES),$(subst .proto,.desc,$(f)))
+
+PROTOC_PREFIX := /usr/local
+PROTOC_LIBDIR := $(PROTOC_PREFIX)/lib
+
+build: $(PROTO_PB2_FILES)
+
+%_pb2.py: %.proto Makefile
+ @echo "Building protocol buffer artifacts from $<"
+ env LD_LIBRARY_PATH=$(PROTOC_LIBDIR) python -m grpc.tools.protoc \
+ -I. \
+ -I./third_party \
+ --python_out=. \
+ --grpc_python_out=. \
+ $<
+
+clean:
+ rm -f $(PROTO_PB2_FILES) $(PROTO_DESC_FILES)
+