blob: afb727e01f464b08b9886560bd2b811ebb0272e2 [file] [log] [blame]
#
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Temp client code to test grpc server"""
import grpc
from voltha.northbound.grpc import pb2_loader
from voltha.core.protos import voltha_pb2
def run():
channel = grpc.insecure_channel('localhost:50055')
# Ping health state as an example
stub = voltha_pb2.HealthServiceStub(channel)
res = stub.GetHealthStatus(voltha_pb2.NullMessage())
print '\nHealth state:', res.state
# Try another API
stub = voltha_pb2.ExampleServiceStub(channel)
res = stub.ListAddresses(voltha_pb2.NullMessage())
print '\nExample objects returned:\n', res.addresses
if __name__ == '__main__':
run()