[ONOS-4348] Yang Bits, Binary and Decimal64

Change-Id: I8e4e54a19a8f9634cbc56a07579a1730174f53f6
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java
index cece4ad..7be4fc1 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/BuiltInTypeObjectFactory.java
@@ -1,5 +1,5 @@
 /*-
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
 package org.onosproject.yangutils.datamodel;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import org.onosproject.yangutils.datamodel.utils.builtindatatype.DataTypeException;
 import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
 import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
@@ -78,11 +79,12 @@
             case UINT64: {
                 return (T) new YangUint64(valueInStr);
             }
+            case DECIMAL64: {
+                return (T) new YangDecimal64(new BigDecimal(valueInStr));
+            }
             default: {
                 throw new DataTypeException("YANG file error : Unsupported data type");
             }
         }
-
     }
-
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java
new file mode 100644
index 0000000..a43e9cd
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBinary.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import java.io.Serializable;
+import java.util.Base64;
+
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
+
+/*
+ * Reference RFC 6020.
+ *
+ * The binary built-in type represents any binary data,
+ * i.e., a sequence of octets.
+ */
+public class YangBinary implements YangBuiltInDataTypeInfo<YangBinary>, Serializable, Comparable<YangBinary> {
+
+    private static final long serialVersionUID = 2106201608L;
+
+    // Binary data is a decoded value by base64 decoding scheme from data input (jason)
+    private byte[] binaryData;
+
+    /**
+     * Creates a binary object corresponding to the base 64 encoding value.
+     *
+     * @param strValue base64 encoded value
+     */
+    public YangBinary(String strValue) {
+        setBinaryData(Base64.getDecoder().decode(strValue));
+    }
+
+    /**
+     * Retrieves decoded binary data.
+     *
+     * @return binary data
+     */
+    public byte[] getBinaryData() {
+        return binaryData;
+    }
+
+    /**
+     * Sets binary data.
+     *
+     * @param binaryData binary data
+     */
+    public void setBinaryData(byte[] binaryData) {
+        this.binaryData = binaryData;
+    }
+
+    /**
+     * Encodes binary data by base64 encoding scheme.
+     *
+     * @return encoded binary data
+     */
+    public String toString() {
+        return Base64.getEncoder()
+                     .encodeToString(binaryData);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.BINARY;
+    }
+
+    @Override
+    public int compareTo(YangBinary o) {
+        for (int i = 0, j = 0; i < this.binaryData.length && j < o.binaryData.length; i++, j++) {
+            int a = (this.binaryData[i] & 0xff);
+            int b = (o.binaryData[j] & 0xff);
+            if (a != b) {
+                return a - b;
+            }
+        }
+        return this.binaryData.length - o.binaryData.length;
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
index 84076dd..b0810e9 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
@@ -17,8 +17,10 @@
 package org.onosproject.yangutils.datamodel;
 
 import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
@@ -38,36 +40,142 @@
 public class YangBits implements Parsable, Serializable {
 
     private static final long serialVersionUID = 806201641L;
+    private static final String SPACE = " ";
 
-    // Bits information set.
-    private Set<YangBit> bitSet;
-
-    // BITS name.
+    // Bits name
     private String bitsName;
+    // Bits data contains bit-positions will be used to send to ONOS application
+    private BitSet bitDataSet;
+    /**
+     * Mapping bit name to YangBit. In data input (jason), only bit name will be received.
+     * By using the bit name corresponding (yang) bit-position will be retrieved from bitNameMap map.
+     */
+    private Map<String, YangBit> bitNameMap;
+    /**
+     * Mapping bit position to YangBit. The bit-position received from ONOS application
+     * will be converted into bit-name by using bitPositionMap map to send (jason) output data as response.
+     */
+    private Map<Integer, YangBit> bitPositionMap;
 
     /**
      * Creates a YANG bits type object.
      */
     public YangBits() {
-        setBitSet(new HashSet<YangBit>());
+        bitDataSet = new BitSet();
+        setBitNameMap(new HashMap<>());
+        setBitPositionMap(new HashMap<>());
     }
 
     /**
-     * Returns the bit set.
+     * Creates an instance of YANG bits.
      *
-     * @return the bit set
+     * @param bits set of bit names
+     * @throws DataModelException due to violation in data model rules
      */
-    public Set<YangBit> getBitSet() {
-        return bitSet;
+    public YangBits(String bits) throws DataModelException {
+        String[] bitNames = bits.trim().split(Pattern.quote(SPACE));
+        setBitDataSet(bitNames);
     }
 
     /**
-     * Sets the bit set.
+     * Returns the bits name.
      *
-     * @param bitSet the bit set
+     * @return the bits name
      */
-    private void setBitSet(Set<YangBit> bitSet) {
-        this.bitSet = bitSet;
+    public String getBitsName() {
+        return bitsName;
+    }
+
+    /**
+     * Sets the bits name.
+     *
+     * @param bitsName the bits name
+     */
+    public void setBitsName(String bitsName) {
+        this.bitsName = bitsName;
+    }
+
+    /**
+     * Returns the bit data set.
+     *
+     * @return the bit data set
+     */
+    public BitSet getBitDataSet() {
+        return bitDataSet;
+    }
+
+    /**
+     * Sets the bit data set.
+     *
+     * @param bitNames the set of bit names
+     * @throws DataModelException due to violation in data model rules
+     */
+    public void setBitDataSet(String[] bitNames) throws DataModelException {
+        YangBit bit;
+        for (String bitName : bitNames) {
+            bit = bitNameMap.get(bitName);
+            if (bit == null) {
+                throw new DataModelException("YANG file error: Unable to find " +
+                                                     "corresponding bit position for bit name: " + bitName);
+            }
+            bitDataSet.set(bit.getPosition());
+        }
+    }
+
+    /**
+     * Returns the bit name map.
+     *
+     * @return the bit name map
+     */
+    public Map<String, YangBit> getBitNameMap() {
+        return bitNameMap;
+    }
+
+    /**
+     * Sets the bit name map.
+     *
+     * @param bitNameMap the bit name map
+     */
+    public void setBitNameMap(Map<String, YangBit> bitNameMap) {
+        this.bitNameMap = bitNameMap;
+    }
+
+    /**
+     * Checks whether bit name already available.
+     *
+     * @param bitName bit name
+     * @return true if bit name already available otherwise returns false
+     */
+    public boolean isBitNameExists(String bitName) {
+        return bitNameMap.containsKey(bitName);
+    }
+
+    /**
+     * Returns the bit position map.
+     *
+     * @return the bit position map
+     */
+    public Map<Integer, YangBit> getBitPositionMap() {
+        return bitPositionMap;
+    }
+
+    /**
+     * Sets the bit position map.
+     *
+     * @param bitPositionMap the bit position map
+     */
+    public void setBitPositionMap(Map<Integer, YangBit> bitPositionMap) {
+        this.bitPositionMap = bitPositionMap;
+    }
+
+    /**
+     * Checks whether bit position already available.
+     *
+     * @param bitPosition bit position
+     * @return true if bit position already available otherwise returns false
+     */
+    public boolean isBitPositionExists(Integer bitPosition) {
+        return bitPositionMap.containsKey(bitPosition);
     }
 
     /**
@@ -77,9 +185,13 @@
      * @throws DataModelException due to violation in data model rules
      */
     public void addBitInfo(YangBit bitInfo) throws DataModelException {
-        if (!getBitSet().add(bitInfo)) {
-            throw new DataModelException("YANG file error: Duplicate identifier detected, same as bit \""
-                    + bitInfo.getBitName() + "\"");
+        if (bitNameMap.put(bitInfo.getBitName(), bitInfo) != null) {
+            throw new DataModelException("YANG file error: Duplicate bit name detected, same as bit name \""
+                                                 + bitInfo.getBitName() + "\"");
+        }
+        if (bitPositionMap.put(bitInfo.getPosition(), bitInfo) != null) {
+            throw new DataModelException("YANG file error: Duplicate bit position detected, same as bit position \""
+                    + bitInfo.getPosition() + "\"");
         }
     }
 
@@ -93,22 +205,36 @@
         return YangConstructType.BITS_DATA;
     }
 
-    /**
-     * Returns the bits name.
-     *
-     * @return name of the bits
-     */
-    public String getBitsName() {
-        return bitsName;
+    @Override
+    public String toString() {
+        YangBit bit;
+        String bits = new String();
+        for (int i = bitDataSet.nextSetBit(0); i >= 0; i = bitDataSet.nextSetBit(i + 1)) {
+            bit = bitPositionMap.get(i);
+            if (bit == null) {
+                return null;
+            }
+            if (bits.isEmpty()) {
+                bits =  bit.getBitName();
+            } else {
+                bits += " " + bit.getBitName();
+            }
+        }
+        return bits.trim();
     }
 
     /**
-     * Sets bits name.
+     * Returns the object of YANG bits based on specific set of bit names.
      *
-     * @param bitsName bit name to be set
+     * @param bits set of bit names
+     * @return Object of YANG bits
      */
-    public void setBitsName(String bitsName) {
-        this.bitsName = bitsName;
+    public static YangBits fromString(String bits) {
+        try {
+            return new YangBits(bits);
+        } catch (Exception e) {
+        }
+        return null;
     }
 
     /**
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java
new file mode 100644
index 0000000..2b19f10
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDecimal64.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.datamodel.utils.FractionDigits;
+import org.onosproject.yangutils.datamodel.utils.Parsable;
+import org.onosproject.yangutils.datamodel.utils.YangConstructType;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangBuiltInDataTypeInfo;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ListIterator;
+
+/**
+ * Represents YANG decimal 64.
+ */
+public class YangDecimal64<T>
+        implements YangBuiltInDataTypeInfo<YangDecimal64>, Parsable, Serializable, Comparable<YangDecimal64> {
+
+    private static final long serialVersionUID = 8006201668L;
+
+    /**
+     * YANG's min keyword.
+     */
+    private static final String MIN_KEYWORD = "min";
+
+    /**
+     * YANG's max keyword.
+     */
+    private static final String MAX_KEYWORD = "max";
+
+    /**
+     * Valid minimum value of YANG's fraction-digits.
+     */
+    public static final int MIN_FRACTION_DIGITS_VALUE = 1;
+
+    /**
+     * Valid maximum value of YANG's fraction-digits.
+     */
+    public static final int MAX_FRACTION_DIGITS_VALUE = 18;
+
+    // Decimal64 value
+    private BigDecimal value;
+
+    // fraction-digits
+    private int fractionDigit;
+
+    /**
+     * Additional information about range restriction.
+     */
+    private T rangeRestrictedExtendedInfo;
+
+    /**
+     * Creates an instance of YANG decimal64.
+     */
+    public YangDecimal64() {
+    }
+
+    /**
+     * Creates an instance of YANG decimal64.
+     *
+     * @param value of decimal64
+     */
+    public YangDecimal64(BigDecimal value) {
+        setValue(value);
+    }
+
+    /**
+     * Creates an instance of YANG decimal64.
+     *
+     * @param value of decimal64 in string
+     * @throws DataModelException a violation of data model rules
+     */
+    public YangDecimal64(String value) throws DataModelException {
+        fromString(value);
+    }
+
+    /**
+     * Returns decimal64 value.
+     *
+     * @return value
+     */
+    public BigDecimal getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the decimal64 value.
+     *
+     * @param value of decimal64
+     */
+    public void setValue(BigDecimal value) {
+        this.value = value;
+    }
+
+    /**
+     * Returns fraction digit.
+     *
+     * @return the fractionDigit
+     */
+    public int getFractionDigit() {
+        return fractionDigit;
+    }
+
+    /**
+     * Sets fraction digit.
+     *
+     * @param fractionDigit fraction digits.
+     */
+    public void setFractionDigit(int fractionDigit) {
+        this.fractionDigit = fractionDigit;
+    }
+
+    /**
+     * Returns additional information about range restriction.
+     *
+     * @return resolved range restricted extended information
+     */
+    public T getRangeRestrictedExtendedInfo() {
+        return rangeRestrictedExtendedInfo;
+    }
+
+    /**
+     * Sets additional information about range restriction.
+     *
+     * @param resolvedExtendedInfo resolved range restricted extended information
+     */
+    public void setRangeRestrictedExtendedInfo(T resolvedExtendedInfo) {
+        this.rangeRestrictedExtendedInfo = resolvedExtendedInfo;
+    }
+
+    /**
+     * Returns object of YANG decimal64.
+     *
+     * @param value of decimal64
+     * @return YANG decimal64 object
+     */
+    public static YangDecimal64 of(BigDecimal value) {
+        return new YangDecimal64(value);
+    }
+
+    @Override
+    public YangDataTypes getYangType() {
+        return YangDataTypes.DECIMAL64;
+    }
+
+    @Override
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.DECIMAL64_DATA;
+    }
+
+    @Override
+    public String toString() {
+        return value.toString();
+    }
+
+    /**
+     * Returns the object of YANG decimal64 from input string.
+     *
+     * @param valInString input String
+     * @return Object of YANG decimal64
+     * @throws DataModelException a violation of data model rules
+     */
+    public static YangDecimal64 fromString(String valInString) throws DataModelException {
+        YangDecimal64 decimal64;
+        decimal64 = of(new BigDecimal(valInString));
+        decimal64.validateValue();
+        return decimal64;
+    }
+
+    /**
+     * Validate decimal64 value.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    public void validateValue() throws DataModelException {
+        if (!(FractionDigits.isValidDecimal64(this.value, this.fractionDigit))) {
+            throw new DataModelException("YANG file error : decimal64 validation failed.");
+        }
+    }
+
+    /**
+     * Validate range restriction values based on fraction-digits decimal64 range value.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    public void validateRange() throws DataModelException {
+        YangRangeRestriction rangeRestriction = (YangRangeRestriction) getRangeRestrictedExtendedInfo();
+        if (rangeRestriction == null) {
+            return;
+        }
+
+        ListIterator<YangRangeInterval> rangeListIterator = rangeRestriction.getAscendingRangeIntervals()
+                .listIterator();
+        while (rangeListIterator.hasNext()) {
+            YangRangeInterval rangeInterval = rangeListIterator.next();
+            if (!(FractionDigits.isValidDecimal64(((YangDecimal64) rangeInterval.getStartValue()).getValue(),
+                                                  getFractionDigit()))) {
+                throw new DataModelException("YANG file error : decimal64 validation failed.");
+            }
+
+            if (!(FractionDigits.isValidDecimal64(((YangDecimal64) rangeInterval.getEndValue()).getValue(),
+                                                  getFractionDigit()))) {
+                throw new DataModelException("YANG file error : decimal64 validation failed.");
+            }
+        }
+    }
+
+    @Override
+    public int compareTo(YangDecimal64 o) {
+        return Double.compare(value.doubleValue(), o.value.doubleValue());
+    }
+
+    /**
+     * Returns decimal64 default range restriction based on fraction-digits.
+     * If range restriction is not provided then this default range value will be applicable.
+     *
+     * @return range restriction
+     * @throws DataModelException a violation of data model rules
+     */
+    public YangRangeRestriction getDefaultRangeRestriction() throws DataModelException {
+        YangRangeRestriction refRangeRestriction = new YangRangeRestriction();
+        YangRangeInterval rangeInterval = new YangRangeInterval<>();
+        FractionDigits.Range range = FractionDigits.getRange(this.fractionDigit);
+        rangeInterval.setStartValue(new YangDecimal64(new BigDecimal((range.getMin()))));
+        rangeInterval.setEndValue(new YangDecimal64(new BigDecimal((range.getMax()))));
+        refRangeRestriction.addRangeRestrictionInterval(rangeInterval);
+        return refRangeRestriction;
+    }
+
+    /**
+     * Validates the data on entering the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnEntry() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+
+    /**
+     * Validates the data on exiting the corresponding parse tree node.
+     *
+     * @throws DataModelException a violation of data model rules
+     */
+    @Override
+    public void validateDataOnExit() throws DataModelException {
+        // TODO auto-generated method stub, to be implemented by parser
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
index 1661d96..7a7439f 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
@@ -32,6 +32,7 @@
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BITS;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BOOLEAN;
+import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.EMPTY;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.ENUMERATION;
@@ -242,97 +243,9 @@
          * otherwise take from the base type of type itself.
          */
         if (baseType.getDataType() == DERIVED) {
-            /*
-             * Check whether the referred typedef is resolved.
-             */
-            if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
-                throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
-            }
-
-            /*
-             * Check if the referred typedef is intra file resolved, if yes sets
-             * current status also to intra file resolved .
-             */
-            if (getReferredTypeDef().getTypeDefBaseType().getResolvableStatus() == INTRA_FILE_RESOLVED) {
-                return INTRA_FILE_RESOLVED;
-            }
-            setEffectiveBuiltInType(((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo())
-                    .getEffectiveBuiltInType());
-            YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
-            /*
-             * Check whether the effective built-in type can have range
-             * restrictions, if yes call resolution of range.
-             */
-            if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
-                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
-                    resolveRangeRestriction(null);
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve range/string restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                } else {
-                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
-                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
-                                "type.");
-                    }
-                    resolveRangeRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve range/string restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                }
-                /*
-                 * If the effective built-in type is of type string calls for
-                 * string resolution.
-                 */
-            } else if (getEffectiveBuiltInType() == STRING) {
-                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
-                    resolveStringRestriction(null);
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve range/string restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                } else {
-                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangStringRestriction)) {
-                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
-                                "type.");
-                    }
-                    resolveStringRestriction((YangStringRestriction) refDerivedInfo.getResolvedExtendedInfo());
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve range/string restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                }
-            } else if (getEffectiveBuiltInType() == BINARY) {
-                if (refDerivedInfo.getResolvedExtendedInfo() == null) {
-                    resolveLengthRestriction(null);
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve length restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                } else {
-                    if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
-                        throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
-                                "type.");
-                    }
-                    resolveLengthRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
-                    /*
-                     * Return the resolution status as resolved, if it's not
-                     * resolve length restriction will throw exception in
-                     * previous function.
-                     */
-                    return RESOLVED;
-                }
+            ResolvableStatus resolvableStatus = resolveTypeDerivedInfo(baseType);
+            if (resolvableStatus != null) {
+                return resolvableStatus;
             }
         } else if ((baseType.getDataType() == LEAFREF) || (baseType.getDataType() == IDENTITYREF)) {
             setEffectiveBuiltInType(baseType.getDataType());
@@ -393,7 +306,7 @@
                 }
             } else if (getEffectiveBuiltInType() == BINARY) {
                 if (baseType.getDataTypeExtendedInfo() == null) {
-                    resolveLengthRestriction(null);
+                    resolveBinaryRestriction(null);
                     /*
                      * Return the resolution status as resolved, if it's not
                      * resolve length restriction will throw exception in
@@ -405,7 +318,7 @@
                         throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
                                 "type.");
                     }
-                    resolveLengthRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
+                    resolveBinaryRestriction((YangRangeRestriction) baseType.getDataTypeExtendedInfo());
                     /*
                      * Return the resolution status as resolved, if it's not
                      * resolve length restriction will throw exception in
@@ -413,8 +326,38 @@
                      */
                     return RESOLVED;
                 }
+            }  else if (getEffectiveBuiltInType() == DECIMAL64) {
+                if (baseType.getDataTypeExtendedInfo() != null) {
+                    if (((YangDecimal64) baseType.getDataTypeExtendedInfo()).getRangeRestrictedExtendedInfo() == null) {
+                        resolveRangeRestriction(null);
+                        /*
+                         * Return the resolution status as resolved, if it's not;
+                         * resolve range restriction will throw exception in
+                         * previous function.
+                         */
+                        return RESOLVED;
+                    } else {
+                        if (!(((YangDecimal64) baseType.getDataTypeExtendedInfo())
+                                .getRangeRestrictedExtendedInfo() instanceof YangRangeRestriction)) {
+                            throw new DataModelException("Linker error: Referred typedef restriction info is" +
+                                                                 " of invalid type.");
+                        }
+                        resolveRangeRestriction((YangRangeRestriction) ((YangDecimal64) baseType
+                                .getDataTypeExtendedInfo()).getRangeRestrictedExtendedInfo());
+                        /*
+                         * Return the resolution status as resolved, if it's not
+                         * resolve range/string restriction will throw exception in
+                         * previous function.
+                         */
+                        return RESOLVED;
+                    }
+
+                } else {
+                    throw new DataModelException("Linker error: Unable to find type extended info for decimal64.");
+                }
             }
         }
