gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22618 - in gnunet-planetlab: . gnunet_automatic_deployment


From: gnunet
Subject: [GNUnet-SVN] r22618 - in gnunet-planetlab: . gnunet_automatic_deployment gplmt gplmt/contrib
Date: Thu, 12 Jul 2012 18:06:09 +0200

Author: wachs
Date: 2012-07-12 18:06:09 +0200 (Thu, 12 Jul 2012)
New Revision: 22618

Added:
   gnunet-planetlab/gplmt/
   gnunet-planetlab/gplmt/Configuration.py
   gnunet-planetlab/gplmt/Nodes.py
   gnunet-planetlab/gplmt/Tasks.py
   gnunet-planetlab/gplmt/Util.py
   gnunet-planetlab/gplmt/contrib/
   gnunet-planetlab/gplmt/contrib/nodes
   gnunet-planetlab/gplmt/contrib/tasks.conf
   gnunet-planetlab/gplmt/contrib/tasks.xml
   gnunet-planetlab/gplmt/contrib/test.conf
   gnunet-planetlab/gplmt/planetlab.py
Modified:
   gnunet-planetlab/gnunet_automatic_deployment/deploy_gnunet.sh
Log:
- Basics for gnunet planetlab largescale management tool

Modified: gnunet-planetlab/gnunet_automatic_deployment/deploy_gnunet.sh
===================================================================
--- gnunet-planetlab/gnunet_automatic_deployment/deploy_gnunet.sh       
2012-07-12 14:16:24 UTC (rev 22617)
+++ gnunet-planetlab/gnunet_automatic_deployment/deploy_gnunet.sh       
2012-07-12 16:06:09 UTC (rev 22618)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 ###
 # Change the following lines 
 ###
@@ -38,6 +38,9 @@
 
 
 echo "Determenining working nodes ..."
+
+#pssh -l tum_dht_testing -h nodes.txt -P date
+#pssh -O StrictHostKeychecking=no -h $nodes_file -P date
 pssh -O StrictHostKeychecking=no -p 25 -t 30 -v -l tum_dht_testing -h 
$nodes_file -P sudo date > $working_nodes_file
 grep SUCCESS $working_nodes_file | awk '{print $4}' > 
$working_nodes_filtered_file
 count_working=`cat $working_nodes_filtered_file | wc -l`
@@ -45,7 +48,6 @@
 echo "Found $count_working working nodes out of $count_total"
 
 
-
 echo "Cleaning up nodes"
 echo "Cleaning up nodes" >> planetlab-automation.log
 $cmd_pssh "sudo rm -rf /home/tum_dht_testing/deploy"

Added: gnunet-planetlab/gplmt/Configuration.py
===================================================================
--- gnunet-planetlab/gplmt/Configuration.py                             (rev 0)
+++ gnunet-planetlab/gplmt/Configuration.py     2012-07-12 16:06:09 UTC (rev 
22618)
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Configuration
+
+import ConfigParser
+
+class Configuration:
+    def __init__(self, filename, logger):
+        assert (None != logger)
+        self.filename = filename
+        self.logger = logger
+        self.slicename = ""
+        self.taskfile = ""
+        self.nodesfile = ""
+    def load (self):        
+        self.logger.log ("Loading configuration file '" + self.filename + "'")
+
+        config = ConfigParser.RawConfigParser()
+        try:
+            config.read(self.filename)
+        except ConfigParser.Error as e:
+            print "Error parsing configuration: " + str (e)
+            return False
+        
+        # required values
+        try: 
+            self.slicename = config.get("planetlab", "slice")
+        except ConfigParser.NoOptionError as e:
+            print "Error parsing configuration: " + str (e)
+            return False
+        # optional values
+        try: 
+            self.taskfile = config.get("planetlab", "tasks")
+            self.nodesfile = config.get("planetlab", "nodes")
+        except ConfigParser.NoOptionError as e:
+            pass
+        
+        return True
+        
\ No newline at end of file

