BUG-47 : unfinished PCEP migration to generated DTOs.
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / subobject / XROUnnumberedInterfaceSubobjectParser.java
index 9b7f40094d16853d4ceee2f0a8a7a32698cc7738..9d3c84fbe79afbd59e7f746d5b62a131e4f00955 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.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 {
@@ -31,19 +27,25 @@ 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.");
@@ -54,8 +56,8 @@ public class XROUnnumberedInterfaceSubobjectParser {
 
                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;
        }