Allow specification of working directory via constructor argument and related cleanup
Change-Id: Ifc73371c920d1d4e47b1fa04e57de5aebd2a6b40
This commit is contained in:
1 parent
c32a07be3e
commit
a169f5702e
5 files changed
+18
-9
No files matched your search
@@ -80,7 +80,7 @@ def run():
|
|||||||
|
|
||||||
# Start ping server
|
# Start ping server
|
||||||
info("Starting pings...\n")
|
info("Starting pings...\n")
|
||||||
pingserver_log = open("/tmp/minindn/c/ndnpingserver.log", "w")
|
pingserver_log = open("{}/c/ndnpingserver.log".format(ndn.workDir), "w")
|
||||||
getPopen(ndn.net["c"], "ndnpingserver {}".format(PREFIX), stdout=pingserver_log,\
|
getPopen(ndn.net["c"], "ndnpingserver {}".format(PREFIX), stdout=pingserver_log,\
|
||||||
stderr=pingserver_log)
|
stderr=pingserver_log)
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ if __name__ == '__main__':
|
|||||||
time.sleep(300)
|
time.sleep(300)
|
||||||
|
|
||||||
totalUpdates = int(host.cmd('grep -r Update {}/*/psync.logs | wc -l'
|
totalUpdates = int(host.cmd('grep -r Update {}/*/psync.logs | wc -l'
|
||||||
.format(args.workDir)))
|
.format(ndn.workDir)))
|
||||||
|
|
||||||
expectedUpdates = (maxUpdatesPerUserPrefixPerNode *
|
expectedUpdates = (maxUpdatesPerUserPrefixPerNode *
|
||||||
len(ndn.net.hosts) * (len(ndn.net.hosts) - 1) * numUserPrefixesPerNode)
|
len(ndn.net.hosts) * (len(ndn.net.hosts) - 1) * numUserPrefixesPerNode)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"""
|
"""
|
||||||
This example demonstrates the functionality of the Traffic generator. It consists of a traffic
|
This example demonstrates the functionality of the Traffic generator. It consists of a traffic
|
||||||
server and client. The server will listen for interest on the prefix specified in the server
|
server and client. The server will listen for interest on the prefix specified in the server
|
||||||
configuration file. The client will send a designated number of interests to the server and
|
configuration file. The client will send a designated number of interests to the server and
|
||||||
get the data back.
|
get the data back.
|
||||||
More details on traffic generator here: https://github.com/named-data/ndn-traffic-generator
|
More details on traffic generator here: https://github.com/named-data/ndn-traffic-generator
|
||||||
"""
|
"""
|
||||||
@@ -91,8 +91,8 @@ if __name__ == '__main__':
|
|||||||
# lets make node "a" as a traffic-server node, and node "c" as a traffic-client node
|
# lets make node "a" as a traffic-server node, and node "c" as a traffic-client node
|
||||||
server = ndn.net['a']
|
server = ndn.net['a']
|
||||||
client = ndn.net['c']
|
client = ndn.net['c']
|
||||||
serverConf = '{}/{}/server-conf'.format(ndn.args.workDir, server.name)
|
serverConf = '{}/{}/server-conf'.format(ndn.workDir, server.name)
|
||||||
clientConf = '{}/{}/client-conf'.format(ndn.args.workDir, client.name)
|
clientConf = '{}/{}/client-conf'.format(ndn.workDir, client.name)
|
||||||
|
|
||||||
copyExistentFile(server, possibleServerConfPath, serverConf)
|
copyExistentFile(server, possibleServerConfPath, serverConf)
|
||||||
copyExistentFile(server, possibleClientConfPath, clientConf)
|
copyExistentFile(server, possibleClientConfPath, clientConf)
|
||||||
|
|||||||
+6
-2
@@ -55,7 +55,7 @@ class Minindn(object):
|
|||||||
resultDir = None
|
resultDir = None
|
||||||
|
|
||||||
def __init__(self, parser=argparse.ArgumentParser(), topo=None, topoFile=None, noTopo=False,
|
def __init__(self, parser=argparse.ArgumentParser(), topo=None, topoFile=None, noTopo=False,
|
||||||
link=TCLink, **mininetParams):
|
link=TCLink, workDir=None, **mininetParams):
|
||||||
"""
|
"""
|
||||||
Create MiniNDN object
|
Create MiniNDN object
|
||||||
:param parser: Parent parser of Mini-NDN parser
|
:param parser: Parent parser of Mini-NDN parser
|
||||||
@@ -70,7 +70,11 @@ class Minindn(object):
|
|||||||
self.parser = Minindn.parseArgs(parser)
|
self.parser = Minindn.parseArgs(parser)
|
||||||
self.args = self.parser.parse_args()
|
self.args = self.parser.parse_args()
|
||||||
|
|
||||||
Minindn.workDir = os.path.abspath(self.args.workDir)
|
if not workDir:
|
||||||
|
Minindn.workDir = os.path.abspath(self.args.workDir)
|
||||||
|
else:
|
||||||
|
Minindn.workDir = os.path.abspath(workDir)
|
||||||
|
|
||||||
Minindn.resultDir = self.args.resultDir
|
Minindn.resultDir = self.args.resultDir
|
||||||
|
|
||||||
if not topoFile:
|
if not topoFile:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
# along with Mini-NDN, e.g., in COPYING.md file.
|
# along with Mini-NDN, e.g., in COPYING.md file.
|
||||||
# If not, see <http://www.gnu.org/licenses/>.
|
# If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import configparser
|
import configparser
|
||||||
@@ -36,7 +37,7 @@ from minindn.minindn import Minindn
|
|||||||
|
|
||||||
class MinindnWifi(Minindn):
|
class MinindnWifi(Minindn):
|
||||||
""" Class for handling default args, Mininet-wifi object and home directories """
|
""" Class for handling default args, Mininet-wifi object and home directories """
|
||||||
def __init__(self, parser=argparse.ArgumentParser(), topo=None, topoFile=None, noTopo=False, link=WirelessLink, **mininetParams):
|
def __init__(self, parser=argparse.ArgumentParser(), topo=None, topoFile=None, noTopo=False, link=WirelessLink, workDir=None, **mininetParams):
|
||||||
"""Create Mini-NDN-Wifi object
|
"""Create Mini-NDN-Wifi object
|
||||||
parser: Parent parser of Mini-NDN-Wifi parser (use to specify experiment arguments)
|
parser: Parent parser of Mini-NDN-Wifi parser (use to specify experiment arguments)
|
||||||
topo: Mininet topo object (optional)
|
topo: Mininet topo object (optional)
|
||||||
@@ -48,7 +49,11 @@ class MinindnWifi(Minindn):
|
|||||||
self.parser = self.parseArgs(parser)
|
self.parser = self.parseArgs(parser)
|
||||||
self.args = self.parser.parse_args()
|
self.args = self.parser.parse_args()
|
||||||
|
|
||||||
Minindn.workDir = self.args.workDir
|
if not workDir:
|
||||||
|
Minindn.workDir = os.path.abspath(self.args.workDir)
|
||||||
|
else:
|
||||||
|
Minindn.workDir = os.path.abspath(workDir)
|
||||||
|
|
||||||
Minindn.resultDir = self.args.resultDir
|
Minindn.resultDir = self.args.resultDir
|
||||||
|
|
||||||
self.topoFile = None
|
self.topoFile = None
|
||||||
|
|||||||
Reference in new issue
Block a user