+
         /*
          * Check if the data type is the one which can't be restricted, in this
          * case check whether no self restrictions should be present.
@@ -428,11 +371,144 @@
                 throw new DataModelException("YANG file error: Restrictions can't be applied to a given type");
             }
         }
+
         // Throw exception for unsupported types
         throw new DataModelException("Linker error: Unable to process the derived type.");
     }
 
     /**
+     * Resolves the type derived info, by obtaining the effective built-in type
+     * and resolving the restrictions.
+     *
+     * @param baseType base type of typedef
+     * @return resolution status
+     * @throws DataModelException a violation in data mode rule
+     */
+    public ResolvableStatus resolveTypeDerivedInfo(YangType<?> baseType)
+            throws DataModelException {
+        /*
+         * Check whether the referred typedef is resolved.
+         */
+        if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
+            throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
+        }
+
+        /*
+         * Check if the referred typedef is intra file resolved, if yes sets
+         * current status also to intra file resolved .
+         */
+        if (getReferredTypeDef().getTypeDefBaseType().getResolvableStatus() == INTRA_FILE_RESOLVED) {
+            return INTRA_FILE_RESOLVED;
+        }
+        setEffectiveBuiltInType(((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo())
+                                        .getEffectiveBuiltInType());
+        YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
+        /*
+         * Check whether the effective built-in type can have range
+         * restrictions, if yes call resolution of range.
+         */
+        if (isOfRangeRestrictedType(getEffectiveBuiltInType())) {
+            if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                resolveRangeRestriction(null);
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            } else {
+                if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
+                    throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                                         "type.");
+                }
+                resolveRangeRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            }
+            /*
+             * If the effective built-in type is of type string calls for
+             * string resolution.
+             */
+        } else if (getEffectiveBuiltInType() == STRING) {
+            if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                resolveStringRestriction(null);
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            } else {
+                if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangStringRestriction)) {
+                    throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                                         "type.");
+                }
+                resolveStringRestriction((YangStringRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            }
+        } else if (getEffectiveBuiltInType() == BINARY) {
+            if (refDerivedInfo.getResolvedExtendedInfo() == null) {
+                resolveBinaryRestriction(null);
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve length restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            } else {
+                if (!(refDerivedInfo.getResolvedExtendedInfo() instanceof YangRangeRestriction)) {
+                    throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                                         "type.");
+                }
+                resolveBinaryRestriction((YangRangeRestriction) refDerivedInfo.getResolvedExtendedInfo());
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve length restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            }
+        } else if (getEffectiveBuiltInType() == DECIMAL64) {
+            if ((refDerivedInfo.getResolvedExtendedInfo() == null) ||
+                    (((YangDecimal64) refDerivedInfo.getResolvedExtendedInfo())
+                            .getRangeRestrictedExtendedInfo() == null)) {
+                resolveRangeRestriction(null);
+                 /*
+                  * Return the resolution status as resolved, if it's not;
+                  * resolve range restriction will throw exception in
+                  * previous function.
+                  */
+                return RESOLVED;
+            } else {
+                if (!(((YangDecimal64) refDerivedInfo.getResolvedExtendedInfo())
+                        .getRangeRestrictedExtendedInfo() instanceof YangRangeRestriction)) {
+                    throw new DataModelException("Linker error: Referred typedef restriction info is of invalid " +
+                                                         "type.");
+                }
+                resolveRangeRestriction((YangRangeRestriction) ((YangDecimal64) refDerivedInfo
+                        .getResolvedExtendedInfo()).getRangeRestrictedExtendedInfo());
+                /*
+                 * Return the resolution status as resolved, if it's not
+                 * resolve range/string restriction will throw exception in
+                 * previous function.
+                 */
+                return RESOLVED;
+            }
+        }
+
+        return null;
+    }
+
+    /**
      * Resolves the string restrictions.
      *
      * @param refStringRestriction referred string restriction of typedef
@@ -490,6 +566,30 @@
     }
 
     /**
+     * Resolves the binary restrictions.
+     *
+     * @param refLengthRestriction referred length restriction of typedef
+     * @throws DataModelException a violation in data model rule
+     */
+    private void resolveBinaryRestriction(YangRangeRestriction refLengthRestriction)
+            throws DataModelException {
+
+        if (rangeRestrictionString != null || patternRestriction != null) {
+            DataModelException dataModelException =
+                    new DataModelException("YANG file error: for binary " +
+                                                   "range restriction or pattern restriction is not allowed.");
+            dataModelException.setLine(lineNumber);
+            dataModelException.setCharPosition(charPositionInLine);
+            throw dataModelException;
+        }
+
+        // Get the final resolved length restriction
+        YangRangeRestriction lengthRestriction = resolveLengthRestriction(refLengthRestriction);
+        // Set the lenght restriction.
+        setResolvedExtendedInfo((T) lengthRestriction);
+    }
+
+    /**
      * Resolves pattern restriction.
      *
      * @param refPatternRestriction referred pattern restriction of typedef
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
index a89c09e..9157801 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLengthRestriction.java
@@ -102,6 +102,7 @@
      * Creates a YANG length restriction object.
      */
     public YangLengthRestriction() {
+        setLengthRestriction(new YangRangeRestriction<YangUint64>());
     }
 
     /**
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java
new file mode 100644
index 0000000..eebe6ab
--- /dev/null
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/FractionDigits.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+/**
+ * The "fraction-digits" statement, which is a substatement to the
+ * "type" statement, MUST be present if the type is "decimal64".  It
+ * takes as an argument an integer between 1 and 18, inclusively.  It
+ * controls the size of the minimum difference between values of a
+ * decimal64 type, by restricting the value space to numbers that are
+ * expressible as "i x 10^-n" where n is the fraction-digits argument.
+ *
+ * +----------------+-----------------------+----------------------+
+ * | fraction-digit | min                   | max                  |
+ * +----------------+-----------------------+----------------------+
+ * | 1              | -922337203685477580.8 | 922337203685477580.7 |
+ * | 2              | -92233720368547758.08 | 92233720368547758.07 |
+ * | 3              | -9223372036854775.808 | 9223372036854775.807 |
+ * | 4              | -922337203685477.5808 | 922337203685477.5807 |
+ * | 5              | -92233720368547.75808 | 92233720368547.75807 |
+ * | 6              | -9223372036854.775808 | 9223372036854.775807 |
+ * | 7              | -922337203685.4775808 | 922337203685.4775807 |
+ * | 8              | -92233720368.54775808 | 92233720368.54775807 |
+ * | 9              | -9223372036.854775808 | 9223372036.854775807 |
+ * | 10             | -922337203.6854775808 | 922337203.6854775807 |
+ * | 11             | -92233720.36854775808 | 92233720.36854775807 |
+ * | 12             | -9223372.036854775808 | 9223372.036854775807 |
+ * | 13             | -922337.2036854775808 | 922337.2036854775807 |
+ * | 14             | -92233.72036854775808 | 92233.72036854775807 |
+ * | 15             | -9223.372036854775808 | 9223.372036854775807 |
+ * | 16             | -922.3372036854775808 | 922.3372036854775807 |
+ * | 17             | -92.23372036854775808 | 92.23372036854775807 |
+ * | 18             | -9.223372036854775808 | 9.223372036854775807 |
+ * +----------------+-----------------------+----------------------+
+ */
+
+/**
+ * Represents the decimal64 value range based on fraction-digits.
+ */
+public final class FractionDigits {
+
+    public static class Range {
+        private double min;
+        private double max;
+
+        /**
+         * Creates an instance of range.
+         *
+         * @param min minimum value of decimal64
+         * @param max maximum value of decimal64
+         */
+        protected Range(double min, double max) {
+            this.min = min;
+            this.max = max;
+        }
+
+        /**
+         * Retrieve minimum value range.
+         *
+         * @return minimum value range
+         */
+        public double getMin() {
+            return min;
+        }
+
+        /**
+         * Retrieve maximum value range.
+         *
+         * @return maximum value range
+         */
+        public double getMax() {
+            return max;
+        }
+    }
+
+    private static ArrayList<Range> decimal64ValueRange = null;
+
+    /**
+     * Creates a fraction-digits instance.
+     */
+    private FractionDigits() {
+    }
+
+    /**
+     * Generates decimal64 value range based on fraction-digits.
+     *
+     * @return decimal64 value range by fraction-digits as index
+     */
+    private static ArrayList<Range> getDecimal64ValueRange() {
+        if (decimal64ValueRange == null) {
+            decimal64ValueRange = new ArrayList<>();
+            decimal64ValueRange.add(new Range(-922337203685477580.8, 922337203685477580.7)); // fraction-digit: 1
+            decimal64ValueRange.add(new Range(-92233720368547758.08, 92233720368547758.07)); // fraction-digit: 2
+            decimal64ValueRange.add(new Range(-9223372036854775.808, 9223372036854775.807)); // fraction-digit: 3
+            decimal64ValueRange.add(new Range(-922337203685477.5808, 922337203685477.5807)); // fraction-digit: 4
+            decimal64ValueRange.add(new Range(-92233720368547.75808, 92233720368547.75807)); // fraction-digit: 5
+            decimal64ValueRange.add(new Range(-9223372036854.775808, 9223372036854.775807)); // fraction-digit: 6
+            decimal64ValueRange.add(new Range(-922337203685.4775808, 922337203685.4775807)); // fraction-digit: 7
+            decimal64ValueRange.add(new Range(-92233720368.54775808, 92233720368.54775807)); // fraction-digit: 8
+            decimal64ValueRange.add(new Range(-9223372036.854775808, 9223372036.854775807)); // fraction-digit: 9
+            decimal64ValueRange.add(new Range(-922337203.6854775808, 922337203.6854775807)); // fraction-digit: 10
+            decimal64ValueRange.add(new Range(-92233720.36854775808, 92233720.36854775807)); // fraction-digit: 11
+            decimal64ValueRange.add(new Range(-9223372.036854775808, 9223372.036854775807)); // fraction-digit: 12
+            decimal64ValueRange.add(new Range(-922337.2036854775808, 922337.2036854775807)); // fraction-digit: 13
+            decimal64ValueRange.add(new Range(-92233.72036854775808, 92233.72036854775807)); // fraction-digit: 14
+            decimal64ValueRange.add(new Range(-9223.372036854775808, 9223.372036854775807)); // fraction-digit: 15
+            decimal64ValueRange.add(new Range(-922.3372036854775808, 922.3372036854775807)); // fraction-digit: 16
+            decimal64ValueRange.add(new Range(-92.23372036854775808, 92.23372036854775807)); // fraction-digit: 17
+            decimal64ValueRange.add(new Range(-9.223372036854775808, 9.223372036854775807)); // fraction-digit: 18
+        }
+        return decimal64ValueRange;
+    }
+
+    /**
+     * Checks given decimal64 value is in the specific range based on given fraction-digit.
+     *
+     * @param value decimal64 value
+     * @param fractionDigit fraction-digits
+     * @return success when it is in specific range otherwise false
+     */
+    public static boolean isValidDecimal64(BigDecimal value, int fractionDigit) {
+        if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
+            return false;
+        }
+
+        // ArrayList index starts from 0.
+        Range range = getDecimal64ValueRange().get(fractionDigit - 1);
+        if ((value.doubleValue() >= range.min) && (value.doubleValue() <= range.max)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Retrieve range based on fraction-digits.
+     *
+     * @param fractionDigit fraction-digits
+     * @return range
+     * @throws DataModelException a violation of data model rules
+     */
+    public static Range getRange(int fractionDigit) throws DataModelException {
+        if (!((fractionDigit >= 1) && (fractionDigit <= 18))) {
+            throw new DataModelException("YANG file error : given fraction-digit is not in its range (1..18).");
+        }
+
+        return getDecimal64ValueRange().get(fractionDigit - 1);
+    }
+}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
index 715fb76..efe5620 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/YangConstructType.java
@@ -95,6 +95,16 @@
     BITS_DATA,
 
     /**
+     * Identifies the YANG decimal64 parsed data.
+     */
+    DECIMAL64_DATA,
+
+    /**
+     * Identifies the YANG fraction-digits parsed data.
+     */
+    FRACTION_DIGITS_DATA,
+
+    /**
      * Identifies the YANG enum parsed data.
      */
     ENUM_DATA,
@@ -413,6 +423,10 @@
                 return "bit";
             case BITS_DATA:
                 return "bits";
+            case DECIMAL64_DATA:
+                return "decimal64";
+            case FRACTION_DIGITS_DATA:
+                return "fraction-digits";
             case ENUM_DATA:
                 return "enum";
             case IMPORT_DATA:
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java
deleted file mode 100644
index 663ddc5..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBinary.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.datamodel.utils.builtindatatype;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents binary data type.
- */
-public final class YangBinary implements Serializable {
-
-    private static final long serialVersionUID = 8006201670L;
-
-    private byte[] byteArray;
-
-    /**
-     * Creates an instance of YANG binary.
-     */
-    private YangBinary() {
-    }
-
-    /**
-     * Creates an instance of YANG binary.
-     *
-     * @param bytes byte array
-     */
-    public YangBinary(byte[] bytes) {
-        byteArray = bytes;
-    }
-
-    /**
-     * Returns object of YANG binary.
-     *
-     * @param bytes byte array
-     * @return object of YANG binary
-     */
-    public static YangBinary of(byte[] bytes) {
-        return new YangBinary(bytes);
-    }
-
-    /**
-     * Returns byte array.
-     *
-     * @return byte array
-     */
-    public byte[] byteArray() {
-        return byteArray;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(byteArray);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof YangBinary) {
-            YangBinary other = (YangBinary) obj;
-            return Objects.equals(byteArray, other.byteArray);
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .omitNullValues()
-                .add("byteArray", byteArray)
-                .toString();
-    }
-
-    /**
-     * Returns the object of YANG binary fromString input String.
-     *
-     * @param valInString input String
-     * @return Object of YANG binary
-     */
-    public static YangBinary fromString(String valInString) {
-        try {
-            byte[] tmpVal = valInString.getBytes();
-            return of(tmpVal);
-        } catch (Exception e) {
-        }
-        return null;
-    }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java
deleted file mode 100644
index 1e1d325..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangBits.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.datamodel.utils.builtindatatype;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents bits data type.
- */
-public class YangBits implements Serializable {
-
-    private static final long serialVersionUID = 8006201669L;
-
-    private byte[] byteArray;
-
-    /**
-     * Creates an instance of YANG bits.
-     */
-    private YangBits() {
-    }
-
-    /**
-     * Creates an instance of YANG bits.
-     *
-     * @param bytes byte array
-     */
-    public YangBits(byte[] bytes) {
-        byteArray = bytes;
-    }
-
-    /**
-     * Returns object of YANG bits.
-     *
-     * @param bytes byte array
-     * @return object of YANG bits
-     */
-    public static YangBits of(byte[] bytes) {
-        return new YangBits(bytes);
-    }
-
-    /**
-     * Returns byte array.
-     *
-     * @return byte array
-     */
-    public byte[] byteArray() {
-        return byteArray;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(byteArray);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof YangBits) {
-            YangBits other = (YangBits) obj;
-            return Objects.equals(byteArray, other.byteArray);
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .omitNullValues()
-                .add("byteArray", byteArray)
-                .toString();
-    }
-
-    /**
-     * Returns the object of YANG bits fromString input String.
-     *
-     * @param valInString input String
-     * @return Object of YANG bits
-     */
-    public static YangBits fromString(String valInString) {
-        try {
-            byte[] tmpVal = valInString.getBytes();
-            return of(tmpVal);
-        } catch (Exception e) {
-        }
-        return null;
-    }
-
-}
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java
index 7578547..738a999 100644
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java
+++ b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDataTypeUtils.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.yangutils.datamodel.utils.builtindatatype;
 
-import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT16;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
 import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
@@ -51,7 +50,6 @@
                 || dataType == UINT8
                 || dataType == UINT16
                 || dataType == UINT32
-                || dataType == UINT64
-                || dataType == DECIMAL64;
+                || dataType == UINT64;
     }
 }
