@Test public void testValidateHelloMessage() throws Exception { helloPdu = new L1L2HelloPdu(isisHeader); result4 = defaultIsisInterface.validateHelloMessage(helloPdu); assertThat(result4, is(false)); }
public boolean validateHelloMessage(HelloPdu helloPdu) { boolean isValid = false; if ((helloPdu.circuitType() == IsisRouterType.L1.value() && reservedPacketCircuitType == IsisRouterType.L2.value()) || (helloPdu.circuitType() == IsisRouterType.L2.value() && reservedPacketCircuitType == IsisRouterType.L1.value())) { return false; } List<Ip4Address> interfaceIpAddresses = helloPdu.interfaceIpAddresses(); Ip4Address neighborIp = (helloPdu.interfaceIpAddresses() != null) ? interfaceIpAddresses.get(0) : Ip4Address.valueOf("0.0.0.0"); if (!IsisUtil.sameNetwork(interfaceIpAddress, neighborIp, networkMask)) { return false; } if (helloPdu.circuitType() == IsisRouterType.L1.value()) { List<String> areas = helloPdu.areaAddress(); for (String area : areas) { if (areaAddress.equals(area)) { isValid = true; } } } else if (helloPdu.circuitType() == IsisRouterType.L2.value() || helloPdu.circuitType() == IsisRouterType.L1L2.value()) { isValid = true; } return isValid; }
DefaultIsisInterface implements IsisInterface { public boolean validateHelloMessage(HelloPdu helloPdu) { boolean isValid = false; if ((helloPdu.circuitType() == IsisRouterType.L1.value() && reservedPacketCircuitType == IsisRouterType.L2.value()) || (helloPdu.circuitType() == IsisRouterType.L2.value() && reservedPacketCircuitType == IsisRouterType.L1.value())) { return false; } List<Ip4Address> interfaceIpAddresses = helloPdu.interfaceIpAddresses(); Ip4Address neighborIp = (helloPdu.interfaceIpAddresses() != null) ? interfaceIpAddresses.get(0) : Ip4Address.valueOf("0.0.0.0"); if (!IsisUtil.sameNetwork(interfaceIpAddress, neighborIp, networkMask)) { return false; } if (helloPdu.circuitType() == IsisRouterType.L1.value()) { List<String> areas = helloPdu.areaAddress(); for (String area : areas) { if (areaAddress.equals(area)) { isValid = true; } } } else if (helloPdu.circuitType() == IsisRouterType.L2.value() || helloPdu.circuitType() == IsisRouterType.L1L2.value()) { isValid = true; } return isValid; } }
DefaultIsisInterface implements IsisInterface { public boolean validateHelloMessage(HelloPdu helloPdu) { boolean isValid = false; if ((helloPdu.circuitType() == IsisRouterType.L1.value() && reservedPacketCircuitType == IsisRouterType.L2.value()) || (helloPdu.circuitType() == IsisRouterType.L2.value() && reservedPacketCircuitType == IsisRouterType.L1.value())) { return false; } List<Ip4Address> interfaceIpAddresses = helloPdu.interfaceIpAddresses(); Ip4Address neighborIp = (helloPdu.interfaceIpAddresses() != null) ? interfaceIpAddresses.get(0) : Ip4Address.valueOf("0.0.0.0"); if (!IsisUtil.sameNetwork(interfaceIpAddress, neighborIp, networkMask)) { return false; } if (helloPdu.circuitType() == IsisRouterType.L1.value()) { List<String> areas = helloPdu.areaAddress(); for (String area : areas) { if (areaAddress.equals(area)) { isValid = true; } } } else if (helloPdu.circuitType() == IsisRouterType.L2.value() || helloPdu.circuitType() == IsisRouterType.L1L2.value()) { isValid = true; } return isValid; }  }
DefaultIsisInterface implements IsisInterface { public boolean validateHelloMessage(HelloPdu helloPdu) { boolean isValid = false; if ((helloPdu.circuitType() == IsisRouterType.L1.value() && reservedPacketCircuitType == IsisRouterType.L2.value()) || (helloPdu.circuitType() == IsisRouterType.L2.value() && reservedPacketCircuitType == IsisRouterType.L1.value())) { return false; } List<Ip4Address> interfaceIpAddresses = helloPdu.interfaceIpAddresses(); Ip4Address neighborIp = (helloPdu.interfaceIpAddresses() != null) ? interfaceIpAddresses.get(0) : Ip4Address.valueOf("0.0.0.0"); if (!IsisUtil.sameNetwork(interfaceIpAddress, neighborIp, networkMask)) { return false; } if (helloPdu.circuitType() == IsisRouterType.L1.value()) { List<String> areas = helloPdu.areaAddress(); for (String area : areas) { if (areaAddress.equals(area)) { isValid = true; } } } else if (helloPdu.circuitType() == IsisRouterType.L2.value() || helloPdu.circuitType() == IsisRouterType.L1L2.value()) { isValid = true; } return isValid; }  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 boolean validateHelloMessage(HelloPdu helloPdu) { boolean isValid = false; if ((helloPdu.circuitType() == IsisRouterType.L1.value() && reservedPacketCircuitType == IsisRouterType.L2.value()) || (helloPdu.circuitType() == IsisRouterType.L2.value() && reservedPacketCircuitType == IsisRouterType.L1.value())) { return false; } List<Ip4Address> interfaceIpAddresses = helloPdu.interfaceIpAddresses(); Ip4Address neighborIp = (helloPdu.interfaceIpAddresses() != null) ? interfaceIpAddresses.get(0) : Ip4Address.valueOf("0.0.0.0"); if (!IsisUtil.sameNetwork(interfaceIpAddress, neighborIp, networkMask)) { return false; } if (helloPdu.circuitType() == IsisRouterType.L1.value()) { List<String> areas = helloPdu.areaAddress(); for (String area : areas) { if (areaAddress.equals(area)) { isValid = true; } } } else if (helloPdu.circuitType() == IsisRouterType.L2.value() || helloPdu.circuitType() == IsisRouterType.L1L2.value()) { isValid = true; } return isValid; }  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();  }