convert tabs to spaces

This commit is contained in:
Quentin De Coninck 2020-06-23 13:20:07 +02:00
parent d0fd689d49
commit b28d9f06b9
12 changed files with 1106 additions and 1106 deletions

View File

@ -1,81 +1,81 @@
class MpConfig: class MpConfig:
PING_OUTPUT = "ping.log" PING_OUTPUT = "ping.log"
def __init__(self, topo, param): def __init__(self, topo, param):
self.topo = topo self.topo = topo
self.param = param self.param = param
def configureNetwork(self): def configureNetwork(self):
print("Configure interfaces....Generic call ?") print("Configure interfaces....Generic call ?")
self.configureInterfaces() self.configureInterfaces()
self.configureRoute() self.configureRoute()
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
"get Middle link, left to right interface" "get Middle link, left to right interface"
pass pass
def getMidR2LInterface(self, id): def getMidR2LInterface(self, id):
pass pass
def getMidLeftName(self, i): def getMidLeftName(self, i):
"get Middle link, left box name" "get Middle link, left box name"
pass pass
def getMidRightName(self, i): def getMidRightName(self, i):
pass pass
def configureInterfaces(self): def configureInterfaces(self):
pass pass
def getClientInterfaceCount(self): def getClientInterfaceCount(self):
raise Exception("To be implemented") raise Exception("To be implemented")
def interfaceBUPCommand(self, interfaceName): def interfaceBUPCommand(self, interfaceName):
s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup " s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup "
print(s) print(s)
return s return s
def interfaceUpCommand(self, interfaceName, ip, subnet): def interfaceUpCommand(self, interfaceName, ip, subnet):
s = "ifconfig " + interfaceName + " " + ip + " netmask " + \ s = "ifconfig " + interfaceName + " " + ip + " netmask " + \
subnet subnet
print(s) print(s)
return s return s
def addRouteTableCommand(self, fromIP, id): def addRouteTableCommand(self, fromIP, id):
s = "ip rule add from " + fromIP + " table " + str(id + 1) s = "ip rule add from " + fromIP + " table " + str(id + 1)
print(s) print(s)
return s return s
def addRouteScopeLinkCommand(self, network, interfaceName, id): def addRouteScopeLinkCommand(self, network, interfaceName, id):
s = "ip route add " + network + " dev " + interfaceName + \ s = "ip route add " + network + " dev " + interfaceName + \
" scope link table " + str(id + 1) " scope link table " + str(id + 1)
print(s) print(s)
return s return s
def addRouteDefaultCommand(self, via, id): def addRouteDefaultCommand(self, via, id):
s = "ip route add default via " + via + " table " + str(id + 1) s = "ip route add default via " + via + " table " + str(id + 1)
print(s) print(s)
return s return s
def addRouteDefaultGlobalCommand(self, via, interfaceName): def addRouteDefaultGlobalCommand(self, via, interfaceName):
s = "ip route add default scope global nexthop via " + via + \ s = "ip route add default scope global nexthop via " + via + \
" dev " + interfaceName " dev " + interfaceName
print(s) print(s)
return s return s
def arpCommand(self, ip, mac): def arpCommand(self, ip, mac):
s = "arp -s " + ip + " " + mac s = "arp -s " + ip + " " + mac
print(s) print(s)
return s return s
def addRouteDefaultSimple(self, via): def addRouteDefaultSimple(self, via):
s = "ip route add default via " + via s = "ip route add default via " + via
print(s) print(s)
return s return s
def pingCommand(self, fromIP, toIP, n=5): def pingCommand(self, fromIP, toIP, n=5):
s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \
" >> " + MpConfig.PING_OUTPUT " >> " + MpConfig.PING_OUTPUT
print(s) print(s)
return s return s

View File

@ -5,163 +5,163 @@ from mpTopo import MpTopo
from struct import * from struct import *
class MpECMPSingleInterfaceConfig(MpConfig): class MpECMPSingleInterfaceConfig(MpConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) MpConfig.__init__(self, topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
mask = len(self.topo.routers) - 1 mask = len(self.topo.routers) - 1
for l in self.topo.routers: for l in self.topo.routers:
cmd = self.getIptableRuleICMP(mask, i) cmd = self.getIptableRuleICMP(mask, i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
cmd = self.getIptableRuleTCPPortClient(mask, i) cmd = self.getIptableRuleTCPPortClient(mask, i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.getIptableRuleTCPPortServer(mask, i) cmd = self.getIptableRuleTCPPortServer(mask, i)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
cmd = self.getIpRuleCmd(i) cmd = self.getIpRuleCmd(i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i), cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i),
i) i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i), cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i),
i) i)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
i = i + 1 i = i + 1
### ###
cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0)) cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0))
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0)) cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0))
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
self.topo.commandTo(self.client, "ip route flush cache") self.topo.commandTo(self.client, "ip route flush cache")
self.topo.commandTo(self.server, "ip route flush cache") self.topo.commandTo(self.server, "ip route flush cache")
def getIptableRuleICMP(self, mask, id): def getIptableRuleICMP(self, mask, id):
s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \
'"6&0xFF=0x1 && ' + \ '"6&0xFF=0x1 && ' + \
'24&0x' + \ '24&0x' + \
pack('>I',(mask)).encode('hex') + \ pack('>I',(mask)).encode('hex') + \
'=0x' + pack('>I',id).encode('hex') + \ '=0x' + pack('>I',id).encode('hex') + \
'" -j MARK --set-mark ' + str(id + 1) '" -j MARK --set-mark ' + str(id + 1)
print (s) print (s)
return s return s
def getIptableRuleTCPPortClient(self, mask, id): def getIptableRuleTCPPortClient(self, mask, id):
s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \
'"6&0xFF=0x6 && ' + \ '"6&0xFF=0x6 && ' + \
'18&0x' + \ '18&0x' + \
pack('>I',(mask)).encode('hex') + \ pack('>I',(mask)).encode('hex') + \
'=0x' + pack('>I',id).encode('hex') + \ '=0x' + pack('>I',id).encode('hex') + \
'" -j MARK --set-mark ' + str(id + 1) '" -j MARK --set-mark ' + str(id + 1)
print (s) print (s)
return s return s
def getIptableRuleTCPPortServer(self, mask, id): def getIptableRuleTCPPortServer(self, mask, id):
s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \
'"6&0xFF=0x6 && ' + \ '"6&0xFF=0x6 && ' + \
'20&0x' + \ '20&0x' + \
pack('>I',(mask)).encode('hex') + \ pack('>I',(mask)).encode('hex') + \
'=0x' + pack('>I',id).encode('hex') + \ '=0x' + pack('>I',id).encode('hex') + \
'" -j MARK --set-mark ' + str(id + 1) '" -j MARK --set-mark ' + str(id + 1)
print (s) print (s)
return s return s
def getIpRuleCmd(self, id): def getIpRuleCmd(self, id):
s = 'ip rule add fwmark ' + str(id + 1) + ' table ' + \ s = 'ip rule add fwmark ' + str(id + 1) + ' table ' + \
str(id + 1) str(id + 1)
print(s) print(s)
return s return s
def getDefaultRouteCmd(self, via, id): def getDefaultRouteCmd(self, via, id):
s = 'ip route add default via ' + via + ' table ' + str(id + 1) s = 'ip route add default via ' + via + ' table ' + str(id + 1)
print(s) print(s)
return s return s
def configureInterfaces(self): def configureInterfaces(self):
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(MpTopo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(MpTopo.serverName)
self.routers = [] self.routers = []
i = 0 i = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
for l in self.topo.routers: for l in self.topo.routers:
self.routers.append(self.topo.getHost( self.routers.append(self.topo.getHost(
MpTopo.routerNamePrefix + str(i))) MpTopo.routerNamePrefix + str(i)))
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceLSwitch(i), self.getRouterInterfaceLSwitch(i),
self.getRouterIPClient(i), netmask) self.getRouterIPClient(i), netmask)
self.topo.commandTo(self.routers[-1] , cmd) self.topo.commandTo(self.routers[-1] , cmd)
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceRSwitch(i), self.getRouterInterfaceRSwitch(i),
self.getRouterIPServer(i), netmask) self.getRouterIPServer(i), netmask)
self.topo.commandTo(self.routers[-1] , cmd) self.topo.commandTo(self.routers[-1] , cmd)
i = i + 1 i = i + 1
cmd = self.interfaceUpCommand(self.getClientInterface(0), cmd = self.interfaceUpCommand(self.getClientInterface(0),
self.getClientIP(0), netmask) self.getClientIP(0), netmask)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.interfaceUpCommand(self.getServerInterface(), cmd = self.interfaceUpCommand(self.getServerInterface(),
self.getServerIP(), netmask) self.getServerIP(), netmask)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPClient(self, id): def getRouterIPClient(self, id):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
routerIP = lSubnet + "0." + str(id + 2) routerIP = lSubnet + "0." + str(id + 2)
return routerIP return routerIP
def getRouterIPServer(self, id): def getRouterIPServer(self, id):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
routerIP = rSubnet + "0." + str(id + 2) routerIP = rSubnet + "0." + str(id + 2)
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getClientInterfaceCount(self): def getClientInterfaceCount(self):
return 1 return 1
def getRouterInterfaceLSwitch(self, id): def getRouterInterfaceLSwitch(self, id):
return MpTopo.routerNamePrefix + str(id) + "-eth0" return MpTopo.routerNamePrefix + str(id) + "-eth0"
def getRouterInterfaceRSwitch(self, id): def getRouterInterfaceRSwitch(self, id):
return MpTopo.routerNamePrefix + str(id) + "-eth1" return MpTopo.routerNamePrefix + str(id) + "-eth1"
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return MpTopo.clientName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return MpTopo.serverName + "-eth0"
def getMidLeftName(self, id): def getMidLeftName(self, id):
return MpTopo.routerNamePrefix + str(id) return MpTopo.routerNamePrefix + str(id)
def getMidRightName(self, id): def getMidRightName(self, id):
return MpTopo.switchNamePrefix + "1" return MpTopo.switchNamePrefix + "1"
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth1" return self.getMidLeftName(id) + "-eth1"
def getMidR2LInterface(self, id): def getMidR2LInterface(self, id):
return self.getMidRightName(id) + "-eth" + str(id+2) return self.getMidRightName(id) + "-eth" + str(id+2)

