add Pv experiment

example :

sudo ./mpPerf.py -t conf/topo/3_ecmp_2 -x conf/xp/3_ncpv

Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
Benjamin Hesmans 2015-01-12 16:34:41 +01:00
parent 519a8aab0c
commit 2573388ccf
7 changed files with 135 additions and 4 deletions

9
src/conf/topo/3_ecmp_2 Normal file
View File

@ -0,0 +1,9 @@
desc:Simple configuration with two para link
leftSubnet:5.5.
rightSubnet:6.6.
midSubnet:zzz
#path_x:delay,queueSize(may be calc),bw
error
path_0:10,10,5
path_1:100,20,5
topoType:ECMPLike

5
src/conf/xp/2_ncpv Normal file
View File

@ -0,0 +1,5 @@
xpType:ncpv
ncClientPort_0:33400
ncClientPort_1:33401
ncClientPort_2:33402
ncClientPort_3:33403

4
src/conf/xp/3_ncpv Normal file
View File

@ -0,0 +1,4 @@
xpType:ncpv
ncClientPort_0:33400
ncClientPort_1:33401
clientPcap:yes

View File

@ -2,6 +2,7 @@ from mpParamXp import MpParamXp
class MpExperience:
PING = "ping"
NCPV = "ncpv"
def __init__(self, xpParam, mpTopo, mpConfig):
self.xpParam = xpParam
self.mpTopo = mpTopo
@ -21,10 +22,19 @@ class MpExperience:
pass
def clean(self):
self.mpTopo.commandTo(self.mpConfig.client,
"killall tcpdump")
self.mpTopo.commandTo(self.mpConfig.server,
"killall tcpdump")
pass
def runTcpDump(self):
#todo : replace filename by cst
if self.xpParam.getParam(MpParamXp.CLIENTPCAP) == "yes" :
print("todo : run client dump")
self.mpTopo.commandTo(self.mpConfig.client,
"tcpdump -i any -w client.pcap &")
if self.xpParam.getParam(MpParamXp.SERVERPCAP) == "yes" :
print("todo : run server dump")
self.mpTopo.commandTo(self.mpConfig.client,
"tcpdump -i any -w server.pcap &")
self.mpTopo.commandTo(self.mpConfig.client,
"sleep 5")

82
src/mpExperienceNCPV.py Normal file
View File

@ -0,0 +1,82 @@
from mpExperience import MpExperience
from mpParamXp import MpParamXp
class MpExperienceNCPV(MpExperience):
"""
NC PV : NetCat and Pipe Viewer
"""
SERVER_NC_LOG = "netcat_server.log"
CLIENT_NC_LOG = "netcat_client.log"
NC_BIN = "netcat"
PV_BIN = "/home/bhesmans/Documents/git/pv/pv"
def __init__(self, xpParamFile, mpTopo, mpConfig):
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
self.loadParam()
MpExperience.classicRun(self)
def loadParam(self):
self.pvg = self.xpParam.getParam(MpParamXp.PVG)
self.pvz = self.xpParam.getParam(MpParamXp.PVZ)
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT)
self.ddibs = self.xpParam.getParam(MpParamXp.DDIBS)
self.ddobs = self.xpParam.getParam(MpParamXp.DDOBS)
self.ddcount = self.xpParam.getParam(MpParamXp.DDCOUNT)
self.ncServerPort = self.xpParam.getParam(MpParamXp.NCSERVERPORT)
self.pvRateLimit = self.xpParam.getParam(MpParamXp.PVRATELIMIT)
self.ncClientPort = []
for k in sorted(self.xpParam.paramDic):
if k.startswith(MpParamXp.NCCLIENTPORT):
port = self.xpParam.paramDic[k]
self.ncClientPort.append(port)
if len(self.ncClientPort) == 0:
d = self.xpParam.getParam(MpParamXp.NCCLIENTPORT)
self.ncClientPort.append(d)
def prepare(self):
MpExperience.prepare(self)
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
MpExperienceNCPV.CLIENT_NC_LOG )
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
MpExperienceNCPV.SERVER_NC_LOG )
def getNCServerCmd(self, id):
s = MpExperienceNCPV.NC_BIN + " -d " + \
" -l " + self.ncServerPort + \
" &>" + MpExperienceNCPV.SERVER_NC_LOG + \
"_" + str(id) + " &"
print(s)
return s
def getNCClientCmd(self, id):
s = "dd if=/dev/urandom ibs=" + self.ddibs + \
" obs=" + self.ddobs + \
" count=" + self.ddcount + \
" | " + MpExperienceNCPV.PV_BIN + \
" -g " + self.pvg + " -z " + self.pvz + \
" -q --rate-limit " + self.pvRateLimit + \
" | " + MpExperienceNCPV.NC_BIN + " " + \
" -p " + self.ncClientPort[id] + " " + \
self.mpConfig.getServerIP() + " " + \
self.ncServerPort + " " + \
"&>" + MpExperienceNCPV.CLIENT_NC_LOG + \
"_" + str(id)
print(s)
return s
def clean(self):
MpExperience.clean(self)
#todo use cst
self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
def run(self):
for i in range(0, len(self.ncClientPort)):
cmd = self.getNCServerCmd(i)
self.mpTopo.commandTo(self.mpConfig.server, cmd)
cmd = self.getNCClientCmd(i)
self.mpTopo.commandTo(self.mpConfig.client, cmd)
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")

View File

@ -7,6 +7,14 @@ class MpParamXp(MpParam):
SERVERPCAP = "serverPcap"
XPTYPE = "xpType"
PINGCOUNT = "pingCount"
DDIBS = "ddIBS"
DDOBS = "ddIBS"
DDCOUNT = "ddCount"
PVRATELIMIT= "pvRateLimit"
PVG = "pvG" #patched version of pv
PVZ = "pvZ"
NCSERVERPORT = "ncServerPort"
NCCLIENTPORT = "ncClientPort"
defaultValue = {}
@ -15,6 +23,14 @@ class MpParamXp(MpParam):
defaultValue[SERVERPCAP] = "no"
defaultValue[XPTYPE] = "ping"
defaultValue[PINGCOUNT] = "5"
defaultValue[DDIBS] = "1k"
defaultValue[DDOBS] = "1k"
defaultValue[DDCOUNT] = "5000" #5k * 1k = 5m
defaultValue[PVRATELIMIT] = "400k"
defaultValue[PVZ] = "10000"
defaultValue[PVG] = "10000"
defaultValue[NCSERVERPORT] = "33666"
defaultValue[NCCLIENTPORT] = "33555"
def __init__(self, paramFile):
MpParam.__init__(self, paramFile)

View File

@ -6,6 +6,7 @@ from mpMultiInterfaceConfig import MpMultiInterfaceConfig
from mpECMPSingleInterfaceConfig import MpECMPSingleInterfaceConfig
from mpMininetBuilder import MpMininetBuilder
from mpExperiencePing import MpExperiencePing
from mpExperienceNCPV import MpExperienceNCPV
from mpExperience import MpExperience
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
@ -64,6 +65,10 @@ class MpXpRunner:
MpExperiencePing(self.xpParam, self.mpTopo,
self.mpTopoConfig)
self.mpTopo.getCLI()
elif xp == MpExperience.NCPV:
MpExperienceNCPV(self.xpParam, self.mpTopo,
self.mpTopoConfig)
self.mpTopo.getCLI()
else:
print("Unfound xp type..." + xp)