예제 #1
0
def mcnFailure(ndn, nfds, nlsrs, args):
    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
    if args.nPings != 0:
        Experiment.setupPing(ndn.net.hosts, 'ifs-rl')
        pingedDict = Experiment.startPctPings(ndn.net, args.nPings,
                                              args.pctTraffic)

    PING_COLLECTION_TIME_BEFORE_FAILURE = 60
    PING_COLLECTION_TIME_AFTER_RECOVERY = 120

    time.sleep(PING_COLLECTION_TIME_BEFORE_FAILURE)

    mcn = max(ndn.net.hosts, key=lambda host: len(host.intfNames()))

    info('Bringing down node {}\n'.format(mcn.name))
    nlsrs[mcn.name].stop()
    nfds[mcn.name].stop()

    time.sleep(args.ctime)

    info('Bringing up node {}\n'.format(mcn.name))
    nfds[mcn.name].start()
    nlsrs[mcn.name].start()

    # Restart pings
    if args.nPings != 0:
        Experiment.setupPing([mcn], 'ifs-rl')
        for nodeToPing in pingedDict[mcn]:
            NDNPingClient.ping(mcn, nodeToPing,
                               PING_COLLECTION_TIME_AFTER_RECOVERY)

        time.sleep(PING_COLLECTION_TIME_AFTER_RECOVERY)

    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
예제 #2
0
def multipleFailure(ndn, nfds, nlsrs, args):

    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
    Experiment.setupPing(ndn.net.hosts, Nfdc.STRATEGY_BEST_ROUTE)

    PING_COLLECTION_TIME_BEFORE_FAILURE = 60
    FAILURE_INTERVAL = 60
    RECOVERY_INTERVAL = 60

    # Number of pings required to make it through the full experiment
    nInitialPings = (PING_COLLECTION_TIME_BEFORE_FAILURE +
                     len(ndn.net.hosts) * (FAILURE_INTERVAL + RECOVERY_INTERVAL))
    print('Scheduling with {} initial pings'.format(nInitialPings))

    pingedDict = Experiment.startPctPings(ndn.net, nInitialPings, args.pctTraffic)
    time.sleep(PING_COLLECTION_TIME_BEFORE_FAILURE)

    nNodesRemainingToFail = len(ndn.net.hosts)

    for host in ndn.net.hosts:
        # Fail the node
        info('Bringing down node {}\n'.format(host.name))
        nlsrs[host.name].stop()
        nfds[host.name].stop()

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

        # Bring the node back up
        start_time = time.time()
        info('Bringing up node {}\n'.format(host.name))
        nfds[host.name].start()
        nlsrs[host.name].start()
        Experiment.setupPing([host], Nfdc.STRATEGY_BEST_ROUTE)

        recovery_time = int(time.time() - start_time)

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

        info('Scheduling with {} remaining pings\n'.format(nPings))

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

        time.sleep(RECOVERY_INTERVAL - recovery_time)

    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
예제 #3
0
    setLogLevel('info')

    ndn = Minindn(parser=getParser())
    args = ndn.args

    ndn.start()

    nfds = AppManager(ndn, ndn.net.hosts, Nfd)
    nlsrs = AppManager(ndn,
                       ndn.net.hosts,
                       Nlsr,
                       sync=args.sync,
                       security=args.security,
                       faceType=args.faceType,
                       nFaces=args.faces,
                       routingType=args.routingType,
                       logLevel='ndn.*=TRACE:nlsr.*=TRACE')

    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=False)

    if args.nPings != 0:
        Experiment.setupPing(ndn.net.hosts, Nfdc.STRATEGY_BEST_ROUTE)
        Experiment.startPctPings(ndn.net, args.nPings, args.pctTraffic)

        time.sleep(args.nPings + 10)

    if args.isCliEnabled:
        MiniNDNCLI(ndn.net)

    ndn.stop()
예제 #4
0
    # Start apps with AppManager which registers a clean up function with ndn
    info('Starting NFD on nodes\n')
    nfds = AppManager(ndn, ndn.net.hosts, Nfd)

    info('Starting NLSR on nodes\n')
    nlsrs = AppManager(ndn,
                       ndn.net.hosts,
                       Nlsr,
                       sync=args.sync,
                       security=args.security,
                       faceType=args.faceType,
                       nFaces=args.faces,
                       routingType=args.routingType,
                       logLevel='ndn.*=TRACE:nlsr.*=TRACE')

    info('Starting Convergence Experiment on nodes\n')
    Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=False)

    if args.nPings != 0:
        info('Starting ping on nodes\n')
        Experiment.setupPing(ndn.net.hosts, 'ifs-rl')
        Experiment.startPctPings(ndn.net, args.nPings, args.pctTraffic)

        time.sleep(args.nPings + 10)

    if args.isCliEnabled:
        MiniNDNCLI(ndn.net)

    # Calls the clean up functions registered via AppManager
    ndn.stop()