@Test public void testReadFrom() throws Exception { ospfPacketHeader = new OspfPacketHeader(); ospfPacketHeader.setAreaId(Ip4Address.valueOf("1.1.1.1")); ospfPacketHeader.setAuthentication(0); ospfPacketHeader.setAuthType(0); ospfPacketHeader.setChecksum(12345); ospfPacketHeader.setDestinationIp(Ip4Address.valueOf("10.10.10.10")); ospfPacketHeader.setOspfPacLength(56); ospfPacketHeader.setOspftype(5); ospfPacketHeader.setOspfVer(2); ospfPacketHeader.setRouterId(Ip4Address.valueOf("2.2.2.2")); ospfPacketHeader.setSourceIp(Ip4Address.valueOf("3.3.3.3")); result = createByteForLSAck(); lsAck = new LsAcknowledge(ospfPacketHeader); channelBuffer = ChannelBuffers.copiedBuffer(result); lsAck.readFrom(channelBuffer); assertThat(lsAck, is(notNullValue())); assertThat(lsAck.ospfMessageType(), is(OspfPacketType.LSAACK)); }
@Override public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { while (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) { LsaHeader header = OspfUtil.readLsaHeader(channelBuffer); addLinkStateHeader(header); } } catch (Exception e) { log.debug("Error::LsAckPacket:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH); } }
LsAcknowledge extends OspfPacketHeader { @Override public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { while (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) { LsaHeader header = OspfUtil.readLsaHeader(channelBuffer); addLinkStateHeader(header); } } catch (Exception e) { log.debug("Error::LsAckPacket:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH); } } }
LsAcknowledge extends OspfPacketHeader { @Override public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { while (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) { LsaHeader header = OspfUtil.readLsaHeader(channelBuffer); addLinkStateHeader(header); } } catch (Exception e) { log.debug("Error::LsAckPacket:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH); } } LsAcknowledge();  LsAcknowledge(OspfPacketHeader ospfHeader); }
LsAcknowledge extends OspfPacketHeader { @Override public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { while (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) { LsaHeader header = OspfUtil.readLsaHeader(channelBuffer); addLinkStateHeader(header); } } catch (Exception e) { log.debug("Error::LsAckPacket:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH); } } LsAcknowledge();  LsAcknowledge(OspfPacketHeader ospfHeader); List<LsaHeader> getLinkStateHeaders(); void addLinkStateHeader(LsaHeader lsaHeader); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getLsAckAsByteArray(); byte[] getLsAckBodyAsByteArray(); @Override String toString(); }
LsAcknowledge extends OspfPacketHeader { @Override public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { while (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) { LsaHeader header = OspfUtil.readLsaHeader(channelBuffer); addLinkStateHeader(header); } } catch (Exception e) { log.debug("Error::LsAckPacket:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH); } } LsAcknowledge();  LsAcknowledge(OspfPacketHeader ospfHeader); List<LsaHeader> getLinkStateHeaders(); void addLinkStateHeader(LsaHeader lsaHeader); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getLsAckAsByteArray(); byte[] getLsAckBodyAsByteArray(); @Override String toString();  }