Ejemplo n.º 1
0
 def __init__(self, args):
     """
   Constructor. Meh
   """
     self.logFile = None
     self.lstProducers = []
     self.DataManager = DataManger()
     self.nMissionMinutes = 0
     Experiment.__init__(self, args)
    def __init__(self, args):

        self.PING_COLLECTION_TIME_BEFORE_FAILURE = 60

        self.FAILURE_INTERVAL = 60
        self.RECOVERY_INTERVAL = 60

        # This is the number of pings required to make it through the full experiment
        nInitialPings = (self.PING_COLLECTION_TIME_BEFORE_FAILURE +
                         len(args["net"].hosts) * (self.FAILURE_INTERVAL + self.RECOVERY_INTERVAL))
        print("Scheduling with {} initial pings".format(nInitialPings))

        Experiment.__init__(self, args)
        self.options.nPings = nInitialPings
    def __init__(self, args):

        self.PING_COLLECTION_TIME_BEFORE_FAILURE = 60

        self.FAILURE_INTERVAL = 60
        self.RECOVERY_INTERVAL = 60

        # This is the number of pings required to make it through the full experiment
        nInitialPings = self.PING_COLLECTION_TIME_BEFORE_FAILURE + len(args["net"].hosts)*(self.FAILURE_INTERVAL + self.RECOVERY_INTERVAL)
        print("Scheduling with %s initial pings" % nInitialPings)

        args["nPings"] = nInitialPings

        Experiment.__init__(self, args)
    def __init__(self, args):
        Experiment.__init__(self, args)
        if "ds" in self.arbArgs:
            self.ds = int(self.arbArgs["ds"])
        else:
            self.ds = 1000

        if "logging" in self.arbArgs:
            self.logging = self.arbArgs["logging"]
            if self.logging == "true":
                self.logging = True
            else:
                self.logging = False
        else:
            self.logging = False
Ejemplo n.º 5
0
 def __init__(self, args):
     Experiment.__init__(self, args)
     self.ds = self.options.arguments.ds
     self.logging = self.options.arguments.logging
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
        self.PING_COLLECTION_TIME_AFTER_RECOVERY = 120

    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)
Ejemplo n.º 8
0
    def start(self):
        host1 = self.net.hosts[0]

        host1.cmd("export NDN_LOG=examples.PartialSyncProducerApp=INFO")
        host1.cmd("psync-producer /sync /{} 10 1 &> producer.log &".format(
            host1.name))
        time.sleep(1)

        host1.cmd(
            "export NDN_LOG=examples.PartialSyncConsumerApp=INFO:$NDN_LOG")
        host1.cmd("psync-consumer /sync 5 &> consumer.log &")

        print("Sleeping 90 seconds for convergence")
        time.sleep(90)

        consumerSubs = int(host1.cmd("cat consumer.log | grep -c Subscribing"))
        consumerUpdates = int(host1.cmd("cat consumer.log | grep -c Update"))
        producerPublish = int(host1.cmd("cat producer.log | grep -c Publish"))

        if consumerSubs == 5 and consumerUpdates == 5 and producerPublish == 10:
            print("PSync partial sync has successfully converged.")
        else:
            print(
                "PSync partial sync convergence was not successful. Exiting..."
            )
            self.net.stop()
            sys.exit(1)


Experiment.register("psync-partial", PSyncPartial)
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
        print "Using {} traffic".format(self.options.pctTraffic)
Ejemplo n.º 12
0
#
# 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
        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)
Ejemplo n.º 13
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)
Ejemplo n.º 14
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)
Ejemplo n.º 15
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)
Ejemplo n.º 16
0
 def __init__(self, args):
     Experiment.__init__(self, args)
     self.syncPrefix = "/sync"
     self.numUserPrefixesPerNode = 2
     self.maxUpdatesPerUserPrefixPerNode = 3
Ejemplo n.º 17
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)
Ejemplo n.º 18
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]:
            self.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)
Ejemplo n.º 19
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)
Ejemplo n.º 20
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)
Ejemplo n.º 21
0
 def setup(self):
     if self.options.nPings != 0:
         Experiment.setup(self)
Ejemplo n.º 22
0
# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
#
# 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)
Ejemplo n.º 23
0
            "ndncatchunks --use-cubic --ignore-cong-marks /50m &>> chunks-output"
        ))
        self.net['host'].cmd(
            "echo '----------------------------------\n' >> chunks-output")
        time.sleep(60)
        #else:
        self.net['host'].cmd(
            "echo '----------------ip----------------\n' >> chunks-output")
        self.net['host'].cmd("ip route add 1.0.0.6 via 1.0.0.2")
        self.net['server'].cmd("ip route add 1.0.0.1 via 1.0.0.5")
        self.net['server'].cmd("iperf3 -s &> /dev/null &")
        self.net['host'].cmd("iperf3 --bytes  50M -c 1.0.0.6 >> chunks-output")
        self.net['host'].cmd(
            "echo '----------------------------------\n' >> chunks-output")
        self.net['host'].cmd("ping 1.0.0.6 -c 10 >> chunks-output")
        self.net['host'].cmd(
            "echo '----------------------------------\n' >> chunks-output")

    def run(self):
        pass

    @staticmethod
    def parseArguments(parser):
        parser.add_argument("--chunksType",
                            dest="chunksType",
                            default="ndn",
                            help="sdgerg")


