test-ndntraffic: test case for testing ndn-traffic-generator
Change-Id: I117f38a206f0ae2a9d1d994f17884ae22e2c2f12
refs: #1387
diff --git a/library_helpers/process_manager.py b/library_helpers/process_manager.py
index ebc4862..fa2fdf3 100644
--- a/library_helpers/process_manager.py
+++ b/library_helpers/process_manager.py
@@ -6,17 +6,23 @@
# See COPYING for copyright and distribution information.
#
+import time
import errno
import subprocess
import multiprocessing as mp
-class process_manager:
+class ProcessManager:
manager = mp.Manager()
processes = dict()
subprocesses = manager.dict()
results = manager.dict()
+ def cleanupProcesses(self):
+ self.processes.clear()
+ self.subprocesses.clear()
+ self.results.clear()
+
def runProcess(self, processKey, processCallFormat, message, subprocesses, results):
print message
process = subprocess.Popen(
@@ -63,8 +69,16 @@
else:
return "Error not available for processKey - " + processKey
+ def getProcessOutput(self, processKey):
+ if processKey in self.results:
+ (returnCode, stdout, stderr) = self.results[processKey]
+ return stdout
+ else:
+ return "Output not available for processKey - " + processKey
+
def startNfd(self):
self.startProcess("nfd", ["sudo", "nfd"], "-> Starting NFD")
def killNfd(self):
self.killProcess("nfd")
+ time.sleep(2)