@Test public void testUpdateInterfaceMap() throws Exception { ospfInterfaceChannelHandler.updateInterfaceMap(ospfProcesses); assertThat(ospfInterfaceChannelHandler, is(notNullValue())); }
public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception { for (OspfProcess ospfUpdatedProcess : ospfProcesses) { for (OspfArea updatedArea : ospfUpdatedProcess.areas()) { for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) { OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex()); if (ospfInterface == null) { ospfUpdatedInterface.setOspfArea(updatedArea); ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller); ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN); ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface); ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel); ospfUpdatedInterface.interfaceUp(); ospfUpdatedInterface.startDelayedAckTimer(); } else { ospfInterface.setOspfArea(updatedArea); if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) { ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime()); Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors(); for (String key : neighbors.keySet()) { OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key); ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime()); ospfNbr.stopInactivityTimeCheck(); ospfNbr.startInactivityTimeCheck(); } } if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) { ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType()); if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) { ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); } ospfInterface.removeNeighbors(); } if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) { ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime()); ospfInterface.stopHelloTimer(); ospfInterface.startHelloTimer(); } ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface); } } } } }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception { for (OspfProcess ospfUpdatedProcess : ospfProcesses) { for (OspfArea updatedArea : ospfUpdatedProcess.areas()) { for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) { OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex()); if (ospfInterface == null) { ospfUpdatedInterface.setOspfArea(updatedArea); ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller); ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN); ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface); ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel); ospfUpdatedInterface.interfaceUp(); ospfUpdatedInterface.startDelayedAckTimer(); } else { ospfInterface.setOspfArea(updatedArea); if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) { ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime()); Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors(); for (String key : neighbors.keySet()) { OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key); ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime()); ospfNbr.stopInactivityTimeCheck(); ospfNbr.startInactivityTimeCheck(); } } if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) { ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType()); if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) { ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); } ospfInterface.removeNeighbors(); } if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) { ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime()); ospfInterface.stopHelloTimer(); ospfInterface.startHelloTimer(); } ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface); } } } } } }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception { for (OspfProcess ospfUpdatedProcess : ospfProcesses) { for (OspfArea updatedArea : ospfUpdatedProcess.areas()) { for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) { OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex()); if (ospfInterface == null) { ospfUpdatedInterface.setOspfArea(updatedArea); ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller); ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN); ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface); ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel); ospfUpdatedInterface.interfaceUp(); ospfUpdatedInterface.startDelayedAckTimer(); } else { ospfInterface.setOspfArea(updatedArea); if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) { ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime()); Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors(); for (String key : neighbors.keySet()) { OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key); ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime()); ospfNbr.stopInactivityTimeCheck(); ospfNbr.startInactivityTimeCheck(); } } if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) { ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType()); if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) { ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); } ospfInterface.removeNeighbors(); } if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) { ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime()); ospfInterface.stopHelloTimer(); ospfInterface.startHelloTimer(); } ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface); } } } } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception { for (OspfProcess ospfUpdatedProcess : ospfProcesses) { for (OspfArea updatedArea : ospfUpdatedProcess.areas()) { for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) { OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex()); if (ospfInterface == null) { ospfUpdatedInterface.setOspfArea(updatedArea); ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller); ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN); ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface); ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel); ospfUpdatedInterface.interfaceUp(); ospfUpdatedInterface.startDelayedAckTimer(); } else { ospfInterface.setOspfArea(updatedArea); if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) { ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime()); Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors(); for (String key : neighbors.keySet()) { OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key); ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime()); ospfNbr.stopInactivityTimeCheck(); ospfNbr.startInactivityTimeCheck(); } } if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) { ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType()); if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) { ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); } ospfInterface.removeNeighbors(); } if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) { ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime()); ospfInterface.stopHelloTimer(); ospfInterface.startHelloTimer(); } ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface); } } } } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); void initializeInterfaceMap(); void updateInterfaceMap(List<OspfProcess> ospfProcesses); @Override void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
            e); @Override void messageReceived(ChannelHandlerContext ctx, MessageEvent
            e); void processOspfMessage(OspfMessage
                                           ospfMessage, ChannelHandlerContext ctx); void sentConfigPacket(byte[] configPacket); }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception { for (OspfProcess ospfUpdatedProcess : ospfProcesses) { for (OspfArea updatedArea : ospfUpdatedProcess.areas()) { for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) { OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex()); if (ospfInterface == null) { ospfUpdatedInterface.setOspfArea(updatedArea); ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller); ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN); ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface); ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel); ospfUpdatedInterface.interfaceUp(); ospfUpdatedInterface.startDelayedAckTimer(); } else { ospfInterface.setOspfArea(updatedArea); if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) { ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime()); Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors(); for (String key : neighbors.keySet()) { OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key); ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime()); ospfNbr.stopInactivityTimeCheck(); ospfNbr.startInactivityTimeCheck(); } } if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) { ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType()); if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) { ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0")); ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0")); } ospfInterface.removeNeighbors(); } if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) { ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime()); ospfInterface.stopHelloTimer(); ospfInterface.startHelloTimer(); } ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface); } } } } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); void initializeInterfaceMap(); void updateInterfaceMap(List<OspfProcess> ospfProcesses); @Override void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
            e); @Override void messageReceived(ChannelHandlerContext ctx, MessageEvent
            e); void processOspfMessage(OspfMessage
                                           ospfMessage, ChannelHandlerContext ctx); void sentConfigPacket(byte[] configPacket);  }