View File

@ -1,44 +1,44 @@
from mpTopo import MpTopo from mpTopo import MpTopo
class MpECMPSingleInterfaceTopo(MpTopo): class MpECMPSingleInterfaceTopo(MpTopo):
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) MpTopo.__init__(self,topoBuilder, parameterFile)
print("Hello ECMP topo") print("Hello ECMP topo")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(MpTopo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(MpTopo.serverName)
self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0") self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0")
self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1") self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1")
self.addLink( self.client, self.lswitch) self.addLink( self.client, self.lswitch)
self.addLink( self.server, self.rswitch) self.addLink( self.server, self.rswitch)
self.routers = [] self.routers = []
for l in self.topoParam.linkCharacteristics: for l in self.topoParam.linkCharacteristics:
self.routers.append(self.addOneRouterPerLink(l)) self.routers.append(self.addOneRouterPerLink(l))
print("added : " + self.routers[-1]) print("added : " + self.routers[-1])
self.addLink(self.lswitch, self.routers[-1]) self.addLink(self.lswitch, self.routers[-1])
self.addLink(self.rswitch, self.routers[-1], **l.asDict()) self.addLink(self.rswitch, self.routers[-1], **l.asDict())
def addOneRouterPerLink(self, link): def addOneRouterPerLink(self, link):
return self.addHost(MpTopo.routerNamePrefix + return self.addHost(MpTopo.routerNamePrefix +
str(link.id)) str(link.id))
def __str__(self): def __str__(self):
s = "Single if ECMP like env\n" s = "Single if ECMP like env\n"
i = 0 i = 0
n = len(self.topoParam.linkCharacteristics) n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics: for p in self.topoParam.linkCharacteristics:
if i == n // 2: if i == n // 2:
if n % 2 == 0: if n % 2 == 0:
s = s + "c---sw sw-----s\n" s = s + "c---sw sw-----s\n"
s = s + " |-----R-----|\n" s = s + " |-----R-----|\n"
else: else:
s = s + "c---sw----R-----sw-----s\n" s = s + "c---sw----R-----sw-----s\n"
else: else:
s = s + " |-----R-----|\n" s = s + " |-----R-----|\n"
i = i + 1 i = i + 1
return s return s

View File

