diff --git a/mpConfig.py b/mpConfig.py index 8833a70..2b76dd2 100644 --- a/mpConfig.py +++ b/mpConfig.py @@ -1,81 +1,81 @@ class MpConfig: - PING_OUTPUT = "ping.log" + PING_OUTPUT = "ping.log" - def __init__(self, topo, param): - self.topo = topo - self.param = param + def __init__(self, topo, param): + self.topo = topo + self.param = param - def configureNetwork(self): - print("Configure interfaces....Generic call ?") - self.configureInterfaces() - self.configureRoute() + def configureNetwork(self): + print("Configure interfaces....Generic call ?") + self.configureInterfaces() + self.configureRoute() - def getMidL2RInterface(self, id): - "get Middle link, left to right interface" - pass + def getMidL2RInterface(self, id): + "get Middle link, left to right interface" + pass - def getMidR2LInterface(self, id): - pass + def getMidR2LInterface(self, id): + pass - def getMidLeftName(self, i): - "get Middle link, left box name" - pass + def getMidLeftName(self, i): + "get Middle link, left box name" + pass - def getMidRightName(self, i): - pass + def getMidRightName(self, i): + pass - def configureInterfaces(self): - pass + def configureInterfaces(self): + pass - def getClientInterfaceCount(self): - raise Exception("To be implemented") + def getClientInterfaceCount(self): + raise Exception("To be implemented") - def interfaceBUPCommand(self, interfaceName): - s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup " - print(s) - return s + def interfaceBUPCommand(self, interfaceName): + s = "/home/mininet/git/iproute-mptcp/ip/ip link set dev " + interfaceName + " multipath backup " + print(s) + return s - def interfaceUpCommand(self, interfaceName, ip, subnet): - s = "ifconfig " + interfaceName + " " + ip + " netmask " + \ - subnet - print(s) - return s + def interfaceUpCommand(self, interfaceName, ip, subnet): + s = "ifconfig " + interfaceName + " " + ip + " netmask " + \ + subnet + print(s) + return s - def addRouteTableCommand(self, fromIP, id): - s = "ip rule add from " + fromIP + " table " + str(id + 1) - print(s) - return s + def addRouteTableCommand(self, fromIP, id): + s = "ip rule add from " + fromIP + " table " + str(id + 1) + print(s) + return s - def addRouteScopeLinkCommand(self, network, interfaceName, id): - s = "ip route add " + network + " dev " + interfaceName + \ - " scope link table " + str(id + 1) - print(s) - return s + def addRouteScopeLinkCommand(self, network, interfaceName, id): + s = "ip route add " + network + " dev " + interfaceName + \ + " scope link table " + str(id + 1) + print(s) + return s - def addRouteDefaultCommand(self, via, id): - s = "ip route add default via " + via + " table " + str(id + 1) - print(s) - return s + def addRouteDefaultCommand(self, via, id): + s = "ip route add default via " + via + " table " + str(id + 1) + print(s) + return s - def addRouteDefaultGlobalCommand(self, via, interfaceName): - s = "ip route add default scope global nexthop via " + via + \ - " dev " + interfaceName - print(s) - return s + def addRouteDefaultGlobalCommand(self, via, interfaceName): + s = "ip route add default scope global nexthop via " + via + \ + " dev " + interfaceName + print(s) + return s - def arpCommand(self, ip, mac): - s = "arp -s " + ip + " " + mac - print(s) - return s + def arpCommand(self, ip, mac): + s = "arp -s " + ip + " " + mac + print(s) + return s - def addRouteDefaultSimple(self, via): - s = "ip route add default via " + via - print(s) - return s + def addRouteDefaultSimple(self, via): + s = "ip route add default via " + via + print(s) + return s - def pingCommand(self, fromIP, toIP, n=5): - s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ - " >> " + MpConfig.PING_OUTPUT - print(s) - return s + def pingCommand(self, fromIP, toIP, n=5): + s = "ping -c " + str(n) + " -I " + fromIP + " " + toIP + \ + " >> " + MpConfig.PING_OUTPUT + print(s) + return s diff --git a/mpECMPSingleInterfaceConfig.py b/mpECMPSingleInterfaceConfig.py index 215b4bf..350fc98 100644 --- a/mpECMPSingleInterfaceConfig.py +++ b/mpECMPSingleInterfaceConfig.py @@ -5,163 +5,163 @@ from mpTopo import MpTopo from struct import * class MpECMPSingleInterfaceConfig(MpConfig): - def __init__(self, topo, param): - MpConfig.__init__(self, topo, param) + def __init__(self, topo, param): + MpConfig.__init__(self, topo, param) - def configureRoute(self): - i = 0 - mask = len(self.topo.routers) - 1 - for l in self.topo.routers: - cmd = self.getIptableRuleICMP(mask, i) - self.topo.commandTo(self.client, cmd) - self.topo.commandTo(self.server, cmd) + def configureRoute(self): + i = 0 + mask = len(self.topo.routers) - 1 + for l in self.topo.routers: + cmd = self.getIptableRuleICMP(mask, i) + self.topo.commandTo(self.client, cmd) + self.topo.commandTo(self.server, cmd) - cmd = self.getIptableRuleTCPPortClient(mask, i) - self.topo.commandTo(self.client, cmd) - cmd = self.getIptableRuleTCPPortServer(mask, i) - self.topo.commandTo(self.server, cmd) + cmd = self.getIptableRuleTCPPortClient(mask, i) + self.topo.commandTo(self.client, cmd) + cmd = self.getIptableRuleTCPPortServer(mask, i) + self.topo.commandTo(self.server, cmd) - cmd = self.getIpRuleCmd(i) - self.topo.commandTo(self.client, cmd) - self.topo.commandTo(self.server, cmd) + cmd = self.getIpRuleCmd(i) + self.topo.commandTo(self.client, cmd) + self.topo.commandTo(self.server, cmd) - cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i), - i) - self.topo.commandTo(self.client, cmd) - cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i), - i) - self.topo.commandTo(self.server, cmd) + cmd = self.getDefaultRouteCmd(self.getRouterIPClient(i), + i) + self.topo.commandTo(self.client, cmd) + cmd = self.getDefaultRouteCmd(self.getRouterIPServer(i), + i) + self.topo.commandTo(self.server, cmd) - i = i + 1 + i = i + 1 - ### - cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0)) - self.topo.commandTo(self.server, cmd) + ### + cmd = self.addRouteDefaultSimple(self.getRouterIPServer(0)) + self.topo.commandTo(self.server, cmd) - cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0)) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteDefaultSimple(self.getRouterIPClient(0)) + self.topo.commandTo(self.client, cmd) - self.topo.commandTo(self.client, "ip route flush cache") - self.topo.commandTo(self.server, "ip route flush cache") + self.topo.commandTo(self.client, "ip route flush cache") + self.topo.commandTo(self.server, "ip route flush cache") - def getIptableRuleICMP(self, mask, id): - s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ - '"6&0xFF=0x1 && ' + \ - '24&0x' + \ - pack('>I',(mask)).encode('hex') + \ - '=0x' + pack('>I',id).encode('hex') + \ - '" -j MARK --set-mark ' + str(id + 1) - print (s) - return s + def getIptableRuleICMP(self, mask, id): + s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ + '"6&0xFF=0x1 && ' + \ + '24&0x' + \ + pack('>I',(mask)).encode('hex') + \ + '=0x' + pack('>I',id).encode('hex') + \ + '" -j MARK --set-mark ' + str(id + 1) + print (s) + return s - def getIptableRuleTCPPortClient(self, mask, id): - s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ - '"6&0xFF=0x6 && ' + \ - '18&0x' + \ - pack('>I',(mask)).encode('hex') + \ - '=0x' + pack('>I',id).encode('hex') + \ - '" -j MARK --set-mark ' + str(id + 1) - print (s) - return s + def getIptableRuleTCPPortClient(self, mask, id): + s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ + '"6&0xFF=0x6 && ' + \ + '18&0x' + \ + pack('>I',(mask)).encode('hex') + \ + '=0x' + pack('>I',id).encode('hex') + \ + '" -j MARK --set-mark ' + str(id + 1) + print (s) + return s - def getIptableRuleTCPPortServer(self, mask, id): - s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ - '"6&0xFF=0x6 && ' + \ - '20&0x' + \ - pack('>I',(mask)).encode('hex') + \ - '=0x' + pack('>I',id).encode('hex') + \ - '" -j MARK --set-mark ' + str(id + 1) - print (s) - return s + def getIptableRuleTCPPortServer(self, mask, id): + s = 'iptables -t mangle -A OUTPUT -m u32 --u32 ' + \ + '"6&0xFF=0x6 && ' + \ + '20&0x' + \ + pack('>I',(mask)).encode('hex') + \ + '=0x' + pack('>I',id).encode('hex') + \ + '" -j MARK --set-mark ' + str(id + 1) + print (s) + return s - def getIpRuleCmd(self, id): - s = 'ip rule add fwmark ' + str(id + 1) + ' table ' + \ - str(id + 1) - print(s) - return s + def getIpRuleCmd(self, id): + s = 'ip rule add fwmark ' + str(id + 1) + ' table ' + \ + str(id + 1) + print(s) + return s - def getDefaultRouteCmd(self, via, id): - s = 'ip route add default via ' + via + ' table ' + str(id + 1) - print(s) - return s + def getDefaultRouteCmd(self, via, id): + s = 'ip route add default via ' + via + ' table ' + str(id + 1) + print(s) + return s - def configureInterfaces(self): - self.client = self.topo.getHost(MpTopo.clientName) - self.server = self.topo.getHost(MpTopo.serverName) - self.routers = [] - i = 0 - netmask = "255.255.255.0" - for l in self.topo.routers: - self.routers.append(self.topo.getHost( - MpTopo.routerNamePrefix + str(i))) - cmd = self.interfaceUpCommand( - self.getRouterInterfaceLSwitch(i), - self.getRouterIPClient(i), netmask) - self.topo.commandTo(self.routers[-1] , cmd) + def configureInterfaces(self): + self.client = self.topo.getHost(MpTopo.clientName) + self.server = self.topo.getHost(MpTopo.serverName) + self.routers = [] + i = 0 + netmask = "255.255.255.0" + for l in self.topo.routers: + self.routers.append(self.topo.getHost( + MpTopo.routerNamePrefix + str(i))) + cmd = self.interfaceUpCommand( + self.getRouterInterfaceLSwitch(i), + self.getRouterIPClient(i), netmask) + self.topo.commandTo(self.routers[-1] , cmd) - cmd = self.interfaceUpCommand( - self.getRouterInterfaceRSwitch(i), - self.getRouterIPServer(i), netmask) - self.topo.commandTo(self.routers[-1] , cmd) + cmd = self.interfaceUpCommand( + self.getRouterInterfaceRSwitch(i), + self.getRouterIPServer(i), netmask) + self.topo.commandTo(self.routers[-1] , cmd) - i = i + 1 + i = i + 1 - cmd = self.interfaceUpCommand(self.getClientInterface(0), - self.getClientIP(0), netmask) - self.topo.commandTo(self.client, cmd) + cmd = self.interfaceUpCommand(self.getClientInterface(0), + self.getClientIP(0), netmask) + self.topo.commandTo(self.client, cmd) - cmd = self.interfaceUpCommand(self.getServerInterface(), - self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) + cmd = self.interfaceUpCommand(self.getServerInterface(), + self.getServerIP(), netmask) + self.topo.commandTo(self.server, cmd) - def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientIP = lSubnet + str(interfaceID) + ".1" - return clientIP + def getClientIP(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientIP = lSubnet + str(interfaceID) + ".1" + return clientIP - def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientSubnet = lSubnet + str(interfaceID) + ".0/24" - return clientSubnet + def getClientSubnet(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientSubnet = lSubnet + str(interfaceID) + ".0/24" + return clientSubnet - def getRouterIPClient(self, id): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - routerIP = lSubnet + "0." + str(id + 2) - return routerIP + def getRouterIPClient(self, id): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + routerIP = lSubnet + "0." + str(id + 2) + return routerIP - def getRouterIPServer(self, id): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - routerIP = rSubnet + "0." + str(id + 2) - return routerIP + def getRouterIPServer(self, id): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + routerIP = rSubnet + "0." + str(id + 2) + return routerIP - def getServerIP(self): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - serverIP = rSubnet + "0.1" - return serverIP + def getServerIP(self): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + serverIP = rSubnet + "0.1" + return serverIP - def getClientInterfaceCount(self): - return 1 + def getClientInterfaceCount(self): + return 1 - def getRouterInterfaceLSwitch(self, id): - return MpTopo.routerNamePrefix + str(id) + "-eth0" + def getRouterInterfaceLSwitch(self, id): + return MpTopo.routerNamePrefix + str(id) + "-eth0" - def getRouterInterfaceRSwitch(self, id): - return MpTopo.routerNamePrefix + str(id) + "-eth1" + def getRouterInterfaceRSwitch(self, id): + return MpTopo.routerNamePrefix + str(id) + "-eth1" - def getClientInterface(self, interfaceID): - return MpTopo.clientName + "-eth" + str(interfaceID) + def getClientInterface(self, interfaceID): + return MpTopo.clientName + "-eth" + str(interfaceID) - def getServerInterface(self): - return MpTopo.serverName + "-eth0" + def getServerInterface(self): + return MpTopo.serverName + "-eth0" - def getMidLeftName(self, id): - return MpTopo.routerNamePrefix + str(id) + def getMidLeftName(self, id): + return MpTopo.routerNamePrefix + str(id) - def getMidRightName(self, id): - return MpTopo.switchNamePrefix + "1" + def getMidRightName(self, id): + return MpTopo.switchNamePrefix + "1" - def getMidL2RInterface(self, id): - return self.getMidLeftName(id) + "-eth1" + def getMidL2RInterface(self, id): + return self.getMidLeftName(id) + "-eth1" - def getMidR2LInterface(self, id): - return self.getMidRightName(id) + "-eth" + str(id+2) + def getMidR2LInterface(self, id): + return self.getMidRightName(id) + "-eth" + str(id+2) diff --git a/mpECMPSingleInterfaceTopo.py b/mpECMPSingleInterfaceTopo.py index d18f246..3a775e9 100644 --- a/mpECMPSingleInterfaceTopo.py +++ b/mpECMPSingleInterfaceTopo.py @@ -1,44 +1,44 @@ from mpTopo import MpTopo class MpECMPSingleInterfaceTopo(MpTopo): - def __init__(self, topoBuilder, parameterFile): - MpTopo.__init__(self,topoBuilder, parameterFile) + def __init__(self, topoBuilder, parameterFile): + MpTopo.__init__(self,topoBuilder, parameterFile) - print("Hello ECMP topo") + print("Hello ECMP topo") - self.client = self.addHost(MpTopo.clientName) - self.server = self.addHost(MpTopo.serverName) - self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0") - self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1") + self.client = self.addHost(MpTopo.clientName) + self.server = self.addHost(MpTopo.serverName) + self.lswitch = self.addSwitch(MpTopo.switchNamePrefix + "0") + self.rswitch = self.addSwitch(MpTopo.switchNamePrefix + "1") - self.addLink( self.client, self.lswitch) - self.addLink( self.server, self.rswitch) + self.addLink( self.client, self.lswitch) + self.addLink( self.server, self.rswitch) - self.routers = [] - for l in self.topoParam.linkCharacteristics: - self.routers.append(self.addOneRouterPerLink(l)) - print("added : " + self.routers[-1]) - self.addLink(self.lswitch, self.routers[-1]) - self.addLink(self.rswitch, self.routers[-1], **l.asDict()) + self.routers = [] + for l in self.topoParam.linkCharacteristics: + self.routers.append(self.addOneRouterPerLink(l)) + print("added : " + self.routers[-1]) + self.addLink(self.lswitch, self.routers[-1]) + self.addLink(self.rswitch, self.routers[-1], **l.asDict()) - def addOneRouterPerLink(self, link): - return self.addHost(MpTopo.routerNamePrefix + - str(link.id)) + def addOneRouterPerLink(self, link): + return self.addHost(MpTopo.routerNamePrefix + + str(link.id)) - def __str__(self): - s = "Single if ECMP like env\n" - i = 0 - n = len(self.topoParam.linkCharacteristics) - for p in self.topoParam.linkCharacteristics: - if i == n // 2: - if n % 2 == 0: - s = s + "c---sw sw-----s\n" - s = s + " |-----R-----|\n" - else: - s = s + "c---sw----R-----sw-----s\n" - else: - s = s + " |-----R-----|\n" + def __str__(self): + s = "Single if ECMP like env\n" + i = 0 + n = len(self.topoParam.linkCharacteristics) + for p in self.topoParam.linkCharacteristics: + if i == n // 2: + if n % 2 == 0: + s = s + "c---sw sw-----s\n" + s = s + " |-----R-----|\n" + else: + s = s + "c---sw----R-----sw-----s\n" + else: + s = s + " |-----R-----|\n" - i = i + 1 - return s + i = i + 1 + return s diff --git a/mpExperience.py b/mpExperience.py index a696b4d..594c69a 100644 --- a/mpExperience.py +++ b/mpExperience.py @@ -2,278 +2,278 @@ from mpParamXp import MpParamXp from mpMultiInterfaceTopo import MpMultiInterfaceTopo class MpExperience: - PING = "ping" - NCPV = "ncpv" - NC = "nc" - NONE = "none" - HTTPS = "https" - HTTP = "http" - EPLOAD = "epload" - NETPERF = "netperf" - AB = "ab" - SIRI = "siri" - SENDFILE = "sendfile" - VLC = "vlc" - IPERF = "iperf" - DITG = "ditg" - MSG = "msg" - SIRIHTTP = "sirihttp" - SIRIMSG = "sirimsg" - QUIC = "quic" - QUICSIRI = "quicsiri" + PING = "ping" + NCPV = "ncpv" + NC = "nc" + NONE = "none" + HTTPS = "https" + HTTP = "http" + EPLOAD = "epload" + NETPERF = "netperf" + AB = "ab" + SIRI = "siri" + SENDFILE = "sendfile" + VLC = "vlc" + IPERF = "iperf" + DITG = "ditg" + MSG = "msg" + SIRIHTTP = "sirihttp" + SIRIMSG = "sirimsg" + QUIC = "quic" + QUICSIRI = "quicsiri" - def __init__(self, xpParam, mpTopo, mpConfig): - self.xpParam = xpParam - self.mpTopo = mpTopo - self.mpConfig = mpConfig - print(self.xpParam) + def __init__(self, xpParam, mpTopo, mpConfig): + self.xpParam = xpParam + self.mpTopo = mpTopo + self.mpConfig = mpConfig + print(self.xpParam) - def classicRun(self): - self.prepare() - self.run() - self.clean() + def classicRun(self): + self.prepare() + self.run() + self.clean() - def prepare(self): - self.setupSysctl() - self.runUserspacePM() - self.mpConfig.configureNetwork() - self.changeMetric() - self.putPriorityOnPaths() - self.disableTSO() - self.runTcpDump() - self.runNetemAt() - pass + def prepare(self): + self.setupSysctl() + self.runUserspacePM() + self.mpConfig.configureNetwork() + self.changeMetric() + self.putPriorityOnPaths() + self.disableTSO() + self.runTcpDump() + self.runNetemAt() + pass - def changeMetric(self): - metric = self.xpParam.getParam(MpParamXp.METRIC) - if int(metric) >= 0: - self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric") + def changeMetric(self): + metric = self.xpParam.getParam(MpParamXp.METRIC) + if int(metric) >= 0: + self.mpTopo.notNSCommand("echo " + metric + " > /sys/module/mptcp_sched_metric/parameters/metric") - def putPriorityOnPaths(self): - # Only meaningful if mpTopo is instance of MpMultiInterfaceTopo - if isinstance(self.mpTopo, MpMultiInterfaceTopo): - prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0) - prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1) - if not prioPath0 == prioPath1: - self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0)) - self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getRouterInterfaceSwitch(0) + " priority " + - str(prioPath0)) - self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getClientInterface(1) + " priority " + str(prioPath1)) - self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + - self.mpConfig.getRouterInterfaceSwitch(1) + " priority " + - str(prioPath1)) + def putPriorityOnPaths(self): + # Only meaningful if mpTopo is instance of MpMultiInterfaceTopo + if isinstance(self.mpTopo, MpMultiInterfaceTopo): + prioPath0 = self.xpParam.getParam(MpParamXp.PRIOPATH0) + prioPath1 = self.xpParam.getParam(MpParamXp.PRIOPATH1) + if not prioPath0 == prioPath1: + self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + + self.mpConfig.getClientInterface(0) + " priority " + str(prioPath0)) + self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + + self.mpConfig.getRouterInterfaceSwitch(0) + " priority " + + str(prioPath0)) + self.mpTopo.commandTo(self.mpConfig.client, "/home/mininet/iproute/ip/ip link set dev " + + self.mpConfig.getClientInterface(1) + " priority " + str(prioPath1)) + self.mpTopo.commandTo(self.mpConfig.router, "/home/mininet/iproute/ip/ip link set dev " + + self.mpConfig.getRouterInterfaceSwitch(1) + " priority " + + str(prioPath1)) - backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0) - if int(backupPath0) > 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))) - backupPath1 = self.xpParam.getParam(MpParamXp.BACKUPPATH1) - if int(backupPath1) > 0: - 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))) + backupPath0 = self.xpParam.getParam(MpParamXp.BACKUPPATH0) + if int(backupPath0) > 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))) + backupPath1 = self.xpParam.getParam(MpParamXp.BACKUPPATH1) + if int(backupPath1) > 0: + 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))) - def disableTSO(self): - links = self.mpTopo.getLinkCharacteristics() - i = 0 - for l in links: - lname = self.mpConfig.getMidLeftName(i) - rname = self.mpConfig.getMidRightName(i) - lbox = self.mpTopo.getHost(lname) - lif = self.mpConfig.getMidL2RInterface(i) - rif = self.mpConfig.getMidR2LInterface(i) - rbox = self.mpTopo.getHost(rname) - print(str(lname) + " " + str(lif)) - print(str(rname) + " " + str(rif)) - print("boxes " + str(lbox) + " " + str(rbox)) - cmd = "ethtool -K " + lif + " tso off" - print(cmd) - self.mpTopo.commandTo(lbox, cmd) - cmd = "ethtool -K " + rif + " tso off" - print(cmd) - self.mpTopo.commandTo(rbox, cmd) - i = i + 1 + def disableTSO(self): + links = self.mpTopo.getLinkCharacteristics() + i = 0 + for l in links: + lname = self.mpConfig.getMidLeftName(i) + rname = self.mpConfig.getMidRightName(i) + lbox = self.mpTopo.getHost(lname) + lif = self.mpConfig.getMidL2RInterface(i) + rif = self.mpConfig.getMidR2LInterface(i) + rbox = self.mpTopo.getHost(rname) + print(str(lname) + " " + str(lif)) + print(str(rname) + " " + str(rif)) + print("boxes " + str(lbox) + " " + str(rbox)) + cmd = "ethtool -K " + lif + " tso off" + print(cmd) + self.mpTopo.commandTo(lbox, cmd) + cmd = "ethtool -K " + rif + " tso off" + print(cmd) + self.mpTopo.commandTo(rbox, cmd) + i = i + 1 - # And for the server - cmd = "ethtool -K " + self.mpConfig.getServerInterface() + " tso off" - print(cmd) - self.mpTopo.commandTo(self.mpConfig.server, cmd) + # And for the server + cmd = "ethtool -K " + self.mpConfig.getServerInterface() + " tso off" + print(cmd) + self.mpTopo.commandTo(self.mpConfig.server, cmd) - cmd = "ethtool -K " + self.mpConfig.getRouterInterfaceSwitch(self.mpConfig.getClientInterfaceCount()) + " tso off" - print(cmd) - self.mpTopo.commandTo(self.mpConfig.router, cmd) + cmd = "ethtool -K " + self.mpConfig.getRouterInterfaceSwitch(self.mpConfig.getClientInterfaceCount()) + " tso off" + print(cmd) + self.mpTopo.commandTo(self.mpConfig.router, cmd) - def runUserspacePM(self): - if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": - print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") - else: - upmc = self.xpParam.getParam(MpParamXp.USERPMC) - upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS) - self.mpTopo.commandTo(self.mpConfig.client, upmc + \ - " " + upmca + " &>upmc.log &") - if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": - print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") - else: - upms = self.xpParam.getParam(MpParamXp.USERPMS) - upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS) - self.mpTopo.commandTo(self.mpConfig.server, upms + \ - " " + upmsa + " &>upms.log &") + def runUserspacePM(self): + if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": + print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") + else: + upmc = self.xpParam.getParam(MpParamXp.USERPMC) + upmca = self.xpParam.getParam(MpParamXp.USERPMCARGS) + self.mpTopo.commandTo(self.mpConfig.client, upmc + \ + " " + upmca + " &>upmc.log &") + if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": + print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") + else: + upms = self.xpParam.getParam(MpParamXp.USERPMS) + upmsa = self.xpParam.getParam(MpParamXp.USERPMSARGS) + self.mpTopo.commandTo(self.mpConfig.server, upms + \ + " " + upmsa + " &>upms.log &") - def cleanUserspacePM(self): - if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": - print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") - else: - upmc = self.xpParam.getParam(MpParamXp.USERPMC) - self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc) - if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": - print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") - else: - upms = self.xpParam.getParam(MpParamXp.USERPMS) - self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms) + def cleanUserspacePM(self): + if self.xpParam.getParam(MpParamXp.KERNELPMC) != "netlink": + print("Client : Error, I can't change the userspace pm if the kernel pm is not netlink !") + else: + upmc = self.xpParam.getParam(MpParamXp.USERPMC) + self.mpTopo.commandTo(self.mpConfig.client, "killall " + upmc) + if self.xpParam.getParam(MpParamXp.KERNELPMS) != "netlink": + print("Server : Error, I can't change the userspace pm if the kernel pm is not netlink !") + else: + upms = self.xpParam.getParam(MpParamXp.USERPMS) + self.mpTopo.commandTo(self.mpConfig.server, "killall " + upms) - def runNetemAt(self): - if not self.mpTopo.changeNetem == "yes": - print("I don't need to change netem") - return - print("Will change netem config on the fly") - links = self.mpTopo.getLinkCharacteristics() - i = 0 - for l in links: - lname = self.mpConfig.getMidLeftName(i) - rname = self.mpConfig.getMidRightName(i) - lbox = self.mpTopo.getHost(lname) - lif = self.mpConfig.getMidL2RInterface(i) - rif = self.mpConfig.getMidR2LInterface(i) - rbox = self.mpTopo.getHost(rname) - print(str(lname) + " " + str(lif)) - print(str(rname) + " " + str(rif)) - print("boxes " + str(lbox) + " " + str(rbox)) - cmd = l.buildBwCmd(lif) - print(cmd) - self.mpTopo.commandTo(lbox, cmd) - cmd = l.buildBwCmd(rif) - print(cmd) - self.mpTopo.commandTo(rbox, cmd) - ilif = self.mpConfig.getMidL2RIncomingInterface(i) - irif = self.mpConfig.getMidR2LIncomingInterface(i) - cmd = l.buildPolicingCmd(ilif) - print(cmd) - self.mpTopo.commandTo(lbox, cmd) - cmd = l.buildPolicingCmd(irif) - print(cmd) - self.mpTopo.commandTo(rbox, cmd) - cmd = l.buildNetemCmd(irif) - print(cmd) - self.mpTopo.commandTo(rbox, cmd) - cmd = l.buildNetemCmd(ilif) - print(cmd) - self.mpTopo.commandTo(lbox, cmd) + def runNetemAt(self): + if not self.mpTopo.changeNetem == "yes": + print("I don't need to change netem") + return + print("Will change netem config on the fly") + links = self.mpTopo.getLinkCharacteristics() + i = 0 + for l in links: + lname = self.mpConfig.getMidLeftName(i) + rname = self.mpConfig.getMidRightName(i) + lbox = self.mpTopo.getHost(lname) + lif = self.mpConfig.getMidL2RInterface(i) + rif = self.mpConfig.getMidR2LInterface(i) + rbox = self.mpTopo.getHost(rname) + print(str(lname) + " " + str(lif)) + print(str(rname) + " " + str(rif)) + print("boxes " + str(lbox) + " " + str(rbox)) + cmd = l.buildBwCmd(lif) + print(cmd) + self.mpTopo.commandTo(lbox, cmd) + cmd = l.buildBwCmd(rif) + print(cmd) + self.mpTopo.commandTo(rbox, cmd) + ilif = self.mpConfig.getMidL2RIncomingInterface(i) + irif = self.mpConfig.getMidR2LIncomingInterface(i) + cmd = l.buildPolicingCmd(ilif) + print(cmd) + self.mpTopo.commandTo(lbox, cmd) + cmd = l.buildPolicingCmd(irif) + print(cmd) + self.mpTopo.commandTo(rbox, cmd) + cmd = l.buildNetemCmd(irif) + print(cmd) + self.mpTopo.commandTo(rbox, cmd) + cmd = l.buildNetemCmd(ilif) + print(cmd) + self.mpTopo.commandTo(lbox, cmd) - i = i + 1 + i = i + 1 - def run(self): - pass + def run(self): + pass - def clean(self): - self.mpTopo.commandTo(self.mpConfig.client, - "killall tcpdump") - self.mpTopo.commandTo(self.mpConfig.server, - "killall tcpdump") - self.backUpSysctl() - self.cleanUserspacePM() - pass + def clean(self): + self.mpTopo.commandTo(self.mpConfig.client, + "killall tcpdump") + self.mpTopo.commandTo(self.mpConfig.server, + "killall tcpdump") + self.backUpSysctl() + self.cleanUserspacePM() + pass - def setupSysctl(self): - self.saveSysctl() - self.writeSysctl() + def setupSysctl(self): + self.saveSysctl() + self.writeSysctl() - def saveSysctl(self): - self.sysctlBUP = {} - 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): + self.sysctlBUP = {} + 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) - 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: - sysctlBUP[k] = val.split(" ",2)[2][:-1] + def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): + for k in sysctlDic: + sysctlKey = sysctlDic[k] + cmd = self.cmdReadSysctl(sysctlKey) + 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: + sysctlBUP[k] = val.split(" ",2)[2][:-1] - def cmdReadSysctl(self, key): - s = "sysctl " + key - return s + def cmdReadSysctl(self, key): + s = "sysctl " + key + return s - def cmdWriteSysctl(self, key, value): - s = self.cmdReadSysctl(key) - s = s + "=\"" + str(value) + "\"" - return s + def cmdWriteSysctl(self, key, value): + s = self.cmdReadSysctl(key) + s = s + "=\"" + str(value) + "\"" + return s - def writeSysctl(self): - 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): + 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) - 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 _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) + 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): - 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): + 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 = sysctlDic[k] - sysctlValue = sysctlBUP[k] - cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) - if not ns: - val = self.mpTopo.notNSCommand(cmd) - else: - val = self.mpTopo.commandTo(who, cmd) + def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None): + for k in sysctlBUP: + sysctlKey = sysctlDic[k] + sysctlValue = sysctlBUP[k] + cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue) + 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) + if val == "Error": + print("oooops can't set sysctl " + sysctlKey) - def runTcpDump(self): - #todo : replace filename by cst - cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP) - spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP) - snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP) - if cpcap == "yes" : - self.mpTopo.commandTo(self.mpConfig.client, - "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") - if spcap == "yes" : - self.mpTopo.commandTo(self.mpConfig.server, - "tcpdump -i any -s " + snaplenpcap + " -w server.pcap &") - if spcap == "yes" or cpcap == "yes": - self.mpTopo.commandTo(self.mpConfig.client,"sleep 5") + def runTcpDump(self): + #todo : replace filename by cst + cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP) + spcap = self.xpParam.getParam(MpParamXp.SERVERPCAP) + snaplenpcap = self.xpParam.getParam(MpParamXp.SNAPLENPCAP) + if cpcap == "yes" : + self.mpTopo.commandTo(self.mpConfig.client, + "tcpdump -i any -s " + snaplenpcap + " -w client.pcap &") + if spcap == "yes" : + self.mpTopo.commandTo(self.mpConfig.server, + "tcpdump -i any -s " + snaplenpcap + " -w server.pcap &") + if spcap == "yes" or cpcap == "yes": + self.mpTopo.commandTo(self.mpConfig.client,"sleep 5") diff --git a/mpLinkCharacteristics.py b/mpLinkCharacteristics.py index 4045c40..a222b65 100644 --- a/mpLinkCharacteristics.py +++ b/mpLinkCharacteristics.py @@ -3,100 +3,100 @@ import math class MpLinkCharacteristics: - tcNetemParent = "1:1" - tcHtbClassid = "10" - tcNetemHandle = "1:10" + tcNetemParent = "1:1" + tcHtbClassid = "10" + tcNetemHandle = "1:10" - def bandwidthDelayProductDividedByMTU(self): - rtt = 2 * float(self.delay) - """ Since bandwidth is in Mbps and rtt in ms """ - bandwidthDelayProduct = (float(self.bandwidth) * 125000.0) * (rtt / 1000.0) - return int(math.ceil(bandwidthDelayProduct * 1.0 / 1500.0)) + def bandwidthDelayProductDividedByMTU(self): + rtt = 2 * float(self.delay) + """ Since bandwidth is in Mbps and rtt in ms """ + bandwidthDelayProduct = (float(self.bandwidth) * 125000.0) * (rtt / 1000.0) + return int(math.ceil(bandwidthDelayProduct * 1.0 / 1500.0)) - def bufferSize(self): - return (1500.0 * self.bandwidthDelayProductDividedByMTU()) + (float(self.bandwidth) * 1000.0 * float(self.queuingDelay) / 8) + def bufferSize(self): + return (1500.0 * self.bandwidthDelayProductDividedByMTU()) + (float(self.bandwidth) * 1000.0 * float(self.queuingDelay) / 8) - def extractQueuingDelay(self, queueSize, bandwidth, delay, mtu=1500): - # rtt = 2 * float(delay) - # bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000)) - # if int(queueSize) <= bdp_queue_size: - # Returning 0 seems to bypass everything, then only limited by CPU. - # This is not what we want... - # return 1 + def extractQueuingDelay(self, queueSize, bandwidth, delay, mtu=1500): + # rtt = 2 * float(delay) + # bdp_queue_size = int((float(rtt) * float(bandwidth) * 1024 * 1024) / (int(mtu) * 8 * 1000)) + # if int(queueSize) <= bdp_queue_size: + # Returning 0 seems to bypass everything, then only limited by CPU. + # This is not what we want... + # return 1 - # queuingQueueSize = int(queueSize) - bdp_queue_size - queuingDelay = (int(queueSize) * int(mtu) * 8.0 * 1000.0) / (float(bandwidth) * 1024 * 1024) - return max(int(queuingDelay), 1) + # queuingQueueSize = int(queueSize) - bdp_queue_size + queuingDelay = (int(queueSize) * int(mtu) * 8.0 * 1000.0) / (float(bandwidth) * 1024 * 1024) + return max(int(queuingDelay), 1) - def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False): - self.id = id - self.delay = delay - self.queueSize = queueSize - self.bandwidth = bandwidth - self.loss = loss - self.queuingDelay = str(self.extractQueuingDelay(queueSize, bandwidth, delay)) - self.netemAt = [] - self.back_up = back_up + def __init__(self, id, delay, queueSize, bandwidth, loss, back_up=False): + self.id = id + self.delay = delay + self.queueSize = queueSize + self.bandwidth = bandwidth + self.loss = loss + self.queuingDelay = str(self.extractQueuingDelay(queueSize, bandwidth, delay)) + self.netemAt = [] + self.back_up = back_up - def addNetemAt(self, n): - if len(self.netemAt) == 0: - n.delta = n.at - self.netemAt.append(n) - else: - if n.at > self.netemAt[-1].at: - n.delta = n.at - self.netemAt[-1].at - self.netemAt.append(n) - else: - print("Do not take into account " + n.__str__() + \ - "because ooo !") - pass + def addNetemAt(self, n): + if len(self.netemAt) == 0: + n.delta = n.at + self.netemAt.append(n) + else: + if n.at > self.netemAt[-1].at: + n.delta = n.at - self.netemAt[-1].at + self.netemAt.append(n) + else: + print("Do not take into account " + n.__str__() + \ + "because ooo !") + pass - def buildBwCmd(self, ifname): - cmd = "" - for n in self.netemAt: - cmd = cmd + "sleep {}".format(n.delta) - 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())) + def buildBwCmd(self, ifname): + cmd = "" + for n in self.netemAt: + cmd = cmd + "sleep {}".format(n.delta) + 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 + " true &" - return cmd + cmd = cmd + " true &" + return cmd - def buildNetemCmd(self, ifname): - cmd = "" - for n in self.netemAt: - cmd = cmd + "sleep " + str(n.delta) - 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) + def buildNetemCmd(self, ifname): + cmd = "" + for n in self.netemAt: + cmd = cmd + "sleep " + str(n.delta) + 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 + " true &" - return cmd + cmd = cmd + " true &" + return cmd - def buildPolicingCmd(self, ifname): - cmd = "" - for n in self.netemAt: - cmd = cmd + "sleep {}".format(n.delta) - cmd = cmd + " && tc qdisc del dev {} 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)) + def buildPolicingCmd(self, ifname): + cmd = "" + for n in self.netemAt: + cmd = cmd + "sleep {}".format(n.delta) + cmd = cmd + " && tc qdisc del dev {} 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 + " true &" - return cmd + cmd = cmd + " true &" + return cmd - def asDict(self): - d = {} - d['bw'] = float(self.bandwidth) - d['delay'] = self.delay + "ms" - d['loss'] = float(self.loss) - d['max_queue_size'] = int(self.queueSize) - return d + def asDict(self): + d = {} + d['bw'] = float(self.bandwidth) + d['delay'] = self.delay + "ms" + d['loss'] = float(self.loss) + d['max_queue_size'] = int(self.queueSize) + return d - def __str__(self): - s = "Link id : " + str(self.id) + "\n" - s = s + "\tDelay : " + str(self.delay) + "\n" - s = s + "\tQueue Size : " + str(self.queueSize) + "\n" - s = s + "\tBandwidth : " + str(self.bandwidth) + "\n" - s = s + "\tLoss : " + str(self.loss) + "\n" - s = s + "\tBack up : " + str(self.back_up) + "\n" - for l in self.netemAt: - s = s + "\t" + l.__str__() + "\n" - return s + def __str__(self): + s = "Link id : " + str(self.id) + "\n" + s = s + "\tDelay : " + str(self.delay) + "\n" + s = s + "\tQueue Size : " + str(self.queueSize) + "\n" + s = s + "\tBandwidth : " + str(self.bandwidth) + "\n" + s = s + "\tLoss : " + str(self.loss) + "\n" + s = s + "\tBack up : " + str(self.back_up) + "\n" + for l in self.netemAt: + s = s + "\t" + l.__str__() + "\n" + return s diff --git a/mpMininetBuilder.py b/mpMininetBuilder.py index 8eecf2c..c020764 100644 --- a/mpMininetBuilder.py +++ b/mpMininetBuilder.py @@ -6,39 +6,39 @@ from mininet.cli import CLI from subprocess import Popen, PIPE class MpMininetBuilder(Topo): - def __init__(self): - Topo.__init__( self ) - self.net = None + def __init__(self): + Topo.__init__( self ) + self.net = None - def commandTo(self, who, cmd): - return who.cmd(cmd) + def commandTo(self, who, cmd): + return who.cmd(cmd) - def notNSCommand(self, cmd): - p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) - stdout, stderr = p.communicate() - if stderr: - return "Error" - return stdout + def notNSCommand(self, cmd): + p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) + stdout, stderr = p.communicate() + if stderr: + return "Error" + return stdout - def startNetwork(self): - self.net = Mininet(topo=self,link=TCLink,switch=OVSBridge) - self.net.start() + def startNetwork(self): + self.net = Mininet(topo=self,link=TCLink,switch=OVSBridge) + self.net.start() - def getCLI(self): - if self.net is None: - print("Can not get the CLI") - else: - CLI(self.net) + def getCLI(self): + if self.net is None: + print("Can not get the CLI") + else: + CLI(self.net) - def getHost(self, who): - if self.net is None: - print("Network not available....") - raise Exception("Network not ready"); - else: - return self.net.getNodeByName(who) + def getHost(self, who): + if self.net is None: + print("Network not available....") + raise Exception("Network not ready"); + else: + return self.net.getNodeByName(who) - def stopNetwork(self): - if self.net is None: - print("Could not stop network... Nothing to stop)") - else: - self.net.stop() + def stopNetwork(self): + if self.net is None: + print("Could not stop network... Nothing to stop)") + else: + self.net.stop() diff --git a/mpMultiInterfaceConfig.py b/mpMultiInterfaceConfig.py index 63ded6d..44d4274 100644 --- a/mpMultiInterfaceConfig.py +++ b/mpMultiInterfaceConfig.py @@ -4,139 +4,139 @@ from mpParamTopo import MpParamTopo from mpTopo import MpTopo class MpMultiInterfaceConfig(MpConfig): - def __init__(self, topo, param): - MpConfig.__init__(self, topo, param) + def __init__(self, topo, param): + MpConfig.__init__(self, topo, param) - def configureRoute(self): - i = 0 - for l in self.topo.switchClient: - cmd = self.addRouteTableCommand(self.getClientIP(i), i) - self.topo.commandTo(self.client, cmd) + def configureRoute(self): + i = 0 + for l in self.topo.switchClient: + cmd = self.addRouteTableCommand(self.getClientIP(i), i) + self.topo.commandTo(self.client, cmd) - cmd = self.addRouteScopeLinkCommand( - self.getClientSubnet(i), - self.getClientInterface(i), i) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteScopeLinkCommand( + self.getClientSubnet(i), + self.getClientInterface(i), i) + self.topo.commandTo(self.client, cmd) - cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), - i) - self.topo.commandTo(self.client, cmd) - i = i + 1 + cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), + i) + self.topo.commandTo(self.client, cmd) + i = i + 1 - cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), - self.getClientInterface(0)) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), + self.getClientInterface(0)) + self.topo.commandTo(self.client, cmd) - cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) - self.topo.commandTo(self.server, cmd) + cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) + self.topo.commandTo(self.server, cmd) - def configureInterfaces(self): - print("Configure interfaces for multi inf") - self.client = self.topo.getHost(MpTopo.clientName) - self.server = self.topo.getHost(MpTopo.serverName) - self.router = self.topo.getHost(MpTopo.routerName) - i = 0 - netmask = "255.255.255.0" - links = self.topo.getLinkCharacteristics() - for l in self.topo.switchClient: - cmd = self.interfaceUpCommand( - self.getClientInterface(i), - self.getClientIP(i), netmask) - self.topo.commandTo(self.client, cmd) - clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) + def configureInterfaces(self): + print("Configure interfaces for multi inf") + self.client = self.topo.getHost(MpTopo.clientName) + self.server = self.topo.getHost(MpTopo.serverName) + self.router = self.topo.getHost(MpTopo.routerName) + i = 0 + netmask = "255.255.255.0" + links = self.topo.getLinkCharacteristics() + for l in self.topo.switchClient: + cmd = self.interfaceUpCommand( + self.getClientInterface(i), + self.getClientIP(i), netmask) + self.topo.commandTo(self.client, cmd) + clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) - if(links[i].back_up): - cmd = self.interfaceBUPCommand( - self.getClientInterface(i)) - self.topo.commandTo(self.client, cmd) + if(links[i].back_up): + cmd = self.interfaceBUPCommand( + self.getClientInterface(i)) + self.topo.commandTo(self.client, cmd) - i = i + 1 + i = i + 1 - i = 0 - for l in self.topo.switchServer: - cmd = self.interfaceUpCommand( - self.getRouterInterfaceSwitch(i), - self.getRouterIPSwitch(i), netmask) - self.topo.commandTo(self.router, cmd) - routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() - self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) - print(str(links[i])) - i = i + 1 + i = 0 + for l in self.topo.switchServer: + cmd = self.interfaceUpCommand( + self.getRouterInterfaceSwitch(i), + self.getRouterIPSwitch(i), netmask) + self.topo.commandTo(self.router, cmd) + routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() + self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + print(str(links[i])) + i = i + 1 - cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), - self.getRouterIPServer(), netmask) - self.topo.commandTo(self.router, cmd) - routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() - self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) + cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), + self.getRouterIPServer(), netmask) + self.topo.commandTo(self.router, cmd) + routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() + self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) - cmd = self.interfaceUpCommand(self.getServerInterface(), - self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) - serverIntfMac = self.server.intf(self.getServerInterface()).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) + cmd = self.interfaceUpCommand(self.getServerInterface(), + self.getServerIP(), netmask) + self.topo.commandTo(self.server, cmd) + serverIntfMac = self.server.intf(self.getServerInterface()).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) - def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientIP = lSubnet + str(interfaceID) + ".1" - return clientIP + def getClientIP(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientIP = lSubnet + str(interfaceID) + ".1" + return clientIP - def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientSubnet = lSubnet + str(interfaceID) + ".0/24" - return clientSubnet + def getClientSubnet(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientSubnet = lSubnet + str(interfaceID) + ".0/24" + return clientSubnet - def getRouterIPSwitch(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - routerIP = lSubnet + str(interfaceID) + ".2" - return routerIP + def getRouterIPSwitch(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + routerIP = lSubnet + str(interfaceID) + ".2" + return routerIP - def getRouterIPServer(self): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - routerIP = rSubnet + "0.2" - return routerIP + def getRouterIPServer(self): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + routerIP = rSubnet + "0.2" + return routerIP - def getServerIP(self): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - serverIP = rSubnet + "0.1" - return serverIP + def getServerIP(self): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + serverIP = rSubnet + "0.1" + return serverIP - def getClientInterfaceCount(self): - return len(self.topo.switchClient) + def getClientInterfaceCount(self): + return len(self.topo.switchClient) - def getRouterInterfaceServer(self): - return self.getRouterInterfaceSwitch(len(self.topo.switchServer)) + def getRouterInterfaceServer(self): + return self.getRouterInterfaceSwitch(len(self.topo.switchServer)) - def getClientInterface(self, interfaceID): - return MpTopo.clientName + "-eth" + str(interfaceID) + def getClientInterface(self, interfaceID): + return MpTopo.clientName + "-eth" + str(interfaceID) - def getRouterInterfaceSwitch(self, interfaceID): - return MpTopo.routerName + "-eth" + str(interfaceID) + def getRouterInterfaceSwitch(self, interfaceID): + return MpTopo.routerName + "-eth" + str(interfaceID) - def getServerInterface(self): - return MpTopo.serverName + "-eth0" + def getServerInterface(self): + return MpTopo.serverName + "-eth0" - def getSwitchClientName(self, id): - return MpTopo.switchNamePrefix + str(2 * id) + def getSwitchClientName(self, id): + return MpTopo.switchNamePrefix + str(2 * id) - def getSwitchServerName(self, id): - return MpTopo.switchNamePrefix + str(2 * id + 1) + def getSwitchServerName(self, id): + return MpTopo.switchNamePrefix + str(2 * id + 1) - def getMidLeftName(self, id): - return self.getSwitchClientName(id) + def getMidLeftName(self, id): + return self.getSwitchClientName(id) - def getMidRightName(self, id): - return self.getSwitchServerName(id) + def getMidRightName(self, id): + return self.getSwitchServerName(id) - def getMidL2RInterface(self, id): - return self.getMidLeftName(id) + "-eth2" + def getMidL2RInterface(self, id): + return self.getMidLeftName(id) + "-eth2" - def getMidR2LInterface(self, id): - return self.getMidRightName(id) + "-eth1" + def getMidR2LInterface(self, id): + return self.getMidRightName(id) + "-eth1" - def getMidL2RIncomingInterface(self, id): - return self.getMidLeftName(id) + "-eth1" + def getMidL2RIncomingInterface(self, id): + return self.getMidLeftName(id) + "-eth1" - def getMidR2LIncomingInterface(self, id): - return self.getMidRightName(id) + "-eth2" + def getMidR2LIncomingInterface(self, id): + return self.getMidRightName(id) + "-eth2" diff --git a/mpMultiInterfaceCongConfig.py b/mpMultiInterfaceCongConfig.py index 7f16e15..f394418 100644 --- a/mpMultiInterfaceCongConfig.py +++ b/mpMultiInterfaceCongConfig.py @@ -4,215 +4,215 @@ from mpParamTopo import MpParamTopo from mpTopo import MpTopo class MpMultiInterfaceCongConfig(MpConfig): - def __init__(self, topo, param): - MpConfig.__init__(self, topo, param) + def __init__(self, topo, param): + MpConfig.__init__(self, topo, param) - def configureRoute(self): - i = 0 - for l in self.topo.switch: - cmd = self.addRouteTableCommand(self.getClientIP(i), i) - self.topo.commandTo(self.client, cmd) + def configureRoute(self): + i = 0 + for l in self.topo.switch: + cmd = self.addRouteTableCommand(self.getClientIP(i), i) + self.topo.commandTo(self.client, cmd) - # Congestion client - cmd = self.addRouteTableCommand(self.getCongClientIP(i), i) - self.topo.commandTo(self.cong_clients[i], cmd) + # Congestion client + cmd = self.addRouteTableCommand(self.getCongClientIP(i), i) + self.topo.commandTo(self.cong_clients[i], cmd) - cmd = self.addRouteScopeLinkCommand( - self.getClientSubnet(i), - self.getClientInterface(i), i) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteScopeLinkCommand( + self.getClientSubnet(i), + self.getClientInterface(i), i) + self.topo.commandTo(self.client, cmd) - # Congestion client - cmd = self.addRouteScopeLinkCommand( - self.getClientSubnet(i), - self.getCongClientInterface(i), i) - self.topo.commandTo(self.cong_clients[i], cmd) + # Congestion client + cmd = self.addRouteScopeLinkCommand( + self.getClientSubnet(i), + self.getCongClientInterface(i), i) + self.topo.commandTo(self.cong_clients[i], cmd) - cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), - i) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteDefaultCommand(self.getRouterIPSwitch(i), + i) + self.topo.commandTo(self.client, cmd) - # Congestion client - # Keep the same command - self.topo.commandTo(self.cong_clients[i], cmd) + # Congestion client + # Keep the same command + self.topo.commandTo(self.cong_clients[i], cmd) - # Congestion client - cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), - self.getCongClientInterface(i)) - i = i + 1 + # Congestion client + cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), + self.getCongClientInterface(i)) + i = i + 1 - cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), - self.getClientInterface(0)) - self.topo.commandTo(self.client, cmd) + cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(0), + self.getClientInterface(0)) + self.topo.commandTo(self.client, cmd) - # Congestion Client - i = 0 - for c in self.cong_clients: - cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), - self.getCongClientInterface(i)) - self.topo.commandTo(c, cmd) - i = i + 1 + # Congestion Client + i = 0 + for c in self.cong_clients: + cmd = self.addRouteDefaultGlobalCommand(self.getRouterIPSwitch(i), + self.getCongClientInterface(i)) + self.topo.commandTo(c, cmd) + i = i + 1 - cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) - self.topo.commandTo(self.server, cmd) - # Congestion servers - i = 0 - for s in self.cong_servers: - cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i)) - self.topo.commandTo(s, cmd) - i += 1 + cmd = self.addRouteDefaultSimple(self.getRouterIPServer()) + self.topo.commandTo(self.server, cmd) + # Congestion servers + i = 0 + for s in self.cong_servers: + cmd = self.addRouteDefaultSimple(self.getRouterIPCongServer(i)) + self.topo.commandTo(s, cmd) + i += 1 - def configureInterfaces(self): - print("Configure interfaces for multi inf") - self.client = self.topo.getHost(MpTopo.clientName) - self.server = self.topo.getHost(MpTopo.serverName) - self.router = self.topo.getHost(MpTopo.routerName) - cong_client_names = self.topo.getCongClients() - self.cong_clients = [] - for cn in cong_client_names: - self.cong_clients.append(self.topo.getHost(cn)) + def configureInterfaces(self): + print("Configure interfaces for multi inf") + self.client = self.topo.getHost(MpTopo.clientName) + self.server = self.topo.getHost(MpTopo.serverName) + self.router = self.topo.getHost(MpTopo.routerName) + cong_client_names = self.topo.getCongClients() + self.cong_clients = [] + for cn in cong_client_names: + self.cong_clients.append(self.topo.getHost(cn)) - cong_server_names = self.topo.getCongServers() - self.cong_servers = [] - for sn in cong_server_names: - self.cong_servers.append(self.topo.getHost(sn)) + cong_server_names = self.topo.getCongServers() + self.cong_servers = [] + for sn in cong_server_names: + self.cong_servers.append(self.topo.getHost(sn)) - i = 0 - netmask = "255.255.255.0" - links = self.topo.getLinkCharacteristics() - for l in self.topo.switch: - cmd = self.interfaceUpCommand( - self.getClientInterface(i), - self.getClientIP(i), netmask) - self.topo.commandTo(self.client, cmd) - clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) + i = 0 + netmask = "255.255.255.0" + links = self.topo.getLinkCharacteristics() + for l in self.topo.switch: + cmd = self.interfaceUpCommand( + self.getClientInterface(i), + self.getClientIP(i), netmask) + self.topo.commandTo(self.client, cmd) + clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getClientIP(i) + " " + clientIntfMac) - if(links[i].back_up): - cmd = self.interfaceBUPCommand( - self.getClientInterface(i)) - self.topo.commandTo(self.client, cmd) + if(links[i].back_up): + cmd = self.interfaceBUPCommand( + self.getClientInterface(i)) + self.topo.commandTo(self.client, cmd) - # Congestion client - cmd = self.interfaceUpCommand( - self.getCongClientInterface(i), - self.getCongClientIP(i), netmask) - self.topo.commandTo(self.cong_clients[i], cmd) - congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) + # Congestion client + cmd = self.interfaceUpCommand( + self.getCongClientInterface(i), + self.getCongClientIP(i), netmask) + self.topo.commandTo(self.cong_clients[i], cmd) + congClientIntfMac = self.cong_clients[i].intf(self.getCongClientInterface(i)).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getCongClientIP(i) + " " + congClientIntfMac) - cmd = self.interfaceUpCommand( - self.getRouterInterfaceSwitch(i), - self.getRouterIPSwitch(i), netmask) - self.topo.commandTo(self.router, cmd) - routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() - self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) - # Don't forget the congestion client - self.topo.commandTo(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) - print(str(links[i])) - i = i + 1 + cmd = self.interfaceUpCommand( + self.getRouterInterfaceSwitch(i), + self.getRouterIPSwitch(i), netmask) + self.topo.commandTo(self.router, cmd) + routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC() + self.topo.commandTo(self.client, "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + # Don't forget the congestion client + self.topo.commandTo(self.cong_clients[i], "arp -s " + self.getRouterIPSwitch(i) + " " + routerIntfMac) + print(str(links[i])) + i = i + 1 - cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), - self.getRouterIPServer(), netmask) - self.topo.commandTo(self.router, cmd) - routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() - self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) + cmd = self.interfaceUpCommand(self.getRouterInterfaceServer(), + self.getRouterIPServer(), netmask) + self.topo.commandTo(self.router, cmd) + routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC() + self.topo.commandTo(self.server, "arp -s " + self.getRouterIPServer() + " " + routerIntfMac) - cmd = self.interfaceUpCommand(self.getServerInterface(), - self.getServerIP(), netmask) - self.topo.commandTo(self.server, cmd) - serverIntfMac = self.server.intf(self.getServerInterface()).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) + cmd = self.interfaceUpCommand(self.getServerInterface(), + self.getServerIP(), netmask) + self.topo.commandTo(self.server, cmd) + serverIntfMac = self.server.intf(self.getServerInterface()).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + serverIntfMac) - # Congestion servers - i = 0 - for s in self.cong_servers: - cmd = self.interfaceUpCommand(self.getRouterInterfaceCongServer(i), - self.getRouterIPCongServer(i), netmask) - self.topo.commandTo(self.router, cmd) - routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC() - self.topo.commandTo(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac) + # Congestion servers + i = 0 + for s in self.cong_servers: + cmd = self.interfaceUpCommand(self.getRouterInterfaceCongServer(i), + self.getRouterIPCongServer(i), netmask) + self.topo.commandTo(self.router, cmd) + routerIntfMac = self.router.intf(self.getRouterInterfaceCongServer(i)).MAC() + self.topo.commandTo(s, "arp -s " + self.getRouterIPCongServer(i) + " " + routerIntfMac) - cmd = self.interfaceUpCommand(self.getCongServerInterface(i), - self.getCongServerIP(i), netmask) - self.topo.commandTo(s, cmd) - congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC() - self.topo.commandTo(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) - i = i + 1 + cmd = self.interfaceUpCommand(self.getCongServerInterface(i), + self.getCongServerIP(i), netmask) + self.topo.commandTo(s, cmd) + congServerIntfMac = s.intf(self.getCongServerInterface(i)).MAC() + self.topo.commandTo(self.router, "arp -s " + self.getCongServerIP(i) + " " + congServerIntfMac) + i = i + 1 - def getClientIP(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientIP = lSubnet + str(interfaceID) + ".1" - return clientIP + def getClientIP(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientIP = lSubnet + str(interfaceID) + ".1" + return clientIP - def getCongClientIP(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - congClientIP = lSubnet + str(interfaceID) + ".127" - return congClientIP + def getCongClientIP(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + congClientIP = lSubnet + str(interfaceID) + ".127" + return congClientIP - def getClientSubnet(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - clientSubnet = lSubnet + str(interfaceID) + ".0/24" - return clientSubnet + def getClientSubnet(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + clientSubnet = lSubnet + str(interfaceID) + ".0/24" + return clientSubnet - def getRouterIPSwitch(self, interfaceID): - lSubnet = self.param.getParam(MpParamTopo.LSUBNET) - routerIP = lSubnet + str(interfaceID) + ".2" - return routerIP + def getRouterIPSwitch(self, interfaceID): + lSubnet = self.param.getParam(MpParamTopo.LSUBNET) + routerIP = lSubnet + str(interfaceID) + ".2" + return routerIP - def getRouterIPServer(self): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - routerIP = rSubnet + "0.2" - return routerIP + def getRouterIPServer(self): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + routerIP = rSubnet + "0.2" + return routerIP - def getRouterIPCongServer(self, congID): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - routerIP = rSubnet + str(1 + congID) + ".2" - return routerIP + def getRouterIPCongServer(self, congID): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + routerIP = rSubnet + str(1 + congID) + ".2" + return routerIP - def getServerIP(self): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - serverIP = rSubnet + "0.1" - return serverIP + def getServerIP(self): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + serverIP = rSubnet + "0.1" + return serverIP - def getCongServerIP(self, congID): - rSubnet = self.param.getParam(MpParamTopo.RSUBNET) - serverIP = rSubnet + str(1 + congID) + ".1" - return serverIP + def getCongServerIP(self, congID): + rSubnet = self.param.getParam(MpParamTopo.RSUBNET) + serverIP = rSubnet + str(1 + congID) + ".1" + return serverIP - def getClientInterfaceCount(self): - return len(self.topo.switch) + def getClientInterfaceCount(self): + return len(self.topo.switch) - def getRouterInterfaceServer(self): - return self.getRouterInterfaceSwitch(len(self.topo.switch)) + def getRouterInterfaceServer(self): + return self.getRouterInterfaceSwitch(len(self.topo.switch)) - def getRouterInterfaceCongServer(self, congID): - return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID) + def getRouterInterfaceCongServer(self, congID): + return self.getRouterInterfaceSwitch(len(self.topo.switch) + 1 + congID) - def getClientInterface(self, interfaceID): - return MpTopo.clientName + "-eth" + str(interfaceID) + def getClientInterface(self, interfaceID): + return MpTopo.clientName + "-eth" + str(interfaceID) - def getCongClientInterface(self, interfaceID): - return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0" + def getCongClientInterface(self, interfaceID): + return MpMultiInterfaceCongTopo.congClientName + str(interfaceID) + "-eth0" - def getRouterInterfaceSwitch(self, interfaceID): - return MpTopo.routerName + "-eth" + str(interfaceID) + def getRouterInterfaceSwitch(self, interfaceID): + return MpTopo.routerName + "-eth" + str(interfaceID) - def getServerInterface(self): - return MpTopo.serverName + "-eth0" + def getServerInterface(self): + return MpTopo.serverName + "-eth0" - def getCongServerInterface(self, interfaceID): - return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0" + def getCongServerInterface(self, interfaceID): + return MpMultiInterfaceCongTopo.congServerName + str(interfaceID) + "-eth0" - def getMidLeftName(self, id): - return MpTopo.switchNamePrefix + str(id) + def getMidLeftName(self, id): + return MpTopo.switchNamePrefix + str(id) - def getMidRightName(self, id): - return MpTopo.routerName + def getMidRightName(self, id): + return MpTopo.routerName - def getMidL2RInterface(self, id): - return self.getMidLeftName(id) + "-eth2" + def getMidL2RInterface(self, id): + return self.getMidLeftName(id) + "-eth2" - def getMidR2LInterface(self, id): - return self.getMidRightName(id) + "-eth" + str(id) + def getMidR2LInterface(self, id): + return self.getMidRightName(id) + "-eth" + str(id) diff --git a/mpMultiInterfaceCongTopo.py b/mpMultiInterfaceCongTopo.py index dd7812f..3b60182 100644 --- a/mpMultiInterfaceCongTopo.py +++ b/mpMultiInterfaceCongTopo.py @@ -1,52 +1,52 @@ from mpTopo import MpTopo class MpMultiInterfaceCongTopo(MpTopo): - congClientName = "CCli" - congServerName = "CSer" + congClientName = "CCli" + congServerName = "CSer" - def __init__(self, topoBuilder, parameterFile): - MpTopo.__init__(self,topoBuilder, parameterFile) - print("Hello from topo multi if") - self.client = self.addHost(MpTopo.clientName) - self.server = self.addHost(MpTopo.serverName) - self.router = self.addHost(MpTopo.routerName) - self.cong_clients = [] - self.cong_servers = [] - self.switch = [] - for l in self.topoParam.linkCharacteristics: - self.switch.append(self.addOneSwitchPerLink(l)) - self.addLink(self.client,self.switch[-1]) - 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.switch[-1],self.router, **l.asDict()) - self.addLink(self.router, self.server) - for i in range(len(self.cong_clients)): - self.cong_servers.append(self.addHost(MpMultiInterfaceCongTopo.congServerName + str(len(self.cong_servers)))) - self.addLink(self.router, self.cong_servers[-1]) + def __init__(self, topoBuilder, parameterFile): + MpTopo.__init__(self,topoBuilder, parameterFile) + print("Hello from topo multi if") + self.client = self.addHost(MpTopo.clientName) + self.server = self.addHost(MpTopo.serverName) + self.router = self.addHost(MpTopo.routerName) + self.cong_clients = [] + self.cong_servers = [] + self.switch = [] + for l in self.topoParam.linkCharacteristics: + self.switch.append(self.addOneSwitchPerLink(l)) + self.addLink(self.client,self.switch[-1]) + 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.switch[-1],self.router, **l.asDict()) + self.addLink(self.router, self.server) + for i in range(len(self.cong_clients)): + self.cong_servers.append(self.addHost(MpMultiInterfaceCongTopo.congServerName + str(len(self.cong_servers)))) + self.addLink(self.router, self.cong_servers[-1]) - def getCongClients(self): - return self.cong_clients + def getCongClients(self): + return self.cong_clients - def getCongServers(self): - return self.cong_servers + def getCongServers(self): + return self.cong_servers - def addOneSwitchPerLink(self, link): - return self.addSwitch(MpMultiInterfaceCongTopo.switchNamePrefix + - str(link.id)) + def addOneSwitchPerLink(self, link): + return self.addSwitch(MpMultiInterfaceCongTopo.switchNamePrefix + + str(link.id)) - def __str__(self): - s = "Simple multiple interface topology with congestion \n" - i = 0 - n = len(self.topoParam.linkCharacteristics) - for p in self.topoParam.linkCharacteristics: - if i == n // 2: - if n % 2 == 0: - s = s + "c r-----s\n" - s = s + "|-----sw-----|\n" - else: - s = s + "c-----sw-----r-----s\n" - else: - s = s + "|-----sw-----|\n" + def __str__(self): + s = "Simple multiple interface topology with congestion \n" + i = 0 + n = len(self.topoParam.linkCharacteristics) + for p in self.topoParam.linkCharacteristics: + if i == n // 2: + if n % 2 == 0: + s = s + "c r-----s\n" + s = s + "|-----sw-----|\n" + else: + s = s + "c-----sw-----r-----s\n" + else: + s = s + "|-----sw-----|\n" - i = i + 1 - return s + i = i + 1 + return s diff --git a/mpMultiInterfaceTopo.py b/mpMultiInterfaceTopo.py index 3ba44a6..00876d5 100644 --- a/mpMultiInterfaceTopo.py +++ b/mpMultiInterfaceTopo.py @@ -1,44 +1,44 @@ from mpTopo import MpTopo class MpMultiInterfaceTopo(MpTopo): - def __init__(self, topoBuilder, parameterFile): - MpTopo.__init__(self,topoBuilder, parameterFile) - print("Hello from topo multi if") - self.client = self.addHost(MpTopo.clientName) - self.server = self.addHost(MpTopo.serverName) - self.router = self.addHost(MpTopo.routerName) - self.switchClient = [] - self.switchServer = [] - for l in self.topoParam.linkCharacteristics: - self.switchClient.append(self.addSwitch1ForLink(l)) - self.addLink(self.client,self.switchClient[-1]) - self.switchServer.append(self.addSwitch2ForLink(l)) - self.addLink(self.switchClient[-1], self.switchServer[-1], **l.asDict()) - self.addLink(self.switchServer[-1],self.router) - self.addLink(self.router, self.server) + def __init__(self, topoBuilder, parameterFile): + MpTopo.__init__(self,topoBuilder, parameterFile) + print("Hello from topo multi if") + self.client = self.addHost(MpTopo.clientName) + self.server = self.addHost(MpTopo.serverName) + self.router = self.addHost(MpTopo.routerName) + self.switchClient = [] + self.switchServer = [] + for l in self.topoParam.linkCharacteristics: + self.switchClient.append(self.addSwitch1ForLink(l)) + self.addLink(self.client,self.switchClient[-1]) + self.switchServer.append(self.addSwitch2ForLink(l)) + self.addLink(self.switchClient[-1], self.switchServer[-1], **l.asDict()) + self.addLink(self.switchServer[-1],self.router) + self.addLink(self.router, self.server) - def addSwitch1ForLink(self, link): - return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + - str(2 * link.id)) + def addSwitch1ForLink(self, link): + return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + + str(2 * link.id)) - def addSwitch2ForLink(self, link): - return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + + def addSwitch2ForLink(self, link): + return self.addSwitch(MpMultiInterfaceTopo.switchNamePrefix + str(2 * link.id + 1)) - def __str__(self): - s = "Simple multiple interface topolgy \n" - i = 0 - n = len(self.topoParam.linkCharacteristics) - for p in self.topoParam.linkCharacteristics: - if i == n // 2: - if n % 2 == 0: - s = s + "c r-----s\n" - s = s + "|--sw----sw--|\n" - else: - s = s + "c--sw----sw--r-----s\n" - else: - s = s + "|--sw----sw--|\n" + def __str__(self): + s = "Simple multiple interface topolgy \n" + i = 0 + n = len(self.topoParam.linkCharacteristics) + for p in self.topoParam.linkCharacteristics: + if i == n // 2: + if n % 2 == 0: + s = s + "c r-----s\n" + s = s + "|--sw----sw--|\n" + else: + s = s + "c--sw----sw--r-----s\n" + else: + s = s + "|--sw----sw--|\n" - i = i + 1 - return s + i = i + 1 + return s diff --git a/mpParam.py b/mpParam.py index 3f34a58..1fa59f1 100644 --- a/mpParam.py +++ b/mpParam.py @@ -19,7 +19,7 @@ class MpParam: tab = l.split(":") if len(tab) == 2: k = tab[0] - val = tab[1][:-1] + val = tab[1].rstrip() if k in self.paramDic: if not isinstance(self.paramDic[k], list): self.paramDic[k] = [self.paramDic[k]] diff --git a/mpParamXp.py b/mpParamXp.py index 0222235..d060dad 100644 --- a/mpParamXp.py +++ b/mpParamXp.py @@ -2,182 +2,182 @@ from mpParam import MpParam class MpParamXp(MpParam): - 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" + 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" - # 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" + # 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" - sysctlKeyClient = {} - sysctlKeyClient[KERNELPMC] = "net.mptcp.mptcp_path_manager" - sysctlKeyServer = {} - sysctlKeyServer[KERNELPMS] = "net.mptcp.mptcp_path_manager" + sysctlKeyClient = {} + sysctlKeyClient[KERNELPMC] = "net.mptcp.mptcp_path_manager" + sysctlKeyServer = {} + sysctlKeyServer[KERNELPMS] = "net.mptcp.mptcp_path_manager" - defaultValue = {} + defaultValue = {} - 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" + 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" - 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" + 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" - def __init__(self, paramFile): - MpParam.__init__(self, paramFile) + def __init__(self, paramFile): + MpParam.__init__(self, paramFile) - def getParam(self, key): - val = MpParam.getParam(self, key) - if val is None: - if key in MpParamXp.defaultValue: - return MpParamXp.defaultValue[key] - else: - raise Exception("Param not found " + key) - else: - return val + def getParam(self, key): + val = MpParam.getParam(self, key) + if val is None: + if key in MpParamXp.defaultValue: + return MpParamXp.defaultValue[key] + else: + raise Exception("Param not found " + key) + else: + return val - def __str__(self): - s = MpParam.__str__(self) - return s + def __str__(self): + s = MpParam.__str__(self) + return s