Added VLC experience
Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be> Signed-off-by: Quentin De Coninck <quentin.deconinck@uclouvain.be>
This commit is contained in:
parent
2ae9b7a008
commit
ed859c44fa
11
src/conf/vlc/topo
Normal file
11
src/conf/vlc/topo
Normal file
@ -0,0 +1,11 @@
|
||||
desc:Simple configuration with two para link
|
||||
leftSubnet:10.0.
|
||||
rightSubnet:10.1.
|
||||
#path_x:delay,queueSize(may be calc),bw
|
||||
path_0:10,20,2
|
||||
path_1:40,5,1,True
|
||||
topoType:MultiIf
|
||||
changeNetem:yes
|
||||
#netem_{path_id}:at,cmd
|
||||
netemAt_0:10,delay 10ms limit 1
|
||||
#netemAt_0:5,delay 2ms limit 15 loss 10%
|
6
src/conf/vlc/xp
Normal file
6
src/conf/vlc/xp
Normal file
@ -0,0 +1,6 @@
|
||||
xpType:vlc
|
||||
clientPcap:yes
|
||||
kpms:fullmesh
|
||||
kpmc:fullmesh
|
||||
vlctime:20
|
||||
sched:metric
|
@ -12,6 +12,7 @@ class MpExperience:
|
||||
AB = "ab"
|
||||
SIRI = "siri"
|
||||
SENDFILE = "sendfile"
|
||||
VLC = "vlc"
|
||||
|
||||
def __init__(self, xpParam, mpTopo, mpConfig):
|
||||
self.xpParam = xpParam
|
||||
|
91
src/mpExperienceVLC.py
Normal file
91
src/mpExperienceVLC.py
Normal file
@ -0,0 +1,91 @@
|
||||
from mpExperience import MpExperience
|
||||
from mpParamXp import MpParamXp
|
||||
from mpPvAt import MpPvAt
|
||||
import os
|
||||
|
||||
class MpExperienceVLC(MpExperience):
|
||||
SERVER_LOG = "vlc_server.log"
|
||||
CLIENT_LOG = "vlc_client.log"
|
||||
VLC_BIN = "/home/mininet/git/vlc/vlc"
|
||||
PING_OUTPUT = "ping.log"
|
||||
|
||||
def __init__(self, xpParamFile, mpTopo, mpConfig):
|
||||
MpExperience.__init__(self, xpParamFile, mpTopo, mpConfig)
|
||||
self.loadParam()
|
||||
self.ping()
|
||||
MpExperience.classicRun(self)
|
||||
|
||||
def ping(self):
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceVLC.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 + \
|
||||
" >> " + MpExperienceVLC.PING_OUTPUT
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def loadParam(self):
|
||||
"""
|
||||
todo : param LD_PRELOAD ??
|
||||
"""
|
||||
self.file = self.xpParam.getParam(MpParamXp.VLCFILE)
|
||||
self.time = self.xpParam.getParam(MpParamXp.VLCTIME)
|
||||
# todo
|
||||
# self.random_size = self.xpParam.getParam(MpParamXp.VLCRANDOMSIZE)
|
||||
|
||||
def prepare(self):
|
||||
MpExperience.prepare(self)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm " + \
|
||||
MpExperienceVLC.CLIENT_LOG )
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "Xvfb :66 &")
|
||||
self.mpTopo.commandTo(self.mpConfig.server, "rm " + \
|
||||
MpExperienceVLC.SERVER_LOG )
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client,
|
||||
"dd if=/dev/urandom of=random bs=1K count=" + \
|
||||
self.random_size)
|
||||
|
||||
def getVLCServerCmd(self):
|
||||
s = "/etc/init.d/apache2 restart &>" + MpExperienceVLC.SERVER_LOG + " "
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def getVLCClientCmd(self):
|
||||
s = MpExperienceVLC.VLC_BIN + " -I dummy --x11-display :66" + \
|
||||
" --adaptative-logic 3 --no-loop --play-and-exit " + \
|
||||
" http://" + self.mpConfig.getServerIP() + \
|
||||
"/" + self.file + " 2>&1 | grep -E '(Neb|halp|bandwidth)' > " + MpExperienceVLC.CLIENT_LOG
|
||||
if self.time != "0" :
|
||||
s = s + " &"
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def clean(self):
|
||||
MpExperience.clean(self)
|
||||
if self.file == "random":
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "rm random*")
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "pkill Xvfb")
|
||||
#todo use cst
|
||||
#self.mpTopo.commandTo(self.mpConfig.server, "killall netcat")
|
||||
|
||||
|
||||
def run(self):
|
||||
cmd = self.getVLCServerCmd()
|
||||
self.mpTopo.commandTo(self.mpConfig.server, cmd)
|
||||
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 1")
|
||||
cmd = self.getVLCClientCmd()
|
||||
self.mpTopo.commandTo(self.mpConfig.client, cmd)
|
||||
|
||||
if self.time != "0" :
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep " + self.time)
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "pkill -9 vlc")
|
||||
|
||||
self.mpTopo.getCLI()
|
||||
self.mpTopo.commandTo(self.mpConfig.client, "sleep 2")
|
@ -47,6 +47,8 @@ class MpParamXp(MpParam):
|
||||
SIRIMAXPAYLOADSIZE = "siriMaxPayloadSize"
|
||||
SIRIINTERVALTIMEMS = "siriIntervalTimeMs"
|
||||
SIRIBUFFERSIZE = "siriBufferSize"
|
||||
VLCFILE = "vlcFile"
|
||||
VLCTIME = "vlcTime"
|
||||
|
||||
|
||||
# global sysctl
|
||||
@ -109,6 +111,8 @@ class MpParamXp(MpParam):
|
||||
defaultValue[SIRIMAXPAYLOADSIZE] = "500"
|
||||
defaultValue[SIRIINTERVALTIMEMS] = "333"
|
||||
defaultValue[SIRIBUFFERSIZE] = "9"
|
||||
defaultValue[VLCFILE] = "bunny_ibmff_360.mpd"
|
||||
defaultValue[VLCTIME] = "0"
|
||||
|
||||
def __init__(self, paramFile):
|
||||
MpParam.__init__(self, paramFile)
|
||||
|
@ -15,6 +15,7 @@ from mpExperienceEpload import MpExperienceEpload
|
||||
from mpExperienceNetperf import MpExperienceNetperf
|
||||
from mpExperienceAb import MpExperienceAb
|
||||
from mpExperienceSiri import MpExperienceSiri
|
||||
from mpExperienceVLC import MpExperienceVLC
|
||||
from mpExperienceNone import MpExperienceNone
|
||||
from mpExperience import MpExperience
|
||||
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
|
||||
@ -103,6 +104,9 @@ class MpXpRunner:
|
||||
elif xp == MpExperience.SENDFILE:
|
||||
MpExperienceSendFile(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
elif xp == MpExperience.VLC:
|
||||
MpExperienceVLC(self.xpParam, self.mpTopo,
|
||||
self.mpTopoConfig)
|
||||
else:
|
||||
print("Unfound xp type..." + xp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user