From: Sapan Bhatia Date: Fri, 1 Aug 2008 02:05:55 +0000 (+0000) Subject: Ping test X-Git-Tag: tests-4.3-0~125 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=debc926373c05460d5bb19788ded77a101253cb3;p=tests.git Ping test --- diff --git a/node_tests/nmapitest.py b/node_tests/nmapitest.py new file mode 100755 index 0000000..f934eb1 --- /dev/null +++ b/node_tests/nmapitest.py @@ -0,0 +1,10 @@ +#!/usr/bin/python +# Module: VNET+ +# Description: +# Connect to the node manager +# Author: acb@cs.princeton.edu + +from xmlrpclib import ServerProxy + +nodemanager = ServerProxy('http://127.0.0.1:812/') +nodemanager.SetLoans('pl_sirius', []) diff --git a/node_tests/ping.pl b/node_tests/ping.pl new file mode 100755 index 0000000..48b2e7f --- /dev/null +++ b/node_tests/ping.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +# Module: VNET+ +# Description: Generate ping packets and count the responses +# Author: sapanb@cs.princeton.edu + +use strict; +use threads; + +#please change to something local +my $guineapig='planetlab-1.cs.princeton.edu'; +my $numiter=1000; + +sub run { + system("ping $guineapig"); + } + +sub mfetch { + foreach (1..$numiter) { + run; + } +} + +sub launch { + my @tarray; + foreach (1..$numthreads) { + my $thr = threads->create(\&mfetch); + push @tarray,$thr; + } + + for (@tarray) { + $_->join; + } +} + +sub open_tcpdump { + my $filter="icmp and src $guineapig"; + my $cmdline="/usr/sbin/tcpdump -c $numpackets $filter"; + + system($cmdline); +} + +sub alhandler { + print "[FAILED] tcpdump apparently did not intercept all SYN/ACK packets\n"; + exit(-1); +} + +print "Starting tcpdump...\n"; +my $tcpdthr=threads->create(\&open_tcpdump); +sleep 10; +print "Generating connections...\n"; +launch; +$SIG{ALRM}=\&alhandler; +alarm(60); +$tcpdthr->join; +$numsynacks++; +print "[SUCCESS] Test completed OK. $numsynacks SYN/ACK packets intercepted.\n";