@Test(expected = Exception.class) public void testGetLsaBodyAsByteArray() throws Exception { opqueHeader = new OpaqueLsaHeader(); opqueHeader.setLsType(10); opqueHeader.setLsPacketLen(48); opqueHeader.setLsCheckSum(10); opqueHeader.setAge(4); opqueHeader.setOpaqueId(1); opqueHeader.setOpaqueType(10); opqueHeader.setLsSequenceNo(250); opqueHeader.setAdvertisingRouter(Ip4Address.valueOf("100.226.165.165")); opqueHeader.setOptions(2); opaqueLsa10 = new OpaqueLsa10(opqueHeader); routerTlv = new RouterTlv(new TlvHeader()); linkTlv = new LinkTlv(new TlvHeader()); opaqueLsa10.addValue(routerTlv); opaqueLsa10.addValue(linkTlv); routerTlv1 = new RouterTlv(new TlvHeader()); linkTlv1 = new LinkTlv(new TlvHeader()); opaqueLsa10.addValue(routerTlv1); opaqueLsa10.addValue(linkTlv1); channelBuffer = ChannelBuffers.copiedBuffer(packet); opaqueLsa10.readFrom(channelBuffer); result = opaqueLsa10.getLsaBodyAsByteArray(); assertThat(result, is(notNullValue())); }
public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); }
OpaqueLsa10 extends OpaqueLsaHeader { public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); } }
OpaqueLsa10 extends OpaqueLsaHeader { public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); } OpaqueLsa10(OpaqueLsaHeader lsaHeader); }
OpaqueLsa10 extends OpaqueLsaHeader { public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); } OpaqueLsa10(OpaqueLsaHeader lsaHeader); List<TopLevelTlv> topLevelValues(); void addValue(TopLevelTlv value); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override OspfLsaType getOspfLsaType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
OpaqueLsa10 extends OpaqueLsaHeader { public byte[] getLsaBodyAsByteArray() throws Exception { List<Byte> bodyLst = new ArrayList<>(); if (this.opaqueId() == 1) { for (TopLevelTlv tlv : this.topLevelValues) { if (tlv instanceof RouterTlv) { RouterTlv routerTlv = (RouterTlv) tlv; bodyLst.addAll(Bytes.asList(routerTlv.asBytes())); } else if (tlv instanceof LinkTlv) { LinkTlv linkTlv = (LinkTlv) tlv; bodyLst.addAll(Bytes.asList(linkTlv.asBytes())); } } } else { return opaqueInfo; } return Bytes.toArray(bodyLst); } OpaqueLsa10(OpaqueLsaHeader lsaHeader); List<TopLevelTlv> topLevelValues(); void addValue(TopLevelTlv value); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override OspfLsaType getOspfLsaType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }