[ONOS-2602] use of Constants variables

Change-Id: I22dd05c5b5c1ac99edce106ab43b00e4b333c177
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/As4Path.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/As4Path.java
index 90e94e8..e9df399 100644
--- a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/As4Path.java
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/As4Path.java
@@ -21,6 +21,7 @@
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.util.Constants;
 import org.onosproject.bgpio.util.Validation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,8 +35,6 @@
     private static final Logger log = LoggerFactory.getLogger(AsPath.class);
     public static final byte AS4PATH_TYPE = 17;
     public static final byte ASNUM_SIZE = 4;
-    public static final int TYPE_AND_LEN_AS_SHORT = 4;
-    public static final int TYPE_AND_LEN_AS_BYTE = 3;
 
     private List<Integer> as4pathSet;
     private List<Integer> as4pathSeq;
@@ -77,8 +76,8 @@
                     validation.getLength());
         }
         //if fourth bit is set length is read as short otherwise as byte , len includes type, length and value
-        int len = validation.isShort() ? validation.getLength() + TYPE_AND_LEN_AS_SHORT : validation
-                .getLength() + TYPE_AND_LEN_AS_BYTE;
+        int len = validation.isShort() ? validation.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : validation
+                .getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
         ChannelBuffer data = tempCb.readBytes(len);
         if (validation.getFirstBit() && !validation.getSecondBit() && validation.getThirdBit()) {
             throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AsPath.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AsPath.java
index 100e14d..e3eb2c5 100644
--- a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AsPath.java
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AsPath.java
@@ -22,6 +22,7 @@
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.util.Constants;
 import org.onosproject.bgpio.util.Validation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,7 +54,7 @@
          *
          * @return AS type
          */
-        public byte getType() {
+        public byte type() {
             return (byte) value;
         }
     }
@@ -63,8 +64,6 @@
     public static final byte ASPATH_SET_TYPE = 1;
     public static final byte ASPATH_SEQ_TYPE = 2;
     public static final byte ASNUM_SIZE = 2;
-    public static final int TYPE_AND_LEN_AS_SHORT = 4;
-    public static final int TYPE_AND_LEN_AS_BYTE = 3;
 
     private boolean isAsPath = false;
     private List<Short> aspathSet;
@@ -108,8 +107,8 @@
                     validation.getLength());
         }
         //if fourth bit is set, length is read as short otherwise as byte , len includes type, length and value
-        int len = validation.isShort() ? validation.getLength() + TYPE_AND_LEN_AS_SHORT : validation
-                .getLength() + TYPE_AND_LEN_AS_BYTE;
+        int len = validation.isShort() ? validation.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : validation
+                .getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
         ChannelBuffer data = tempCb.readBytes(len);
         if (validation.getFirstBit() && !validation.getSecondBit() && validation.getThirdBit()) {
             throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/LocalPref.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/LocalPref.java
index 048d81e..0f78ab7 100644
--- a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/LocalPref.java
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/LocalPref.java
@@ -19,9 +19,8 @@
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.util.Constants;
 import org.onosproject.bgpio.util.Validation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.base.MoreObjects;
 
@@ -29,11 +28,7 @@
  * Provides implementation of LocalPref BGP Path Attribute.
  */
 public class LocalPref implements BGPValueType {
-
-    private static final Logger log = LoggerFactory.getLogger(LocalPref.class);
     public static final byte LOCAL_PREF_TYPE = 5;
-    public static final int TYPE_AND_LEN_AS_SHORT = 4;
-    public static final int TYPE_AND_LEN_AS_BYTE = 3;
     public static final byte LOCAL_PREF_MAX_LEN = 4;
 
     private int localPref;
@@ -72,8 +67,8 @@
                     parseFlags.getLength());
         }
 
-        int len = parseFlags.isShort() ? parseFlags.getLength() + TYPE_AND_LEN_AS_SHORT : parseFlags.getLength()
-                + TYPE_AND_LEN_AS_BYTE;
+        int len = parseFlags.isShort() ? parseFlags.getLength() +
+                  Constants.TYPE_AND_LEN_AS_SHORT : parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
         ChannelBuffer data = tempCb.readBytes(len);
         if (parseFlags.getFirstBit()) {
             throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/Med.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/Med.java
index 49e1fc5..23402c2 100644
--- a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/Med.java
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/Med.java
@@ -19,9 +19,8 @@
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.util.Constants;
 import org.onosproject.bgpio.util.Validation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.base.MoreObjects;
 
@@ -29,10 +28,7 @@
  * Provides Implementation of Med BGP Path Attribute.
  */
 public class Med implements BGPValueType {
-    private static final Logger log = LoggerFactory.getLogger(Med.class);
     public static final byte MED_TYPE = 4;
-    public static final int TYPE_AND_LEN_AS_SHORT = 4;
-    public static final int TYPE_AND_LEN_AS_BYTE = 3;
     public static final byte MED_MAX_LEN = 4;
 
     private int med;
@@ -71,8 +67,8 @@
             Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
                     parseFlags.getLength());
         }
-        int len = parseFlags.isShort() ? parseFlags.getLength() + TYPE_AND_LEN_AS_SHORT : parseFlags
-                .getLength() + TYPE_AND_LEN_AS_BYTE;
+        int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : parseFlags
+                .getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
         ChannelBuffer data = tempCb.readBytes(len);
         if (!parseFlags.getFirstBit() && parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
             throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);