Skip to content

Commit

Permalink
Move wifi experiment specific arguments to separate parser
Browse files Browse the repository at this point in the history
This also fixes a crash when using wifi_ping.py example due
to code not being fully removed.

Change-Id: I06662cc4f19b4899b4261da313cea943c3a258cd
  • Loading branch information
awlane committed Nov 15, 2024
1 parent eda7e07 commit 595cbda
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
10 changes: 5 additions & 5 deletions examples/wifi/wifi_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
from minindn.util import MiniNDNWifiCLI
from minindn.apps.app_manager import AppManager
from minindn.apps.nfd import Nfd
from minindn.helpers.experiment import Experiment
from minindn.helpers.nfdc import Nfdc
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.
def runExperiment():
setLogLevel('info')

info("Starting network")
ndnwifi = MinindnWifi()
ndnwifi = MinindnWifi(parser=Experiment.getWifiExperimentParser())
a = ndnwifi.net["sta1"]
b = ndnwifi.net["sta2"]
# Test for model-based mobility
Expand All @@ -59,16 +59,16 @@ def runExperiment():
ndnwifi.startMobility(time=0, mob_rep=1, reverse=False)

ndnwifi.start()
info("Starting NFD")
info("Starting NFD...\n")
sleep(2)
AppManager(ndnwifi, ndnwifi.net.stations, Nfd)

info("Starting pingserver...")
info("Starting pingserver...\n")
NDNPing.startPingServer(b, "/example")
faceID = Nfdc.createFace(a, b.IP())
Nfdc.registerRoute(a, "/example", faceID)

info("Starting ping...")
info("Starting ping...\n")
NDNPing.ping(a, "/example", nPings=10)

sleep(10)
Expand Down
13 changes: 13 additions & 0 deletions minindn/helpers/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import time
import sys
import argparse
from itertools import cycle

from mininet.log import info
Expand Down Expand Up @@ -130,3 +131,15 @@ def startPctPings(net, nPings, pctTraffic=1.0):
nodesPingedList = []

return pingedDict

import argparse

@staticmethod
def getWifiExperimentParser(parent=argparse.ArgumentParser()):
parser = argparse.ArgumentParser(prog='minindn-wifi', parents=[parent], add_help=False)

parser.add_argument('--mobility',action='store_true',dest='mobility',default=False,
help='Enable custom mobility for topology (defined in script)')
parser.add_argument('--model-mob',action='store_true',dest='modelMob',default=False,
help='Enable model mobility for topology (defined in script; see adhoc experiment for how to specify in topology file)')
return parser
6 changes: 0 additions & 6 deletions minindn/wifi/minindnwifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def parseArgs(parent):
parser.add_argument('--result-dir', action='store', dest='resultDir', default=None,
help='Specify the full path destination folder where experiment results will be moved')

parser.add_argument('--mobility',action='store_true',dest='mobility',default=False,
help='Enable custom mobility for topology (defined in topology file)')

parser.add_argument('--ifb',action='store_true',dest='ifb',default=False,
help='Simulate delay on receiver-side by use of virtual IFB devices (see docs)')

Expand Down Expand Up @@ -391,9 +388,6 @@ def parseArgs(parent):
parser.add_argument('--result-dir', action='store', dest='resultDir', default=None,
help='Specify the full path destination folder where experiment results will be moved')

parser.add_argument('--mobility',action='store_true',dest='mobility',default=False,
help='Enable custom mobility for topology (defined in topology file)')

parser.add_argument('--ifb',action='store_true',dest='ifb',default=False,
help='Simulate delay on receiver-side by use of virtual IFB devices (see docs)')

Expand Down

0 comments on commit 595cbda

Please sign in to comment.