*/
package org.opendaylight.protocol.pcep.impl.subobject;
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.IPv4Address;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.concepts.UnnumberedInterfaceIdentifier;
import org.opendaylight.protocol.pcep.subobject.ExcludeRouteSubobject;
import org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject;
-import com.google.common.primitives.UnsignedInts;
+import org.opendaylight.protocol.util.ByteArray;
/**
- * Parser for
- * {@link org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject
+ * Parser for {@link org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject
* XROUnnumberedInterfaceSubobject}
*/
public class XROUnnumberedInterfaceSubobjectParser {
public static final int CONTENT_LENGTH = INTERFACE_ID_NUMBER_OFFSET + INTERFACE_ID_NUMBER_LENGTH;
- public static XROUnnumberedInterfaceSubobject parse(byte[] soContentsBytes, boolean mandatory) throws PCEPDeserializerException {
+ public static XROUnnumberedInterfaceSubobject parse(final byte[] soContentsBytes, final boolean mandatory)
+ throws PCEPDeserializerException {
if (soContentsBytes == null || soContentsBytes.length == 0)
throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
if (soContentsBytes.length != CONTENT_LENGTH)
- throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: " + CONTENT_LENGTH + ".");
+ throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: "
+ + CONTENT_LENGTH + ".");
- return new XROUnnumberedInterfaceSubobject(new IPv4Address(
- ByteArray.subByte(soContentsBytes, ROUTER_ID_NUMBER_OFFSET, ROUTER_ID_NUMBER_LENGTH)), new UnnumberedInterfaceIdentifier(
- UnsignedInts.toLong(ByteArray.bytesToInt(ByteArray.subByte(soContentsBytes, INTERFACE_ID_NUMBER_OFFSET, INTERFACE_ID_NUMBER_LENGTH)))),
- mandatory, XROSubobjectAttributeMapping.getInstance().getFromAttributeIdentifier((short) (soContentsBytes[ATTRIBUTE_OFFSET] & 0xFF)));
+ // return new XROUnnumberedInterfaceSubobject(new IPv4Address(
+ // ByteArray.subByte(soContentsBytes, ROUTER_ID_NUMBER_OFFSET, ROUTER_ID_NUMBER_LENGTH)), new
+ // UnnumberedInterfaceIdentifier(
+ // UnsignedInts.toLong(ByteArray.bytesToInt(ByteArray.subByte(soContentsBytes, INTERFACE_ID_NUMBER_OFFSET,
+ // INTERFACE_ID_NUMBER_LENGTH)))),
+ // mandatory, XROSubobjectAttributeMapping.getInstance().getFromAttributeIdentifier((short)
+ // (soContentsBytes[ATTRIBUTE_OFFSET] & 0xFF)));
+ return null;
}
- public static byte[] put(ExcludeRouteSubobject objToSerialize) {
+ public static byte[] put(final ExcludeRouteSubobject objToSerialize) {
if (!(objToSerialize instanceof XROUnnumberedInterfaceSubobject))
throw new IllegalArgumentException("Unknown PCEPXROSubobject instance. Passed " + objToSerialize.getClass()
+ ". Needed XROUnnumberedInterfaceSubobject.");
retBytes[ATTRIBUTE_OFFSET] = (byte) XROSubobjectAttributeMapping.getInstance().getFromAttributeEnum(specObj.getAttribute());
ByteArray.copyWhole(specObj.getRouterID().getAddress(), retBytes, ROUTER_ID_NUMBER_OFFSET);
- System.arraycopy(ByteArray.longToBytes(specObj.getInterfaceID().getInterfaceId()), Long.SIZE / Byte.SIZE - INTERFACE_ID_NUMBER_LENGTH, retBytes,
- INTERFACE_ID_NUMBER_OFFSET, INTERFACE_ID_NUMBER_LENGTH);
+ System.arraycopy(ByteArray.longToBytes(specObj.getInterfaceID().getInterfaceId()), Long.SIZE / Byte.SIZE
+ - INTERFACE_ID_NUMBER_LENGTH, retBytes, INTERFACE_ID_NUMBER_OFFSET, INTERFACE_ID_NUMBER_LENGTH);
return retBytes;
}