@Test(expected = Exception.class) public void testGetLsaBodyAsByteArray() throws Exception { networkLsa.addAttachedRouter(Ip4Address.valueOf("1.1.1.1")); networkLsa.addAttachedRouter(Ip4Address.valueOf("2.2.2.2")); networkLsa.addAttachedRouter(Ip4Address.valueOf("3.3.3.3")); result1 = networkLsa.getLsaBodyAsByteArray(); assertThat(result1, is(notNullValue())); }
public byte[] getLsaBodyAsByteArray() throws OspfParseException { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); for (Ip4Address attachedRouter : attachedRouters) { bodyLst.addAll(Bytes.asList(attachedRouter.toOctets())); } } catch (Exception e) { log.debug("Error::NetworkLSA::getLsrBodyAsByteArray {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } return Bytes.toArray(bodyLst); }
NetworkLsa extends LsaHeader { public byte[] getLsaBodyAsByteArray() throws OspfParseException { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); for (Ip4Address attachedRouter : attachedRouters) { bodyLst.addAll(Bytes.asList(attachedRouter.toOctets())); } } catch (Exception e) { log.debug("Error::NetworkLSA::getLsrBodyAsByteArray {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } return Bytes.toArray(bodyLst); } }
NetworkLsa extends LsaHeader { public byte[] getLsaBodyAsByteArray() throws OspfParseException { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); for (Ip4Address attachedRouter : attachedRouters) { bodyLst.addAll(Bytes.asList(attachedRouter.toOctets())); } } catch (Exception e) { log.debug("Error::NetworkLSA::getLsrBodyAsByteArray {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } return Bytes.toArray(bodyLst); } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); }
NetworkLsa extends LsaHeader { public byte[] getLsaBodyAsByteArray() throws OspfParseException { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); for (Ip4Address attachedRouter : attachedRouters) { bodyLst.addAll(Bytes.asList(attachedRouter.toOctets())); } } catch (Exception e) { log.debug("Error::NetworkLSA::getLsrBodyAsByteArray {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } return Bytes.toArray(bodyLst); } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); void addAttachedRouter(Ip4Address attachedRouter); List<Ip4Address> attachedRouters(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
NetworkLsa extends LsaHeader { public byte[] getLsaBodyAsByteArray() throws OspfParseException { List<Byte> bodyLst = new ArrayList<>(); try { bodyLst.addAll(Bytes.asList(this.networkMask().toOctets())); for (Ip4Address attachedRouter : attachedRouters) { bodyLst.addAll(Bytes.asList(attachedRouter.toOctets())); } } catch (Exception e) { log.debug("Error::NetworkLSA::getLsrBodyAsByteArray {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } return Bytes.toArray(bodyLst); } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); void addAttachedRouter(Ip4Address attachedRouter); List<Ip4Address> attachedRouters(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }