updated traceroutes to install tcptraceroute if it doesn't exist
Sapan Bhatia [Mon, 30 Mar 2009 15:36:13 +0000 (15:36 +0000)]
qaapi/qa/tests/slice/nmapitest.py
qaapi/qa/tests/slice/traceroutes.pl

index 3c5df41..023629b 100755 (executable)
@@ -5,14 +5,15 @@
 # Author: acb@cs.princeton.edu/sapanb@cs.princeton.edu
 
 import sys
+import os
 
 from xmlrpclib import ServerProxy
 
-if (len(sys.argv)!=2):
-    print "[FAILED] Please pass the name of the slice this script runs in as the first argument.\n";
-else:
-    nodemanager = ServerProxy('http://127.0.0.1:812/')
-    try:
-        nodemanager.SetLoans(sys.argv[1], [])
-    except:
-        print "[FAILED] SetLoans didn't work, probably because the packets of this connection are not getting tagged.\n";
+homedir=os.environ['HOME']
+slice_name = homedir.rsplit('/')[0]
+
+nodemanager = ServerProxy('http://127.0.0.1:812/')
+try:
+    nodemanager.SetLoans(slice_name, [])
+except:
+    print "[FAILED] SetLoans didn't work, probably because the packets of this connection are not getting tagged.\n";
index 95e7a70..fdb0406 100755 (executable)
@@ -35,7 +35,11 @@ if ($traceroute !~ /^\//) {
 
 if (!-e "$ttraceroute") {
        print $ttraceroute."\n";
-       die("[FAILED] Please install tcptraceroute in the slice before running this test\n");
+       print "[OOPS] TCPtraceroute not found. Installing... \n";
+    system("yum -y tcptraceroute");
+    if (!-e "$ttraceroute") {
+           print "[FAILED] TCPtraceroute could not be installed. Test failed.\n";
+    }
 }      
 else {
        print "Found tcptraceroute. Good.\n";