Examples: incorporate latest change of NDNPing Class
Change-Id: I01d59de621992a87c082074766dc18e9a7b549a2
This commit is contained in:
committed by
Saurab Dulal
parent
b428660d54
commit
578f2ec695
@@ -1,6 +1,6 @@
|
||||
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
|
||||
#
|
||||
# Copyright (C) 2015-2019, The University of Memphis,
|
||||
# Copyright (C) 2015-2021, The University of Memphis,
|
||||
# Arizona Board of Regents,
|
||||
# Regents of the University of California.
|
||||
#
|
||||
@@ -32,7 +32,7 @@ from minindn.apps.nfd import Nfd
|
||||
from minindn.apps.nlsr import Nlsr
|
||||
from minindn.helpers.experiment import Experiment
|
||||
from minindn.helpers.nfdc import Nfdc
|
||||
from minindn.helpers.ndnpingclient import NDNPingClient
|
||||
from minindn.helpers.ndnping import NDNPing
|
||||
|
||||
from nlsr_common import getParser
|
||||
|
||||
@@ -63,7 +63,7 @@ def mcnFailure(ndn, nfds, nlsrs, args):
|
||||
if args.nPings != 0:
|
||||
Experiment.setupPing([mcn], Nfdc.STRATEGY_BEST_ROUTE)
|
||||
for nodeToPing in pingedDict[mcn]:
|
||||
NDNPingClient.ping(mcn, nodeToPing, PING_COLLECTION_TIME_AFTER_RECOVERY)
|
||||
NDNPing.ping(mcn, nodeToPing, nPings=PING_COLLECTION_TIME_AFTER_RECOVERY)
|
||||
|
||||
time.sleep(PING_COLLECTION_TIME_AFTER_RECOVERY)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
|
||||
#
|
||||
# Copyright (C) 2015-2019, The University of Memphis,
|
||||
# Copyright (C) 2015-2021, The University of Memphis,
|
||||
# Arizona Board of Regents,
|
||||
# Regents of the University of California.
|
||||
#
|
||||
@@ -32,7 +32,7 @@ from minindn.apps.nfd import Nfd
|
||||
from minindn.apps.nlsr import Nlsr
|
||||
from minindn.helpers.experiment import Experiment
|
||||
from minindn.helpers.nfdc import Nfdc
|
||||
from minindn.helpers.ndnpingclient import NDNPingClient
|
||||
from minindn.helpers.ndnping import NDNPing
|
||||
|
||||
from nlsr_common import getParser
|
||||
|
||||
@@ -45,7 +45,7 @@ def multipleFailure(ndn, nfds, nlsrs, args):
|
||||
FAILURE_INTERVAL = 60
|
||||
RECOVERY_INTERVAL = 60
|
||||
|
||||
# This is the number of pings required to make it through the full experiment
|
||||
# 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))
|
||||
@@ -82,11 +82,11 @@ def multipleFailure(ndn, nfds, nlsrs, args):
|
||||
|
||||
# Restart pings
|
||||
for nodeToPing in pingedDict[host]:
|
||||
NDNPingClient.ping(host, nodeToPing, nPings)
|
||||
NDNPing.ping(host, nodeToPing, nPings=nPings)
|
||||
|
||||
time.sleep(RECOVERY_INTERVAL - recovery_time)
|
||||
|
||||
#Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
|
||||
Experiment.checkConvergence(ndn, ndn.net.hosts, args.ctime, quit=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
setLogLevel('info')
|
||||
|
||||
@@ -27,7 +27,7 @@ from minindn.util import MiniNDNWifiCLI, getPopen
|
||||
from minindn.apps.app_manager import AppManager
|
||||
from minindn.apps.nfd import Nfd
|
||||
from minindn.helpers.nfdc import Nfdc
|
||||
from minindn.helpers.ndnpingclient import NDNPingClient
|
||||
from minindn.helpers.ndnping import NDNPing
|
||||
from time import sleep
|
||||
# This experiment uses the singleap topology and is intended to be a basic
|
||||
# test case where we see if two nodes can send interests to each other.
|
||||
@@ -64,13 +64,14 @@ def runExperiment():
|
||||
nfds = AppManager(ndnwifi, ndnwifi.net.stations, Nfd)
|
||||
|
||||
info("Starting pingserver...")
|
||||
ping_server_proc = getPopen(b, "ndnpingserver /example")
|
||||
NDNPing.startPingServer(b, "/example")
|
||||
Nfdc.createFace(a, b.IP())
|
||||
Nfdc.registerRoute(a, "/example", b.IP())
|
||||
|
||||
info("Starting ping...")
|
||||
NDNPingClient.ping(a, "/example", 10)
|
||||
NDNPing.ping(a, "/example", nPings=10)
|
||||
|
||||
sleep(10)
|
||||
# Start the CLI
|
||||
MiniNDNWifiCLI(ndnwifi.net)
|
||||
ndnwifi.net.stop()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
|
||||
#
|
||||
# Copyright (C) 2015-2020, The University of Memphis,
|
||||
# Copyright (C) 2015-2021, The University of Memphis,
|
||||
# Arizona Board of Regents,
|
||||
# Regents of the University of California.
|
||||
#
|
||||
@@ -28,7 +28,8 @@ import time
|
||||
class NDNPing(object):
|
||||
@staticmethod
|
||||
def ping(source, prefix, pingDataFile="output-client", nPings=1, interval=None, timeout=None,
|
||||
starting_seq_num=None, identifier=None, allow_stale_data=False, print_timestamp=True, sleepTime=0.2):
|
||||
starting_seq_num=None, identifier=None, allow_stale_data=False, print_timestamp=True,
|
||||
sleepTime=0.2):
|
||||
print('Scheduling ping(s) from {} for {}'.format(source.name, prefix))
|
||||
# Use '&' to run in background and perform parallel pings
|
||||
source.cmd("mkdir -p ping-data")
|
||||
@@ -46,8 +47,9 @@ class NDNPing(object):
|
||||
))
|
||||
time.sleep(sleepTime)
|
||||
|
||||
def startPingServer(source, prefix, pingDataFile="output-server", freshness=None, satisfy=None,
|
||||
size=None, timestamp=False, quiet=False):
|
||||
@staticmethod
|
||||
def startPingServer(source, prefix, pingDataFile="output-server", freshness=None, satisfy=None,
|
||||
size=None, timestamp=False, quiet=False):
|
||||
"""
|
||||
Start a pingserver
|
||||
:param string preifx: prefix to start pingserver on
|
||||
|
||||
Reference in New Issue
Block a user