add ping before pv
Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
5d7faeacd2
commit
8b39f5f207
@ -8,14 +8,31 @@ class MpExperienceNCPV(MpExperience):
|
|||||||
"""
|
"""
|
||||||
SERVER_NC_LOG = "netcat_server"
|
SERVER_NC_LOG = "netcat_server"
|
||||||
CLIENT_NC_LOG = "netcat_client"
|
CLIENT_NC_LOG = "netcat_client"
|
||||||
NC_BIN = "netcat"
|
NC_BIN = "/home/mininet/git/netcat-openbsd-1.105/nc"
|
||||||
PV_BIN = "/home/bhesmans/Documents/git/pv/pv"
|
PV_BIN = "pv"
|
||||||
|
PING_OUTPUT = "ping.log"
|
||||||
|
|
||||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||||
self.loadParam()
|
self.loadParam()
|
||||||
|
self.ping()
|
||||||
MpExperience.classicRun(self)
|
MpExperience.classicRun(self)
|
||||||
|
|
||||||
|
def ping(self):
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||||
|
MpExperienceNCPV.PING_OUTPUT )
|
||||||
|
count = self.xpParam.getParam(MpParamXp.PINGCOUNT)
|
||||||
|
for i in range(0, self.mpConfig.getClientInterfaceCount()):
|
||||||
|
cmd = self.pingCommand(self.mpConfig.getClientIP(i),
|
||||||
|
self.mpConfig.getServerIP(), n = count)
|
||||||
|
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||||
|
|
||||||
|
def pingCommand(self, fromIP, toIP, n=5):
|
||||||
|
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
|
||||||
|
" >> " + MpExperienceNCPV.PING_OUTPUT
|
||||||
|
print(s)
|
||||||
|
return s
|
||||||
|
|
||||||
def loadParam(self):
|
def loadParam(self):
|
||||||
self.pvg = self.xpParam.getParam(MpParamXp.PVG)
|
self.pvg = self.xpParam.getParam(MpParamXp.PVG)
|
||||||
self.pvz = self.xpParam.getParam(MpParamXp.PVZ)
|
self.pvz = self.xpParam.getParam(MpParamXp.PVZ)
|
||||||
@ -83,9 +100,9 @@ class MpExperienceNCPV(MpExperience):
|
|||||||
MpExperienceNCPV.SERVER_NC_LOG )
|
MpExperienceNCPV.SERVER_NC_LOG )
|
||||||
|
|
||||||
def getNCServerCmd(self, id):
|
def getNCServerCmd(self, id):
|
||||||
s = MpExperienceNCPV.NC_BIN + " -d " + \
|
s = MpExperienceNCPV.NC_BIN + " -d " + \
|
||||||
" -l " + self.ncServerPort + \
|
" -l " + self.ncServerPort + \
|
||||||
" &>" + MpExperienceNCPV.SERVER_NC_LOG + \
|
" 1>/dev/null 2>" + MpExperienceNCPV.SERVER_NC_LOG + \
|
||||||
"_" + str(id) + ".log &"
|
"_" + str(id) + ".log &"
|
||||||
print(s)
|
print(s)
|
||||||
return s
|
return s
|
||||||
@ -98,7 +115,7 @@ class MpExperienceNCPV(MpExperience):
|
|||||||
" -g " + self.pvg + " -z " + self.pvz + \
|
" -g " + self.pvg + " -z " + self.pvz + \
|
||||||
" -q --rate-limit " + self.pvRateLimit + \
|
" -q --rate-limit " + self.pvRateLimit + \
|
||||||
" | " + MpExperienceNCPV.NC_BIN + " " + \
|
" | " + MpExperienceNCPV.NC_BIN + " " + \
|
||||||
" -p " + self.ncClientPort[id] + " " + \
|
" -p " + self.ncClientPort[id] + " " + \
|
||||||
self.mpConfig.getServerIP() + " " + \
|
self.mpConfig.getServerIP() + " " + \
|
||||||
self.ncServerPort + " " + \
|
self.ncServerPort + " " + \
|
||||||
"&>" + MpExperienceNCPV.CLIENT_NC_LOG + \
|
"&>" + MpExperienceNCPV.CLIENT_NC_LOG + \
|
||||||
|
Loading…
Reference in New Issue
Block a user