Added: gnunet-planetlab/gplmt/Nodes.py
===================================================================
--- gnunet-planetlab/gplmt/Nodes.py                             (rev 0)
+++ gnunet-planetlab/gplmt/Nodes.py     2012-07-12 16:06:09 UTC (rev 22618)
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Tasks
+
+class Nodes:
+    def __init__(self, filename, logger):
+        assert (None != logger)
+        self.logger = logger
+        self.filename = filename
+        self.nodes = list ()
+    def load (self):        
+        self.logger.log ("Loading nodes file '" + self.filename + "'")
+        try:
+            fobj = open (self.filename, "r") 
+            for line in fobj: 
+                line = line.strip() 
+                self.logger.log ("Found node '" + line + "'")
+                self.nodes.append(line)
+            fobj.close()
+        except IOError:
+            print "File " + self.filename + " not found"
+            return False
+        self.logger.log ("Loaded " + str(len(self.nodes)) + " nodes")
+        return True

Added: gnunet-planetlab/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/Tasks.py                             (rev 0)
+++ gnunet-planetlab/gplmt/Tasks.py     2012-07-12 16:06:09 UTC (rev 22618)
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Nodes
+
+import xml.dom.minidom;
+import xml.parsers.expat;
+from xml.dom.minidom import parse, parseString
+import ConfigParser
+
+
+class Tasks:
+    def __init__(self, filename, logger):
+        assert (None != logger)
+        self.logger = logger
+        self.filename = filename
+    def load (self):        
+        self.logger.log ("Loading nodes file '" + self.filename + "'")
+        
+        config = ConfigParser.RawConfigParser()
+        try:
+            config.read(self.filename)
+        except ConfigParser.Error as e:
+            print "Error parsing configuration: " + str (e)
+            return False
+        
+        for i in config:
+            print i
+        return True
+#        try:
+#            dom = xml.dom.minidom.parse (self.filename)
+#        except ExpatError as e:
+#            print e
+                
+#        try:
+#            fobj = open (self.filename, "r") 
+#            for line in fobj: 
+#                line = line.strip() 
+#            fobj.close()
+#        except IOError:
+#            print "File " + self.filename + " not found"
+#            return False
+

Added: gnunet-planetlab/gplmt/Util.py
===================================================================
--- gnunet-planetlab/gplmt/Util.py                              (rev 0)
+++ gnunet-planetlab/gplmt/Util.py      2012-07-12 16:06:09 UTC (rev 22618)
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Utilities
+
+class Logger:
+
+    def __init__(self, verbose):
+        if (True == verbose):
+            self.verbose = True
+        else:
+            self.verbose = False
+    def log (self, message):
+        global main
+        if (True == self.verbose):
+            print (message)
\ No newline at end of file

Added: gnunet-planetlab/gplmt/contrib/nodes
===================================================================
--- gnunet-planetlab/gplmt/contrib/nodes                                (rev 0)
+++ gnunet-planetlab/gplmt/contrib/nodes        2012-07-12 16:06:09 UTC (rev 
22618)
@@ -0,0 +1,3 @@
+dmmuy 2
+dmmy
+asddas
\ No newline at end of file

Added: gnunet-planetlab/gplmt/contrib/tasks.conf
===================================================================
--- gnunet-planetlab/gplmt/contrib/tasks.conf                           (rev 0)
+++ gnunet-planetlab/gplmt/contrib/tasks.conf   2012-07-12 16:06:09 UTC (rev 
22618)
@@ -0,0 +1,8 @@
+[run cat]
+command = date
+args = 
+returncode = 0
+output = 
+stop_on_fail = 1 
+
+[run date]

