Beispiel #1
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
Beispiel #2
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)
Beispiel #3
0
def traceroute(client, args):
    response = client.RunNetworkTests(
        magmad_pb2.NetworkTestRequest(traceroutes=[
            magmad_pb2.TracerouteParams(
                host_or_ip=host,
                max_hops=args.max_hops,
                bytes_per_packet=args.bytes,
            ) for host in args.hosts
        ], ), )
    print(response)