@Test public void testL1l2LsPduBody() throws Exception { channelBuffer = ChannelBuffers.copiedBuffer(l1Lsp); lsPdu.readFrom(channelBuffer); result = lsPdu.l1l2LsPduBody(); assertThat(result, is(notNullValue())); }
public byte[] l1l2LsPduBody() { List<Byte> bodyList = new ArrayList<>(); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.pduLength()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.remainingLifeTime()))); bodyList.addAll(IsisUtil.sourceAndLanIdToBytes(this.lspId())); bodyList.addAll(Bytes.asList(IsisUtil.convertToFourBytes(this.sequenceNumber()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.checkSum()))); String temString = ""; if (this.partitionRepair()) { temString = "1" + temString; } else { temString = "0" + temString; } switch (this.attachedToOtherAreas()) { case ERRORMETRIC: temString = temString + "1000"; break; case EXPENSEMETRIC: temString = temString + "0100"; break; case DELAYMETRIC: temString = temString + "0010"; break; case DEFAULTMETRIC: temString = temString + "0001"; break; case NONE: temString = temString + "0000"; break; default: break; } if (this.lspDbol()) { temString = temString + "1"; } else { temString = temString + "0"; } String isType = Integer.toBinaryString(this.intermediateSystemType()); if (isType.length() % 2 != 0) { isType = "0" + isType; } temString = temString + isType; bodyList.add((byte) Integer.parseInt(temString, 2)); for (IsisTlv isisTlv : variableLengths) { bodyList.addAll(TlvsToBytes.tlvToBytes(isisTlv)); } return Bytes.toArray(bodyList); }
LsPdu extends IsisHeader { public byte[] l1l2LsPduBody() { List<Byte> bodyList = new ArrayList<>(); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.pduLength()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.remainingLifeTime()))); bodyList.addAll(IsisUtil.sourceAndLanIdToBytes(this.lspId())); bodyList.addAll(Bytes.asList(IsisUtil.convertToFourBytes(this.sequenceNumber()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.checkSum()))); String temString = ""; if (this.partitionRepair()) { temString = "1" + temString; } else { temString = "0" + temString; } switch (this.attachedToOtherAreas()) { case ERRORMETRIC: temString = temString + "1000"; break; case EXPENSEMETRIC: temString = temString + "0100"; break; case DELAYMETRIC: temString = temString + "0010"; break; case DEFAULTMETRIC: temString = temString + "0001"; break; case NONE: temString = temString + "0000"; break; default: break; } if (this.lspDbol()) { temString = temString + "1"; } else { temString = temString + "0"; } String isType = Integer.toBinaryString(this.intermediateSystemType()); if (isType.length() % 2 != 0) { isType = "0" + isType; } temString = temString + isType; bodyList.add((byte) Integer.parseInt(temString, 2)); for (IsisTlv isisTlv : variableLengths) { bodyList.addAll(TlvsToBytes.tlvToBytes(isisTlv)); } return Bytes.toArray(bodyList); } }
LsPdu extends IsisHeader { public byte[] l1l2LsPduBody() { List<Byte> bodyList = new ArrayList<>(); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.pduLength()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.remainingLifeTime()))); bodyList.addAll(IsisUtil.sourceAndLanIdToBytes(this.lspId())); bodyList.addAll(Bytes.asList(IsisUtil.convertToFourBytes(this.sequenceNumber()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.checkSum()))); String temString = ""; if (this.partitionRepair()) { temString = "1" + temString; } else { temString = "0" + temString; } switch (this.attachedToOtherAreas()) { case ERRORMETRIC: temString = temString + "1000"; break; case EXPENSEMETRIC: temString = temString + "0100"; break; case DELAYMETRIC: temString = temString + "0010"; break; case DEFAULTMETRIC: temString = temString + "0001"; break; case NONE: temString = temString + "0000"; break; default: break; } if (this.lspDbol()) { temString = temString + "1"; } else { temString = temString + "0"; } String isType = Integer.toBinaryString(this.intermediateSystemType()); if (isType.length() % 2 != 0) { isType = "0" + isType; } temString = temString + isType; bodyList.add((byte) Integer.parseInt(temString, 2)); for (IsisTlv isisTlv : variableLengths) { bodyList.addAll(TlvsToBytes.tlvToBytes(isisTlv)); } return Bytes.toArray(bodyList); } LsPdu(IsisHeader isisHeader); }
LsPdu extends IsisHeader { public byte[] l1l2LsPduBody() { List<Byte> bodyList = new ArrayList<>(); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.pduLength()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.remainingLifeTime()))); bodyList.addAll(IsisUtil.sourceAndLanIdToBytes(this.lspId())); bodyList.addAll(Bytes.asList(IsisUtil.convertToFourBytes(this.sequenceNumber()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.checkSum()))); String temString = ""; if (this.partitionRepair()) { temString = "1" + temString; } else { temString = "0" + temString; } switch (this.attachedToOtherAreas()) { case ERRORMETRIC: temString = temString + "1000"; break; case EXPENSEMETRIC: temString = temString + "0100"; break; case DELAYMETRIC: temString = temString + "0010"; break; case DEFAULTMETRIC: temString = temString + "0001"; break; case NONE: temString = temString + "0000"; break; default: break; } if (this.lspDbol()) { temString = temString + "1"; } else { temString = temString + "0"; } String isType = Integer.toBinaryString(this.intermediateSystemType()); if (isType.length() % 2 != 0) { isType = "0" + isType; } temString = temString + isType; bodyList.add((byte) Integer.parseInt(temString, 2)); for (IsisTlv isisTlv : variableLengths) { bodyList.addAll(TlvsToBytes.tlvToBytes(isisTlv)); } return Bytes.toArray(bodyList); } LsPdu(IsisHeader isisHeader); List<IsisTlv> tlvs(); void addTlv(IsisTlv isisTlv); int remainingLifeTime(); void setRemainingLifeTime(int remainingLifeTime); boolean lspDbol(); void setLspDbol(boolean lspDbol); byte typeBlock(); void setTypeBlock(byte typeBlock); int sequenceNumber(); void setSequenceNumber(int sequenceNumber); int checkSum(); void setCheckSum(int checkSum); boolean partitionRepair(); void setPartitionRepair(boolean partitionRepair); AttachedToOtherAreas attachedToOtherAreas(); void setAttachedToOtherAreas(AttachedToOtherAreas attachedToOtherAreas); byte intermediateSystemType(); void setIntermediateSystemType(byte intermediateSystemType); String lspId(); void setLspId(String lspId); int pduLength(); void setPduLength(int pduLength); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] l1l2IsisPduHeader(); byte[] l1l2LsPduBody(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
LsPdu extends IsisHeader { public byte[] l1l2LsPduBody() { List<Byte> bodyList = new ArrayList<>(); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.pduLength()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.remainingLifeTime()))); bodyList.addAll(IsisUtil.sourceAndLanIdToBytes(this.lspId())); bodyList.addAll(Bytes.asList(IsisUtil.convertToFourBytes(this.sequenceNumber()))); bodyList.addAll(Bytes.asList(IsisUtil.convertToTwoBytes(this.checkSum()))); String temString = ""; if (this.partitionRepair()) { temString = "1" + temString; } else { temString = "0" + temString; } switch (this.attachedToOtherAreas()) { case ERRORMETRIC: temString = temString + "1000"; break; case EXPENSEMETRIC: temString = temString + "0100"; break; case DELAYMETRIC: temString = temString + "0010"; break; case DEFAULTMETRIC: temString = temString + "0001"; break; case NONE: temString = temString + "0000"; break; default: break; } if (this.lspDbol()) { temString = temString + "1"; } else { temString = temString + "0"; } String isType = Integer.toBinaryString(this.intermediateSystemType()); if (isType.length() % 2 != 0) { isType = "0" + isType; } temString = temString + isType; bodyList.add((byte) Integer.parseInt(temString, 2)); for (IsisTlv isisTlv : variableLengths) { bodyList.addAll(TlvsToBytes.tlvToBytes(isisTlv)); } return Bytes.toArray(bodyList); } LsPdu(IsisHeader isisHeader); List<IsisTlv> tlvs(); void addTlv(IsisTlv isisTlv); int remainingLifeTime(); void setRemainingLifeTime(int remainingLifeTime); boolean lspDbol(); void setLspDbol(boolean lspDbol); byte typeBlock(); void setTypeBlock(byte typeBlock); int sequenceNumber(); void setSequenceNumber(int sequenceNumber); int checkSum(); void setCheckSum(int checkSum); boolean partitionRepair(); void setPartitionRepair(boolean partitionRepair); AttachedToOtherAreas attachedToOtherAreas(); void setAttachedToOtherAreas(AttachedToOtherAreas attachedToOtherAreas); byte intermediateSystemType(); void setIntermediateSystemType(byte intermediateSystemType); String lspId(); void setLspId(String lspId); int pduLength(); void setPduLength(int pduLength); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] l1l2IsisPduHeader(); byte[] l1l2LsPduBody(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }