Adding nitos_testbed_bootstrap.py
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 30 Oct 2014 18:11:24 +0000 (19:11 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 30 Oct 2014 18:11:24 +0000 (19:11 +0100)
examples/linux/nitos_testbed_bootstrap.py [new file with mode: 0644]
examples/omf/vod_exp/vod_experiment.py

diff --git a/examples/linux/nitos_testbed_bootstrap.py b/examples/linux/nitos_testbed_bootstrap.py
new file mode 100644 (file)
index 0000000..f4518df
--- /dev/null
@@ -0,0 +1,86 @@
+#\r
+#    NEPI, a framework to manage network experiments\r
+#    Copyright (C) 2014 INRIA\r
+#\r
+#    This program is free software: you can redistribute it and/or modify\r
+#    it under the terms of the GNU General Public License as published by\r
+#    the Free Software Foundation, either version 3 of the License, or\r
+#    (at your option) any later version.\r
+#\r
+#    This program is distributed in the hope that it will be useful,\r
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+#    GNU General Public License for more details.\r
+#\r
+#    You should have received a copy of the GNU General Public License\r
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+#\r
+# Author: Alina Quereilhac <alina.quereilhac@inria.fr>\r
+#         Maksym Gabielkov <maksym.gabielkovc@inria.fr>\r
+#\r
+\r
+## This is a maintenance script used to bootstrap the nodes from\r
+## Nitos testbed (NITLab) before running a OMF experiment using\r
+## Nitos nodes. This fixes the problem of Resource Controller \r
+## misbehaving by restarting it and it also loads the ath5k driver.\r
+\r
+# Example of how to run this experiment (replace with your information):\r
+#\r
+# $ cd <path-to-nepi>\r
+# python examples/linux/nitos_testbed_bootstrap.py -H "node025 node026" -U <NITOS-username> -i <ssh-key>\r
+\r
+\r
+from nepi.execution.ec import ExperimentController\r
+from optparse import OptionParser, SUPPRESS_HELP\r
+import os\r
+\r
+usage = ("usage: %prog -H <list-of-nitos-hosts> -u <nitos-username> -i <ssh-key> -g <nitos-gateway> -U <nitos-gateway-username>")\r
+\r
+parser = OptionParser(usage = usage)\r
+parser.add_option("-H", "--hosts", dest="hosts", \r
+        help="Space separated list of hosts", type="str")\r
+parser.add_option("-u", "--username", dest="username", \r
+        help="Username for the nitos hosts (usually root)", \r
+        type="str", default="root" )\r
+parser.add_option("-g", "--gateway", dest="gateway", \r
+        help="Nitos gateway hostname", \r
+        type="str", default="nitlab.inf.uth.gr")\r
+parser.add_option("-U", "--gateway-user", dest="gateway_username", \r
+        help="Nitos gateway username", \r
+        type="str", default="nitlab.inf.uth.gr")\r
+parser.add_option("-i", "--ssh-key", dest="ssh_key", \r
+        help="Path to private SSH key to be used for connection", \r
+        type="str")\r
+(options, args) = parser.parse_args()\r
+\r
+hosts = options.hosts.split(" ")\r
+username = options.username\r
+gateway = options.gateway\r
+gateway_username = options.gateway_username\r
+ssh_key = options.ssh_key\r
+\r
+apps = []\r
+\r
+ec = ExperimentController(exp_id="ath5k")\r
+\r
+for hostname in hosts:\r
+   node = ec.register_resource("LinuxNode")\r
+   ec.set(node, "username", username)\r
+   ec.set(node, "hostname", hostname)\r
+   ec.set(node, "gateway", gateway )\r
+   ec.set(node, "gatewayUser", gateway_username)\r
+   ec.set(node, "cleanExperiment", True)\r
+\r
+   app = ec.register_resource("LinuxApplication")\r
+   ec.set(app, "command", "modprobe ath5k && ip a | grep wlan0 && service omf_rc restart")\r
+   ec.register_connection(app, node)\r
+   \r
+   apps.append(app)\r
+\r
+ec.deploy()\r
+ec.wait_finished(apps)\r
+\r
+for app in apps:\r
+   print ec.trace(app, "stdout") \r
+\r
+\r
index b3459e8..7fd5e1a 100755 (executable)
@@ -39,16 +39,16 @@ ec = ExperimentController(exp_id)
 
 # Define SFA credentials
 
-slicename = 'ple.inria.lguevgeo'
-sfauser = 'ple.inria.lucia_guevgeozian_odizzio'
-sfaPrivateKey = '/user/lguevgeo/home/.sfi/lucia_guevgeozian_odizzio.pkey'
+slicename = 'ple.inria.nepi'
+sfauser = 'ple.inria.aquereilhac'
+sfaPrivateKey = '/home/alina/.sfi/aquereilhac.pkey'
 
 # Functions for nodes and ifaces registration
 
 def create_planetlab_node(ec, host):
     node = ec.register_resource("PlanetlabSfaNode")
     ec.set(node, "hostname", host)
-    ec.set(node, "username", "inria_lguevgeo")
+    ec.set(node, "username", "inria_nepi")
     ec.set(node, "sfauser", sfauser)
     ec.set(node, "sfaPrivateKey", sfaPrivateKey)
     ec.set(node, 'cleanExperiment', True)
@@ -90,7 +90,7 @@ client1 = create_omf_node(ec, 'zotacB3')
 client2 = create_omf_node(ec, 'zotacB5')
 client3 = create_omf_node(ec, 'zotacC1')
 client4 = create_omf_node(ec, 'zotacC3')
-client5 = create_omf_node(ec, 'zotacC4')
+client5 = create_omf_node(ec, 'zotacB2')
 
 omf_nodes = [wifi_center, client1, client2, client3, client4, client5]