@ -2,278 +2,278 @@ from mpParamXp import MpParamXp
from mpMultiInterfaceTopo import MpMultiInterfaceTopo from mpMultiInterfaceTopo import MpMultiInterfaceTopo
class MpExperience: class MpExperience:
PING = "ping" PING = "ping"
NCPV = "ncpv" NCPV = "ncpv"
NC = "nc" NC = "nc"
NONE = "none" NONE = "none"
HTTPS = "https" HTTPS = "https"
HTTP = "http" HTTP = "http"
EPLOAD = "epload" EPLOAD = "epload"
NETPERF = "netperf" NETPERF = "netperf"
AB = "ab" AB = "ab"
SIRI = "siri" SIRI = "siri"
SENDFILE = "sendfile" SENDFILE = "sendfile"
VLC = "vlc" VLC = "vlc"
IPERF = "iperf" IPERF = "iperf"
DITG = "ditg" DITG = "ditg"
MSG = "msg" MSG = "msg"
SIRIHTTP = "sirihttp" SIRIHTTP = "sirihttp"
SIRIMSG = "sirimsg" SIRIMSG = "sirimsg"
QUIC = "quic" QUIC = "quic"
QUICSIRI = "quicsiri" QUICSIRI = "quicsiri"
def __init__(self, xpParam, mpTopo, mpConfig): def __init__(self, xpParam, mpTopo, mpConfig):
self.xpParam = xpParam self.xpParam = xpParam
self.mpTopo = mpTopo self.mpTopo = mpTopo
self.mpConfig = mpConfig self.mpConfig = mpConfig
print(self.xpParam) print(self.xpParam)
def classicRun(self): def classicRun(self):
self.prepare() self.prepare()
self.run() self.run()
self.clean() self.clean()
def prepare(self): def prepare(self):
self.setupSysctl() self.setupSysctl()
self.runUserspacePM() self.runUserspacePM()
self.mpConfig.configureNetwork() self.mpConfig.configureNetwork()
self.changeMetric() self.changeMetric()
self.putPriorityOnPaths() self.putPriorityOnPaths()
self.disableTSO() self.disableTSO()
self.runTcpDump() self.runTcpDump()
self.runNetemAt() self.runNetemAt()
pass pass
def changeMetric(self): def changeMetric(self):
metric = self.xpParam.getParam(MpParamXp.METRIC) metric = self.xpParam.getParam(MpParamXp.METRIC)
if int(metric) >= 0: if int(metric) >= 0:
self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric") self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric")
def putPriorityOnPaths(self): def putPriorityOnPaths(self):
# Only meaningful if mpTopo is instance of MpMultiInterfaceTopo # Only meaningful if mpTopo is instance of MpMultiInterfaceTopo
if isinstance(self.mpTopo, MpMultiInterfaceTopo): if isinstance(self.mpTopo, MpMultiInterfaceTopo):
prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0) prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0)
prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1) prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1)
if not prioPath0 == prioPath1: if not prioPath0 == prioPath1:
self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " +
self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0)) self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0))
self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " +
self.mpConfig.getRouterInterfaceSwitch(0) + " priority " + self.mpConfig.getRouterInterfaceSwitch(0) + " priority " +
str(prioPath0)) str(prioPath0))
self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " +
self.mpConfig.getClientInterface(1) + " priority " + str(prioPath1)) self.mpConfig.getClientInterface(1) + " priority " + str(prioPath1))
self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " +
self.mpConfig.getRouterInterfaceSwitch(1) + " priority " + self.mpConfig.getRouterInterfaceSwitch(1) + " priority " +
str(prioPath1)) str(prioPath1))
backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0) backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0)
if int(backupPath0) > 0: if int(backupPath0) > 0:
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(0))) self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(0)))
self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(0))) self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(0)))
backupPath1 = self.xpParam.getParam(MpParamXp.BACKUPPATH1) backupPath1 = self.xpParam.getParam(MpParamXp.BACKUPPATH1)
if int(backupPath1) > 0: if int(backupPath1) > 0:
self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(1))) self.mpTopo.commandTo(self.mpConfig.client, self.mpConfig.interfaceBUPCommand(self.mpConfig.getClientInterface(1)))
self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(1))) self.mpTopo.commandTo(self.mpConfig.router, self.mpConfig.interfaceBUPCommand(self.mpConfig.getRouterInterfaceSwitch(1)))
def disableTSO(self): def disableTSO(self):
links = self.mpTopo.getLinkCharacteristics() links = self.mpTopo.getLinkCharacteristics()
i = 0 i = 0
for l in links: for l in links:
lname = self.mpConfig.getMidLeftName(i) lname = self.mpConfig.getMidLeftName(i)
rname = self.mpConfig.getMidRightName(i) rname = self.mpConfig.getMidRightName(i)
lbox = self.mpTopo.getHost(lname) lbox = self.mpTopo.getHost(lname)
lif = self.mpConfig.getMidL2RInterface(i) lif = self.mpConfig.getMidL2RInterface(i)
rif = self.mpConfig.getMidR2LInterface(i) rif = self.mpConfig.getMidR2LInterface(i)
rbox = self.mpTopo.getHost(rname) rbox = self.mpTopo.getHost(rname)
print(str(lname) + " " + str(lif)) print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif)) print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox)) print("boxes " + str(lbox) + " " + str(rbox))
cmd = "ethtool -K " + lif + " tso off" cmd = "ethtool -K " + lif + " tso off"
print(cmd) print(cmd)
self.mpTopo.commandTo(lbox, cmd) self.mpTopo.commandTo(lbox, cmd)
cmd = "ethtool -K " + rif + " tso off" cmd = "ethtool -K " + rif + " tso off"
print(cmd) print(cmd)
self.mpTopo.commandTo(rbox, cmd) self.mpTopo.commandTo(rbox, cmd)
i = i + 1 i = i + 1
# And for the server # And for the server
cmd = "ethtool -K " + self.mpConfig.getServerInterface() + " tso off" cmd = "ethtool -K " + self.mpConfig.getServerInterface() + " tso off"
print(cmd) print(cmd)
self.mpTopo.commandTo(self.mpConfig.server, cmd) self.mpTopo.commandTo(self.mpConfig.server, cmd)
cmd = "ethtool -K " + self.mpConfig.getRouterInterfaceSwitch(self.mpConfig.getClientInterfaceCount()) + " tso off" cmd = "ethtool -K " + self.mpConfig.getRouterInterfaceSwitch(self.mpConfig.getClientInterfaceCount()) + " tso off"
print(cmd) print(cmd)
self.mpTopo.commandTo(self.mpConfig.router, cmd) self.mpTopo.commandTo(self.mpConfig.router, cmd)
def runUserspacePM(self): def runUserspacePM(self):
if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink":
print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upmc = self.xpParam.getParam(MpParamXp.USERPMC) upmc = self.xpParam.getParam(MpParamXp.USERPMC)
upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS) upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS)
self.mpTopo.commandTo(self.mpConfig.client, upmc + \ self.mpTopo.commandTo(self.mpConfig.client, upmc + \
" " + upmca + " &>upmc.log &") " " + upmca + " &>upmc.log &")
if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink":
print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upms = self.xpParam.getParam(MpParamXp.USERPMS) upms = self.xpParam.getParam(MpParamXp.USERPMS)
upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS) upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS)
self.mpTopo.commandTo(self.mpConfig.server, upms + \ self.mpTopo.commandTo(self.mpConfig.server, upms + \
" " + upmsa + " &>upms.log &") " " + upmsa + " &>upms.log &")
def cleanUserspacePM(self): def cleanUserspacePM(self):
if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink":
print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upmc = self.xpParam.getParam(MpParamXp.USERPMC) upmc = self.xpParam.getParam(MpParamXp.USERPMC)
self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc) self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc)
if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink":
print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !")
else: else:
upms = self.xpParam.getParam(MpParamXp.USERPMS) upms = self.xpParam.getParam(MpParamXp.USERPMS)
self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms) self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms)
def runNetemAt(self): def runNetemAt(self):
if not self.mpTopo.changeNetem == "yes": if not self.mpTopo.changeNetem == "yes":
print("I don't need to change netem") print("I don't need to change netem")
return return
print("Will change netem config on the fly") print("Will change netem config on the fly")
links = self.mpTopo.getLinkCharacteristics() links = self.mpTopo.getLinkCharacteristics()
i = 0 i = 0
for l in links: for l in links:
lname = self.mpConfig.getMidLeftName(i) lname = self.mpConfig.getMidLeftName(i)
rname = self.mpConfig.getMidRightName(i) rname = self.mpConfig.getMidRightName(i)
lbox = self.mpTopo.getHost(lname) lbox = self.mpTopo.getHost(lname)
lif = self.mpConfig.getMidL2RInterface(i) lif = self.mpConfig.getMidL2RInterface(i)
rif = self.mpConfig.getMidR2LInterface(i) rif = self.mpConfig.getMidR2LInterface(i)
rbox = self.mpTopo.getHost(rname) rbox = self.mpTopo.getHost(rname)
print(str(lname) + " " + str(lif)) print(str(lname) + " " + str(lif))
print(str(rname) + " " + str(rif)) print(str(rname) + " " + str(rif))
print("boxes " + str(lbox) + " " + str(rbox)) print("boxes " + str(lbox) + " " + str(rbox))
cmd = l.buildBwCmd(lif) cmd = l.buildBwCmd(lif)
print(cmd) print(cmd)
self.mpTopo.commandTo(lbox, cmd) self.mpTopo.commandTo(lbox, cmd)
cmd = l.buildBwCmd(rif) cmd = l.buildBwCmd(rif)
print(cmd) print(cmd)
self.mpTopo.commandTo(rbox, cmd) self.mpTopo.commandTo(rbox, cmd)
ilif = self.mpConfig.getMidL2RIncomingInterface(i) ilif = self.mpConfig.getMidL2RIncomingInterface(i)
irif = self.mpConfig.getMidR2LIncomingInterface(i) irif = self.mpConfig.getMidR2LIncomingInterface(i)
cmd = l.buildPolicingCmd(ilif) cmd = l.buildPolicingCmd(ilif)
print(cmd) print(cmd)
self.mpTopo.commandTo(lbox, cmd) self.mpTopo.commandTo(lbox, cmd)
cmd = l.buildPolicingCmd(irif) cmd = l.buildPolicingCmd(irif)
print(cmd) print(cmd)
self.mpTopo.commandTo(rbox, cmd) self.mpTopo.commandTo(rbox, cmd)
cmd = l.buildNetemCmd(irif) cmd = l.buildNetemCmd(irif)
print(cmd) print(cmd)
self.mpTopo.commandTo(rbox, cmd) self.mpTopo.commandTo(rbox, cmd)
cmd = l.buildNetemCmd(ilif) cmd = l.buildNetemCmd(ilif)
print(cmd) print(cmd)
self.mpTopo.commandTo(lbox, cmd) self.mpTopo.commandTo(lbox, cmd)
i = i + 1 i = i + 1
def run(self): def run(self):
pass pass
def clean(self): def clean(self):
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"killall tcpdump") "killall tcpdump")
self.mpTopo.commandTo(self.mpConfig.server, self.mpTopo.commandTo(self.mpConfig.server,
"killall tcpdump") "killall tcpdump")
self.backUpSysctl() self.backUpSysctl()
self.cleanUserspacePM() self.cleanUserspacePM()
pass pass
def setupSysctl(self): def setupSysctl(self):
self.saveSysctl() self.saveSysctl()
self.writeSysctl() self.writeSysctl()
def saveSysctl(self): def saveSysctl(self):
self.sysctlBUP = {} self.sysctlBUP = {}
self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self.sysctlBUPC = {} self.sysctlBUPC = {}
self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self.sysctlBUPS = {} self.sysctlBUPS = {}
self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlDic: for k in sysctlDic:
sysctlKey = sysctlDic[k] sysctlKey = sysctlDic[k]
cmd = self.cmdReadSysctl(sysctlKey) cmd = self.cmdReadSysctl(sysctlKey)
if not ns: if not ns:
val = self.mpTopo.notNSCommand(cmd) val = self.mpTopo.notNSCommand(cmd)
else: else:
val = self.mpTopo.commandTo(who, cmd) val = self.mpTopo.commandTo(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't get sysctl " + sysctlKey) print("oooops can't get sysctl " + sysctlKey)
else: else:
sysctlBUP[k] = val.split(" ",2)[2][:-1] sysctlBUP[k] = val.split(" ",2)[2][:-1]
def cmdReadSysctl(self, key): def cmdReadSysctl(self, key):
s = "sysctl " + key s = "sysctl " + key
return s return s
def cmdWriteSysctl(self, key, value): def cmdWriteSysctl(self, key, value):
s = self.cmdReadSysctl(key) s = self.cmdReadSysctl(key)
s = s + "=\"" + str(value) + "\"" s = s + "=\"" + str(value) + "\""
return s return s
def writeSysctl(self): def writeSysctl(self):
self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlBUP: for k in sysctlBUP:
sysctlKey = sysctlDic[k] sysctlKey = sysctlDic[k]
sysctlValue = self.xpParam.getParam(k) sysctlValue = self.xpParam.getParam(k)
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
if not ns: if not ns:
val = self.mpTopo.notNSCommand(cmd) val = self.mpTopo.notNSCommand(cmd)
else: else:
val = self.mpTopo.commandTo(who, cmd) val = self.mpTopo.commandTo(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't set sysctl " + sysctlKey) print("oooops can't set sysctl " + sysctlKey)
def backUpSysctl(self): def backUpSysctl(self):
self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP) self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC, self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
ns = True, who = self.mpConfig.client) ns = True, who = self.mpConfig.client)
self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS, self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
ns = True, who = self.mpConfig.server) ns = True, who = self.mpConfig.server)
def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
for k in sysctlBUP: for k in sysctlBUP:
sysctlKey = sysctlDic[k] sysctlKey = sysctlDic[k]
sysctlValue = sysctlBUP[k] sysctlValue = sysctlBUP[k]
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
if not ns: if not ns:
val = self.mpTopo.notNSCommand(cmd) val = self.mpTopo.notNSCommand(cmd)
else: else:
val = self.mpTopo.commandTo(who, cmd) val = self.mpTopo.commandTo(who, cmd)
if val == "Error": if val == "Error":
print("oooops can't set sysctl " + sysctlKey) print("oooops can't set sysctl " + sysctlKey)
def runTcpDump(self): def runTcpDump(self):
#todo : replace filename by cst #todo : replace filename by cst
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP) cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP)
spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP) spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP)
snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP) snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP)
if cpcap == "yes" : if cpcap == "yes" :
self.mpTopo.commandTo(self.mpConfig.client, self.mpTopo.commandTo(self.mpConfig.client,
"tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &")
if spcap == "yes" : if spcap == "yes" :
self.mpTopo.commandTo(self.mpConfig.server, self.mpTopo.commandTo(self.mpConfig.server,
"tcpdump -i any -s " + snaplenpcap + " -w server.pcap &") "tcpdump -i any -s " + snaplenpcap + " -w server.pcap &")
if spcap == "yes" or cpcap == "yes": if spcap == "yes" or cpcap == "yes":
self.mpTopo.commandTo(self.mpConfig.client,"sleep 5") self.mpTopo.commandTo(self.mpConfig.client,"sleep 5")

View File

@ -3,100 +3,100 @@ import math
class MpLinkCharacteristics: class MpLinkCharacteristics:
tcNetemParent = "1:1" tcNetemParent = "1:1"
tcHtbClassid = "10" tcHtbClassid = "10"
tcNetemHandle = "1:10" tcNetemHandle = "1:10"
def bandwidthDelayProductDividedByMTU(self): def bandwidthDelayProductDividedByMTU(self):
rtt = 2 * float(self.delay) rtt = 2 * float(self.delay)
""" Since bandwidth is in Mbps and rtt in ms """ """ Since bandwidth is in Mbps and rtt in ms """
bandwidthDelayProduct = (float(self.bandwidth) * 125000.0) * (rtt / 1000.0) bandwidthDelayProduct = (float(self.bandwidth) * 125000.0) * (rtt / 1000.0)
return int(math.ceil(bandwidthDelayProduct * 1.0 / 1500.0)) return int(math.ceil(bandwidthDelayProduct * 1.0 / 1500.0))
def bufferSize(self): def bufferSize(self):
return (1500.0 * self.bandwidthDelayProductDividedByMTU()) + (float(self.bandwidth) * 1000.0 * float(self.queuingDelay) / 8) return (1500.0 * self.bandwidthDelayProductDividedByMTU()) + (float(self.bandwidth) * 1000.0 * float(self.queuingDelay) / 8)
def extractQueuingDelay(self, queueSize, bandwidth, delay, mtu=1500): def extractQueuingDelay(self, queueSize, bandwidth, delay, mtu=1500):
# rtt = 2 * float(delay) # rtt = 2 * float(delay)
# bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000)) # bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000))
# if int(queueSize) <= bdp_queue_size: # if int(queueSize) <= bdp_queue_size:
# Returning 0 seems to bypass everything, then only limited by CPU. # Returning 0 seems to bypass everything, then only limited by CPU.
# This is not what we want... # This is not what we want...
# return 1 # return 1
# queuingQueueSize = int(queueSize) - bdp_queue_size # queuingQueueSize = int(queueSize) - bdp_queue_size
queuingDelay = (int(queueSize) * int(mtu) * 8.0 * 1000.0) / (float(bandwidth) * 1024 * 1024) queuingDelay = (int(queueSize) * int(mtu) * 8.0 * 1000.0) / (float(bandwidth) * 1024 * 1024)
return max(int(queuingDelay), 1) return max(int(queuingDelay), 1)
def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False): def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False):
self.id = id self.id = id
self.delay = delay self.delay = delay
self.queueSize = queueSize self.queueSize = queueSize
self.bandwidth = bandwidth self.bandwidth = bandwidth
self.loss = loss self.loss = loss
self.queuingDelay = str(self.extractQueuingDelay(queueSize, bandwidth, delay)) self.queuingDelay = str(self.extractQueuingDelay(queueSize, bandwidth, delay))
self.netemAt = [] self.netemAt = []
self.back_up = back_up self.back_up = back_up
def addNetemAt(self, n): def addNetemAt(self, n):
if len(self.netemAt) == 0: if len(self.netemAt) == 0:
n.delta = n.at n.delta = n.at
self.netemAt.append(n) self.netemAt.append(n)
else: else:
if n.at > self.netemAt[-1].at: if n.at > self.netemAt[-1].at:
n.delta = n.at - self.netemAt[-1].at n.delta = n.at - self.netemAt[-1].at
self.netemAt.append(n) self.netemAt.append(n)
else: else:
print("Do not take into account " + n.__str__() + \ print("Do not take into account " + n.__str__() + \
"because ooo !") "because ooo !")
pass pass
def buildBwCmd(self, ifname): def buildBwCmd(self, ifname):
cmd = "" cmd = ""
for n in self.netemAt: for n in self.netemAt:
cmd = cmd + "sleep {}".format(n.delta) cmd = cmd + "sleep {}".format(n.delta)
cmd = cmd + " && tc qdisc del dev {} root ".format(ifname) cmd = cmd + " && tc qdisc del dev {} root ".format(ifname)
cmd = cmd + " ; tc qdisc add dev {} root handle 5:0 tbf rate {}mbit burst 15000 limit {} &&".format(ifname, self.bandwidth, int(self.bufferSize())) cmd = cmd + " ; tc qdisc add dev {} root handle 5:0 tbf rate {}mbit burst 15000 limit {} &&".format(ifname, self.bandwidth, int(self.bufferSize()))
cmd = cmd + " true &" cmd = cmd + " true &"
return cmd return cmd
def buildNetemCmd(self, ifname): def buildNetemCmd(self, ifname):
cmd = "" cmd = ""
for n in self.netemAt: for n in self.netemAt:
cmd = cmd + "sleep " + str(n.delta) cmd = cmd + "sleep " + str(n.delta)
cmd = cmd + " && tc qdisc del dev " + ifname + " root " cmd = cmd + " && tc qdisc del dev " + ifname + " root "
cmd = cmd + " ; tc qdisc add dev {} root handle 10: netem {} delay {}ms limit 50000 &&".format(ifname, n.cmd, self.delay) cmd = cmd + " ; tc qdisc add dev {} root handle 10: netem {} delay {}ms limit 50000 &&".format(ifname, n.cmd, self.delay)
cmd = cmd + " true &" cmd = cmd + " true &"
return cmd return cmd
def buildPolicingCmd(self, ifname): def buildPolicingCmd(self, ifname):
cmd = "" cmd = ""
for n in self.netemAt: for n in self.netemAt:
cmd = cmd + "sleep {}".format(n.delta) cmd = cmd + "sleep {}".format(n.delta)
cmd = cmd + " && tc qdisc del dev {} ingress".format(ifname) cmd = cmd + " && tc qdisc del dev {} ingress".format(ifname)
cmd = cmd + " ; tc qdisc add dev {} handle ffff: ingress".format(ifname) cmd = cmd + " ; tc qdisc add dev {} handle ffff: ingress".format(ifname)
cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop && ".format(ifname, self.bandwidth, int(self.bufferSize() * 1.2)) cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop && ".format(ifname, self.bandwidth, int(self.bufferSize() * 1.2))
cmd = cmd + " true &" cmd = cmd + " true &"
return cmd return cmd
def asDict(self): def asDict(self):
d = {} d = {}
d['bw'] = float(self.bandwidth) d['bw'] = float(self.bandwidth)
d['delay'] = self.delay + "ms" d['delay'] = self.delay + "ms"
d['loss'] = float(self.loss) d['loss'] = float(self.loss)
d['max_queue_size'] = int(self.queueSize) d['max_queue_size'] = int(self.queueSize)
return d return d
def __str__(self): def __str__(self):
s = "Link id : " + str(self.id) + "\n" s = "Link id : " + str(self.id) + "\n"
s = s + "\tDelay : " + str(self.delay) + "\n" s = s + "\tDelay : " + str(self.delay) + "\n"
s = s + "\tQueue Size : " + str(self.queueSize) + "\n" s = s + "\tQueue Size : " + str(self.queueSize) + "\n"
s = s + "\tBandwidth : " + str(self.bandwidth) + "\n" s = s + "\tBandwidth : " + str(self.bandwidth) + "\n"
s = s + "\tLoss : " + str(self.loss) + "\n" s = s + "\tLoss : " + str(self.loss) + "\n"
s = s + "\tBack up : " + str(self.back_up) + "\n" s = s + "\tBack up : " + str(self.back_up) + "\n"
for l in self.netemAt: for l in self.netemAt:
s = s + "\t" + l.__str__() + "\n" s = s + "\t" + l.__str__() + "\n"
return s return s

