From 6ff8717cf162ba4c340739b1267383578ee987db Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Thu, 5 May 2016 10:21:32 +0200 Subject: [PATCH] mpMultiInterfaceConfig: arp should be fixed now --- src/mpMultiInterfaceConfig.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/mpMultiInterfaceConfig.py b/src/mpMultiInterfaceConfig.py index 39227c0..4009124 100644 --- a/src/mpMultiInterfaceConfig.py +++ b/src/mpMultiInterfaceConfig.py @@ -37,17 +37,15 @@ class MpMultiInterfaceConfig(MpConfig): self.server = self.topo.getHost(MpTopo.serverName) self.router = self.topo.getHost(MpTopo.routerName) i = 0 - count = 0 netmask = "255.255.255.0" - startMac = "00:00:00:00:00:" 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) - self.topo.commandTo(self.client, "arp -s " + self.getClientIP(i) + " " + startMac + hex(count).split('x')[1]) - count += 1 + 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( @@ -58,22 +56,22 @@ class MpMultiInterfaceConfig(MpConfig): self.getRouterInterfaceSwitch(i), self.getRouterIPSwitch(i), netmask) self.topo.commandTo(self.router, cmd) - self.topo.commandTo(self.router, "arp -s " + self.getRouterIPSwitch(i) + " " + startMac + hex(count).split('x')[1]) - count += 1 + 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) - self.topo.commandTo(self.router, "arp -s " + self.getRouterIPServer() + " " + startMac + hex(count).split('x')[1]) - count += 1 + 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) - self.topo.commandTo(self.router, "arp -s " + self.getServerIP() + " " + startMac + hex(count).split('x')[1]) - count += 1 + 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)