3 # NEPI, a framework to manage network experiments
4 # Copyright (C) 2013 INRIA
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 2 as
8 # published by the Free Software Foundation;
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
20 from nepi.execution.ec import ExperimentController
21 from test_utils import skipIfAnyNotAlive
28 class LinuxUdpTestTestCase(unittest.TestCase):
30 self.fedora_host = "nepi2.pl.sophia.inria.fr"
31 self.fedora_user = "inria_nepi"
33 self.ubuntu_host = "roseval.pl.sophia.inria.fr"
34 self.ubuntu_user = "alina"
36 self.target = "nepi5.pl.sophia.inria.fr"
39 def t_rtt(self, user1, host1, user2, host2):
41 ec = ExperimentController(exp_id = "test-udptest-rtt")
43 node1 = ec.register_resource("linux::Node")
44 ec.set(node1, "hostname", host1)
45 ec.set(node1, "username", user1)
46 ec.set(node1, "cleanExperiment", True)
47 ec.set(node1, "cleanProcesses", True)
49 server = ec.register_resource("linux::UdpTest")
50 ec.set(server, "s", True)
51 ec.register_connection(server, node1)
53 node2 = ec.register_resource("linux::Node")
54 ec.set(node2, "hostname", host2)
55 ec.set(node2, "username", user2)
56 ec.set(node2, "cleanExperiment", True)
57 ec.set(node2, "cleanProcesses", True)
59 client = ec.register_resource("linux::UdpTest")
60 ec.set(client, "a", True)
61 ec.set(client, "target", host1)
62 ec.register_connection(client, node2)
66 ec.wait_finished(client)
68 stdout = ec.trace(client, "stderr")
69 self.assertTrue(stdout.find("10 trials with message size 64 Bytes.") > -1)
73 def test_rtt_fedora(self):
74 self.t_rtt(self.fedora_user, self.fedora_host, self.fedora_user,
77 def test_rtt_ubuntu(self):
78 self.t_rtt(self.ubuntu_user, self.ubuntu_host, self.fedora_user,
81 if __name__ == '__main__':