示例#1
0
def ping(client, args):
    response = client.RunNetworkTests(
        magmad_pb2.NetworkTestRequest(pings=[
            magmad_pb2.PingParams(
                host_or_ip=host,
                num_packets=args.packets,
            ) for host in args.hosts
        ], ), )
    print(response)
示例#2
0
    def ping(self, host, num_packets=4):
        chan = ServiceRegistry.get_rpc_channel('magmad', ServiceRegistry.LOCAL)
        client = MagmadStub(chan)

        response = client.RunNetworkTests(
            magmad_pb2.NetworkTestRequest(pings=[
                magmad_pb2.PingParams(host_or_ip=host, num_packets=num_packets)
            ]))
        return response.pings