2015-01-08 18:52:45 +00:00
|
|
|
from mpParamXp import MpParamXp
|
|
|
|
|
|
|
|
class MpExperience:
|
|
|
|
PING = "ping"
|
2015-01-12 15:34:41 +00:00
|
|
|
NCPV = "ncpv"
|
2015-01-08 18:52:45 +00:00
|
|
|
def __init__(self, xpParam, mpTopo, mpConfig):
|
|
|
|
self.xpParam = xpParam
|
|
|
|
self.mpTopo = mpTopo
|
|
|
|
self.mpConfig = mpConfig
|
|
|
|
print(self.xpParam)
|
|
|
|
|
|
|
|
def classicRun(self):
|
|
|
|
self.prepare()
|
|
|
|
self.run()
|
|
|
|
self.clean()
|
|
|
|
|
|
|
|
def prepare(self):
|
|
|
|
self.runTcpDump()
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def clean(self):
|
2015-01-12 15:34:41 +00:00
|
|
|
self.mpTopo.commandTo(self.mpConfig.client,
|
|
|
|
"killall tcpdump")
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.server,
|
|
|
|
"killall tcpdump")
|
2015-01-08 18:52:45 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
def runTcpDump(self):
|
2015-01-12 15:34:41 +00:00
|
|
|
#todo : replace filename by cst
|
|
|
|
if self.xpParam.getParam(MpParamXp.CLIENTPCAP) == "yes" :
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.client,
|
|
|
|
"tcpdump -i any -w client.pcap &")
|
|
|
|
if self.xpParam.getParam(MpParamXp.SERVERPCAP) == "yes" :
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.client,
|
|
|
|
"tcpdump -i any -w server.pcap &")
|
|
|
|
self.mpTopo.commandTo(self.mpConfig.client,
|
|
|
|
"sleep 5")
|