VOL-1460 Updated to use a voltha-protos repo as source for protos

Change-Id: I6e88fb3bb16f91941abaad2f0a810ebc5aa29f36
diff --git a/python/Makefile b/python/Makefile
index 3ac6936..31846fc 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -78,6 +78,8 @@
 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-openolt-adapter-base:${TAG} -f docker/Dockerfile.base_local .
 else
 	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base .
@@ -103,6 +105,7 @@
 
 clean:
 	rm -rf pyvoltha
+	rm -rf voltha-protos
 	find . -name '*.pyc' | xargs rm -f
 
 distclean: clean
@@ -130,8 +133,11 @@
 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/
 	@ . ${VENVDIR}/bin/activate && \
-	    pip install pyvoltha/dist/*.tar.gz
+	    pip install pyvoltha/dist/*.tar.gz \
+	    pip install voltha-protos/dist/*.tar.gz
 endif
 
 # end file
diff --git a/python/adapters/openolt/main.py b/python/adapters/openolt/main.py
index d4c43e7..e23d532 100755
--- a/python/adapters/openolt/main.py
+++ b/python/adapters/openolt/main.py
@@ -43,10 +43,10 @@
     get_messaging_proxy
 from pyvoltha.adapters.kafka.kafka_proxy import KafkaProxy, get_kafka_proxy
 from openolt import OpenoltAdapter
-from pyvoltha.protos import third_party
-from pyvoltha.protos.adapter_pb2 import AdapterConfig
+#from voltha_protos import third_party
+from voltha_protos.adapter_pb2 import AdapterConfig
 
-_ = third_party
+#_ = third_party
 
 defs = dict(
     version_file='./VERSION',
diff --git a/python/adapters/openolt/openolt.py b/python/adapters/openolt/openolt.py
index b786e2d..34b330c 100644
--- a/python/adapters/openolt/openolt.py
+++ b/python/adapters/openolt/openolt.py
@@ -39,17 +39,17 @@
 from pyvoltha.common.utils.asleep import asleep
 from pyvoltha.common.utils.registry import registry
 from pyvoltha.adapters.kafka.kafka_proxy import get_kafka_proxy
-from pyvoltha.protos import openolt_pb2
-from pyvoltha.protos import third_party
-from pyvoltha.protos.common_pb2 import OperStatus, ConnectStatus
-from pyvoltha.protos.common_pb2 import LogLevel
-from pyvoltha.protos.common_pb2 import OperationResp
-from pyvoltha.protos.inter_container_pb2 import SwitchCapability, PortCapability, \
+from voltha_protos import openolt_pb2
+#from voltha_protos import third_party
+from voltha_protos.common_pb2 import OperStatus, ConnectStatus
+from voltha_protos.common_pb2 import LogLevel
+from voltha_protos.common_pb2 import OperationResp
+from voltha_protos.inter_container_pb2 import SwitchCapability, PortCapability, \
     InterAdapterMessageType, InterAdapterResponseBody
-from pyvoltha.protos.device_pb2 import Port, PmConfig, PmConfigs, \
+from voltha_protos.device_pb2 import Port, PmConfig, PmConfigs, \
     DeviceType, DeviceTypes
-from pyvoltha.protos.adapter_pb2 import Adapter
-from pyvoltha.protos.adapter_pb2 import AdapterConfig
+from voltha_protos.adapter_pb2 import Adapter
+from voltha_protos.adapter_pb2 import AdapterConfig
 from openolt_flow_mgr import OpenOltFlowMgr
 from openolt_alarms import OpenOltAlarmMgr
 from openolt_statistics import OpenOltStatisticsMgr
@@ -58,15 +58,15 @@
 from openolt_resource_manager import OpenOltResourceMgr
 from openolt_device import OpenoltDevice
 
-from pyvoltha.protos.events_pb2 import KpiEvent, KpiEventType, MetricValuePairs
-from pyvoltha.protos.logical_device_pb2 import LogicalPort
-from pyvoltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
+from voltha_protos.events_pb2 import KpiEvent, KpiEventType, MetricValuePairs
+from voltha_protos.logical_device_pb2 import LogicalPort
+from voltha_protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
     OFPPF_1GB_FD, \
     OFPC_GROUP_STATS, OFPC_PORT_STATS, OFPC_TABLE_STATS, OFPC_FLOW_STATS, \
     ofp_switch_features, ofp_desc
-from pyvoltha.protos.openflow_13_pb2 import ofp_port
+from voltha_protos.openflow_13_pb2 import ofp_port
 
-_ = third_party
+#_ = third_party
 log = structlog.get_logger()
 OpenOltDefaults = {
     'support_classes': {
diff --git a/python/adapters/openolt/openolt_alarms.py b/python/adapters/openolt/openolt_alarms.py
index ad6fd99..932855c 100644
--- a/python/adapters/openolt/openolt_alarms.py
+++ b/python/adapters/openolt/openolt_alarms.py
@@ -30,8 +30,8 @@
 from pyvoltha.adapters.extensions.alarms.onu.onu_window_drift_alarm import OnuWindowDriftAlarm
 from pyvoltha.adapters.extensions.alarms.onu.onu_activation_fail_alarm import OnuActivationFailAlarm
 
-import pyvoltha.protos.openolt_pb2 as openolt_pb2
-import pyvoltha.protos.device_pb2 as device_pb2
+import voltha_protos.openolt_pb2 as openolt_pb2
+import voltha_protos.device_pb2 as device_pb2
 
 
 class OpenOltAlarmMgr(object):
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 06a07d1..7fae0de 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -25,22 +25,22 @@
 from scapy.layers.l2 import Ether, Dot1Q
 from transitions import Machine
 
-from pyvoltha.protos import openolt_pb2_grpc, openolt_pb2
+from voltha_protos import openolt_pb2_grpc, openolt_pb2
 
 from pyvoltha.adapters.extensions.alarms.onu.onu_discovery_alarm import OnuDiscoveryAlarm
 
 from pyvoltha.common.utils.nethelpers import mac_str_to_tuple
-from pyvoltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
+from voltha_protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
     OFPPS_LINK_DOWN, OFPPF_1GB_FD, \
     OFPC_GROUP_STATS, OFPC_PORT_STATS, OFPC_TABLE_STATS, OFPC_FLOW_STATS, \
     ofp_switch_features, ofp_port, ofp_port_stats, ofp_desc
 from pyvoltha.common.utils.registry import registry
-from pyvoltha.protos import third_party
-from pyvoltha.protos.common_pb2 import AdminState, OperStatus, ConnectStatus
-from pyvoltha.protos.common_pb2 import LogLevel
-from pyvoltha.protos.device_pb2 import Port, Device
+#from voltha_protos import third_party
+from voltha_protos.common_pb2 import AdminState, OperStatus, ConnectStatus
+from voltha_protos.common_pb2 import LogLevel
+from voltha_protos.device_pb2 import Port, Device
 
-from pyvoltha.protos.logical_device_pb2 import LogicalDevice, LogicalPort
+from voltha_protos.logical_device_pb2 import LogicalDevice, LogicalPort
 
 
 class OpenoltDevice(object):
diff --git a/python/adapters/openolt/openolt_flow_mgr.py b/python/adapters/openolt/openolt_flow_mgr.py
index 19604c5..b05753f 100644
--- a/python/adapters/openolt/openolt_flow_mgr.py
+++ b/python/adapters/openolt/openolt_flow_mgr.py
@@ -20,12 +20,12 @@
 import hashlib
 from simplejson import dumps
 
-from pyvoltha.protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, \
+from voltha_protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, \
     ofp_flow_stats, OFPMT_OXM, Flows, FlowGroups, OFPXMT_OFB_IN_PORT, \
     OFPXMT_OFB_VLAN_VID
-from pyvoltha.protos.device_pb2 import Port
+from voltha_protos.device_pb2 import Port
 import pyvoltha.common.openflow.utils as fd
-from pyvoltha.protos import openolt_pb2
+from voltha_protos import openolt_pb2
 from pyvoltha.common.utils.registry import registry
 
 from pyvoltha.common.tech_profile.tech_profile import DEFAULT_TECH_PROFILE_TABLE_ID
diff --git a/python/adapters/openolt/openolt_platform.py b/python/adapters/openolt/openolt_platform.py
index 7032247..a52d653 100644
--- a/python/adapters/openolt/openolt_platform.py
+++ b/python/adapters/openolt/openolt_platform.py
@@ -14,8 +14,8 @@
 # limitations under the License.
 #
 
-from pyvoltha.protos.device_pb2 import Port
-import pyvoltha.protos.device_pb2 as dev_pb2
+from voltha_protos.device_pb2 import Port
+import voltha_protos.device_pb2 as dev_pb2
 
 """
 Encoding of identifiers
diff --git a/python/adapters/openolt/openolt_resource_manager.py b/python/adapters/openolt/openolt_resource_manager.py
index c784678..121f193 100644
--- a/python/adapters/openolt/openolt_resource_manager.py
+++ b/python/adapters/openolt/openolt_resource_manager.py
@@ -22,7 +22,7 @@
 from pyvoltha.common.config.config_backend import EtcdStore
 from openolt_flow_mgr import *
 
-from pyvoltha.protos import openolt_pb2
+from voltha_protos import openolt_pb2
 from openolt_platform import OpenOltPlatform
 
 
diff --git a/python/adapters/openolt/openolt_statistics.py b/python/adapters/openolt/openolt_statistics.py
index ccab90a..47cfa37 100644
--- a/python/adapters/openolt/openolt_statistics.py
+++ b/python/adapters/openolt/openolt_statistics.py
@@ -17,7 +17,7 @@
 
 from twisted.internet import reactor, defer
 from pyvoltha.adapters.extensions.kpi.olt.olt_pm_metrics import OltPmMetrics
-from pyvoltha.protos.device_pb2 import PmConfig, PmConfigs, PmGroupConfig, Port
+from voltha_protos.device_pb2 import PmConfig, PmConfigs, PmGroupConfig, Port
 
 
 class OpenOltStatisticsMgr(object):
diff --git a/python/compose/adapters-openolt.yml b/python/compose/adapters-openolt.yml
index dba89cf..09aa672 100644
--- a/python/compose/adapters-openolt.yml
+++ b/python/compose/adapters-openolt.yml
@@ -29,7 +29,7 @@
       "--kafka_adapter=${DOCKER_HOST_IP}:9092",
       "--kafka_cluster=${DOCKER_HOST_IP}:9092",
       "--backend=etcd",
-      "--etcd=${DOCKER_HOST_IP}:2379"
+      "--etcd=${DOCKER_HOST_IP}:2379",
       "--core_topic=rwcore"
     ]
     networks:
diff --git a/python/docker/Dockerfile.base_local b/python/docker/Dockerfile.base_local
index 9b6ce9e..d2aae88 100644
--- a/python/docker/Dockerfile.base_local
+++ b/python/docker/Dockerfile.base_local
@@ -32,3 +32,7 @@
 COPY pyvoltha/dist /pyvoltha/dist
 RUN pip install /pyvoltha/dist/*.tar.gz
 
+# Install local voltha-protos
+COPY voltha-protos/dist /voltha-protos/dist
+RUN pip install /voltha-protos/dist/*.tar.gz
+
diff --git a/python/requirements.txt b/python/requirements.txt
index 3e688c0..9a87401 100644
--- a/python/requirements.txt
+++ b/python/requirements.txt
@@ -65,3 +65,4 @@
 python-consul==0.6.2
 afkak==3.0.0.dev20181106
 pyvoltha==0.1.7
+voltha-protos==0.1.0