gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23050 - in gnunet-planetlab: gplmt gplmt/contrib gplmt/scr


From: gnunet
Subject: [GNUnet-SVN] r23050 - in gnunet-planetlab: gplmt gplmt/contrib gplmt/scripts planetlab-api
Date: Fri, 3 Aug 2012 14:33:35 +0200

Author: wachs
Date: 2012-08-03 14:33:35 +0200 (Fri, 03 Aug 2012)
New Revision: 23050

Added:
   gnunet-planetlab/gplmt/scripts/
   gnunet-planetlab/gplmt/scripts/list_failing_nodes
   gnunet-planetlab/planetlab-api/add_slice_to_nodes.py
Modified:
   gnunet-planetlab/gplmt/Notifications.py
   gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf
   gnunet-planetlab/planetlab-api/delete_slice_from_nodes.py
Log:
more code

Modified: gnunet-planetlab/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/Notifications.py     2012-08-03 12:20:06 UTC (rev 
23049)
+++ gnunet-planetlab/gplmt/Notifications.py     2012-08-03 12:33:35 UTC (rev 
23050)
@@ -65,6 +65,30 @@
         self.end = 0
         self.tasks = list ()
 
+
+class FileLoggerNotification (Notification):
+    def __init__(self, logger):
+        assert (None != logger)
+        self.logger = logger
+        self.nodes = NodeCollection ()
+    def node_connected (self, node, success):
+        return
+    def node_disconnected (self, node, success):
+        return 
+    def tasklist_started (self, node, tasks):
+        return
+    def tasklist_completed (self, node, tasks, success):
+        self.nodes.add (Node(node))
+        if (success == True):
+            print node + " : Tasklist '" +  tasks.name + "' completed 
successfully"
+        else:
+            print node + " : Tasklist '" +  tasks.name + "' completed with 
failure"
+    def task_started (self, node, task):
+        return
+    def task_completed (self, node, task, result):
+        return   
+
+
 class TaskListResultNotification (Notification):
     def __init__(self, logger):
         assert (None != logger)

Modified: gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf
===================================================================
--- gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf     
2012-08-03 12:20:06 UTC (rev 23049)
+++ gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf     
2012-08-03 12:33:35 UTC (rev 23050)
@@ -1,11 +1,11 @@
 [gplmt]
-nodes = contrib/test_node.nodes
-tasks = contrib/deploy_gnunet_fc8.xml
+#nodes = contrib/test_node.nodes
+#tasks = contrib/deploy_gnunet_fc8.xml
 
 # Which notification mechanism to use: 
 # simple: print messages to stdout
-#notification = simple
-notification = result
+notification = simple
+#notification = result
 
 [planetlab]
 slice = tumple_gnunet_deployment

Added: gnunet-planetlab/gplmt/scripts/list_failing_nodes
===================================================================
--- gnunet-planetlab/gplmt/scripts/list_failing_nodes                           
(rev 0)
+++ gnunet-planetlab/gplmt/scripts/list_failing_nodes   2012-08-03 12:33:35 UTC 
(rev 23050)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ "$1" = "" ]; then
+       echo "Planetlab password required"
+       exit 1
+fi     
+
+../gplmt.py -c ../contrib/deploy_to_tumple_deployment.conf -a -p $1 -t 
../contrib/tasklists/check_node.xml | grep failure | awk '{print $1}'
+
+


Property changes on: gnunet-planetlab/gplmt/scripts/list_failing_nodes
___________________________________________________________________
Added: svn:executable
   + *

Added: gnunet-planetlab/planetlab-api/add_slice_to_nodes.py
===================================================================
--- gnunet-planetlab/planetlab-api/add_slice_to_nodes.py                        
        (rev 0)
