예제 #1
0
        # Bring down MCN
        self.failNode(mostConnectedNode)

        # MCN is down for 2 minutes
        time.sleep(int(self.options.arguments.waitTime))

        # Bring MCN back up
        self.recoverNode(mostConnectedNode)

        # Restart pings
        if self.options.nPings != 0:
            for nodeToPing in self.pingedDict[mostConnectedNode]:
                NDNPingClient.ping(mostConnectedNode, nodeToPing,
                                   self.PING_COLLECTION_TIME_AFTER_RECOVERY)

            # Collect pings for more seconds after MCN is up
            time.sleep(self.PING_COLLECTION_TIME_AFTER_RECOVERY)
        else:
            self.checkConvergence()

    @staticmethod
    def parseArguments(parser):
        parser.add_argument(
            "--wait-time",
            dest="waitTime",
            default="120",
            help="[Experiment] Generic wait time for experiment use")


Experiment.register("mcn-failure", MCNFailureExperiment)
예제 #2
0
            statusRouter = host.cmd("nfd-status -b | grep /ndn/edu/%C1.Router/cs/")
            statusPrefix = host.cmd("nfd-status -b | grep /ndn/edu/")
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                host.cmd("ft-consumer-fixed --cwnd=50 /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)

Experiment.register("cc_fixed_cwnd", CCFixedCwndExperiment)
예제 #3
0
# along with Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.

from ndn.experiments.experiment import Experiment

import time


class PingallExperiment(Experiment):
    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
        print "Using {} traffic".format(self.options.pctTraffic)

    def setup(self):
        if self.options.nPings != 0:
            Experiment.setup(self)

    def run(self):
        if self.options.nPings == 0:
            return

        self.startPctPings()

        # For pingall experiment sleep for the number of pings + some offset
        time.sleep(self.options.nPings + self.COLLECTION_PERIOD_BUFFER)


Experiment.register("pingall", PingallExperiment)
예제 #4
0
파일: cc_aimd.py 프로젝트: imsure/ndn_cc
            statusRouter = host.cmd("nfd-status -b | grep /ndn/edu/%C1.Router/cs/")
            statusPrefix = host.cmd("nfd-status -b | grep /ndn/edu/")
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                host.cmd("ft-consumer-aimd -v /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)

Experiment.register("cc_aimd", CCAimdExperiment)
예제 #5
0
	  if host.name == 'a':
	      res3 = host.cmd("awk '/eth0/ { split($1,a,\"=\");print a[2]}' %s " % tmpfile)
	      # somewhere someone adds trailing \r\n to the output, throwing them away
	      if '\r' in res3:
		faceid = res3.split('\\')[0]
	      else:
		faceid = res3
	      print("Printing eth0 faceID: %s" % faceid)
	      host.cmd("nfdc register ndn:/snt/sedan/state %s &>> %s" % (faceid,tmpfile) )
	      time.sleep(0.5)
	      host.cmd("nfdc register ndn:/snt/sedan %s &>> %s " % (faceid,tmpfile) )
	      time.sleep(0.5)
	      host.cmd("nfdc register ndn:/snt %s &>> %s" % (faceid,tmpfile) )
	      time.sleep(0.5)
	      host.cmd("nfd-status &>> %s" % tmpfile)

    def run(self):
        # It is extremely important that ndnpook on node b runs before ndnpeek is launched on a!!! Otherwise the Interest goes too fast that
        # it will be seen on the switch but not by the ndnpook on node b.
        for host in list(reversed((self.net.hosts))):
          print 'Starting demo application on' + host.name
	  if host.name == 'a':
	      host.cmd("ndnpeek -p ndn:/snt/sedan/state/signorello.pdf > packetPayload.txt")
	  elif host.name == 'b':
	      host.cmd("echo 'Hello world' | ndnpoke -w 30000 ndn:/snt/sedan/state/signorello.pdf &")
          # Watch out not to remove the following sleep, otherwise the packet sent out by a and processed by s1 is going to be so fast that b
          # will not be ready to receive it
          time.sleep(1)

Experiment.register("P4_NDN_experiment", P4NdnExperiment)
#
# Mini-NDN 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 Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.

from ndn.experiments.experiment import Experiment

import time

class PingallExperiment(Experiment):

    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
        self.pctTraffic = float(args["pctTraffic"])
        print "Using %f traffic" % self.pctTraffic

    def run(self):
        self.startPctPings()

        # For pingall experiment sleep for the number of pings + some offset
        time.sleep(self.nPings + self.COLLECTION_PERIOD_BUFFER)

Experiment.register("pingall", PingallExperiment)
예제 #7
0
    def run(self):
        # Tests are supposed to be run from host a
        a = self.net['a']
        a.cmd("cd ~/integration-tests")

        tests = [
            #"test_linkfail",
            #"test_hub_discovery",
            #"test_interest_loop",
            #"test_interest_aggregation",
            #"test_localhost_scope",
            #"test_multicast_strategy",
            #"test_multicast",
            #"test_tcp_udp_tunnel",
            #"test_localhop",
            "test_unixface",
            "test_ndnpeekpoke",
            "test_route_expiration",
            #"test_nfdc",
            "test_ndnping",
            "test_cs_freshness",
            "test_nrd",
            "test_fib_matching",
            #"test_remote_register",
            "test_ndntraffic"
        ]
        for test in tests:
            a.cmd("./run_tests.py", test, verbose=True)

Experiment.register("integration-tests", IntegrationTests)
예제 #8
0
        for host in self.net.hosts:
            Nfdc.setStrategy(host, self.syncPrefix, "multicast")
            self.registerRouteToAllNeighbors(host)

        print("Starting psync-full-sync on all the nodes")
        for host in self.net.hosts:
            host.cmd("export NDN_LOG=examples.FullSyncApp=INFO")
            host.cmd("psync-full-sync {} {} {} {} &> psync.logs &"
                     .format(self.syncPrefix, host.name, self.numUserPrefixesPerNode,
                             self.maxUpdatesPerUserPrefixPerNode))

        print("Sleeping 5 minutes for convergence")
        # Estimated time for 4 node default topology
        time.sleep(300)

        totalUpdates = int(host.cmd("grep -r Update {}/*/psync.logs | wc -l"
                                    .format(self.options.workDir)))

        expectedUpdates = (self.maxUpdatesPerUserPrefixPerNode *
                          len(self.net.hosts) * (len(self.net.hosts) - 1) *
                          self.numUserPrefixesPerNode)

        if totalUpdates == expectedUpdates:
            print("PSync full sync has successfully converged.")
        else:
            print("PSync full sync convergence was not successful. Exiting...")
            self.net.stop()
            sys.exit(1)

Experiment.register("psync-full", PSyncFull)
예제 #9
0
    def setup(self):
        # print("Setting UNIX Socket forwawrding for simulator clients")
        for host in self.net.hosts:
            host_str = str(host).lower()

            if host_str.startswith("plc"):
                host.cmd(
                    'socat TCP4-LISTEN:8000,fork,reuseaddr UNIX-CONNECT:/tmp/aqua/sim &'
                )
                res_socat = host.cmd('printf $!')
                host.cmd(
                    'python /vagrant/icn/plc/main.py {0} > /tmp/aqua/ndn-{0}.log 2>&1 &'
                    .format(host_str))

                print "Host '{}' SOCAT PID '{}' PLC PID '{}'".format(
                    host_str, res_socat, host.cmd('printf $!'))

            if host_str.startswith("hmi"):
                host.cmd(
                    'python /vagrant/icn/hmi/main.py {1} > /tmp/aqua/ndn-{0}.log 2>&1 &'
                    .format(host_str, "normal"))
                print "Host '{}' HMI PID '{}'".format(host_str,
                                                      host.cmd('printf $!'))

    def run(self):
        for host in self.net.hosts:
            host.cmd("nfdc status report > status.txt")


Experiment.register("aqua-complex", AquaComplex)
        nNodesRemainingToFail = len(self.net.hosts)

        # Fail and recover each node
        for host in self.net.hosts:
            # Fail the node
            self.failNode(host)

            # Stay in failure state for FAILURE_INTERVAL seconds
            time.sleep(self.FAILURE_INTERVAL)

            # Bring the node back up
            start_time = time.time()
            self.recoverNode(host)
            recovery_time = int(time.time() - start_time)

            # Number of pings required to reach the end of the test
            nNodesRemainingToFail -= 1
            nPings = ((self.RECOVERY_INTERVAL - recovery_time) +
                      nNodesRemainingToFail*(self.FAILURE_INTERVAL + self.RECOVERY_INTERVAL))

            print("Scheduling with %s remaining pings" % nPings)

            # Restart pings
            for nodeToPing in self.pingedDict[host]:
                self.ping(host, nodeToPing, nPings)

            time.sleep(self.RECOVERY_INTERVAL - recovery_time)

Experiment.register("multiple-failure", MultipleFailureExperiment)
예제 #11
0
# If not, see <http://www.gnu.org/licenses/>.

from ndn.experiments.experiment import Experiment
from ndn.experiments.mcn_failure_experiment import MCNFailureExperiment

import time

class MCNFailureConvergenceExperiment(MCNFailureExperiment):

    def __init__(self, args):
        MCNFailureExperiment.__init__(self, args)

    def run(self):
        mostConnectedNode = self.getMostConnectedNode()

        # After the pings are scheduled, collect pings for 1 minute
        time.sleep(self.PING_COLLECTION_TIME_BEFORE_FAILURE)

        # Bring down MCN
        self.failNode(mostConnectedNode)

        # MCN is down for 2 minutes
        time.sleep(120)

        # Bring MCN back up
        self.recoverNode(mostConnectedNode)

        self.checkConvergence()

Experiment.register("mcn-failure-convergence", MCNFailureConvergenceExperiment)
예제 #12
0
        rv.cmd("NDN_LOG=kite.*=ALL kiterv %s > rv.out 2>&1 &" % rvPrefix)
        time.sleep(1)
        producer.cmd(
            "NDN_LOG=kite.*=ALL kiteproducer -r %s -p %s > producer.out 2>&1 &"
            % (rvPrefix, producerSuffix))
        time.sleep(1)

        seq = 0
        minRtt = 0.2

        self.attach(producer, f3)
        time.sleep(1)
        self.update(producer)
        time.sleep(minRtt)  # wait for update to finish
        consumer.cmd("ndnpeek %s/%d -v -w 2000 >> peek.out 2>&1 &" %
                     (rvPrefix + producerSuffix, seq))  # single path
        seq += 1
        time.sleep(minRtt)  # wait for at least one rtt

        self.attach(producer, f2)
        time.sleep(1)
        self.update(producer)
        time.sleep(minRtt)
        consumer.cmd("ndnpeek %s/%d -v -w 2000 >> peek.out 2>&1 &" %
                     (rvPrefix + producerSuffix, seq))  # single path
        seq += 1
        time.sleep(minRtt)


Experiment.register("kite-simple", SimpleExperiment)
예제 #13
0
파일: cc_reno.py 프로젝트: imsure/ndn_cc
            statusRouter = host.cmd("nfd-status -b | grep /ndn/edu/%C1.Router/cs/")
            statusPrefix = host.cmd("nfd-status -b | grep /ndn/edu/")
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                host.cmd("ft-consumer-reno -v -o /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)

Experiment.register("cc_reno", CCRenoExperiment)
예제 #14
0
      Generate C2 data info.
      """
        if (nPoolSize % nPayloadQtd != 0):
            self.log(
                'randomDataInfoFromPool',
                'Payload times not evenly distributed ' + 'poolSize=' +
                str(nPoolSize) + '; payloadQtd=' + str(nPayloadQtd))
            raise Exception

        # Determine which package it is
        nPackagesPerType = nPoolSize / nPayloadQtd
        nPackageID = randint(0, nPackagesPerType - 1)
        nPackageType = randint(0, nPayloadQtd - 1)
        strPackageName = 'C2Data-' + str(nPackageID) + '-Type' + str(
            nPackageType)
        return strPackageName

    def log(self, strFunction, strContent):
        """
      Logs a line in the Andre standard format
      """
        if (not self.logFile):
            self.logFile = open(c_strLogFile, 'w')

        strLine = '[RandomTalks.' + strFunction + '] ' + strContent + '\n'
        self.logFile.write(strLine)
        print(strLine)


Experiment.register("random-talks", RandomTalks)
    def run(self):
        self.startPctPings()

        # After the pings are scheduled, collect pings for 1 minute
        time.sleep(self.PING_COLLECTION_TIME_BEFORE_FAILURE)

        # Bring down CSU
        for host in self.net.hosts:
            if host.name == "csu":
                self.failNode(host)
                break

        # CSU is down for 2 minutes
        time.sleep(120)

        # Bring CSU back up
        for host in self.net.hosts:
            if host.name == "csu":
                self.recoverNode(host)

                for other in self.net.hosts:
                    if host.name != other.name:
                        self.ping(host, other,
                                  self.PING_COLLECTION_TIME_AFTER_RECOVERY)

        # Collect pings for more seconds after CSU is up
        time.sleep(self.PING_COLLECTION_TIME_AFTER_RECOVERY)


Experiment.register("failure", FailureExperiment)
예제 #16
0
#
# Mini-NDN 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.
#
# Mini-NDN 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 Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.

from ndn.experiments.experiment import Experiment


class ConvergenceExperiment(Experiment):
    def __init__(self, args):
        Experiment.__init__(self, args)

    def setup(self):
        self.checkConvergence()

    def run(self):
        pass


Experiment.register("convergence", ConvergenceExperiment)
        nNodesRemainingToFail = len(self.net.hosts)

        # Fail and recover each node
        for host in self.net.hosts:
            # Fail the node
            self.failNode(host)

            # Stay in failure state for FAILURE_INTERVAL
            time.sleep(self.FAILURE_INTERVAL)

            # Bring the node back up
            self.recoverNode(host)

            # Number of pings required to reach the end of the test
            nPings = self.RECOVERY_INTERVAL + nNodesRemainingToFail*(self.FAILURE_INTERVAL + self.RECOVERY_INTERVAL)
            nNodesRemainingToFail = nNodesRemainingToFail - 1

            # Wait for NFD and NLSR to fully recover
            time.sleep(1)
            print("Scheduling with %s remaining pings" % nPings)

            # Restart pings
            for other in self.net.hosts:
                # Do not ping self
                if host.name != other.name:
                    self.ping(host, other, nPings)

            time.sleep(self.RECOVERY_INTERVAL)

Experiment.register("multiple-failure", MultipleFailureExperiment)
예제 #18
0
                    firstNode.name))

        print("Testing advertise")
        firstNode.cmd("nlsrc advertise /testPrefix")
        time.sleep(30)

        for host in self.net.hosts:
            if host.name != firstNode.name:
                if (int(host.cmd("nfdc fib | grep testPrefix | wc -l")) != 1 or
                        int(host.cmd("nlsrc status | grep testPrefix | wc -l"))
                        != 1):
                    print("Advertise test failed")
                    self.net.stop()
                    sys.exit(1)

        print("Testing withdraw")
        firstNode.cmd("nlsrc withdraw /testPrefix")
        time.sleep(30)

        for host in self.net.hosts:
            if host.name != firstNode.name:
                if (int(host.cmd("nfdc fib | grep testPrefix | wc -l")) != 0 or
                        int(host.cmd("nlsrc status | grep testPrefix | wc -l"))
                        != 0):
                    print("Withdraw test failed")
                    self.net.stop()
                    sys.exit(1)


Experiment.register("prefix-propogation", PrefixPropogationExperiment)
예제 #19
0
            statusPrefix = host.cmd("nfd-status -b | grep /ndn/edu/")
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                host.cmd("ndncatchunks -v -d iterative /ndn/edu/producer%s/spmcat.dat 2> stderr.log &" % host.name[-1])
        time.sleep(2)


Experiment.register("dumbell_ndnchunk", DumbbellNdnchunkExperiment)
예제 #20
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.

from ndn.experiments.experiment import Experiment
from ndn.apps.routing_helper import IPRoutingHelper

from mininet.log import info


class IpRoutingExperiment(Experiment):

    def __init__(self, args):
        Experiment.__init__(self, args)

    def setup(self):
        pass

    def run(self):

        # Calculate all routes for IP routing
        IPRoutingHelper.calcAllRoutes(self.net)
        info("IP routes configured, start ping\n")

        self.net.pingAll()


Experiment.register("ip-routing", IpRoutingExperiment)
예제 #21
0
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                # host.cmd('ndndump -v -i %s-eth0 > ndndump.log &' % host.name)
                # host.cmd('tcpdump -i %s-eth0 > tcpdump.log &' % host.name)
                host.cmd('tcpdump -i any -evvXX > tcpdump.log &')
                host.cmd("trivial-consumer > trivial-consumer.log &")
        time.sleep(1)

Experiment.register("ndndump", NdndumpExperiment)
예제 #22
0
        print "The most connected node is: %s" % mcn.name
        return mcn

    def run(self):
        mostConnectedNode = self.getMostConnectedNode()

        self.startPctPings()

        # After the pings are scheduled, collect pings for 1 minute
        time.sleep(self.PING_COLLECTION_TIME_BEFORE_FAILURE)

        # Bring down MCN
        self.failNode(mostConnectedNode)

        # MCN is down for 2 minutes
        time.sleep(120)

        # Bring MCN back up
        self.recoverNode(mostConnectedNode)

        # Restart pings
        for nodeToPing in self.pingedDict[mostConnectedNode]:
            NDNPingClient.ping(mostConnectedNode, nodeToPing,
                               self.PING_COLLECTION_TIME_AFTER_RECOVERY)

        # Collect pings for more seconds after MCN is up
        time.sleep(self.PING_COLLECTION_TIME_AFTER_RECOVERY)


Experiment.register("failure-mcn", MCNFailureExperiment)
        # Checking for convergence
        for host in self.net.hosts:
            statusRouter = host.cmd("nfd-status -b | grep /ndn/edu/%C1.Router/cs/")
            statusPrefix = host.cmd("nfd-status -b | grep /ndn/edu/")
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                host.cmd("ndncatchunks -s -d iterative ndn:/ndn/edu/producer%s/spmcat 2> consumer_log 1> spmcat &" % host.name[-1])

Experiment.register("ndnchunk", NDNChunkExperiment)
예제 #24
0
            didNodeConverge = True
            for node in self.nodes.split(","):
                    if ("/ndn/edu/%C1.Router/cs/" + node) not in statusRouter:
                        didNodeConverge = False
                        didNlsrConverge = False
                    if str(host) != node and ("/ndn/edu/" + node) not in statusPrefix:
                        didNodeConverge = False
                        didNlsrConverge = False

            host.cmd("echo " + str(didNodeConverge) + " > convergence-result &")

        if didNlsrConverge:
            print("NLSR has successfully converged.")
        else:
            print("NLSR has not converged. Exiting...")
            for host in self.net.hosts:
                host.nfd.stop()
            sys.exit(1)


    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('consumer'):
                print "run %s" % host.name
                host.cmd("file-transfer-consumer /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
                #host.cmd("file-transfer-consumer /ndn/edu/producer%s/gpl2 > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)


Experiment.register("dumbell_file_transfer", DumbbellFileTransferExperiment)
예제 #25
0
        # After the pings are scheduled, collect pings for 1 minute
        time.sleep(self.PING_COLLECTION_TIME_BEFORE_FAILURE)

        # Bring down CSU
        for host in self.net.hosts:
            if host.name == "csu":
                print("Bringing CSU down")
                host.nfd.stop()
                break

        # CSU is down for 2 minutes
        time.sleep(120)

        # Bring CSU back up
        for host in self.net.hosts:
            if host.name == "csu":
                print("Bringing CSU up")
                host.nfd.start()
                host.nlsr.start()
                host.nfd.setStrategy("/ndn/edu", self.strategy)
                host.cmd("ndnpingserver /ndn/edu/" + str(host) + " > ping-server &")

                for other in self.net.hosts:
                    if host.name != other.name:
                        self.ping(host, other, self.PING_COLLECTION_TIME_AFTER_RECOVERY)

        # Collect pings for more seconds after CSU is up
        time.sleep(self.PING_COLLECTION_TIME_AFTER_RECOVERY)

Experiment.register("failure", FailureExperiment)
예제 #26
0
파일: ftp.py 프로젝트: imsure/ndn_cc
#!/usr/bin/python

from ndn.experiments.experiment import Experiment
import time

class FtpExperiment(Experiment):
    def __init__(self, args):
        Experiment.__init__(self, args)

    def setup(self):
        pass

    def run(self):
        for host in self.net.hosts:
            if host.name.startswith('producer'):
                print "run ftp server on producer"
                host.cmd('sudo vsftpd &')

Experiment.register("ftp-over-tcp", FtpExperiment)