wip on per ns sysctl

Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
Benjamin Hesmans 2015-02-23 11:32:22 +01:00
parent 6576eb330f
commit 13d9bdb635
2 changed files with 56 additions and 13 deletions

View File

@ -62,14 +62,27 @@ class MpExperience:
def saveSysctl(self):
self.sysctlBUP = {}
for k in MpParamXp.sysctlKey:
sysctlKey = MpParamXp.sysctlKey[k]
self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self.sysctlBUPC = {}
self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client)
self.sysctlBUPS = {}
self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server)
def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlDic:
sysctlKey = sysctlDic[k]
cmd = self.cmdReadSysctl(sysctlKey)
val = self.mpTopo.notNSCommand(cmd)
if not ns:
val = self.mpTopo.notNSCommand(cmd)
else:
val = self.mpTopo.commandTo(who, cmd)
if val == "Error":
print("oooops can't get sysctl " + sysctlKey)
else:
self.sysctlBUP[k] = val.split(" ",2)[2][:-1]
sysctlBUP[k] = val.split(" ",2)[2][:-1]
def cmdReadSysctl(self, key):
s = "sysctl " + key
@ -81,23 +94,47 @@ class MpExperience:
return s
def writeSysctl(self):
for k in self.sysctlBUP:
sysctlKey = MpParamXp.sysctlKey[k]
self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client)
self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server)
def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlBUP:
sysctlKey = sysctlDic[k]
sysctlValue = self.xpParam.getParam(k)
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
val = self.mpTopo.notNSCommand(cmd)
if not ns:
val = self.mpTopo.notNSCommand(cmd)
else:
val = self.mpTopo.commandTo(who, cmd)
if val == "Error":
print("oooops can't set sysctl " + sysctlKey)
def backUpSysctl(self):
for k in self.sysctlBUP:
sysctlKey = MpParamXp.sysctlKey[k]
sysctlValue = self.sysctlBUP[k]
self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client)
self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server)
def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlBUP:
sysctlKey = sysctlKey[k]
sysctlValue = sysctlBUP[k]
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
val = self.mpTopo.notNSCommand(cmd)
if not ns:
val = self.mpTopo.notNSCommand(cmd)
else:
val = self.mpTopo.commandTo(who, cmd)
if val == "Error":
print("oooops can't set sysctl " + sysctlKey)
def runTcpDump(self):
#todo : replace filename by cst
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP)

View File

@ -5,6 +5,8 @@ class MpParamXp(MpParam):
RMEM = "rmem"
SCHED = "sched"
KERNELPM = "kpm"
KERNELPMC = "kpmc" #kernel path manager client / server
KERNELPMS = "kpms"
CLIENTPCAP = "clientPcap"
SERVERPCAP = "serverPcap"
XPTYPE = "xpType"
@ -26,13 +28,17 @@ class MpParamXp(MpParam):
sysctlKey[KERNELPM] = "net.mptcp.mptcp_path_manager"
sysctlKey[SCHED] = "net.mptcp.mptcp_scheduler"
sysctlListClient = []
sysctlListServer = []
sysctlKeyClient = {}
sysctlKeyClient[KERNELPMC] = "net.mptcp.mptcp_path_manager"
sysctlKeyServer = {}
sysctlKeyServer[KERNELPMS] = "net.mptcp.mptcp_path_manager"
defaultValue = {}
defaultValue[RMEM] = "10240 87380 16777216"
defaultValue[KERNELPM] = "fullmesh"
defaultValue[KERNELPMC] = "fullmesh"
defaultValue[KERNELPMS] = "fullmesh"
defaultValue[SCHED] = "default"
defaultValue[CLIENTPCAP] = "no"