Added: gnunet-planetlab/gplmt/contrib/tasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/tasks.xml                            (rev 0)
+++ gnunet-planetlab/gplmt/contrib/tasks.xml    2012-07-12 16:06:09 UTC (rev 
22618)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<taskfile> 
+    <task> 
+        <type typ="str">run</type> 
+        <command typ="str">cat</command> 
+        <arguments typ="str"></arguments> 
+        <result>
+                       <returncode typ="int">0</returncode>
+                       <output></output>
+                       <stop_on_fail typ="int">0</stop_on_fail>
+               <result>                        
+    </task> 
+</taskfile>

Added: gnunet-planetlab/gplmt/contrib/test.conf
===================================================================
--- gnunet-planetlab/gplmt/contrib/test.conf                            (rev 0)
+++ gnunet-planetlab/gplmt/contrib/test.conf    2012-07-12 16:06:09 UTC (rev 
22618)
@@ -0,0 +1,4 @@
+[planetlab]
+slice = tum_dht_testing
+nodes = nodes
+tasks = tasks.conf
\ No newline at end of file

Added: gnunet-planetlab/gplmt/planetlab.py
===================================================================
--- gnunet-planetlab/gplmt/planetlab.py                         (rev 0)
+++ gnunet-planetlab/gplmt/planetlab.py 2012-07-12 16:06:09 UTC (rev 22618)
@@ -0,0 +1,132 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Main file
+
+import getopt;
+import sys;
+import Util;
+import Configuration;
+import Nodes;
+import Tasks;
+
+
+def main():
+    global main
+    main = Main ()
+# Parse command line arguments
+    
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hvc:n:t:", ["help", 
"config=", "nodes=", "tasks="])
+    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 == "-v":
+            main.verbose = True
+        elif o in ("-h", "--help"):
+            usage()
+            sys.exit()
+        elif o in ("-c", "--config"):
+            main.config_file = a      
+        elif o in ("-n", "--nodes"):
+            main.nodes_file = a      
+        elif o in ("-t", "--tasks"):
+            main.tasks_file = a                                                
+        else:
+            assert False, "unhandled option"
+
+    if (main.verbose == True):
+        main.logger = Util.Logger (True)
+    else:
+        main.logger = Util.Logger (False)
+        
+    if (main.config_file == ""):
+        print "No configuration file given!\n"
+        usage()
+        sys.exit(2)                      
+        
+# Load configuration file
+    configuration = Configuration.Configuration (main.config_file, 
main.logger);
+    if (configuration.load() == False):
+        sys.exit(2)
+
+
+    
+    # command line beats configuration
+    if (main.nodes_file == ""):
+        if (configuration.nodesfile != ""):
+            main.nodes_file = configuration.nodesfile
+        else: 
+            print "No nodes file given!\n"
+            usage()
+            sys.exit(2)
+    if (main.tasks_file == ""):
+        if (configuration.taskfile != ""):
+            main.tasks_file = configuration.taskfile
+        else: 
+            print "No tasks file given!\n"
+            usage()
+            sys.exit(2)            
+
+# Load hosts files
+    nodes = Nodes.Nodes (main.nodes_file, main.logger);
+    if (nodes.load() == False):
+        sys.exit(2)
+
+# Load actions file
+    tasks = Tasks.Tasks (main.tasks_file, main.logger);
+    if (tasks.load() == False):
+        sys.exit(2)        
+
+# Start parallel ssh execution
+
+# Clean up
+
+
+# ---------------------------------------------------
+
+def usage():
+    print "GNUnet PlanetLab deployment and automation toolset\n\
+Arguments mandatory for long options are also mandatory for short options.\n\
+  -c, --config=FILENAME      use configuration file FILENAME\n\
+  -n, --nodes=FILENAME       use node file FILENAME\n\
+  -t, --tasks=FILENAME       use tasks file FILENAME\n\
+  -h, --help                 print this help\n\
+  -V, --verbose              be verbose \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/";
+
+class Main:
+    verbose = False;
+    config_file = "";
+    nodes_file = "";
+    tasks_file = "";
+    logger = None;
+    def __init__(self):
+        self.verbose = False;
+        
+if __name__ == "__main__":
+    main() 
\ No newline at end of file


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




reply via email to

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