View File

@ -6,39 +6,39 @@ from mininet.cli import CLI
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
class MpMininetBuilder(Topo): class MpMininetBuilder(Topo):
def __init__(self): def __init__(self):
Topo.__init__( self ) Topo.__init__( self )
self.net = None self.net = None
def commandTo(self, who, cmd): def commandTo(self, who, cmd):
return who.cmd(cmd) return who.cmd(cmd)
def notNSCommand(self, cmd): def notNSCommand(self, cmd):
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
if stderr: if stderr:
return "Error" return "Error"
return stdout return stdout
def startNetwork(self): def startNetwork(self):
self.net = Mininet(topo=self,link=TCLink,switch=OVSBridge) self.net = Mininet(topo=self,link=TCLink,switch=OVSBridge)
self.net.start() self.net.start()
def getCLI(self): def getCLI(self):
if self.net is None: if self.net is None:
print("Can not get the CLI") print("Can not get the CLI")
else: else:
CLI(self.net) CLI(self.net)
def getHost(self, who): def getHost(self, who):
if self.net is None: if self.net is None:
print("Network not available....") print("Network not available....")
raise Exception("Network not ready"); raise Exception("Network not ready");
else: else:
return self.net.getNodeByName(who) return self.net.getNodeByName(who)
def stopNetwork(self): def stopNetwork(self):
if self.net is None: if self.net is None:
print("Could not stop network... Nothing to stop)") print("Could not stop network... Nothing to stop)")
else: else:
self.net.stop() self.net.stop()

