예제 #1
0
def test(args, net):
    print('-------------------Test Begin---------------------')
    seconds = int(args.t)
    ct_name=args.names.client[0]
    sv_name=args.names.server[0]
    client = net.getNodeByName(ct_name)
    server = net.getNodeByName(sv_name)

    lg.info("pinging each destination interface\n")
    
    for i in range(args.n):
        ip='172.16.%i.2'%i
        output = args.output + args.prepend + '_'+ "ping_"+ip 
        opts = "-DAq "
        interval = "0.250"
        n = (float(args.t)-1)/float(interval)
        client.cmd('ping %s -c %d -i %s 172.16.%i.2 > %s &' % (opts,n,interval,i,output)) # ping pendant iperf
        

    lg.info("iperfing")
    #iperf options
    #-i report time interval
    #-s server mode
    #-c client mode
    #-m report MTU
    #-M set MSS

    #***** common_args **** 
    report = ' --reportstyle C' if args.csv else ''

    #********* server **********
    opts =' -i 1 -m -M 1460 -w %s' %args.arg2
    cmd = 'iperf -s' + opts + report
    server.sendCmd(cmd)
    
    #********* client **********
    opts =  ' -t %d -i 1 -m -M 1460 -w %s' % (seconds,args.arg2)
    ip = ' 172.16.0.2'
    cmd = 'iperf -c ' + ip + opts + report
    client.sendCmd(cmd)


    progress(seconds + 1)
    client_out = client.waitOutput()
    lg.info("client output:\n%s\n" % client_out)
    sleep(0.1)  # hack to wait for iperf server output.
    server_out = server.read(500000)#
    lg.info("server output: %s\n" % server_out)

    
    ssh_cmd ='/usr/sbin/sshd'
    
	#dirty way to kill sshd
    cmd='pkill -f "ping -DAq"'
    call(cmd,shell=True)

    print('-------------------Test End---------------------')

    return server_out,client_out
예제 #2
0
def test(args, net):
    print ("-------------------Test Begin---------------------")
    seconds = int(args.t)
    ct_name = args.names.client[0]
    sv_name = args.names.server[0]
    client = net.getNodeByName(ct_name)
    server = net.getNodeByName(sv_name)

    lg.info("pinging each destination interface\n")

    for i in range(args.n):
        ip = "172.16.%i.2" % i
        output = args.output + args.prepend + "_" + "ping_" + ip
        opts = "-D "  # ne pas mettre Adaptative
        interval = "1"
        n = int(args.t) - 10
        server.cmd("ping %s -c %s 172.16.%i.1 > %s &" % (opts, str(n), i, output))  # ping pendant iperf
    #        client.cmd('ping %s -c %s -i %s 172.16.%i.2 &' % (opts,str(n),interval,i)) # ping pendant iperf

    lg.info("iperfing")
    # iperf options
    # -i report time interval
    # -s server mode
    # -c client mode
    # -m report MTU
    # -M set MSS

    # ***** common_args ****
    report = " --reportstyle C" if args.csv else ""

    # ********* server **********
    opts = " -i 1 -m -M 1460"

    cmd = "iperf -s" + opts + report
    server.sendCmd(cmd)

    # ********* client **********

    opts = " -t %d -i 1 -m -M 1460" % seconds
    ip = " 172.16.0.2"
    cmd = "iperf -c " + ip + opts + report
    client.sendCmd(cmd)

    progress(seconds + 1)
    client_out = client.waitOutput()
    lg.info("client output:\n%s\n" % client_out)
    sleep(0.1)  # hack to wait for iperf server output.
    server_out = server.read(500000)  #
    lg.info("server output: %s\n" % server_out)

    #  sleep(1)

    cmd = 'pkill -f "ping -Dq"'
    call(cmd, shell=True)

    print ("-------------------Test End---------------------")

    return server_out, client_out
