Move wifi experiment specific arguments to separate parser
This also fixes a crash when using wifi_ping.py example due
to code not being fully removed.
Change-Id: I06662cc4f19b4899b4261da313cea943c3a258cd
diff --git a/examples/wifi/wifi_ping.py b/examples/wifi/wifi_ping.py
index 16fd62d..b123e18 100644
--- a/examples/wifi/wifi_ping.py
+++ b/examples/wifi/wifi_ping.py
@@ -26,6 +26,7 @@
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
@@ -33,9 +34,8 @@
# 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
@@ -59,16 +59,16 @@
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)
diff --git a/minindn/helpers/experiment.py b/minindn/helpers/experiment.py
index c454ff4..b6c2b02 100644
--- a/minindn/helpers/experiment.py
+++ b/minindn/helpers/experiment.py
@@ -23,6 +23,7 @@
import time
import sys
+import argparse
from itertools import cycle
from mininet.log import info
@@ -130,3 +131,15 @@
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
\ No newline at end of file
diff --git a/minindn/wifi/minindnwifi.py b/minindn/wifi/minindnwifi.py
index 2e3b9ea..8eb9b2c 100644
--- a/minindn/wifi/minindnwifi.py
+++ b/minindn/wifi/minindnwifi.py
@@ -120,9 +120,6 @@
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)')
@@ -391,9 +388,6 @@
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)')