VOL-1500 VOL-1475 Updated the remaining python containers in voltha-go to use pyvoltha and voltha-protos

Changed the build system to have separate flags for local pyvoltha and local protos.
Cleared out now unneeded python libraries and protos from voltha-go

PonSim was tested by launching the system-test-ponsim.yml and making sure the ponsim enables.
This was tested on docker-compose and k8s.
Let me know if there are other cases to test.

Change-Id: Ie2d5a19900fcfc93b96aba2981efb18fd9e649bb
diff --git a/python/Makefile b/python/Makefile
index d7c4a1b..4fa911e 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -55,12 +55,14 @@
 	 --rm --force-rm \
 	$(DOCKER_BUILD_EXTRA_ARGS)
 
+DOCKER_BUILD_EXTRA_ARGS = \
+	--build-arg LOCAL_PYVOLTHA=${LOCAL_PYVOLTHA} \
+	--build-arg LOCAL_PROTOS=${LOCAL_PROTOS}
+
 VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]')
 
 DOCKER_IMAGE_LIST = \
 	base \
-	protoc \
-	protos \
 	adapter-ponsim-olt \
 	adapter-ponsim-onu
 
@@ -101,8 +103,6 @@
 	@echo "distclean    : Remove venv directory"
 	@echo "fetch        : Pre-fetch artifacts for subsequent local builds"
 	@echo "help         : Print this help"
-	@echo "protoc       : Build a container with protoc installed"
-	@echo "protos       : Compile all grpc/protobuf files"
 	@echo "rebuild-venv : Rebuild local Python virtualenv from scratch"
 	@echo "venv         : Build local Python virtualenv if did not exist yet"
 	@echo "containers   : Build all the docker containers"
@@ -142,20 +142,22 @@
 	@echo "    FLAKE8 $(basename $@)"
 	-$(Q)$(MAKE) -C $(basename $@) flake8
 
-build: protoc protos containers
+build: containers
 
 containers: base adapter_ponsim_olt adapter_ponsim_onu ofagent cli
 
 base:
+	mkdir -p local_imports
 ifdef LOCAL_PYVOLTHA
-	mkdir -p pyvoltha/dist
-	cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
-	mkdir -p voltha-protos/dist
-	cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-base:${TAG} -f docker/Dockerfile.base_local .
-else
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-base:${TAG} -f docker/Dockerfile.base .
+	mkdir -p local_imports/pyvoltha/dist
+	cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
 endif
+ifdef LOCAL_PROTOS
+	mkdir -p local_imports/voltha-protos/dist
+	cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+endif
+	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-base:${TAG} -f docker/Dockerfile.base .
+
 
 adapter_ponsim_olt:
 	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-ponsim-olt:${TAG} -f docker/Dockerfile.adapter_ponsim_olt .
@@ -184,30 +186,9 @@
 %.pull:
 	docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG}
 
-protoc:
-ifeq ($(VOLTHA_BUILD),docker)
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-protoc:${TAG} -f docker/Dockerfile.protoc .
-endif
-
-protos:
-ifneq ($(VOLTHA_BUILD),docker)
-	make -C protos
-else
-	#cp ../protos/*.proto ./protos
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-protos:${TAG} -f docker/Dockerfile.protos .
-endif
-
-install-protoc:
-	make -C voltha/protos install-protoc
-
 clean:
 	find . -name '*.pyc' | xargs rm -f
-	rm -f ./protos/*_pb2.py
-	rm -f ./protos/*_pb2_grpc.py
-	rm -f ./protos/*.desc
-	rm -f ./protos/*.proto
-	rm -rf pyvoltha
-	rm -rf voltha-protos
+	rm -rf local_imports
 
 distclean: clean
 	rm -rf ${VENVDIR}
@@ -242,13 +223,16 @@
 	    fi
 
 ifdef LOCAL_PYVOLTHA
-	mkdir -p pyvoltha/dist
-	cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
-	mkdir -p voltha-protos/dist
-	cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
+	mkdir -p local_imports/pyvoltha/dist
+	cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
 	. ${VENVDIR}/bin/activate && \
-	    pip install pyvoltha/dist/*.tar.gz && \
-	    pip install voltha-protos/dist/*.tar.gz
+	    pip install local_imports/pyvoltha/dist/*.tar.gz
+endif
+ifdef LOCAL_PROTOS
+	mkdir -p local_imports/voltha-protos/dist
+	cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+	. ${VENVDIR}/bin/activate && \
+	    pip install local_imports/voltha-protos/dist/*.tar.gz
 endif
 
 flake8: $(DIRS_FLAKE8)