@Test public void testReadFrom() throws Exception { channelBuffer = ChannelBuffers.copiedBuffer(internalReachability); reachability.readFrom(channelBuffer); assertThat(reachability, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); this.setDefaultMetric(metric); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); if (metricInBinary.charAt(1) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDefaultDistributionDown(true); } else { this.setDefaultDistributionDown(false); } byte delayMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(delayMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDelayMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setDelayIsInternal(true); } else { this.setDelayIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); } else { this.setDelayMetricSupported(false); } byte expenseMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(expenseMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setExpenseMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setExpenseIsInternal(true); } else { this.setExpenseIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setExpenseMetricSupported(true); } else { this.setExpenseMetricSupported(false); } byte errorMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(errorMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setErrorMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setErrorIsInternal(true); } else { this.setErrorIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setErrorMetricSupported(true); } else { this.setErrorMetricSupported(false); } byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setIpAddress(Ip4Address.valueOf(tempByteArray)); tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setSubnetAddres(Ip4Address.valueOf(tempByteArray)); }
MetricOfInternalReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); this.setDefaultMetric(metric); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); if (metricInBinary.charAt(1) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDefaultDistributionDown(true); } else { this.setDefaultDistributionDown(false); } byte delayMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(delayMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDelayMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setDelayIsInternal(true); } else { this.setDelayIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); } else { this.setDelayMetricSupported(false); } byte expenseMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(expenseMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setExpenseMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setExpenseIsInternal(true); } else { this.setExpenseIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setExpenseMetricSupported(true); } else { this.setExpenseMetricSupported(false); } byte errorMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(errorMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setErrorMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setErrorIsInternal(true); } else { this.setErrorIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setErrorMetricSupported(true); } else { this.setErrorMetricSupported(false); } byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setIpAddress(Ip4Address.valueOf(tempByteArray)); tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setSubnetAddres(Ip4Address.valueOf(tempByteArray)); } }
MetricOfInternalReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); this.setDefaultMetric(metric); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); if (metricInBinary.charAt(1) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDefaultDistributionDown(true); } else { this.setDefaultDistributionDown(false); } byte delayMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(delayMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDelayMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setDelayIsInternal(true); } else { this.setDelayIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); } else { this.setDelayMetricSupported(false); } byte expenseMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(expenseMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setExpenseMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setExpenseIsInternal(true); } else { this.setExpenseIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setExpenseMetricSupported(true); } else { this.setExpenseMetricSupported(false); } byte errorMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(errorMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setErrorMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setErrorIsInternal(true); } else { this.setErrorIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setErrorMetricSupported(true); } else { this.setErrorMetricSupported(false); } byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setIpAddress(Ip4Address.valueOf(tempByteArray)); tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setSubnetAddres(Ip4Address.valueOf(tempByteArray)); }  }
MetricOfInternalReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); this.setDefaultMetric(metric); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); if (metricInBinary.charAt(1) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDefaultDistributionDown(true); } else { this.setDefaultDistributionDown(false); } byte delayMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(delayMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDelayMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setDelayIsInternal(true); } else { this.setDelayIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); } else { this.setDelayMetricSupported(false); } byte expenseMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(expenseMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setExpenseMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setExpenseIsInternal(true); } else { this.setExpenseIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setExpenseMetricSupported(true); } else { this.setExpenseMetricSupported(false); } byte errorMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(errorMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setErrorMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setErrorIsInternal(true); } else { this.setErrorIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setErrorMetricSupported(true); } else { this.setErrorMetricSupported(false); } byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setIpAddress(Ip4Address.valueOf(tempByteArray)); tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setSubnetAddres(Ip4Address.valueOf(tempByteArray)); }  Ip4Address getIpAddress(); void setIpAddress(Ip4Address ipAddress); Ip4Address getSubnetAddres(); void setSubnetAddres(Ip4Address subnetAddres); boolean isErrorIsInternal(); void setErrorIsInternal(boolean errorIsInternal); boolean isExpenseIsInternal(); void setExpenseIsInternal(boolean expenseIsInternal); boolean isDelayIsInternal(); void setDelayIsInternal(boolean delayIsInternal); boolean isDefaultDistributionDown(); void setDefaultDistributionDown(boolean defaultDistributionDown); boolean isDefaultIsInternal(); void setDefaultIsInternal(boolean defaultIsInternal); boolean isErrorMetricSupported(); void setErrorMetricSupported(boolean errorMetricSupported); boolean isExpenseMetricSupported(); void setExpenseMetricSupported(boolean expenseMetricSupported); boolean isDelayMetricSupported(); void setDelayMetricSupported(boolean delayMetricSupported); byte errorMetric(); void setErrorMetric(byte errorMetric); byte expenseMetric(); void setExpenseMetric(byte expenseMetric); byte delayMetric(); void setDelayMetric(byte delayMetric); byte defaultMetric(); void setDefaultMetric(byte defaultMetric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); @Override String toString(); }
MetricOfInternalReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); this.setDefaultMetric(metric); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); if (metricInBinary.charAt(1) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDefaultDistributionDown(true); } else { this.setDefaultDistributionDown(false); } byte delayMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(delayMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDelayMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setDelayIsInternal(true); } else { this.setDelayIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); } else { this.setDelayMetricSupported(false); } byte expenseMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(expenseMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setExpenseMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setExpenseIsInternal(true); } else { this.setExpenseIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setExpenseMetricSupported(true); } else { this.setExpenseMetricSupported(false); } byte errorMetric = channelBuffer.readByte(); metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(errorMetric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setErrorMetric(Byte.parseByte(metricInBinary.substring(5, metricInBinary.length()), 2)); if (metricInBinary.charAt(1) == 0) { this.setErrorIsInternal(true); } else { this.setErrorIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setErrorMetricSupported(true); } else { this.setErrorMetricSupported(false); } byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setIpAddress(Ip4Address.valueOf(tempByteArray)); tempByteArray = new byte[IsisUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); this.setSubnetAddres(Ip4Address.valueOf(tempByteArray)); }  Ip4Address getIpAddress(); void setIpAddress(Ip4Address ipAddress); Ip4Address getSubnetAddres(); void setSubnetAddres(Ip4Address subnetAddres); boolean isErrorIsInternal(); void setErrorIsInternal(boolean errorIsInternal); boolean isExpenseIsInternal(); void setExpenseIsInternal(boolean expenseIsInternal); boolean isDelayIsInternal(); void setDelayIsInternal(boolean delayIsInternal); boolean isDefaultDistributionDown(); void setDefaultDistributionDown(boolean defaultDistributionDown); boolean isDefaultIsInternal(); void setDefaultIsInternal(boolean defaultIsInternal); boolean isErrorMetricSupported(); void setErrorMetricSupported(boolean errorMetricSupported); boolean isExpenseMetricSupported(); void setExpenseMetricSupported(boolean expenseMetricSupported); boolean isDelayMetricSupported(); void setDelayMetricSupported(boolean delayMetricSupported); byte errorMetric(); void setErrorMetric(byte errorMetric); byte expenseMetric(); void setExpenseMetric(byte expenseMetric); byte delayMetric(); void setDelayMetric(byte delayMetric); byte defaultMetric(); void setDefaultMetric(byte defaultMetric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); @Override String toString();  }