From: Alina Quereilhac Date: Thu, 30 Oct 2014 18:11:24 +0000 (+0100) Subject: Adding nitos_testbed_bootstrap.py X-Git-Tag: nepi-3.2.0~61 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=bc5d40079447db05f521c9fdb30e0f437edeba0e Adding nitos_testbed_bootstrap.py --- diff --git a/examples/linux/nitos_testbed_bootstrap.py b/examples/linux/nitos_testbed_bootstrap.py new file mode 100644 index 00000000..f4518df8 --- /dev/null +++ b/examples/linux/nitos_testbed_bootstrap.py @@ -0,0 +1,86 @@ +# +# NEPI, a framework to manage network experiments +# Copyright (C) 2014 INRIA +# +# This program 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see . +# +# Author: Alina Quereilhac +# Maksym Gabielkov +# + +## This is a maintenance script used to bootstrap the nodes from +## Nitos testbed (NITLab) before running a OMF experiment using +## Nitos nodes. This fixes the problem of Resource Controller +## misbehaving by restarting it and it also loads the ath5k driver. + +# Example of how to run this experiment (replace with your information): +# +# $ cd +# python examples/linux/nitos_testbed_bootstrap.py -H "node025 node026" -U -i + + +from nepi.execution.ec import ExperimentController +from optparse import OptionParser, SUPPRESS_HELP +import os + +usage = ("usage: %prog -H -u -i -g -U ") + +parser = OptionParser(usage = usage) +parser.add_option("-H", "--hosts", dest="hosts", + help="Space separated list of hosts", type="str") +parser.add_option("-u", "--username", dest="username", + help="Username for the nitos hosts (usually root)", + type="str", default="root" ) +parser.add_option("-g", "--gateway", dest="gateway", + help="Nitos gateway hostname", + type="str", default="nitlab.inf.uth.gr") +parser.add_option("-U", "--gateway-user", dest="gateway_username", + help="Nitos gateway username", + type="str", default="nitlab.inf.uth.gr") +parser.add_option("-i", "--ssh-key", dest="ssh_key", + help="Path to private SSH key to be used for connection", + type="str") +(options, args) = parser.parse_args() + +hosts = options.hosts.split(" ") +username = options.username +gateway = options.gateway +gateway_username = options.gateway_username +ssh_key = options.ssh_key + +apps = [] + +ec = ExperimentController(exp_id="ath5k") + +for hostname in hosts: + node = ec.register_resource("LinuxNode") + ec.set(node, "username", username) + ec.set(node, "hostname", hostname) + ec.set(node, "gateway", gateway ) + ec.set(node, "gatewayUser", gateway_username) + ec.set(node, "cleanExperiment", True) + + app = ec.register_resource("LinuxApplication") + ec.set(app, "command", "modprobe ath5k && ip a | grep wlan0 && service omf_rc restart") + ec.register_connection(app, node) + + apps.append(app) + +ec.deploy() +ec.wait_finished(apps) + +for app in apps: + print ec.trace(app, "stdout") + + diff --git a/examples/omf/vod_exp/vod_experiment.py b/examples/omf/vod_exp/vod_experiment.py index b3459e8e..7fd5e1a0 100755 --- a/examples/omf/vod_exp/vod_experiment.py +++ b/examples/omf/vod_exp/vod_experiment.py @@ -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]