mpMultiInterfaceConfig: arp should be fixed now

This commit is contained in:
Quentin De Coninck 2016-05-05 10:21:32 +02:00
parent 061bf784d7
commit 6ff8717cf1

View File

@ -37,17 +37,15 @@ class MpMultiInterfaceConfig(MpConfig):
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
count = 0
netmask = "255.255.255.0" netmask = "255.255.255.0"
startMac = "00:00:00:00:00:"
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)
self.topo.commandTo(self.client, "arp -s " + self.getClientIP(i) + " " + startMac + hex(count).split('x')[1]) clientIntfMac = self.client.intf(self.getClientInterface(i)).MAC()
count += 1 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(
@ -58,22 +56,22 @@ class MpMultiInterfaceConfig(MpConfig):
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)
self.topo.commandTo(self.router, "arp -s " + self.getRouterIPSwitch(i) + " " + startMac + hex(count).split('x')[1]) routerIntfMac = self.router.intf(self.getRouterInterfaceSwitch(i)).MAC()
count += 1 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)
self.topo.commandTo(self.router, "arp -s " + self.getRouterIPServer() + " " + startMac + hex(count).split('x')[1]) routerIntfMac = self.router.intf(self.getRouterInterfaceServer()).MAC()
count += 1 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)
self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + startMac + hex(count).split('x')[1]) serverIntfMac = self.server.intf(self.getServerInterface()).MAC()
count += 1 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)