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 skipIfNotAlive, skipInteractive
28 class LinuxFIBEntryTestCase(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 = "nepi"
36 self.target = "nepi5.pl.sophia.inria.fr"
39 def t_traces(self, host, user):
41 ec = ExperimentController(exp_id = "test-fib-traces")
43 node1 = ec.register_resource("linux::Node")
44 ec.set(node1, "hostname", host)
45 ec.set(node1, "username", user)
46 ec.set(node1, "cleanExperiment", True)
47 ec.set(node1, "cleanProcesses", True)
49 ccnd1 = ec.register_resource("linux::CCND")
50 ec.register_connection(ccnd1, node1)
52 entry1 = ec.register_resource("linux::FIBEntry")
53 ec.set(entry1, "host", self.target)
54 ec.enable_trace(entry1, "ping")
55 ec.enable_trace(entry1, "mtr")
56 ec.register_connection(entry1, ccnd1)
58 node2 = ec.register_resource("linux::Node")
59 ec.set(node2, "hostname", self.target)
60 ec.set(node2, "username", self.fedora_user)
61 ec.set(node2, "cleanExperiment", True)
62 ec.set(node2, "cleanProcesses", True)
64 ccnd2 = ec.register_resource("linux::CCND")
65 ec.register_connection(ccnd2, node2)
67 entry2 = ec.register_resource("linux::FIBEntry")
68 ec.set(entry2, "host", host)
69 ec.register_connection(entry2, ccnd2)
73 ec.wait_started([ccnd1, ccnd2])
75 stdout = ec.trace(entry1, "ping")
76 expected = "icmp_seq=1"
77 self.assertTrue(stdout.find(expected) > -1)
79 stdout = ec.trace(entry1, "mtr")
81 self.assertTrue(stdout.find(expected) > -1)
85 def test_traces_fedora(self):
86 self.t_traces(self.fedora_host, self.fedora_user)
88 def test_traces_ubuntu(self):
89 self.t_traces(self.ubuntu_host, self.ubuntu_user)
91 if __name__ == '__main__':