@Test(expected = Exception.class) public void testProcessCsnPduMessage() throws Exception { ChannelBuffer channelBuffer = ChannelBuffers.copiedBuffer(csnpBytes); csnp = new Csnp(isisHeader); csnp.readFrom(channelBuffer); csnp.setSourceMac(macAddress1); csnp.setIsisPduType(IsisPduType.L2CSNP.value()); isisMessage = csnp; defaultIsisInterface.processIsisMessage(isisMessage, isisLsdb, channel); assertThat(defaultIsisInterface, is(notNullValue())); }
public void processCsnPduMessage(IsisMessage isisMessage, Channel channel) { log.debug("Enters processCsnPduMessage ...!!!"); IsisNeighbor neighbor = neighbouringRouter(isisMessage.sourceMac()); if (networkType == IsisNetworkType.BROADCAST && neighbor == null) { return; } Csnp csnPacket = (Csnp) isisMessage; IsisPduType psnPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2PSNP : IsisPduType.L1PSNP; IsisPduType lsPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2LSPDU : IsisPduType.L1LSPDU; List<LspEntry> lspEntryRequestList = new ArrayList<>(); boolean selfOriginatedFound = false; List<IsisTlv> isisTlvs = csnPacket.getAllTlv(); Iterator iterator = isisTlvs.iterator(); while (iterator.hasNext()) { IsisTlv isisTlv = (IsisTlv) iterator.next(); if (isisTlv instanceof LspEntriesTlv) { LspEntriesTlv lspEntriesTlv = (LspEntriesTlv) isisTlv; List<LspEntry> lspEntryList = lspEntriesTlv.lspEntry(); Iterator lspEntryListIterator = lspEntryList.iterator(); while (lspEntryListIterator.hasNext()) { LspEntry lspEntry = (LspEntry) lspEntryListIterator.next(); String lspKey = lspEntry.lspId(); LspWrapper lspWrapper = isisLsdb.findLsp(lsPduType, lspKey); if (lspWrapper != null) { LsPdu lsPdu = (LsPdu) lspWrapper.lsPdu(); if (lspWrapper.isSelfOriginated()) { selfOriginatedFound = true; if (lspEntry.lspSequenceNumber() < lsPdu.sequenceNumber()) { sendLsp(lsPdu, channel); } } else { if (lsPdu.sequenceNumber() < lspEntry.lspSequenceNumber()) { lspEntryRequestList.add(lspEntry); flagValue = true; } } } else { lspEntryRequestList.add(lspEntry); flagValue = true; } } } } if (flagValue) { sendPsnPduMessage(lspEntryRequestList, psnPduType, channel); lspEntryRequestList.clear(); } if (!selfOriginatedFound) { String lspKey = isisLsdb.lspKey(systemId); LspWrapper wrapper = isisLsdb.findLsp(lsPduType, lspKey); if (wrapper != null) { sendLsp((LsPdu) wrapper.lsPdu(), channel); } } }
DefaultIsisInterface implements IsisInterface { public void processCsnPduMessage(IsisMessage isisMessage, Channel channel) { log.debug("Enters processCsnPduMessage ...!!!"); IsisNeighbor neighbor = neighbouringRouter(isisMessage.sourceMac()); if (networkType == IsisNetworkType.BROADCAST && neighbor == null) { return; } Csnp csnPacket = (Csnp) isisMessage; IsisPduType psnPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2PSNP : IsisPduType.L1PSNP; IsisPduType lsPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2LSPDU : IsisPduType.L1LSPDU; List<LspEntry> lspEntryRequestList = new ArrayList<>(); boolean selfOriginatedFound = false; List<IsisTlv> isisTlvs = csnPacket.getAllTlv(); Iterator iterator = isisTlvs.iterator(); while (iterator.hasNext()) { IsisTlv isisTlv = (IsisTlv) iterator.next(); if (isisTlv instanceof LspEntriesTlv) { LspEntriesTlv lspEntriesTlv = (LspEntriesTlv) isisTlv; List<LspEntry> lspEntryList = lspEntriesTlv.lspEntry(); Iterator lspEntryListIterator = lspEntryList.iterator(); while (lspEntryListIterator.hasNext()) { LspEntry lspEntry = (LspEntry) lspEntryListIterator.next(); String lspKey = lspEntry.lspId(); LspWrapper lspWrapper = isisLsdb.findLsp(lsPduType, lspKey); if (lspWrapper != null) { LsPdu lsPdu = (LsPdu) lspWrapper.lsPdu(); if (lspWrapper.isSelfOriginated()) { selfOriginatedFound = true; if (lspEntry.lspSequenceNumber() < lsPdu.sequenceNumber()) { sendLsp(lsPdu, channel); } } else { if (lsPdu.sequenceNumber() < lspEntry.lspSequenceNumber()) { lspEntryRequestList.add(lspEntry); flagValue = true; } } } else { lspEntryRequestList.add(lspEntry); flagValue = true; } } } } if (flagValue) { sendPsnPduMessage(lspEntryRequestList, psnPduType, channel); lspEntryRequestList.clear(); } if (!selfOriginatedFound) { String lspKey = isisLsdb.lspKey(systemId); LspWrapper wrapper = isisLsdb.findLsp(lsPduType, lspKey); if (wrapper != null) { sendLsp((LsPdu) wrapper.lsPdu(), channel); } } } }
DefaultIsisInterface implements IsisInterface { public void processCsnPduMessage(IsisMessage isisMessage, Channel channel) { log.debug("Enters processCsnPduMessage ...!!!"); IsisNeighbor neighbor = neighbouringRouter(isisMessage.sourceMac()); if (networkType == IsisNetworkType.BROADCAST && neighbor == null) { return; } Csnp csnPacket = (Csnp) isisMessage; IsisPduType psnPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2PSNP : IsisPduType.L1PSNP; IsisPduType lsPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2LSPDU : IsisPduType.L1LSPDU; List<LspEntry> lspEntryRequestList = new ArrayList<>(); boolean selfOriginatedFound = false; List<IsisTlv> isisTlvs = csnPacket.getAllTlv(); Iterator iterator = isisTlvs.iterator(); while (iterator.hasNext()) { IsisTlv isisTlv = (IsisTlv) iterator.next(); if (isisTlv instanceof LspEntriesTlv) { LspEntriesTlv lspEntriesTlv = (LspEntriesTlv) isisTlv; List<LspEntry> lspEntryList = lspEntriesTlv.lspEntry(); Iterator lspEntryListIterator = lspEntryList.iterator(); while (lspEntryListIterator.hasNext()) { LspEntry lspEntry = (LspEntry) lspEntryListIterator.next(); String lspKey = lspEntry.lspId(); LspWrapper lspWrapper = isisLsdb.findLsp(lsPduType, lspKey); if (lspWrapper != null) { LsPdu lsPdu = (LsPdu) lspWrapper.lsPdu(); if (lspWrapper.isSelfOriginated()) { selfOriginatedFound = true; if (lspEntry.lspSequenceNumber() < lsPdu.sequenceNumber()) { sendLsp(lsPdu, channel); } } else { if (lsPdu.sequenceNumber() < lspEntry.lspSequenceNumber()) { lspEntryRequestList.add(lspEntry); flagValue = true; } } } else { lspEntryRequestList.add(lspEntry); flagValue = true; } } } } if (flagValue) { sendPsnPduMessage(lspEntryRequestList, psnPduType, channel); lspEntryRequestList.clear(); } if (!selfOriginatedFound) { String lspKey = isisLsdb.lspKey(systemId); LspWrapper wrapper = isisLsdb.findLsp(lsPduType, lspKey); if (wrapper != null) { sendLsp((LsPdu) wrapper.lsPdu(), channel); } } }  }
DefaultIsisInterface implements IsisInterface { public void processCsnPduMessage(IsisMessage isisMessage, Channel channel) { log.debug("Enters processCsnPduMessage ...!!!"); IsisNeighbor neighbor = neighbouringRouter(isisMessage.sourceMac()); if (networkType == IsisNetworkType.BROADCAST && neighbor == null) { return; } Csnp csnPacket = (Csnp) isisMessage; IsisPduType psnPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2PSNP : IsisPduType.L1PSNP; IsisPduType lsPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2LSPDU : IsisPduType.L1LSPDU; List<LspEntry> lspEntryRequestList = new ArrayList<>(); boolean selfOriginatedFound = false; List<IsisTlv> isisTlvs = csnPacket.getAllTlv(); Iterator iterator = isisTlvs.iterator(); while (iterator.hasNext()) { IsisTlv isisTlv = (IsisTlv) iterator.next(); if (isisTlv instanceof LspEntriesTlv) { LspEntriesTlv lspEntriesTlv = (LspEntriesTlv) isisTlv; List<LspEntry> lspEntryList = lspEntriesTlv.lspEntry(); Iterator lspEntryListIterator = lspEntryList.iterator(); while (lspEntryListIterator.hasNext()) { LspEntry lspEntry = (LspEntry) lspEntryListIterator.next(); String lspKey = lspEntry.lspId(); LspWrapper lspWrapper = isisLsdb.findLsp(lsPduType, lspKey); if (lspWrapper != null) { LsPdu lsPdu = (LsPdu) lspWrapper.lsPdu(); if (lspWrapper.isSelfOriginated()) { selfOriginatedFound = true; if (lspEntry.lspSequenceNumber() < lsPdu.sequenceNumber()) { sendLsp(lsPdu, channel); } } else { if (lsPdu.sequenceNumber() < lspEntry.lspSequenceNumber()) { lspEntryRequestList.add(lspEntry); flagValue = true; } } } else { lspEntryRequestList.add(lspEntry); flagValue = true; } } } } if (flagValue) { sendPsnPduMessage(lspEntryRequestList, psnPduType, channel); lspEntryRequestList.clear(); } if (!selfOriginatedFound) { String lspKey = isisLsdb.lspKey(systemId); LspWrapper wrapper = isisLsdb.findLsp(lsPduType, lspKey); if (wrapper != null) { sendLsp((LsPdu) wrapper.lsPdu(), channel); } } }  IsisLsdb isisLsdb(); void setAllConfiguredInterfaceIps(List<Ip4Address> allConfiguredInterfaces); void removeNeighbor(IsisNeighbor isisNeighbor); void removeNeighbors(); IsisNeighbor lookup(MacAddress isisNeighborMac); Set<MacAddress> neighbors(); Channel channel(); int interfaceIndex(); void setInterfaceIndex(int interfaceIndex); Ip4Address interfaceIpAddress(); void setInterfaceIpAddress(Ip4Address interfaceIpAddress); byte[] networkMask(); void setNetworkMask(byte[] networkMask); MacAddress getInterfaceMacAddress(); void setInterfaceMacAddress(MacAddress interfaceMacAddress); String intermediateSystemName(); void setIntermediateSystemName(String intermediateSystemName); String systemId(); void setSystemId(String systemId); String l1LanId(); void setL1LanId(String l1LanId); String l2LanId(); void setL2LanId(String l2LanId); int getIdLength(); void setIdLength(int idLength); int getMaxAreaAddresses(); void setMaxAreaAddresses(int maxAreaAddresses); int reservedPacketCircuitType(); void setReservedPacketCircuitType(int reservedPacketCircuitType); IsisNetworkType networkType(); void setNetworkType(IsisNetworkType networkType); String areaAddress(); void setAreaAddress(String areaAddress); int getAreaLength(); void setAreaLength(int areaLength); int holdingTime(); void setHoldingTime(int holdingTime); int priority(); void setPriority(int priority); int helloInterval(); void setHelloInterval(int helloInterval); IsisInterfaceState interfaceState(); void setInterfaceState(IsisInterfaceState interfaceState); String circuitId(); void setCircuitId(String circuitId); void processIsisMessage(IsisMessage isisMessage, IsisLsdb isisLsdb, Channel channel); boolean validateHelloMessage(HelloPdu helloPdu); void processL1L2HelloPduMessage(IsisMessage isisMessage, Channel channel); void processP2pHelloPduMessage(IsisMessage isisMessage, Channel channel); void processLsPduMessage(IsisMessage isisMessage, Channel channel); void processPsnPduMessage(IsisMessage isisMessage, Channel channel); void processCsnPduMessage(IsisMessage isisMessage, Channel channel); String lspKeyP2P(String systemId); void startHelloSender(Channel channel); void stopHelloSender(); }
DefaultIsisInterface implements IsisInterface { public void processCsnPduMessage(IsisMessage isisMessage, Channel channel) { log.debug("Enters processCsnPduMessage ...!!!"); IsisNeighbor neighbor = neighbouringRouter(isisMessage.sourceMac()); if (networkType == IsisNetworkType.BROADCAST && neighbor == null) { return; } Csnp csnPacket = (Csnp) isisMessage; IsisPduType psnPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2PSNP : IsisPduType.L1PSNP; IsisPduType lsPduType = (IsisPduType.L2CSNP.equals(csnPacket.isisPduType())) ? IsisPduType.L2LSPDU : IsisPduType.L1LSPDU; List<LspEntry> lspEntryRequestList = new ArrayList<>(); boolean selfOriginatedFound = false; List<IsisTlv> isisTlvs = csnPacket.getAllTlv(); Iterator iterator = isisTlvs.iterator(); while (iterator.hasNext()) { IsisTlv isisTlv = (IsisTlv) iterator.next(); if (isisTlv instanceof LspEntriesTlv) { LspEntriesTlv lspEntriesTlv = (LspEntriesTlv) isisTlv; List<LspEntry> lspEntryList = lspEntriesTlv.lspEntry(); Iterator lspEntryListIterator = lspEntryList.iterator(); while (lspEntryListIterator.hasNext()) { LspEntry lspEntry = (LspEntry) lspEntryListIterator.next(); String lspKey = lspEntry.lspId(); LspWrapper lspWrapper = isisLsdb.findLsp(lsPduType, lspKey); if (lspWrapper != null) { LsPdu lsPdu = (LsPdu) lspWrapper.lsPdu(); if (lspWrapper.isSelfOriginated()) { selfOriginatedFound = true; if (lspEntry.lspSequenceNumber() < lsPdu.sequenceNumber()) { sendLsp(lsPdu, channel); } } else { if (lsPdu.sequenceNumber() < lspEntry.lspSequenceNumber()) { lspEntryRequestList.add(lspEntry); flagValue = true; } } } else { lspEntryRequestList.add(lspEntry); flagValue = true; } } } } if (flagValue) { sendPsnPduMessage(lspEntryRequestList, psnPduType, channel); lspEntryRequestList.clear(); } if (!selfOriginatedFound) { String lspKey = isisLsdb.lspKey(systemId); LspWrapper wrapper = isisLsdb.findLsp(lsPduType, lspKey); if (wrapper != null) { sendLsp((LsPdu) wrapper.lsPdu(), channel); } } }  IsisLsdb isisLsdb(); void setAllConfiguredInterfaceIps(List<Ip4Address> allConfiguredInterfaces); void removeNeighbor(IsisNeighbor isisNeighbor); void removeNeighbors(); IsisNeighbor lookup(MacAddress isisNeighborMac); Set<MacAddress> neighbors(); Channel channel(); int interfaceIndex(); void setInterfaceIndex(int interfaceIndex); Ip4Address interfaceIpAddress(); void setInterfaceIpAddress(Ip4Address interfaceIpAddress); byte[] networkMask(); void setNetworkMask(byte[] networkMask); MacAddress getInterfaceMacAddress(); void setInterfaceMacAddress(MacAddress interfaceMacAddress); String intermediateSystemName(); void setIntermediateSystemName(String intermediateSystemName); String systemId(); void setSystemId(String systemId); String l1LanId(); void setL1LanId(String l1LanId); String l2LanId(); void setL2LanId(String l2LanId); int getIdLength(); void setIdLength(int idLength); int getMaxAreaAddresses(); void setMaxAreaAddresses(int maxAreaAddresses); int reservedPacketCircuitType(); void setReservedPacketCircuitType(int reservedPacketCircuitType); IsisNetworkType networkType(); void setNetworkType(IsisNetworkType networkType); String areaAddress(); void setAreaAddress(String areaAddress); int getAreaLength(); void setAreaLength(int areaLength); int holdingTime(); void setHoldingTime(int holdingTime); int priority(); void setPriority(int priority); int helloInterval(); void setHelloInterval(int helloInterval); IsisInterfaceState interfaceState(); void setInterfaceState(IsisInterfaceState interfaceState); String circuitId(); void setCircuitId(String circuitId); void processIsisMessage(IsisMessage isisMessage, IsisLsdb isisLsdb, Channel channel); boolean validateHelloMessage(HelloPdu helloPdu); void processL1L2HelloPduMessage(IsisMessage isisMessage, Channel channel); void processP2pHelloPduMessage(IsisMessage isisMessage, Channel channel); void processLsPduMessage(IsisMessage isisMessage, Channel channel); void processPsnPduMessage(IsisMessage isisMessage, Channel channel); void processCsnPduMessage(IsisMessage isisMessage, Channel channel); String lspKeyP2P(String systemId); void startHelloSender(Channel channel); void stopHelloSender();  }