@Test public void testGetLsaHeaderAsByteArray() throws Exception { result3 = lsaHeader.getLsaHeaderAsByteArray(); assertThat(result3, is(notNullValue())); }
public byte[] getLsaHeaderAsByteArray() { List<Byte> headerLst = new ArrayList<>(); try { headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.age()))); headerLst.add((byte) this.options()); headerLst.add((byte) this.lsType()); headerLst.addAll(Bytes.asList(InetAddress.getByName(this.linkStateId()).getAddress())); headerLst.addAll(Bytes.asList(this.advertisingRouter().toOctets())); headerLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.lsSequenceNo()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsCheckSum()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsPacketLen()))); } catch (Exception e) { log.debug("Error::getLsaHeaderAsByteArray {}", e.getMessage()); return Bytes.toArray(headerLst); } return Bytes.toArray(headerLst); }
LsaHeader implements OspfLsa { public byte[] getLsaHeaderAsByteArray() { List<Byte> headerLst = new ArrayList<>(); try { headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.age()))); headerLst.add((byte) this.options()); headerLst.add((byte) this.lsType()); headerLst.addAll(Bytes.asList(InetAddress.getByName(this.linkStateId()).getAddress())); headerLst.addAll(Bytes.asList(this.advertisingRouter().toOctets())); headerLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.lsSequenceNo()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsCheckSum()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsPacketLen()))); } catch (Exception e) { log.debug("Error::getLsaHeaderAsByteArray {}", e.getMessage()); return Bytes.toArray(headerLst); } return Bytes.toArray(headerLst); } }
LsaHeader implements OspfLsa { public byte[] getLsaHeaderAsByteArray() { List<Byte> headerLst = new ArrayList<>(); try { headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.age()))); headerLst.add((byte) this.options()); headerLst.add((byte) this.lsType()); headerLst.addAll(Bytes.asList(InetAddress.getByName(this.linkStateId()).getAddress())); headerLst.addAll(Bytes.asList(this.advertisingRouter().toOctets())); headerLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.lsSequenceNo()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsCheckSum()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsPacketLen()))); } catch (Exception e) { log.debug("Error::getLsaHeaderAsByteArray {}", e.getMessage()); return Bytes.toArray(headerLst); } return Bytes.toArray(headerLst); }  }
LsaHeader implements OspfLsa { public byte[] getLsaHeaderAsByteArray() { List<Byte> headerLst = new ArrayList<>(); try { headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.age()))); headerLst.add((byte) this.options()); headerLst.add((byte) this.lsType()); headerLst.addAll(Bytes.asList(InetAddress.getByName(this.linkStateId()).getAddress())); headerLst.addAll(Bytes.asList(this.advertisingRouter().toOctets())); headerLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.lsSequenceNo()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsCheckSum()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsPacketLen()))); } catch (Exception e) { log.debug("Error::getLsaHeaderAsByteArray {}", e.getMessage()); return Bytes.toArray(headerLst); } return Bytes.toArray(headerLst); }  int age(); void setAge(int age); int options(); void setOptions(int options); int lsType(); void setLsType(int lsType); String linkStateId(); void setLinkStateId(String linkStateId); Ip4Address advertisingRouter(); void setAdvertisingRouter(Ip4Address advertisingRouter); long lsSequenceNo(); void setLsSequenceNo(long lsSequenceNo); int lsCheckSum(); void setLsCheckSum(int lsCheckSum); int lsPacketLen(); void setLsPacketLen(int lsPacketLen); @Override OspfLsaType getOspfLsaType(); @Override OspfLsa lsaHeader(); byte[] getLsaHeaderAsByteArray(); void populateHeader(LsaHeader lsaHeader); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
LsaHeader implements OspfLsa { public byte[] getLsaHeaderAsByteArray() { List<Byte> headerLst = new ArrayList<>(); try { headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.age()))); headerLst.add((byte) this.options()); headerLst.add((byte) this.lsType()); headerLst.addAll(Bytes.asList(InetAddress.getByName(this.linkStateId()).getAddress())); headerLst.addAll(Bytes.asList(this.advertisingRouter().toOctets())); headerLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(this.lsSequenceNo()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsCheckSum()))); headerLst.addAll(Bytes.asList(OspfUtil.convertToTwoBytes(this.lsPacketLen()))); } catch (Exception e) { log.debug("Error::getLsaHeaderAsByteArray {}", e.getMessage()); return Bytes.toArray(headerLst); } return Bytes.toArray(headerLst); }  int age(); void setAge(int age); int options(); void setOptions(int options); int lsType(); void setLsType(int lsType); String linkStateId(); void setLinkStateId(String linkStateId); Ip4Address advertisingRouter(); void setAdvertisingRouter(Ip4Address advertisingRouter); long lsSequenceNo(); void setLsSequenceNo(long lsSequenceNo); int lsCheckSum(); void setLsCheckSum(int lsCheckSum); int lsPacketLen(); void setLsPacketLen(int lsPacketLen); @Override OspfLsaType getOspfLsaType(); @Override OspfLsa lsaHeader(); byte[] getLsaHeaderAsByteArray(); void populateHeader(LsaHeader lsaHeader); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }