X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=test%2Fresources%2Fplanetlab%2Ftun.py;h=d384af3e2dab90a0a88b100d77b1f79f1982454e;hb=1d2350d56f314a6e3de43517a66f7e2f48128d44;hp=07214c5a88be9f6008b1fb69719f5394c72675af;hpb=7f6a711e6d4a245a1f4b104ab9e999af484a8d69;p=nepi.git diff --git a/test/resources/planetlab/tun.py b/test/resources/planetlab/tun.py index 07214c5a..d384af3e 100755 --- a/test/resources/planetlab/tun.py +++ b/test/resources/planetlab/tun.py @@ -4,9 +4,8 @@ # Copyright (C) 2013 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. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,27 +27,34 @@ import unittest class PlanetlabTunTestCase(unittest.TestCase): def setUp(self): - self.host = "nepi2.pl.sophia.inria.fr" + self.host = "planetlab2.upc.es" self.user = "inria_nepi" + self.identity = "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME']) + self.netblock = "192.168.3" + #self.host = "nepi2.pl.sophia.inria.fr" + #self.user = "inria_nepi" + #self.identity = None + #self.netblock = "192.168.1" @skipIfNotAlive - def t_tun_create(self, host, user): + def t_tun_create(self, host, user, identity): - ec = ExperimentController(exp_id = "test-un-create") + ec = ExperimentController(exp_id="test-un-create") - node = ec.register_resource("PlanetlabNode") + node = ec.register_resource("planetlab::Node") ec.set(node, "hostname", host) ec.set(node, "username", user) - ec.set(node, "cleanHome", True) + ec.set(node, "identity", identity) + ec.set(node, "cleanExperiment", True) ec.set(node, "cleanProcesses", True) - tun = ec.register_resource("PlanetlabTun") - ec.set(tun, "ip4", "192.168.1.1") - ec.set(tun, "prefix4", 24) + tun = ec.register_resource("planetlab::Tun") + ec.set(tun, "ip", "%s.1" % self.netblock) + ec.set(tun, "prefix", "24") ec.register_connection(tun, node) - app = ec.register_resource("LinuxApplication") - cmd = "ping -c3 192.168.1.1" + app = ec.register_resource("linux::Application") + cmd = "ping -c3 %s.1" % self.netblock ec.set(app, "command", cmd) ec.register_connection(app, node) @@ -56,7 +62,7 @@ class PlanetlabTunTestCase(unittest.TestCase): ec.wait_finished(app) - ping = ec.trace(app, 'stdout') + ping = ec.trace(app, "stdout") expected = """3 packets transmitted, 3 received, 0% packet loss""" self.assertTrue(ping.find(expected) > -1) @@ -66,7 +72,7 @@ class PlanetlabTunTestCase(unittest.TestCase): ec.shutdown() def test_tun_create(self): - self.t_tun_create(self.host, self.user) + self.t_tun_create(self.host, self.user, self.identity) if __name__ == '__main__': unittest.main()