diff --git a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java b/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java
deleted file mode 100644
index 74c657b..0000000
--- a/utils/yangutils/datamodel/src/main/java/org/onosproject/yangutils/datamodel/utils/builtindatatype/YangDecimal64.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.datamodel.utils.builtindatatype;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents YANG decimal 64.
- */
-public class YangDecimal64 implements Serializable {
-
-    private static final long serialVersionUID = 8006201668L;
-
-    private int fractionDigit;
-
-    /**
-     * Creates an instance of YANG decimal64.
-     */
-    public YangDecimal64() {
-    }
-
-    /**
-     * Creates an instance of of YANG decimal64.
-     *
-     * @param fractionDigit fraction digit
-     */
-    public YangDecimal64(int fractionDigit) {
-        setFractionDigit(fractionDigit);
-    }
-
-    /**
-     * Returns fraction digit.
-     *
-     * @return the fractionDigit
-     */
-    public int getFractionDigit() {
-        return fractionDigit;
-    }
-
-    /**
-     * Sets fraction digit.
-     *
-     * @param fractionDigit fraction digits.
-     */
-    public void setFractionDigit(int fractionDigit) {
-        this.fractionDigit = fractionDigit;
-    }
-
-    /**
-     * Returns object of YANG decimal64.
-     *
-     * @param value fraction digit
-     * @return YANG decimal64
-     */
-    public static YangDecimal64 of(int value) {
-        return new YangDecimal64(value);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(fractionDigit);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof YangDecimal64) {
-            YangDecimal64 other = (YangDecimal64) obj;
-            return Objects.equals(fractionDigit, other.fractionDigit);
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .omitNullValues()
-                .add("fractionDigit", fractionDigit)
-                .toString();
-    }
-
-    /**
-     * Returns the object of YANG decimal64 fromString input String.
-     *
-     * @param valInString input String
-     * @return Object of YANG decimal64
-     */
-    public static YangDecimal64 fromString(String valInString) {
-        try {
-            int tmpVal = Integer.parseInt(valInString);
-            return of(tmpVal);
-        } catch (Exception e) {
-        }
-        return null;
-    }
-}