Dockerized chameleon to work
diff --git a/grpc_client/grpc_client.py b/grpc_client/grpc_client.py
index 5f373a7..c2d66db 100644
--- a/grpc_client/grpc_client.py
+++ b/grpc_client/grpc_client.py
@@ -136,7 +136,7 @@
cmd = (
'cd %s && '
- 'env PATH=%s '
+ 'env PATH=%s PYTHONPATH=%s '
'python -m grpc.tools.protoc '
'-I. '
'-I%s '
@@ -148,6 +148,7 @@
self.work_dir,
':'.join([os.environ['PATH'], self.plugin_dir]),
google_api_dir,
+ google_api_dir,
self.plugin_dir,
fname)
)
diff --git a/protoc_plugins/gw_gen.py b/protoc_plugins/gw_gen.py
index aa2a3ce..e6dac24 100755
--- a/protoc_plugins/gw_gen.py
+++ b/protoc_plugins/gw_gen.py
@@ -17,6 +17,7 @@
import os
import sys
+from google.protobuf import descriptor as _descriptor
from google.protobuf.compiler import plugin_pb2 as plugin
from google.protobuf.descriptor import FieldDescriptor
from google.protobuf.descriptor_pb2 import ServiceDescriptorProto, MethodOptions
@@ -25,7 +26,7 @@
from simplejson import dumps
# without this import, http method annotations would not be recognized:
-from google.api import annotations_pb2 as _, http_pb2
+from google.api import annotations_pb2, http_pb2
template = Template("""
diff --git a/web_server/web_server.py b/web_server/web_server.py
index 4452ccd..af8c6c5 100644
--- a/web_server/web_server.py
+++ b/web_server/web_server.py
@@ -28,71 +28,6 @@
log = get_logger()
-'''
-## To be automated as part of the template
-from voltha.protos.voltha_pb2 import *
-from protobuf_to_dict import protobuf_to_dict, dict_to_protobuf
-
-def add_routes(app, grpc_client):
-
- @app.route('/health', methods=['GET'])
- def get_health(server, request):
- log.debug('get-health-req', request=request, server=server)
- req = NullMessage()
- res = grpc_client.invoke(
- HealthServiceStub, 'GetHealthStatus', req)
- data = protobuf_to_dict(res, use_enum_labels=True)
- request.setHeader('Content-Type', 'application/json')
- log.debug('get-health-res', **data)
- return dumps(data)
-
- @app.route('/addresses', methods=['GET'])
- def list_addresses(server, request):
- log.debug('list-addresses-req', request=request, server=server)
- req = NullMessage()
- res = grpc_client.invoke(
- ExampleServiceStub, 'ListAddresses', req)
- data = protobuf_to_dict(res, use_enum_labels=True)
- request.setHeader('Content-Type', 'application/json')
- log.debug('list-addresses-res', **data)
- return dumps(data)
-
- @app.route('/addresses/<string:id>', methods=['GET'])
- def get_address(server, request, id):
- log.debug('get-address-req', request=request, server=server, id=id)
- req = ID(id=id)
- res = grpc_client.invoke(
- ExampleServiceStub, 'GetAddress', req)
- data = protobuf_to_dict(res, use_enum_labels=True)
- request.setHeader('Content-Type', 'application/json')
- log.debug('get-address-res', **data)
- return dumps(data)
-
- @app.route('/addresses/<string:id>', methods=['DELETE'])
- def delete_address(server, request, id):
- log.debug('delete-address-req', request=request, server=server, id=id)
- req = ID(id=id)
- res = grpc_client.invoke(
- ExampleServiceStub, 'DeleteAddress', req)
- data = protobuf_to_dict(res, use_enum_labels=True)
- request.setHeader('Content-Type', 'application/json')
- log.debug('delete-address-res', **data)
- return dumps(data)
-
- @app.route('/addresses', methods=['PATCH'])
- def update_address(server, request):
- log.debug('update-address-req', request=request, server=server)
- data = load(request.content)
- req = dict_to_protobuf(Address, data)
- res = grpc_client.invoke(
- ExampleServiceStub, 'UpdateAddress', req)
- data = protobuf_to_dict(res, use_enum_labels=True)
- request.setHeader('Content-Type', 'application/json')
- log.debug('update-address-res', **data)
- return dumps(data)
-
-## end
-'''
class WebServer(object):