예제 #3
0
def test(args, net):
    print('-------------------Test Begin---------------------')
    seconds = int(args.t)
    ct_name=args.names.client[0]
    sv_name=args.names.server[0]
    client = net.getNodeByName(ct_name)
    server = net.getNodeByName(sv_name)

    lg.info("pinging each destination interface\n")
    for i in range(args.n):
        opts = "-DAq "
        n = "500" # ping
        out_ping=client.cmdPrint('ping %s -c %s 172.16.%i.2' % (opts,n,i))
        
       # lg.info("ping test output: %s\n" % out_ping)
        
        ip='172.16.%i.2'%i
        g=open(args.output + args.prepend + '_'+ "ping_"+ip,'w')
        g.write(out_ping)
        g.close()




    lg.info("iperfing")
    #iperf options
    #-i report time interval
    #-s server mode
    #-c client mode
    #-m report MTU
    #-M set MSS

    #***** common_args **** 
    report = ' --reportstyle C' if args.csv else ''

    #********* server **********
    opts =' -i 1 -m -M 1460'
    cmd = 'iperf -s' + opts + report
    server.sendCmd(cmd)
    
    #********* client **********
    opts =  ' -t %d -i 1 -m -M 1460' % seconds
    ip = ' 172.16.0.2'
    cmd = 'iperf -c ' + ip + opts + report
    client.sendCmd(cmd)


    progress(seconds + 1)
    client_out = client.waitOutput()
    lg.info("client output:\n%s\n" % client_out)
    sleep(0.1)  # hack to wait for iperf server output.
    server_out = server.read(500000)#
    lg.info("server output: %s\n" % server_out)

    print('-------------------Test End---------------------')

    return server_out,client_out
예제 #4
0
def test(args, net):
    print('-------------------Test Begin---------------------')
    seconds = int(args.t)
    sd_name=args.names.client[0]
    rv_name=args.names.server[0]
    client = net.getNodeByName(sd_name)
    server = net.getNodeByName(rv_name)

    lg.info("pinging each destination interface\n")
    for i in range(args.n):
        client.cmd('ping -c 1 172.16.%i.2' % i)
        
    lg.info("iperfing")
    #iperf options
    #-i report time interval
    #-s server mode
    #-c client mode
    #-m report MTU
    #-M set MSS

    #***** common_args **** 
    report = ' --reportstyle C -o /dev/null' if args.csv else ''

    #********* server **********
    opts =' -i 1 -m -M 1460'
    cmd = 'iperf -s' + opts + report
    server.sendCmd(cmd)
    
    #********* client **********
    opts =  ' -t %d -i 1 -m -M 1460' % seconds
    ip = ' 172.16.0.2'
    cmd = 'iperf -c ' + ip + opts + report
    client.sendCmd(cmd)


    progress(seconds + 1)
    client_out = client.waitOutput()
    lg.info("client output:\n%s\n" % client_out)
    sleep(0.1)  # hack to wait for iperf server output.
    server_out = server.read(500000)#
    lg.info("server output: %s\n" % server_out)

    print('-------------------Test End---------------------')

    return server_out,client_out
예제 #5
0
def test(args, net):
    print('-------------------Test Begin---------------------')
    seconds = int(args.t)
    ct_name=args.names.client[0]
    sv_name=args.names.server[0]
    client = net.getNodeByName(ct_name)
    server = net.getNodeByName(sv_name)

    lg.info("pinging each destination interface\n")
    
    for i in range(args.n):
        """
        ip='172.16.%i.2'%i
        output = args.output + args.prepend + '_'+ "ping_"+ip 
        opts = "-D " # ne pas mettre Adaptative
        interval = "1"
        n = (int(args.t)-10)
        #server.cmd('ping %s -c %s 172.16.%i.1 > %s &' % (opts,str(n),i,output)) 
        client.cmd('ping %s -c %s -i %s 172.16.%i.2 > %s &' % (opts,str(n),interval,i,output)) # ping pendant iperf 

        """
        opts = "-DAq "
        n = "20" # ping
        out_ping=client.cmdPrint('ping %s -c %s 172.16.%i.2' % (opts,n,i))
        
       # lg.info("ping test output: %s\n" % out_ping)
        
        ip='172.16.%i.2'%i
        g=open(args.output + args.prepend + '_'+ "ping_"+ip,'w')
        g.write(out_ping)
        g.close()
         

    lg.info("iperfing")
    #iperf options
    #-i report time interval
    #-s server mode
    #-c client mode
    #-m report MTU
    #-M set MSS

    #***** common_args **** 
    report = ' --reportstyle C' if args.csv else ''

    #********* server **********
    opts =' -i 1 -m -M 1460'
    cmd = 'iperf -s' + opts + report
    server.sendCmd(cmd)
    
    #********* client **********
    opts =  ' -t %d -i 1 -m -M 1460' % (seconds)
    ip = ' 172.16.0.2'
    cmd = 'iperf -c ' + ip + opts + report
    client.sendCmd(cmd)


    progress(seconds + 1)
    client_out = client.waitOutput()
    lg.info("client output:\n%s\n" % client_out)
    sleep(0.1)  # hack to wait for iperf server output.
    server_out = server.read(500000)#
    lg.info("server output: %s\n" % server_out)

    
    ssh_cmd ='/usr/sbin/sshd'
	#dirty way to kill sshd

    cmd='pkill -f "ping -DAq"'
    call(cmd,shell=True)
    sleep(1)
    print('-------------------Test End---------------------')

    return server_out,client_out