From: Alina Quereilhac Date: Mon, 30 Jun 2014 16:59:43 +0000 (+0200) Subject: Adding examples/linux/dce/dce_ccnpeek_application.py X-Git-Tag: nepi-3.1.0~4 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=f71157063eb66ff77c28f0522aa1d12ba1bb72b6 Adding examples/linux/dce/dce_ccnpeek_application.py --- diff --git a/examples/linux/dce/dce_ccnpeek_application.py b/examples/linux/dce/dce_ccnpeek_application.py new file mode 100644 index 00000000..014eb6e8 --- /dev/null +++ b/examples/linux/dce/dce_ccnpeek_application.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# +# NEPI, a framework to manage network experiments +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author: Alina Quereilhac + +from nepi.execution.ec import ExperimentController + +def add_ns3_node(ec, simu): + node = ec.register_resource("ns3::Node") + ec.register_connection(node, simu) + + ipv4 = ec.register_resource("ns3::Ipv4L3Protocol") + ec.register_connection(node, ipv4) + + arp = ec.register_resource("ns3::ArpL3Protocol") + ec.register_connection(node, arp) + + icmp = ec.register_resource("ns3::Icmpv4L4Protocol") + ec.register_connection(node, icmp) + + udp = ec.register_resource("ns3::UdpL4Protocol") + ec.register_connection(node, udp) + + tcp = ec.register_resource("ns3::TcpL4Protocol") + ec.register_connection(node, tcp) + + return node + +ec = ExperimentController(exp_id = "dce-ccnpeek-app") + +node = ec.register_resource("LinuxNode") +ec.set(node, "hostname", "localhost") +ec.set(node, "cleanProcesses", True) +#ec.set(node, "cleanHome", True) + +simu = ec.register_resource("LinuxNS3Simulation") +ec.register_connection(simu, node) + +nsnode = add_ns3_node(ec, simu) + +### create applications +ccnd = ec.register_resource("ns3::LinuxDceCCND") +ec.set (ccnd, "stackSize", 1<<20) +ec.set (ccnd, "StartTime", "1s") +ec.register_connection(ccnd, nsnode) + +ccnpoke = ec.register_resource("ns3::LinuxDceCCNPoke") +ec.set (ccnpoke, "contentName", "ccnx:/chunk0") +ec.set (ccnpoke, "content", "DATA") +ec.set (ccnpoke, "stackSize", 1<<20) +ec.set (ccnpoke, "StartTime", "2s") +ec.register_connection(ccnpoke, nsnode) + +ccnpeek = ec.register_resource("ns3::LinuxDceCCNPeek") +ec.set (ccnpeek, "contentName", "ccnx:/chunk0") +ec.set (ccnpeek, "stackSize", 1<<20) +ec.set (ccnpeek, "StartTime", "4s") +ec.set (ccnpeek, "StopTime", "20s") +ec.register_connection(ccnpeek, nsnode) + +ec.deploy() + +ec.wait_finished([ccnpeek]) + +stdout = ec.trace(ccnpeek, "stdout") + +ec.shutdown() + +print "PEEK received", stdout diff --git a/examples/linux/dce/dce_ping_application.py b/examples/linux/dce/dce_ping_application.py index 07ebcbb7..c4d137af 100644 --- a/examples/linux/dce/dce_ping_application.py +++ b/examples/linux/dce/dce_ping_application.py @@ -52,7 +52,7 @@ def add_point2point_device(ec, node, ip, prefix): return dev -ec = ExperimentController(exp_id = "dce-custom-ping") +ec = ExperimentController(exp_id = "dce-ping-app") node = ec.register_resource("LinuxNode") ec.set(node, "hostname", "localhost") @@ -60,9 +60,6 @@ ec.set(node, "cleanProcesses", True) #ec.set(node, "cleanHome", True) simu = ec.register_resource("LinuxNS3Simulation") -ec.set(simu, "verbose", True) -ec.set(simu, "nsLog", "DceApplication") -ec.set(simu, "enableDump", True) ec.register_connection(simu, node) nsnode1 = add_ns3_node(ec, simu)