add_smt.py 868 B

1234567891011121314151617181920212223
  1. import logging as Log
  2. import grpc,argparse,time,sys,threading
  3. import mllp_grpc.sim_mt_pb2_grpc as sim_mt_pb2_grpc
  4. import mllp_grpc.sim_mt_pb2 as sim_mt_pb2
  5. import mllp_grpc.sim_mt_common_pb2 as sim_mt_common_pb2
  6. import google.protobuf.empty_pb2 as empty_pb2
  7. SMT_SERVER_HOST = "localhost"
  8. SMT_SERVER_PORT = 8043
  9. SMT_SYSTEM_HOST = "localhost"
  10. SMT_SYSTEM_PORT = 8044
  11. if __name__=='__main__':
  12. addr= '%s:%d'%(SMT_SERVER_HOST, SMT_SERVER_PORT)
  13. with grpc.insecure_channel(addr) as channel:
  14. stub= sim_mt_pb2_grpc.SimMTStub(channel)
  15. for info in stub.GetSystemsInfo(empty_pb2.Empty()):
  16. print(info)
  17. res= stub.AddSystem(sim_mt_pb2.AddSystemRequest(host=SMT_SYSTEM_HOST,
  18. port=SMT_SYSTEM_PORT))
  19. for info in stub.GetSystemsInfo(empty_pb2.Empty()):
  20. print(info)