mininet-sample/core/parameter.py

224 lines
7.6 KiB
Python
Raw Normal View History

2020-06-24 08:54:44 +00:00
class Parameter(object):
def __init__(self, paramFile):
self.paramDic = {}
print("Create the param Object")
if paramFile is None:
print("default param...")
else:
self.loadParamFile(paramFile)
def loadParamFile(self, paramFile):
f = open(paramFile)
i = 0
for l in f:
i = i + 1
if l.startswith("#"):
continue
tab = l.split(":")
if len(tab) == 2:
k = tab[0]
val = tab[1].rstrip()
if k in self.paramDic:
if not isinstance(self.paramDic[k], list):
self.paramDic[k] = [self.paramDic[k]]
self.paramDic[k].append(val)
else:
self.paramDic[k] = val
else:
print("Ignored Line " + str(i))
print(l),
print("In file " + paramFile)
f.close()
def get(self, key):
if key in self.paramDic:
return self.paramDic[key]
return None
def __str__(self):
s = self.paramDic.__str__()
return s
2020-06-24 08:36:26 +00:00
class ExperienceParameter(Parameter):
2020-06-23 11:20:07 +00:00
RMEM = "rmem"
WMEM = "wmem"
SCHED = "sched"
CC = "congctrl"
AUTOCORK = "autocork"
EARLYRETRANS = "earlyRetrans"
KERNELPM = "kpm"
KERNELPMC = "kpmc" #kernel path manager client / server
KERNELPMS = "kpms"
USERPMC = "upmc"
USERPMS = "upms" #userspace path manager client / server
USERPMCARGS = "upmc_args"
USERPMSARGS = "upms_args"
CLIENTPCAP = "clientPcap"
SERVERPCAP = "serverPcap"
SNAPLENPCAP = "snaplenPcap"
XPTYPE = "xpType"
PINGCOUNT = "pingCount"
DDIBS = "ddIBS"
DDOBS = "ddIBS"
DDCOUNT = "ddCount"
PVRATELIMIT= "pvRateLimit"
PVG = "pvG" #patched version of pv
PVZ = "pvZ"
NCSERVERPORT = "ncServerPort"
NCCLIENTPORT = "ncClientPort"
CHANGEPV = "changePv"
CHANGEPVAT = "changePvAt"
HTTPSFILE = "file" # file to wget, if random : we create a file with random data called random.
HTTPSRANDOMSIZE = "file_size" # if file is set to random, define the size of the random file
EPLOADTESTDIR = "epload_test_dir"
HTTPFILE = "http_file"
HTTPRANDOMSIZE = "http_file_size"
NETPERFTESTLEN = "netperfTestlen"
NETPERFTESTNAME = "netperfTestname"
NETPERFREQRESSIZE = "netperfReqresSize"
ABCONCURRENTREQUESTS = "abConccurentRequests"
ABTIMELIMIT = "abTimelimit"
SIRIRUNTIME = "siriRunTime"
SIRIQUERYSIZE = "siriQuerySize"
SIRIRESPONSESIZE = "siriResponseSize"
SIRIDELAYQUERYRESPONSE = "siriDelayQueryResponse"
SIRIMINPAYLOADSIZE = "siriMinPayloadSize"
SIRIMAXPAYLOADSIZE = "siriMaxPayloadSize"
SIRIINTERVALTIMEMS = "siriIntervalTimeMs"
SIRIBUFFERSIZE = "siriBufferSize"
SIRIBURSTSIZE = "siriBurstSize"
SIRIINTERVALBURSTTIMEMS = "siriIntervalBurstTimeMs"
VLCFILE = "vlcFile"
VLCTIME = "vlcTime"
DITGKBYTES = "ditgKBytes"
DITGCONSTANTPACKETSIZE = "ditgConstantPacketSize"
DITGMEANPOISSONPACKETSSEC = "ditgMeanPoissonPacketsSec"
DITGCONSTANTPACKETSSEC = "ditgConstantPacketsSec"
DITGBURSTSONPACKETSSEC = "ditgBurstsOnPacketsSec"
DITGBURSTSOFFPACKETSSEC = "ditgBurstsOffPacketsSec"
IPERFTIME = "iperfTime"
IPERFPARALLEL = "iperfParallel"
MSGCLIENTSLEEP = "msgClientSleep"
MSGSERVERSLEEP = "msgServerSleep"
MSGNBREQUESTS = "msgNbRequests"
MSGBYTES = "msgBytes"
QUICMULTIPATH = "quicMultipath"
QUICSIRIRUNTIME = "quicSiriRunTime"
PRIOPATH0 = "prioPath0"
PRIOPATH1 = "prioPath1"
BACKUPPATH0 = "backupPath0"
BACKUPPATH1 = "backupPath1"
EXPIRATION = "expiration"
BUFFERAUTOTUNING = "bufferAutotuning"
METRIC = "metric"
2020-06-23 11:20:07 +00:00
# global sysctl
sysctlKey = {}
sysctlKey[RMEM] = "net.ipv4.tcp_rmem"
sysctlKey[WMEM] = "net.ipv4.tcp_wmem"
sysctlKey[KERNELPM] = "net.mptcp.mptcp_path_manager"
sysctlKey[SCHED] = "net.mptcp.mptcp_scheduler"
sysctlKey[CC] = "net.ipv4.tcp_congestion_control"
sysctlKey[AUTOCORK] = "net.ipv4.tcp_autocorking"
sysctlKey[EARLYRETRANS] = "net.ipv4.tcp_early_retrans"
sysctlKey[EXPIRATION] = "net.mptcp.mptcp_sched_expiration"
sysctlKey[BUFFERAUTOTUNING] = "net.ipv4.tcp_moderate_rcvbuf"
2020-06-23 11:20:07 +00:00
sysctlKeyClient = {}
sysctlKeyClient[KERNELPMC] = "net.mptcp.mptcp_path_manager"
sysctlKeyServer = {}
sysctlKeyServer[KERNELPMS] = "net.mptcp.mptcp_path_manager"
2020-06-23 11:20:07 +00:00
defaultValue = {}
2020-06-23 11:20:07 +00:00
defaultValue[RMEM] = "10240 87380 16777216"
defaultValue[WMEM] = "4096 16384 4194304"
defaultValue[KERNELPM] = "fullmesh"
defaultValue[KERNELPMC] = "fullmesh"
defaultValue[KERNELPMS] = "fullmesh"
defaultValue[USERPMC] = "fullmesh"
defaultValue[USERPMS] = "fullmesh"
defaultValue[USERPMCARGS] = ""
defaultValue[USERPMSARGS] = ""
defaultValue[CC] = "olia"
defaultValue[SCHED] = "default"
defaultValue[AUTOCORK] = "1"
defaultValue[EARLYRETRANS] = "3"
defaultValue[EXPIRATION] = "300"
defaultValue[BUFFERAUTOTUNING] = "1"
defaultValue[METRIC] = "-1"
2020-06-23 11:20:07 +00:00
defaultValue[CLIENTPCAP] = "no"
defaultValue[SERVERPCAP] = "no"
defaultValue[SNAPLENPCAP] = "65535" # Default snapping value of tcpdump
defaultValue[XPTYPE] = "none"
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"
defaultValue[CHANGEPV] = "no"
defaultValue[HTTPSFILE] = "random"
defaultValue[HTTPSRANDOMSIZE] = "1024"
defaultValue[EPLOADTESTDIR] = "/bla/bla/bla"
defaultValue[HTTPFILE] = "random"
defaultValue[HTTPRANDOMSIZE] = "1024"
defaultValue[NETPERFTESTLEN] = "10"
defaultValue[NETPERFTESTNAME] = "TCP_RR"
defaultValue[NETPERFREQRESSIZE] = "2K,256"
defaultValue[ABCONCURRENTREQUESTS] = "50"
defaultValue[ABTIMELIMIT] = "20"
defaultValue[SIRIQUERYSIZE] = "2500"
defaultValue[SIRIRESPONSESIZE] = "750"
defaultValue[SIRIDELAYQUERYRESPONSE] = "0"
defaultValue[SIRIMINPAYLOADSIZE] = "85"
defaultValue[SIRIMAXPAYLOADSIZE] = "500"
defaultValue[SIRIINTERVALTIMEMS] = "333"
defaultValue[SIRIBUFFERSIZE] = "9"
defaultValue[SIRIBURSTSIZE] = "0"
defaultValue[SIRIINTERVALBURSTTIMEMS] = "0"
defaultValue[VLCFILE] = "bunny_ibmff_360.mpd"
defaultValue[VLCTIME] = "0"
defaultValue[DITGKBYTES] = "10000"
defaultValue[DITGCONSTANTPACKETSIZE] = "1428"
defaultValue[DITGMEANPOISSONPACKETSSEC] = "0"
defaultValue[DITGCONSTANTPACKETSSEC] = "0"
defaultValue[DITGBURSTSONPACKETSSEC] = "0"
defaultValue[DITGBURSTSOFFPACKETSSEC] = "0"
defaultValue[IPERFTIME] = "10"
defaultValue[IPERFPARALLEL] = "1"
defaultValue[MSGCLIENTSLEEP] = "5.0"
defaultValue[MSGSERVERSLEEP] = "5.0"
defaultValue[MSGNBREQUESTS] = "5"
defaultValue[MSGBYTES] = "1200"
defaultValue[QUICMULTIPATH] = "0"
defaultValue[PRIOPATH0] = "0"
defaultValue[PRIOPATH1] = "0"
defaultValue[BACKUPPATH0] = "0"
defaultValue[BACKUPPATH1] = "0"
2020-06-23 11:20:07 +00:00
def __init__(self, paramFile):
2020-06-24 08:54:44 +00:00
super(ExperienceParameter, self).__init__(paramFile)
def get(self, key):
val = super(ExperienceParameter, self).get(key)
2020-06-23 11:20:07 +00:00
if val is None:
2020-06-24 08:36:26 +00:00
if key in ExperienceParameter.defaultValue:
return ExperienceParameter.defaultValue[key]
2020-06-23 11:20:07 +00:00
else:
2020-06-24 08:36:26 +00:00
raise Exception("Parameter not found " + key)
2020-06-23 11:20:07 +00:00
else:
return val
2020-06-24 08:36:26 +00:00