-help file for ping
authorSapan Bhatia <sapanb@cs.princeton.edu>
Thu, 19 Mar 2009 16:43:54 +0000 (16:43 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Thu, 19 Mar 2009 16:43:54 +0000 (16:43 +0000)
-modified traceroutes test that is more robust
-nmapitest, which for some reason wasn't checked in :-/

qaapi/qa/tests/slice/nmapitest.py [new file with mode: 0755]
qaapi/qa/tests/slice/ping.help [new file with mode: 0644]
qaapi/qa/tests/slice/traceroutes.pl

diff --git a/qaapi/qa/tests/slice/nmapitest.py b/qaapi/qa/tests/slice/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/qaapi/qa/tests/slice/ping.help b/qaapi/qa/tests/slice/ping.help
new file mode 100644 (file)
index 0000000..2a307be
--- /dev/null
@@ -0,0 +1,5 @@
+Description: Ping test for VNET+.
+Action: Send out ping echo requests to a given IP.
+Pass: ping echo replies return for each outgoing request.
+Fail: one or more echo requests go unanswered.
+Author: sapanb@cs.princeton.edu
index 5dfad46..95e7a70 100755 (executable)
@@ -9,6 +9,7 @@
 # Author: sapanb@cs.princeton.edu
 
 $|=1;
+use strict;
 
 # ********************************************************************************
 # CONFIGURATION
@@ -22,6 +23,8 @@ my $guineapig="vini-veritas.net";
 my $ttraceroute=`which tcptraceroute 2>/dev/null`;
 my $traceroute=`which traceroute 2>/dev/null`;
 
+my %tr;
+
 chop($ttraceroute);
 chop($traceroute);
 
@@ -35,60 +38,55 @@ if (!-e "$ttraceroute") {
        die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
 }      
 else {
-       print "Found rcptraceroute. Good.\n";
+       print "Found tcptraceroute. Good.\n";
 }
 
 if ($traceroute !~ /^\//) {
        die("[FAILED] Please install traceroute in the slice before running this test\n");
 }      
 
-my %hash;
-
 sub open_tcptraceroute {
-       my $cmdline="sudo $ttraceroute $guineapig";
+       my $cmdline="sudo $ttraceroute $guineapig 2>&1";
+       print $cmdline."\n";
        my $out='';
        open TT,"$cmdline|";
 
        while (<TT>) {
                if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
-                       glob %hash;
-                       print ">>> $_";
-                       $hash{$1}++;
+            glob %tr;
+            $tr{"IP$1"}++;
+            print ">>>$1\n";
                }
        }
 }
 
 sub open_traceroute {
        my $ref=shift;
-       my $cmdline="$traceroute $guineapig";
+       my $cmdline="$traceroute $guineapig 2>&1";
        my $out='';
        print $cmdline."\n";
        open TT,"$cmdline|";
 
        while (<TT>) {
                if (/\((\d+\.\d+\.\d+\.\d+)\)/) {
-                       glob %hash;
-                       print ">>> $_";
-                       $hash{$1}=$hash{$1}+1;
+            glob %tr;
+            $tr{"IP$1"}++;
+            print ">>>$1\n";
                }
        }
 }
 
 sub compare {
-       my $ref=shift;
        my $ret=1;
        my $double=0;
        my $single=0;
-       glob %hash;
-       foreach (keys %hash) {
-               if ($hash{$_}==1) {
+       glob %tr;
+       foreach (keys %tr) {
+               if ($tr{$_}==1) {
                        $single++;
-               } elsif ($hash{$_}==2) {
-                       print "Concorded on $_\n";
+               } elsif ($tr{$_}==2) {
                        $double++;
                }
-               else { die ("[FAILED] Could not complete test.\n");}
-
        }
        return ($single,$double);
 }
@@ -98,25 +96,23 @@ sub alhandler {
        exit(-1);
 }
 
-print "Starting tcptraceroute...\n";
 if (fork==0) {
        my %r1;
        my $s;
        my $d;
+    glob %tr;
 
        open_tcptraceroute;
        open_traceroute;
-       ($s,$d)=compare;
-       if ($s==0 && $d>2) {
-               print "[SUCCESS] traceroute and tcptraceroute reported the same result. $d hops.\n";
-               exit(0);
-       }
-       elsif ($s && $d>2) {
-               print "[PARTIAL SUCCESS] traceroute and tcptraceroute reported $s different hops out of $d.\n";
-       }
-       else {
-               print "[FAILED] traceroute and tcptraceroute reported different results\n";
-       }
+
+    ($s,$d)=compare;
+
+    if ($d>4) {
+        print "[SUCCESS] traceroutes succeeded, singles: $s, doubles: $d\n";
+    }
+    else {
+        print "[FAILED] traceroutes returned different results: $s, $d\n";
+    }
 }
 else {
        print "Generating connections...\n";