View File

@ -4,139 +4,139 @@ from mpParamTopo import MpParamTopo
from mpTopo import MpTopo from mpTopo import MpTopo
class MpMultiInterfaceConfig(MpConfig): class MpMultiInterfaceConfig(MpConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) MpConfig.__init__(self, topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
for l in self.topo.switchClient: for l in self.topo.switchClient:
cmd = self.addRouteTableCommand(self.getClientIP(i), i) cmd = self.addRouteTableCommand(self.getClientIP(i), i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.addRouteScopeLinkCommand( cmd = self.addRouteScopeLinkCommand(
self.getClientSubnet(i), self.getClientSubnet(i),
self.getClientInterface(i), i) self.getClientInterface(i), i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i),
i) i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
i = i + 1 i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
self.getClientInterface(0)) self.getClientInterface(0))
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) cmd = self.addRouteDefaultSimple(self.getRouterIPServer())
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
def configureInterfaces(self): def configureInterfaces(self):
print("Configure interfaces for multi inf") print("Configure interfaces for multi inf")
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(MpTopo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(MpTopo.serverName)
self.router = self.topo.getHost(MpTopo.routerName) self.router = self.topo.getHost(MpTopo.routerName)
i = 0 i = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
for l in self.topo.switchClient: for l in self.topo.switchClient:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getClientInterface(i), self.getClientInterface(i),
self.getClientIP(i), netmask) self.getClientIP(i), netmask)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac)
if(links[i].back_up): if(links[i].back_up):
cmd = self.interfaceBUPCommand( cmd = self.interfaceBUPCommand(
self.getClientInterface(i)) self.getClientInterface(i))
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
i = i + 1 i = i + 1
i = 0 i = 0
for l in self.topo.switchServer: for l in self.topo.switchServer:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceSwitch(i), self.getRouterInterfaceSwitch(i),
self.getRouterIPSwitch(i), netmask) self.getRouterIPSwitch(i), netmask)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC()
self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
print(str(links[i])) print(str(links[i]))
i = i + 1 i = i + 1
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
self.getRouterIPServer(), netmask) self.getRouterIPServer(), netmask)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getServerInterface(), cmd = self.interfaceUpCommand(self.getServerInterface(),
self.getServerIP(), netmask) self.getServerIP(), netmask)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
serverIntfMac = self.server.intf(self.getServerInterface()).MAC() serverIntfMac = self.server.intf(self.getServerInterface()).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPSwitch(self, interfaceID): def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
routerIP = lSubnet + str(interfaceID) + ".2" routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP return routerIP
def getRouterIPServer(self): def getRouterIPServer(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getClientInterfaceCount(self): def getClientInterfaceCount(self):
return len(self.topo.switchClient) return len(self.topo.switchClient)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.getRouterInterfaceSwitch(len(self.topo.switchServer)) return self.getRouterInterfaceSwitch(len(self.topo.switchServer))
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return MpTopo.clientName + "-eth" + str(interfaceID)
def getRouterInterfaceSwitch(self, interfaceID): def getRouterInterfaceSwitch(self, interfaceID):
return MpTopo.routerName + "-eth" + str(interfaceID) return MpTopo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return MpTopo.serverName + "-eth0"
def getSwitchClientName(self, id): def getSwitchClientName(self, id):
return MpTopo.switchNamePrefix + str(2 * id) return MpTopo.switchNamePrefix + str(2 * id)
def getSwitchServerName(self, id): def getSwitchServerName(self, id):
return MpTopo.switchNamePrefix + str(2 * id + 1) return MpTopo.switchNamePrefix + str(2 * id + 1)
def getMidLeftName(self, id): def getMidLeftName(self, id):
return self.getSwitchClientName(id) return self.getSwitchClientName(id)
def getMidRightName(self, id): def getMidRightName(self, id):
return self.getSwitchServerName(id) return self.getSwitchServerName(id)
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2" return self.getMidLeftName(id) + "-eth2"
def getMidR2LInterface(self, id): def getMidR2LInterface(self, id):
return self.getMidRightName(id) + "-eth1" return self.getMidRightName(id) + "-eth1"
def getMidL2RIncomingInterface(self, id): def getMidL2RIncomingInterface(self, id):
return self.getMidLeftName(id) + "-eth1" return self.getMidLeftName(id) + "-eth1"
def getMidR2LIncomingInterface(self, id): def getMidR2LIncomingInterface(self, id):
return self.getMidRightName(id) + "-eth2" return self.getMidRightName(id) + "-eth2"

View File

@ -4,215 +4,215 @@ from mpParamTopo import MpParamTopo
from mpTopo import MpTopo from mpTopo import MpTopo
class MpMultiInterfaceCongConfig(MpConfig): class MpMultiInterfaceCongConfig(MpConfig):
def __init__(self, topo, param): def __init__(self, topo, param):
MpConfig.__init__(self, topo, param) MpConfig.__init__(self, topo, param)
def configureRoute(self): def configureRoute(self):
i = 0 i = 0
for l in self.topo.switch: for l in self.topo.switch:
cmd = self.addRouteTableCommand(self.getClientIP(i), i) cmd = self.addRouteTableCommand(self.getClientIP(i), i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
# Congestion client # Congestion client
cmd = self.addRouteTableCommand(self.getCongClientIP(i), i) cmd = self.addRouteTableCommand(self.getCongClientIP(i), i)
self.topo.commandTo(self.cong_clients[i], cmd) self.topo.commandTo(self.cong_clients[i], cmd)
cmd = self.addRouteScopeLinkCommand( cmd = self.addRouteScopeLinkCommand(
self.getClientSubnet(i), self.getClientSubnet(i),
self.getClientInterface(i), i) self.getClientInterface(i), i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
# Congestion client # Congestion client
cmd = self.addRouteScopeLinkCommand( cmd = self.addRouteScopeLinkCommand(
self.getClientSubnet(i), self.getClientSubnet(i),
self.getCongClientInterface(i), i) self.getCongClientInterface(i), i)
self.topo.commandTo(self.cong_clients[i], cmd) self.topo.commandTo(self.cong_clients[i], cmd)
cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i),
i) i)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
# Congestion client # Congestion client
# Keep the same command # Keep the same command
self.topo.commandTo(self.cong_clients[i], cmd) self.topo.commandTo(self.cong_clients[i], cmd)
# Congestion client # Congestion client
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i),
self.getCongClientInterface(i)) self.getCongClientInterface(i))
i = i + 1 i = i + 1
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0),
self.getClientInterface(0)) self.getClientInterface(0))
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
# Congestion Client # Congestion Client
i = 0 i = 0
for c in self.cong_clients: for c in self.cong_clients:
cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i),
self.getCongClientInterface(i)) self.getCongClientInterface(i))
self.topo.commandTo(c, cmd) self.topo.commandTo(c, cmd)
i = i + 1 i = i + 1
cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) cmd = self.addRouteDefaultSimple(self.getRouterIPServer())
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
# Congestion servers # Congestion servers
i = 0 i = 0
for s in self.cong_servers: for s in self.cong_servers:
cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i)) cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i))
self.topo.commandTo(s, cmd) self.topo.commandTo(s, cmd)
i += 1 i += 1
def configureInterfaces(self): def configureInterfaces(self):
print("Configure interfaces for multi inf") print("Configure interfaces for multi inf")
self.client = self.topo.getHost(MpTopo.clientName) self.client = self.topo.getHost(MpTopo.clientName)
self.server = self.topo.getHost(MpTopo.serverName) self.server = self.topo.getHost(MpTopo.serverName)
self.router = self.topo.getHost(MpTopo.routerName) self.router = self.topo.getHost(MpTopo.routerName)
cong_client_names = self.topo.getCongClients() cong_client_names = self.topo.getCongClients()
self.cong_clients = [] self.cong_clients = []
for cn in cong_client_names: for cn in cong_client_names:
self.cong_clients.append(self.topo.getHost(cn)) self.cong_clients.append(self.topo.getHost(cn))
cong_server_names = self.topo.getCongServers() cong_server_names = self.topo.getCongServers()
self.cong_servers = [] self.cong_servers = []
for sn in cong_server_names: for sn in cong_server_names:
self.cong_servers.append(self.topo.getHost(sn)) self.cong_servers.append(self.topo.getHost(sn))
i = 0 i = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
links = self.topo.getLinkCharacteristics() links = self.topo.getLinkCharacteristics()
for l in self.topo.switch: for l in self.topo.switch:
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getClientInterface(i), self.getClientInterface(i),
self.getClientIP(i), netmask) self.getClientIP(i), netmask)
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac)
if(links[i].back_up): if(links[i].back_up):
cmd = self.interfaceBUPCommand( cmd = self.interfaceBUPCommand(
self.getClientInterface(i)) self.getClientInterface(i))
self.topo.commandTo(self.client, cmd) self.topo.commandTo(self.client, cmd)
# Congestion client # Congestion client
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getCongClientInterface(i), self.getCongClientInterface(i),
self.getCongClientIP(i), netmask) self.getCongClientIP(i), netmask)
self.topo.commandTo(self.cong_clients[i], cmd) self.topo.commandTo(self.cong_clients[i], cmd)
congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC() congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac)
cmd = self.interfaceUpCommand( cmd = self.interfaceUpCommand(
self.getRouterInterfaceSwitch(i), self.getRouterInterfaceSwitch(i),
self.getRouterIPSwitch(i), netmask) self.getRouterIPSwitch(i), netmask)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC()
self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
# Don't forget the congestion client # Don't forget the congestion client
self.topo.commandTo(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) self.topo.commandTo(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac)
print(str(links[i])) print(str(links[i]))
i = i + 1 i = i + 1
cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(),
self.getRouterIPServer(), netmask) self.getRouterIPServer(), netmask)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getServerInterface(), cmd = self.interfaceUpCommand(self.getServerInterface(),
self.getServerIP(), netmask) self.getServerIP(), netmask)
self.topo.commandTo(self.server, cmd) self.topo.commandTo(self.server, cmd)
serverIntfMac = self.server.intf(self.getServerInterface()).MAC() serverIntfMac = self.server.intf(self.getServerInterface()).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac)
# Congestion servers # Congestion servers
i = 0 i = 0
for s in self.cong_servers: for s in self.cong_servers:
cmd = self.interfaceUpCommand(self.getRouterInterfaceCongServer(i), cmd = self.interfaceUpCommand(self.getRouterInterfaceCongServer(i),
self.getRouterIPCongServer(i), netmask) self.getRouterIPCongServer(i), netmask)
self.topo.commandTo(self.router, cmd) self.topo.commandTo(self.router, cmd)
routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC() routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC()
self.topo.commandTo(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac) self.topo.commandTo(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac)
cmd = self.interfaceUpCommand(self.getCongServerInterface(i), cmd = self.interfaceUpCommand(self.getCongServerInterface(i),
self.getCongServerIP(i), netmask) self.getCongServerIP(i), netmask)
self.topo.commandTo(s, cmd) self.topo.commandTo(s, cmd)
congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC() congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC()
self.topo.commandTo(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) self.topo.commandTo(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac)
i = i + 1 i = i + 1
def getClientIP(self, interfaceID): def getClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientIP = lSubnet + str(interfaceID) + ".1" clientIP = lSubnet + str(interfaceID) + ".1"
return clientIP return clientIP
def getCongClientIP(self, interfaceID): def getCongClientIP(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
congClientIP = lSubnet + str(interfaceID) + ".127" congClientIP = lSubnet + str(interfaceID) + ".127"
return congClientIP return congClientIP
def getClientSubnet(self, interfaceID): def getClientSubnet(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
clientSubnet = lSubnet + str(interfaceID) + ".0/24" clientSubnet = lSubnet + str(interfaceID) + ".0/24"
return clientSubnet return clientSubnet
def getRouterIPSwitch(self, interfaceID): def getRouterIPSwitch(self, interfaceID):
lSubnet = self.param.getParam(MpParamTopo.LSUBNET) lSubnet = self.param.getParam(MpParamTopo.LSUBNET)
routerIP = lSubnet + str(interfaceID) + ".2" routerIP = lSubnet + str(interfaceID) + ".2"
return routerIP return routerIP
def getRouterIPServer(self): def getRouterIPServer(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
routerIP = rSubnet + "0.2" routerIP = rSubnet + "0.2"
return routerIP return routerIP
def getRouterIPCongServer(self, congID): def getRouterIPCongServer(self, congID):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
routerIP = rSubnet + str(1 + congID) + ".2" routerIP = rSubnet + str(1 + congID) + ".2"
return routerIP return routerIP
def getServerIP(self): def getServerIP(self):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
serverIP = rSubnet + "0.1" serverIP = rSubnet + "0.1"
return serverIP return serverIP
def getCongServerIP(self, congID): def getCongServerIP(self, congID):
rSubnet = self.param.getParam(MpParamTopo.RSUBNET) rSubnet = self.param.getParam(MpParamTopo.RSUBNET)
serverIP = rSubnet + str(1 + congID) + ".1" serverIP = rSubnet + str(1 + congID) + ".1"
return serverIP return serverIP
def getClientInterfaceCount(self): def getClientInterfaceCount(self):
return len(self.topo.switch) return len(self.topo.switch)
def getRouterInterfaceServer(self): def getRouterInterfaceServer(self):
return self.getRouterInterfaceSwitch(len(self.topo.switch)) return self.getRouterInterfaceSwitch(len(self.topo.switch))
def getRouterInterfaceCongServer(self, congID): def getRouterInterfaceCongServer(self, congID):
return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID) return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID)
def getClientInterface(self, interfaceID): def getClientInterface(self, interfaceID):
return MpTopo.clientName + "-eth" + str(interfaceID) return MpTopo.clientName + "-eth" + str(interfaceID)
def getCongClientInterface(self, interfaceID): def getCongClientInterface(self, interfaceID):
return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0" return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0"
def getRouterInterfaceSwitch(self, interfaceID): def getRouterInterfaceSwitch(self, interfaceID):
return MpTopo.routerName + "-eth" + str(interfaceID) return MpTopo.routerName + "-eth" + str(interfaceID)
def getServerInterface(self): def getServerInterface(self):
return MpTopo.serverName + "-eth0" return MpTopo.serverName + "-eth0"
def getCongServerInterface(self, interfaceID): def getCongServerInterface(self, interfaceID):
return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0" return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0"
def getMidLeftName(self, id): def getMidLeftName(self, id):
return MpTopo.switchNamePrefix + str(id) return MpTopo.switchNamePrefix + str(id)
def getMidRightName(self, id): def getMidRightName(self, id):
return MpTopo.routerName return MpTopo.routerName
def getMidL2RInterface(self, id): def getMidL2RInterface(self, id):
return self.getMidLeftName(id) + "-eth2" return self.getMidLeftName(id) + "-eth2"
def getMidR2LInterface(self, id): def getMidR2LInterface(self, id):
return self.getMidRightName(id) + "-eth" + str(id) return self.getMidRightName(id) + "-eth" + str(id)

View File

@ -1,52 +1,52 @@
from mpTopo import MpTopo from mpTopo import MpTopo
class MpMultiInterfaceCongTopo(MpTopo): class MpMultiInterfaceCongTopo(MpTopo):
congClientName = "CCli" congClientName = "CCli"
congServerName = "CSer" congServerName = "CSer"
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) MpTopo.__init__(self,topoBuilder, parameterFile)
print("Hello from topo multi if") print("Hello from topo multi if")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(MpTopo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(MpTopo.serverName)
self.router = self.addHost(MpTopo.routerName) self.router = self.addHost(MpTopo.routerName)
self.cong_clients = [] self.cong_clients = []
self.cong_servers = [] self.cong_servers = []
self.switch = [] self.switch = []
for l in self.topoParam.linkCharacteristics: for l in self.topoParam.linkCharacteristics:
self.switch.append(self.addOneSwitchPerLink(l)) self.switch.append(self.addOneSwitchPerLink(l))
self.addLink(self.client,self.switch[-1]) self.addLink(self.client,self.switch[-1])
self.cong_clients.append(self.addHost(MpMultiInterfaceCongTopo.congClientName + str(len(self.cong_clients)))) self.cong_clients.append(self.addHost(MpMultiInterfaceCongTopo.congClientName + str(len(self.cong_clients))))
self.addLink(self.cong_clients[-1], self.switch[-1]) self.addLink(self.cong_clients[-1], self.switch[-1])
self.addLink(self.switch[-1],self.router, **l.asDict()) self.addLink(self.switch[-1],self.router, **l.asDict())
self.addLink(self.router, self.server) self.addLink(self.router, self.server)
for i in range(len(self.cong_clients)): for i in range(len(self.cong_clients)):
self.cong_servers.append(self.addHost(MpMultiInterfaceCongTopo.congServerName + str(len(self.cong_servers)))) self.cong_servers.append(self.addHost(MpMultiInterfaceCongTopo.congServerName + str(len(self.cong_servers))))
self.addLink(self.router, self.cong_servers[-1]) self.addLink(self.router, self.cong_servers[-1])
def getCongClients(self): def getCongClients(self):
return self.cong_clients return self.cong_clients
def getCongServers(self): def getCongServers(self):
return self.cong_servers return self.cong_servers
def addOneSwitchPerLink(self, link): def addOneSwitchPerLink(self, link):
return self.addSwitch(MpMultiInterfaceCongTopo.switchNamePrefix + return self.addSwitch(MpMultiInterfaceCongTopo.switchNamePrefix +
str(link.id)) str(link.id))
def __str__(self): def __str__(self):
s = "Simple multiple interface topology with congestion \n" s = "Simple multiple interface topology with congestion \n"
i = 0 i = 0
n = len(self.topoParam.linkCharacteristics) n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics: for p in self.topoParam.linkCharacteristics:
if i == n // 2: if i == n // 2:
if n % 2 == 0: if n % 2 == 0:
s = s + "c r-----s\n" s = s + "c r-----s\n"
s = s + "|-----sw-----|\n" s = s + "|-----sw-----|\n"
else: else:
s = s + "c-----sw-----r-----s\n" s = s + "c-----sw-----r-----s\n"
else: else:
s = s + "|-----sw-----|\n" s = s + "|-----sw-----|\n"
i = i + 1 i = i + 1
return s return s

View File

@ -1,44 +1,44 @@
from mpTopo import MpTopo from mpTopo import MpTopo
class MpMultiInterfaceTopo(MpTopo): class MpMultiInterfaceTopo(MpTopo):
def __init__(self, topoBuilder, parameterFile): def __init__(self, topoBuilder, parameterFile):
MpTopo.__init__(self,topoBuilder, parameterFile) MpTopo.__init__(self,topoBuilder, parameterFile)
print("Hello from topo multi if") print("Hello from topo multi if")
self.client = self.addHost(MpTopo.clientName) self.client = self.addHost(MpTopo.clientName)
self.server = self.addHost(MpTopo.serverName) self.server = self.addHost(MpTopo.serverName)
self.router = self.addHost(MpTopo.routerName) self.router = self.addHost(MpTopo.routerName)
self.switchClient = [] self.switchClient = []
self.switchServer = [] self.switchServer = []
for l in self.topoParam.linkCharacteristics: for l in self.topoParam.linkCharacteristics:
self.switchClient.append(self.addSwitch1ForLink(l)) self.switchClient.append(self.addSwitch1ForLink(l))
self.addLink(self.client,self.switchClient[-1]) self.addLink(self.client,self.switchClient[-1])
self.switchServer.append(self.addSwitch2ForLink(l)) self.switchServer.append(self.addSwitch2ForLink(l))
self.addLink(self.switchClient[-1], self.switchServer[-1], **l.asDict()) self.addLink(self.switchClient[-1], self.switchServer[-1], **l.asDict())
self.addLink(self.switchServer[-1],self.router) self.addLink(self.switchServer[-1],self.router)
self.addLink(self.router, self.server) self.addLink(self.router, self.server)
def addSwitch1ForLink(self, link): def addSwitch1ForLink(self, link):
return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix +
str(2 * link.id)) str(2 * link.id))
def addSwitch2ForLink(self, link): def addSwitch2ForLink(self, link):
return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix +
str(2 * link.id + 1)) str(2 * link.id + 1))
def __str__(self): def __str__(self):
s = "Simple multiple interface topolgy \n" s = "Simple multiple interface topolgy \n"
i = 0 i = 0
n = len(self.topoParam.linkCharacteristics) n = len(self.topoParam.linkCharacteristics)
for p in self.topoParam.linkCharacteristics: for p in self.topoParam.linkCharacteristics:
if i == n // 2: if i == n // 2:
if n % 2 == 0: if n % 2 == 0:
s = s + "c r-----s\n" s = s + "c r-----s\n"
s = s + "|--sw----sw--|\n" s = s + "|--sw----sw--|\n"
else: else:
s = s + "c--sw----sw--r-----s\n" s = s + "c--sw----sw--r-----s\n"
else: else:
s = s + "|--sw----sw--|\n" s = s + "|--sw----sw--|\n"
i = i + 1 i = i + 1
return s return s

View File

@ -19,7 +19,7 @@ class MpParam:
tab = l.split(":") tab = l.split(":")
if len(tab) == 2: if len(tab) == 2:
k = tab[0] k = tab[0]
val = tab[1][:-1] val = tab[1].rstrip()
if k in self.paramDic: if k in self.paramDic:
if not isinstance(self.paramDic[k], list): if not isinstance(self.paramDic[k], list):
self.paramDic[k] = [self.paramDic[k]] self.paramDic[k] = [self.paramDic[k]]

View File

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