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.resource import ResourceState, ResourceAction
21 from nepi.execution.ec import ExperimentController
22 from test_utils import skipIfAnyNotAlive
29 class LinuxCCNPeekTestCase(unittest.TestCase):
31 #self.fedora_host = "nepi2.pl.sophia.inria.fr"
32 #self.fedora_user = "inria_nepi"
33 self.fedora_identity = "%s/.ssh/id_rsa" % (os.environ['HOME'])
35 self.fedora_host = "mimas.inria.fr"
36 self.fedora_user = "aquereil"
39 def test_ccnpeek(self):
40 ec = ExperimentController(exp_id = "test-linux-ccncat")
42 node = ec.register_resource("linux::Node")
43 ec.set(node, "hostname", self.fedora_host)
44 ec.set(node, "username", self.fedora_user)
45 ec.set(node, "identity", self.fedora_identity)
46 #ec.set(node, "cleanProcesses", True)
47 #ec.set(node, "cleanExperiment", True)
49 ccnd = ec.register_resource("linux::CCND")
50 ec.register_connection(ccnd, node)
52 # REPO file is in test/resources/linux/ns3/ccn/repoFile1
53 repofile = os.path.join(
54 os.path.dirname(os.path.realpath(__file__)),
55 "..", "ns3", "ccn", "repoFile1")
57 ## Register a repository in node 1
58 ccnr = ec.register_resource("linux::CCNR")
59 ec.set(ccnr, "repoFile1", repofile)
60 ec.register_connection(ccnr, ccnd)
62 ccncat = ec.register_resource("linux::CCNCat")
63 ec.set(ccncat, "contentName", "ccnx:/test/bunny.ts")
64 ec.register_connection(ccncat, ccnd)
68 ec.wait_finished(ccncat)
71 stdout = ec.trace(ccncat, "stdout")
72 self.assertTrue(len(stdout) == expected , stdout)
76 if __name__ == '__main__':