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-ccnpeek")
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 peek = ec.register_resource("linux::CCNPeek")
53 ec.set(peek, "contentName", "ccnx:/chunk0")
54 ec.register_connection(peek, ccnd)
56 poke = ec.register_resource("linux::CCNPoke")
57 ec.set(poke, "contentName", "ccnx:/chunk0")
58 ec.set(poke, "content", "DATA")
59 ec.register_connection(poke, ccnd)
61 ec.register_condition(peek, ResourceAction.START, poke,
62 ResourceState.STARTED)
66 ec.wait_finished(peek)
68 stdout = ec.trace(peek, "stdout")
71 self.assertTrue(stdout.find(expected) > -1)
75 if __name__ == '__main__':