Experiment.register("chunks", ChunksExperiment)
Ejemplo n.º 24
0
        host1.nlsr = Nlsr(host1, self.options)
        host1.nlsr.start()

        expectedTotalCount = 500
        for i in range(0, expectedTotalCount):
            host1.cmd(
                "nlsrc advertise /long/name/to/exceed/max/packet/size/host1/{}"
                .format(i))

        time.sleep(60)

        host2 = self.net.hosts[1]
        host2.nlsr = Nlsr(host2, self.options)
        host2.nlsr.start()

        time.sleep(60)

        advertiseCount = int(host2.cmd("nfdc fib | grep host1 | wc -l"))
        info(advertiseCount)
        if advertiseCount == expectedTotalCount:
            info('\nSuccessfully advertised {} prefixes\n'.format(
                expectedTotalCount))
        else:
            info('\nAdvertising {} prefixes failed. Exiting...\n'.format(
                expectedTotalCount))
            self.net.stop()
            sys.exit(1)


Experiment.register("advertise-delayed-start", AdvertiseDelayedStartExperiment)
Ejemplo n.º 25
0
        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)
Ejemplo n.º 26
0
    def run(self):
        pass

    def startNlsr(self, checkConvergence=True):
        # NLSR Security
        if self.options.nlsrSecurity is True:
            Nlsr.createKeysAndCertificates(self.net, self.options.workDir)

        i = 1
        # NLSR initialization
        info('Starting NLSR on nodes\n')
        for host in self.net.hosts:
            host.nlsr = Nlsr(host, self.options)
            host.nlsr.start()

            # Wait 1/2 minute between starting NLSRs
            # Wait 1 hour before starting last NLSR
            if i == len(self.net.hosts) - 1:
                info('Sleeping 1 hour before starting last NLSR')
                time.sleep(3600)
            else:
                time.sleep(30)
            i += 1

        if checkConvergence:
            self.checkConvergence()


Experiment.register("nlsr-delayed-start", NlsrDelayedStartExperiment)
        # 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)
Ejemplo n.º 28
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-aimd -v /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)

Experiment.register("cc_aimd", CCAimdExperiment)
Ejemplo n.º 29
0
    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
Ejemplo n.º 30
0
class ArgumentsExperiment(Experiment):
    def __init__(self, args):
        Experiment.__init__(self, args)
        self.ds = self.options.arguments.ds
        self.logging = self.options.arguments.logging

    def start(self):
        pass

    def setup(self):
        pass

    def run(self):
        print("Argument ds: {}".format(self.ds))
        print("Argument logging: {}".format(self.logging))

    @staticmethod
    def parseArguments(parser):
        parser.add_argument(
            "--ds",
            dest="ds",
            default="1000",
            help="[Arguments Experiment] Number of data streams")
        parser.add_argument("--logging",
                            dest="logging",
                            action="store_true",
                            help="[Arguments Experiment] Enable logging")


Experiment.register("args-exp", ArgumentsExperiment)
Ejemplo n.º 31
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)
Ejemplo n.º 32
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-reno -v -o /ndn/edu/producer%s/spmcat spmcat > %s.log &" % (host.name[-1], host.name))
        time.sleep(2)

Experiment.register("cc_reno", CCRenoExperiment)
Ejemplo n.º 33
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)
    def __init__(self, args):
        Experiment.__init__(self, args)
        if "ds" in self.arbArgs:
            self.ds = int(self.arbArgs["ds"])
        else:
            self.ds = 1000

        if "logging" in self.arbArgs:
            self.logging = self.arbArgs["logging"]
            if self.logging == "true":
                self.logging = True
            else:
                self.logging = False
        else:
            self.logging = False

    def setup(self):
        pass

    def run(self):
        print("Argument ds: {}".format(self.ds))
        print("Argument logging: {}".format(self.logging))

    @staticmethod
    def arguments():
        ''' This will be printed in sudo minindn --list-experiments'''
        return "--ds <num-data-streams> --logging <true/false>"


Experiment.register("arbitrary-arguments", AbitraryArgumentsExperiment)
Ejemplo n.º 35
0
        firstNode = self.net.hosts[0]

        if self.nlsrSecurity:
            firstNode.cmd("ndnsec-set-default /ndn/{}-site/%C1.Operator/op".format(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)
        # 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)
Ejemplo n.º 37
0
    def findHostByName(self, strName):
        """
      Finds a host in MiniNDN self.net.hosts by name
      """
        for (nIndex, pNode) in enumerate(self.net.hosts):
            if (str(pNode) == strName):
                return nIndex
        return -1

    def getFilterByHostname(self, strName):
        """
      Creates interest filter base on the producer`s name
      """
        return '/' + c_strAppName + '/' + strName + '/'

    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)

# Batata
Ejemplo n.º 38
0
 def __init__(self, args):
     Experiment.__init__(self,args)
#
# 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)
Ejemplo n.º 40
0
    def __init__(self, args):
        args["nPings"] = 300
        Experiment.__init__(self, args)

        self.PING_COLLECTION_TIME_BEFORE_FAILURE = 60
        self.PING_COLLECTION_TIME_AFTER_RECOVERY = 120
    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
        self.pctTraffic = float(args["pctTraffic"])
        print "Using %f traffic" % self.pctTraffic
Ejemplo n.º 42
0
    def __init__(self, args):
        args["nPings"] = 300
        Experiment.__init__(self, args)

        self.PING_COLLECTION_TIME_BEFORE_FAILURE = 60
        self.PING_COLLECTION_TIME_AFTER_RECOVERY = 120
Ejemplo n.º 43
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)
Ejemplo n.º 44
0
    def __init__(self, args):

        Experiment.__init__(self, args)
        self.COLLECTION_PERIOD_BUFFER = 10
        print "Using %f traffic" % self.pctTraffic
Ejemplo n.º 45
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)
Ejemplo n.º 46
0
 def __init__(self, args):
     Experiment.__init__(self, args)
Ejemplo n.º 47
0
Archivo: ftp.py Proyecto: 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)