Ping test
authorSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 1 Aug 2008 02:05:55 +0000 (02:05 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 1 Aug 2008 02:05:55 +0000 (02:05 +0000)
node_tests/nmapitest.py [new file with mode: 0755]
node_tests/ping.pl [new file with mode: 0755]

diff --git a/node_tests/nmapitest.py b/node_tests/nmapitest.py
new file mode 100755 (executable)
index 0000000..f934eb1
--- /dev/null
@@ -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 (executable)
index 0000000..48b2e7f
--- /dev/null
@@ -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";