Improve the resiliency of the packet deserialization code.

Packet deserializers now check for malformed input while reading the byte
stream. Deserializers are re-implemented as functions that take a byte array
and return a packet object. The old IPacket.deserialize(...) methods have been
deprecated with the goal of eventually moving to immutable packet objects.
Unit tests have been implemented for all Deserializer functions.

ONOS-1589

Change-Id: I9073d5e6e7991e15d43830cfd810989256b71c56
diff --git a/utils/misc/src/main/java/org/onlab/packet/IPacket.java b/utils/misc/src/main/java/org/onlab/packet/IPacket.java
index ac6ae60..38684eb 100644
--- a/utils/misc/src/main/java/org/onlab/packet/IPacket.java
+++ b/utils/misc/src/main/java/org/onlab/packet/IPacket.java
@@ -64,6 +64,11 @@
     /**
      * Deserializes this packet layer and all possible payloads.
      *
+     * NOTE: This method has been deprecated and will be removed in a future
+     * release. It is now recommended to use the Deserializer function provided
+     * by the deserialize() method on each packet to deserialize them. The
+     * Deserializer functions are robust to malformed input.
+     *
      * @param data bytes to deserialize
      * @param offset
      *            offset to start deserializing from
@@ -71,6 +76,7 @@
      *            length of the data to deserialize
      * @return the deserialized data
      */
+    @Deprecated
     IPacket deserialize(byte[] data, int offset, int length);
 
     /**