BUG-47 : unfinished PCEP migration to generated DTOs.
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / subobject / EROUnnumberedInterfaceSubobjectParser.java
index 81dfec0e21865e63822af99f654fabb67f5c5c4f..64ce60b086547d88242b2e2c17be71db5ffb9d28 100644 (file)
@@ -7,17 +7,13 @@
  */
 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.EROUnnumberedInterfaceSubobject;
 import org.opendaylight.protocol.pcep.subobject.ExplicitRouteSubobject;
-import com.google.common.primitives.UnsignedInts;
+import org.opendaylight.protocol.util.ByteArray;
 
 /**
- * Parser for
- * {@link org.opendaylight.protocol.pcep.subobject.EROUnnumberedInterfaceSubobject
+ * Parser for {@link org.opendaylight.protocol.pcep.subobject.EROUnnumberedInterfaceSubobject
  * EROUnnumberedInterfaceSubobject}
  */
 public class EROUnnumberedInterfaceSubobjectParser {
@@ -29,17 +25,21 @@ public class EROUnnumberedInterfaceSubobjectParser {
 
        public static final int CONTENT_LENGTH = INTERFACE_ID_NUMBER_OFFSET + INTERFACE_ID_NUMBER_LENGTH;
 
-       public static EROUnnumberedInterfaceSubobject parse(byte[] soContentsBytes, boolean loose) throws PCEPDeserializerException {
+       public static EROUnnumberedInterfaceSubobject parse(final byte[] soContentsBytes, final boolean loose) 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 + ".");
-
-               return new EROUnnumberedInterfaceSubobject(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)))), loose);
+                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: "
+                                       + CONTENT_LENGTH + ".");
+
+               // return new EROUnnumberedInterfaceSubobject(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)))), loose);
+               return null;
        }
 
-       public static byte[] put(ExplicitRouteSubobject objToSerialize) {
+       public static byte[] put(final ExplicitRouteSubobject objToSerialize) {
                if (!(objToSerialize instanceof EROUnnumberedInterfaceSubobject))
                        throw new IllegalArgumentException("Unknown ExplicitRouteSubobject instance. Passed " + objToSerialize.getClass()
                                        + ". Needed EROUnnumberedInterfaceSubobject.");
@@ -49,8 +49,8 @@ public class EROUnnumberedInterfaceSubobjectParser {
                final EROUnnumberedInterfaceSubobject specObj = (EROUnnumberedInterfaceSubobject) objToSerialize;
 
                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;
        }