+++ gnunet-planetlab/planetlab-api/add_slice_to_nodes.py        2012-08-03 
12:33:35 UTC (rev 23050)
@@ -0,0 +1,97 @@
+#!/usr/bin/python
+# Add slice from all nodes listed in file 
+
+def usage():
+    print "GNUnet PlanetLab deployment and automation toolset\n\
+Arguments mandatory for long options are also mandatory for short options.\n\
+  -u, --user=      Planetlab username\n\
+  -p, --password=       Planetlab password\n\
+  -s, --slice=       Planetlab slice\n\
+  -f, --file=                  file containing nodes\n\
+  -h, --help                 print this help\n\
+Report bugs to address@hidden \n\
+GNUnet home page: http://www.gnu.org/software/gnunet/ \n\
+General help using GNU software: http://www.gnu.org/gethelp/";
+
+
+
+import sys, os, urllib, xmlrpclib, socket, getopt
+
+user = None
+password = None
+slice = None
+filename = None
+
+# Parse command line arguments
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], "hu:p:s:f:", ["help", "user=", 
"password=", "slice=", "file="])
+except getopt.GetoptError, err:
+    # print help information and exit:
+    print str(err) # will print something like "option -a not recognized"
+    usage()
+    sys.exit(2)
+for o, a in opts:
+    if o in ("-h", "--help"):
+        usage()
+        sys.exit()
+    elif o in ("-u", "--user"):
+        user = a
+    elif o in ("-p", "--password"):
+        password = a
+    elif o in ("-s", "--slice"):
+        slice = a                                                 
+    elif o in ("-f", "--file"):
+        filename = a                                 
+    else:
+        assert False, "unhandled option"
+        
+        
+if ((user == None) or (user == None) or (user == None) or (user == None)):
+    usage ()
+    sys.exit (2)
+
+# PlanetLab Europe
+api_url = "https://www.planet-lab.eu/PLCAPI/";
+# Planetlab Central
+#api_url = https://www.planet-lab.org/PLCAPI/
+
+server = xmlrpclib.ServerProxy(api_url)
+
+# the auth struct
+auth = {}
+auth['Username'] = user
+auth['AuthString'] = password
+auth['AuthMethod'] = "password"
+
+nodes = list()
+
+slice_data = {}
+slice_data['name'] = slice
+
+
+# request nodes assigned to slice
+nodes = list()
+try:
+    fobj = open (filename, "r") 
+    for line in fobj: 
+        line = line.strip() 
+        print "Found node '" + line + "'"
+        nodes.append(line)
+        
+
+    fobj.close()
+except IOError:
+    print "File '" + filename + "' not found"
+    sys.exit(2)
+
+try:
+    res = server.AddSliceToNodes (auth, slice, nodes)
+    if (res == 1):
+        print "Added slice '" + slice+ "' to nodes :" + str(nodes)
+        sys.stdout.flush()
+except Exception as e:
+    print "Failed to delete node :" + str(e)
+
+
+       
\ No newline at end of file


Property changes on: gnunet-planetlab/planetlab-api/add_slice_to_nodes.py
___________________________________________________________________
Added: svn:executable
   + *

Modified: gnunet-planetlab/planetlab-api/delete_slice_from_nodes.py
===================================================================
--- gnunet-planetlab/planetlab-api/delete_slice_from_nodes.py   2012-08-03 
12:20:06 UTC (rev 23049)
+++ gnunet-planetlab/planetlab-api/delete_slice_from_nodes.py   2012-08-03 
12:33:35 UTC (rev 23050)
@@ -17,10 +17,10 @@
 
 import sys, os, urllib, xmlrpclib, socket, getopt
 
-user = ''
-password = ''
-slice = ''
-filename =''
+user = None
+password = None
+slice = None
+filename = None
 
 # Parse command line arguments
 
@@ -46,6 +46,9 @@
     else:
         assert False, "unhandled option"
         
+if ((user == None) or (user == None) or (user == None) or (user == None)):
+    usage ()
+    sys.exit (2)        
 
 # PlanetLab Europe
 api_url = "https://www.planet-lab.eu/PLCAPI/";
@@ -78,7 +81,8 @@
 
     fobj.close()
 except IOError:
-    print "File " + filename + " not found"
+    print "File '" + filename + "' not found"
+    sys.exit(2)
 
 try:
     res = server.DeleteSliceFromNodes (auth, slice, test)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]