diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyDefinitions.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyDefinitions.java
new file mode 100755
index 0000000..6830742
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyDefinitions.java
@@ -0,0 +1,34 @@
+/*
+ * 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.nemo.model.object;
+
+import org.onosproject.nemo.model.object.property.definitions.PropertyDefinition;
+
+import java.util.List;
+
+/**
+ * Single property definitions information.
+ */
+public interface PropertyDefinitions {
+
+    /**
+     * Returns a description of the characteristic, responsibility
+     * and purpose for a kind of property definitions.
+     *
+     * @return a description of the property
+     */
+    List<PropertyDefinition> getPropertyDefinitions();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyInstance.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyInstance.java
new file mode 100755
index 0000000..48bd522
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/PropertyInstance.java
@@ -0,0 +1,39 @@
+/*
+ * 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.nemo.model.object;
+
+import org.onosproject.nemo.model.common.PropertyName;
+import org.onosproject.nemo.model.object.property.instance.PropertyValues;
+
+/**
+ * Single property instance's information.
+ */
+public interface PropertyInstance {
+
+    /**
+     * Returns a user-visible and unique name for a kind of property.
+     *
+     * @return a user-visible and unique name
+     */
+    PropertyName getPropertyName();
+
+    /**
+     * Returns the value of YANG list type.
+     *
+     * @return the value
+     */
+    PropertyValues getPropertyValues();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinition.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinition.java
new file mode 100644
index 0000000..8aeffcb
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinition.java
@@ -0,0 +1,104 @@
+/*
+ * 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.nemo.model.object.match.item.definitions;
+
+import org.onosproject.nemo.model.common.MatchItemName;
+
+import static com.google.common.collect.ImmutableMap.builder;
+
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap.Builder;
+
+public interface MatchItemDefinition {
+
+
+    /**
+     * Returns the name of an match item.
+     * 
+     * @return the match item name
+     */
+    MatchItemName getMatchItemName();
+
+    /**
+     * Returns the type of a parameter value.
+     * 
+     * @return the type
+     */
+    MatchItemValueType getMatchItemValueType();
+
+    /**
+     * Returns the primary key of YANG type list.
+     * 
+     * @return the match item definition key
+     */
+    MatchItemDefinitionKey getKey();
+
+    /**
+     * Types of match item value.
+     */
+    enum MatchItemValueType {
+        /** A string-valued match item. */
+        STRING(0),
+
+        /** An integer-valued match item. */
+        INT(1),
+
+        /** An integer-range match item. */
+        RANGE(2);
+
+        private static final Map<Integer, MatchItemValueType> VALUE_MAP;
+
+        int code;
+
+        MatchItemValueType(int value) {
+            this.code = value;
+        }
+
+        /**
+         * Returns the code of this action definition.
+         *
+         * @return the code
+         */
+        public int codeValue() {
+            return code;
+        }
+
+        static {
+            Builder<Integer, MatchItemValueType> b = builder();
+            for (MatchItemValueType enumItem : MatchItemValueType.values()) {
+                b.put(enumItem.code, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns the type from the given match item code.
+         *
+         * @param code the given code
+         * @return corresponding type constant
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static MatchItemValueType forValue(int code) {
+            MatchItemValueType type = VALUE_MAP.get(code);
+            if (type == null) {
+                throw new IllegalArgumentException(
+                        "No MatchItemType for value: " + code);
+            }
+            return type;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionBuilder.java
new file mode 100644
index 0000000..873ab9d
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionBuilder.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2017-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.nemo.model.object.match.item.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.MatchItemName;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of match item definition.
+ */
+public class MatchItemDefinitionBuilder {
+
+    private Map<Class<? extends MatchItemDefinition>, MatchItemDefinition>
+        augmentation = Maps.newHashMap();
+    private MatchItemDefinitionKey key;
+    private MatchItemName matchItemName;
+    private MatchItemDefinition.MatchItemValueType matchItemValueType;
+
+    /**
+     * Creates a default match item definition builder.
+     */
+    public MatchItemDefinitionBuilder() {
+    }
+
+    /**
+     * Creates an match item definition builder from a given match item
+     *  definition.
+     *
+     * @param base the match item definition
+     */
+    public MatchItemDefinitionBuilder(MatchItemDefinition base) {
+        if (base.getKey() == null) {
+            key = new MatchItemDefinitionKey(base.getMatchItemName());
+            matchItemName = base.getMatchItemName();
+        } else {
+            key = base.getKey();
+            matchItemName = key.getMatchItemName();
+        }
+        matchItemValueType = base.getMatchItemValueType();
+        MatchItemDefinitionImpl impl = (MatchItemDefinitionImpl) base;
+        if (!impl.augmentation.isEmpty()) {
+            augmentation = new HashMap<>(impl.augmentation);
+        }
+    }
+
+    /**
+     * Sets the match item definition key to be used by the builder.
+     *
+     * @param value the match item definition key value
+     * @return self
+     */
+    public MatchItemDefinitionBuilder Key(MatchItemDefinitionKey value) {
+        key = value;
+        return this;
+    }
+
+    /**
+     * Sets the match item name to be used by the builder.
+     *
+     * @param value the match item value
+     * @return self
+     */
+    public MatchItemDefinitionBuilder MatchItemName(MatchItemName value) {
+        matchItemName = value;
+        return this;
+    }
+
+    /**
+     * Sets the match item value type to be used by the builder.
+     *
+     * @param value match item definition value type
+     * @return self
+     */
+    public MatchItemDefinitionBuilder MatchItemValueType(MatchItemDefinition.MatchItemValueType value) {
+        matchItemValueType = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public MatchItemDefinitionBuilder addAugmentation(
+            Class<? extends MatchItemDefinition> augmentationType,
+            MatchItemDefinition augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public MatchItemDefinitionBuilder removeAugmentation(
+            Class<? extends MatchItemDefinition> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an match item definition from this builder instance.
+     *
+     * @return match item definition
+     */
+    public MatchItemDefinition build() {
+        return new MatchItemDefinitionImpl(this);
+    }
+
+    /**
+     * The implementation of match item definition.
+     */
+    private static final class MatchItemDefinitionImpl
+            implements MatchItemDefinition {
+
+        private final MatchItemDefinitionKey key;
+        private final MatchItemName matchItemName;
+        private final MatchItemValueType matchItemValueType;
+        private final Map<Class<? extends MatchItemDefinition>,
+                MatchItemDefinition> augmentation;
+
+        private MatchItemDefinitionImpl(MatchItemDefinitionBuilder base) {
+            if (base.key == null) {
+                key = new MatchItemDefinitionKey(base.matchItemName);
+                matchItemName = base.matchItemName;
+            } else {
+                key = base.key;
+                matchItemName = key.getMatchItemName();
+            }
+            matchItemValueType = base.matchItemValueType;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public MatchItemDefinitionKey getKey() {
+            return key;
+        }
+
+        @Override
+        public MatchItemName getMatchItemName() {
+            return matchItemName;
+        }
+
+        @Override
+        public MatchItemValueType getMatchItemValueType() {
+            return matchItemValueType;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, matchItemName, matchItemValueType,
+                    augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            MatchItemDefinition other = (MatchItemDefinition) obj;
+            if (!Objects.equals(key, other.getKey())) {
+                return false;
+            }
+            if (!Objects.equals(matchItemName, other.getMatchItemName())) {
+                return false;
+            }
+            if (!Objects.equals(matchItemValueType, other.getMatchItemValueType())) {
+                return false;
+            }
+            MatchItemDefinitionImpl otherImpl = (MatchItemDefinitionImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("matchItemName", matchItemName)
+                    .add("matchItemValueType", matchItemValueType)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKey.java
new file mode 100644
index 0000000..ee6e367
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKey.java
@@ -0,0 +1,83 @@
+/*
+ * 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.nemo.model.object.match.item.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.MatchItemName;
+
+/**
+ * The key to match item definition.
+ */
+public class MatchItemDefinitionKey {
+    private final MatchItemName matchItemName;
+
+    /**
+     * Creates a match item name from a given match item name.
+     *
+     * @param matchItemName the match item name
+     */
+    public MatchItemDefinitionKey(MatchItemName matchItemName) {
+        this.matchItemName = matchItemName;
+    }
+
+    /**
+     * Creates a copy from source object.
+     *
+     * @param source the source object
+     */
+    public MatchItemDefinitionKey(MatchItemDefinitionKey source) {
+        matchItemName = source.matchItemName;
+    }
+
+    /**
+     * Returns the match item name of this instance.
+     *
+     * @return the match item name
+     */
+    public MatchItemName getMatchItemName() {
+        return matchItemName;
+    }
+
+    @Override
+    public int hashCode() {
+        return matchItemName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        MatchItemDefinitionKey other = (MatchItemDefinitionKey) obj;
+        return Objects.equals(matchItemName, other.matchItemName);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("matchItemName", matchItemName)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/package-info.java
new file mode 100644
index 0000000..6571c45
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/definitions/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Definitions classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.match.item.definitions;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValue.java
new file mode 100644
index 0000000..9117f29
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValue.java
@@ -0,0 +1,45 @@
+/*
+ * 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.nemo.model.object.match.item.instance;
+
+import org.onosproject.nemo.model.object.match.item.instance.match.item.value.RangeValue;
+
+/**
+ * Single match item value's information.
+ */
+public interface MatchItemValue {
+
+    /**
+     * Returns the primary string value of YANG list type.
+     *
+     * @return the value
+     */
+    String getStringValue();
+
+    /**
+     * Returns the primary integer value of YANG list type.
+     *
+     * @return the value
+     */
+    Long getIntValue();
+
+    /**
+     * Returns the primary range value of YANG list type.
+     *
+     * @return the value
+     */
+    RangeValue getRangeValue();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValueBuilder.java
new file mode 100644
index 0000000..118d72d
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/MatchItemValueBuilder.java
@@ -0,0 +1,198 @@
+/*
+ * 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.nemo.model.object.match.item.instance;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.object.match.item.instance.match.item.value.RangeValue;
+
+import com.google.common.collect.Maps;
+
+
+public class MatchItemValueBuilder {
+
+    Map<Class<? extends MatchItemValue>, MatchItemValue>
+            augmentation = Maps.newHashMap();
+    private Long intValue;
+    private RangeValue rangeValue;
+    private String stringValue;
+
+    /**
+     * Creates a default match item value builder.
+     */
+    public MatchItemValueBuilder() {
+    }
+
+    /**
+     * Creates an match item value builder from a given match item value.
+     *
+     * @param base the action definition
+     */
+    public MatchItemValueBuilder(MatchItemValue base) {
+        intValue = base.getIntValue();
+        rangeValue = base.getRangeValue();
+        stringValue = base.getStringValue();
+        MatchItemValueImpl impl = (MatchItemValueImpl) base;
+        if (!impl.augmentation.isEmpty()) {
+            this.augmentation = new HashMap<>(impl.augmentation);
+        }
+    }
+
+    /**
+     * Sets the value to be used by the builder.
+     *
+     * @param value the value
+     * @return self
+     */
+    public MatchItemValueBuilder IntValue(Long value) {
+        intValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the range value to be used by the builder.
+     *
+     * @param value the range value
+     * @return self
+     */
+    public MatchItemValueBuilder RangeValue(RangeValue value) {
+        rangeValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the string value to be used by the builder.
+     *
+     * @param value the string value
+     * @return self
+     */
+    public MatchItemValueBuilder StringValue(String value) {
+        stringValue = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public MatchItemValueBuilder addAugmentation(
+            Class<? extends MatchItemValue> augmentationType,
+            MatchItemValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public MatchItemValueBuilder removeAugmentation(
+            Class<? extends MatchItemValue> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an match item value from this builder instance.
+     *
+     * @return match item value
+     */
+    public MatchItemValue build() {
+        return new MatchItemValueImpl(this);
+    }
+
+    /**
+     * The implementation of match item value.
+     */
+    private static final class MatchItemValueImpl implements MatchItemValue {
+
+        private final Long intValue;
+        private final RangeValue rangeValue;
+        private final String stringValue;
+        private final Map<Class<? extends MatchItemValue>, MatchItemValue>
+                augmentation;
+
+        private MatchItemValueImpl(MatchItemValueBuilder base) {
+            intValue = base.intValue;
+            rangeValue = base.rangeValue;
+            stringValue = base.stringValue;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public Long getIntValue() {
+            return intValue;
+        }
+
+        @Override
+        public RangeValue getRangeValue() {
+            return rangeValue;
+        }
+
+        @Override
+        public String getStringValue() {
+            return stringValue;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(
+                    intValue, rangeValue, stringValue, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            MatchItemValue other = (MatchItemValue) obj;
+            if (!Objects.equals(intValue, other.getIntValue())) {
+                return false;
+            }
+            if (!Objects.equals(rangeValue, other.getRangeValue())) {
+                return false;
+            }
+            if (!Objects.equals(stringValue, other.getStringValue())) {
+                return false;
+            }
+            MatchItemValueImpl otherImpl = (MatchItemValueImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("intValue", intValue)
+                    .add("rangeValue", rangeValue)
+                    .add("stringValue", stringValue)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValue.java
new file mode 100644
index 0000000..cc825c3
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValue.java
@@ -0,0 +1,36 @@
+/*
+ * 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.nemo.model.object.match.item.instance.match.item.value;
+
+/**
+ * Single range value's information.
+ */
+public interface RangeValue {
+
+    /**
+     * Returns the minimum value of YANG list type.
+     *
+     * @return the value
+     */
+    Long getMin();
+
+    /**
+     * Returns the maximum value of YANG list type.
+     *
+     * @return the value
+     */
+    Long getMax();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValueBuilder.java
new file mode 100644
index 0000000..ceb9a92
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/RangeValueBuilder.java
@@ -0,0 +1,173 @@
+/*
+ * 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.nemo.model.object.match.item.instance.match.item.value;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Representation of building a range value.
+ */
+public class RangeValueBuilder {
+
+    private Map<Class<? extends RangeValue>, RangeValue>
+            augmentation = Maps.newHashMap();
+    private Long max;
+    private Long min;
+
+    /**
+     * Creates a default range value builder.
+     */
+    public RangeValueBuilder() {
+    }
+
+    /**
+     * Creates an range value builder from a given range value.
+     *
+     * @param base the range value
+     */
+    public RangeValueBuilder(RangeValue base) {
+        max = base.getMax();
+        min = base.getMin();
+        RangeValueImpl impl = (RangeValueImpl) base;
+        if (!impl.augmentation.isEmpty()) {
+            this.augmentation = new HashMap<>(impl.augmentation);
+        }
+    }
+
+    /**
+     * Sets the maximum range value to be used by the builder.
+     *
+     * @param value range value
+     * @return self
+     */
+    public RangeValueBuilder Max(Long value) {
+        max = value;
+        return this;
+    }
+
+    /**
+     * Sets the minimum range value to be used by the builder.
+     *
+     * @param value range value
+     * @return self
+     */
+    public RangeValueBuilder Min(Long value) {
+        min = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public RangeValueBuilder addAugmentation(
+            Class<? extends RangeValue> augmentationType,
+            RangeValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public RangeValueBuilder removeAugmentation(
+            Class<? extends RangeValue> augmentationType) {
+        this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an range value from this builder instance.
+     *
+     * @return range value
+     */
+    public RangeValue build() {
+        return new RangeValueImpl(this);
+    }
+
+    /**
+     * The implementation of range value.
+     */
+    private static final class RangeValueImpl implements RangeValue {
+
+        private final Long max;
+        private final Long min;
+        private final Map<Class<? extends RangeValue>, RangeValue>
+                augmentation;
+
+        private RangeValueImpl(RangeValueBuilder base) {
+            max = base.max;
+            min = base.min;
+            this.augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public Long getMax() {
+            return max;
+        }
+
+        @Override
+        public Long getMin() {
+            return min;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(max, max, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            RangeValue other = (RangeValue) obj;
+            if (!Objects.equals(max, other.getMax())) {
+                return false;
+            }
+            if (!Objects.equals(min, other.getMin())) {
+                return false;
+            }
+            RangeValueImpl otherImpl = (RangeValueImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("max", max)
+                    .add("min", min)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/package-info.java
new file mode 100644
index 0000000..d51b408
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/match/item/value/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Value classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.match.item.instance.match.item.value;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/package-info.java
new file mode 100644
index 0000000..2190105
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/instance/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.match.item.instance;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/package-info.java
new file mode 100644
index 0000000..56d5808
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/match/item/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Item classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.match.item;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinition.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinition.java
new file mode 100755
index 0000000..d146481
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinition.java
@@ -0,0 +1,49 @@
+/*
+ * 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.nemo.model.object.node.definitions;
+
+import org.onosproject.nemo.model.common.NodeType;
+import org.onosproject.nemo.model.object.property.definitions.PropertyDefinition;
+
+import java.util.List;
+
+/**
+ * Single Node definition's information.
+ */
+public interface NodeDefinition {
+
+    /**
+     * Returns a unique node type for a kind of node.
+     *
+     * @return a unique node type
+     */
+    NodeType getNodeType();
+
+    /**
+     * Returns the primary key of YANG list type.
+     *
+     * @return the key
+     */
+    NodeDefinitionKey getKey();
+
+    /**
+     * Returns a description of the characteristic,
+     * responsibility and purpose for a kind of property.
+     *
+     * @return a description of property
+     */
+    List<PropertyDefinition> getPropertyDefinitions();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilder.java
new file mode 100755
index 0000000..c45372b
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilder.java
@@ -0,0 +1,223 @@
+/*
+ * 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.nemo.model.object.node.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import com.google.common.collect.Maps;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.NodeType;
+import org.onosproject.nemo.model.object.PropertyDefinitions;
+import org.onosproject.nemo.model.object.property.definitions.PropertyDefinition;
+
+/**
+ * The builder of node definition.
+ */
+public class NodeDefinitionBuilder {
+    private Map<Class<? extends NodeDefinition>, NodeDefinition>
+            augmentation = Maps.newHashMap();
+    private NodeDefinitionKey key;
+    private NodeType nodeType;
+    private List<PropertyDefinition> propDefs;
+
+    /**
+     * Creates a default node definition builder.
+     */
+    public NodeDefinitionBuilder() {
+    }
+
+    /**
+     * Creates a node definition builder from a given definitions.
+     *
+     * @param definitions the property definitions
+     */
+    public NodeDefinitionBuilder(PropertyDefinitions definitions) {
+        propDefs = definitions.getPropertyDefinitions();
+    }
+
+    /**
+     * Creates a node definition builder from a given node definition.
+     *
+     * @param base the node definition object
+     */
+    public NodeDefinitionBuilder(NodeDefinition base) {
+        if (base.getKey() == null) {
+            key = new NodeDefinitionKey(base.getNodeType());
+            nodeType = base.getNodeType();
+        } else {
+            key = base.getKey();
+            nodeType = key.getNodeType();
+        }
+        propDefs = base.getPropertyDefinitions();
+    }
+
+    /**
+     * Sets the key to be used by the builder.
+     *
+     * @param key key value
+     * @return self
+     */
+    public NodeDefinitionBuilder key(NodeDefinitionKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the node type to be used by the builder.
+     *
+     * @param type node type
+     * @return self
+     */
+    public NodeDefinitionBuilder nodeType(NodeType type) {
+        nodeType = type;
+        return this;
+    }
+
+    /**
+     * Sets the property definitions to be used by the builder.
+     *
+     * @param definition property definition
+     * @return self
+     */
+    public NodeDefinitionBuilder propertyDefinition(
+            List<PropertyDefinition> definition) {
+        propDefs = definition;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public NodeDefinitionBuilder addAugmentation(
+            Class<NodeDefinition> augmentationType,
+            NodeDefinition augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public NodeDefinitionBuilder removeAugmentation(
+        Class<NodeDefinition> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a node definition from this builder instance.
+     *
+     * @return node definition
+     */
+    public NodeDefinition build() {
+        return new NodeDefinitionImpl(this);
+    }
+
+    /**
+     * The implementation of node definition interface.
+     */
+    private static final class NodeDefinitionImpl implements NodeDefinition {
+
+        private final NodeDefinitionKey key;
+        private final NodeType nodeType;
+        private final List<PropertyDefinition> propertyDefinitions;
+        private final Map<Class<? extends NodeDefinition>, NodeDefinition>
+                augmentation;
+
+        private NodeDefinitionImpl(NodeDefinitionBuilder base) {
+            if (base.key == null) {
+                key = new NodeDefinitionKey(base.nodeType);
+                nodeType = base.nodeType;
+            } else {
+                key = base.key;
+                nodeType = key.getNodeType();
+            }
+            propertyDefinitions = base.propDefs;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public NodeDefinitionKey getKey() {
+            return key;
+        }
+
+        @Override
+        public NodeType getNodeType() {
+            return nodeType;
+        }
+
+        @Override
+        public List<PropertyDefinition> getPropertyDefinitions() {
+            return propertyDefinitions;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, nodeType, propertyDefinitions,
+                    augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            NodeDefinition other = (NodeDefinition) obj;
+            if (!Objects.equals(key, other.getKey())) {
+                return false;
+            }
+            if (!Objects.equals(nodeType, other.getNodeType())) {
+                return false;
+            }
+            if (!Objects.equals(propertyDefinitions, other.
+                    getPropertyDefinitions())) {
+                return false;
+            }
+            NodeDefinitionImpl otherImpl = (NodeDefinitionImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("nodeType", nodeType)
+                    .add("propertyDefinition", propertyDefinitions)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKey.java
new file mode 100755
index 0000000..1cb3544
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKey.java
@@ -0,0 +1,81 @@
+/*
+ * 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.nemo.model.object.node.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.NodeType;
+
+/**
+ * The key to differentiate node definition.
+ */
+public class NodeDefinitionKey {
+    private final NodeType nodeType;
+
+    /**
+     * Creates a node definition key from a given node type.
+     *
+     * @param nodeType the node type
+     */
+    public NodeDefinitionKey(NodeType nodeType) {
+        this.nodeType = nodeType;
+    }
+
+    /**
+     * Creates a copy from a given node definition key instance.
+     *
+     * @param key the node definition key
+     */
+    public NodeDefinitionKey(NodeDefinitionKey key) {
+        nodeType = key.nodeType;
+    }
+
+    /**
+     * Returns the node type of this instance.
+     *
+     * @return node type
+     */
+    public NodeType getNodeType() {
+        return nodeType;
+    }
+
+    @Override
+    public int hashCode() {
+        return nodeType.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        NodeDefinitionKey other = (NodeDefinitionKey) obj;
+        return Objects.equals(nodeType, other.nodeType);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("nodeType", nodeType).toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/package-info.java
new file mode 100755
index 0000000..7a9b279
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/definitions/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Node definitions classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.node.definitions;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/Property.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/Property.java
new file mode 100755
index 0000000..f2783bb
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/Property.java
@@ -0,0 +1,46 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import org.onosproject.nemo.model.common.PropertyName;
+import org.onosproject.nemo.model.object.property.instance.PropertyValues;
+
+/**
+ * Single property's information.
+ */
+public interface Property {
+
+    /**
+     * Returns the primary key of YANG list type.
+     *
+     * @return the key
+     */
+    PropertyKey getKey();
+
+    /**
+     * Returns a unique name for a kind of property.
+     *
+     * @return a unique name
+     */
+    PropertyName getPropertyName();
+
+    /**
+     * Returns a value for a kind of property.
+     *
+     * @return a value of the property
+     */
+    PropertyValues getPropertyValues();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilder.java
new file mode 100755
index 0000000..2be9fa6
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilder.java
@@ -0,0 +1,215 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.PropertyName;
+import org.onosproject.nemo.model.object.PropertyInstance;
+import org.onosproject.nemo.model.object.property.instance.PropertyValues;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of property.
+ */
+public class PropertyBuilder {
+
+    private Map<Class<? extends Property>, Property> augmentation =
+            Maps.newHashMap();
+    private PropertyKey key;
+    private PropertyName propertyName;
+    private PropertyValues propertyValues;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public PropertyBuilder() {
+    }
+
+    /**
+     * Creates a property builder from a property.
+     *
+     * @param instance the property instance
+     */
+    public PropertyBuilder(PropertyInstance instance) {
+        propertyName = instance.getPropertyName();
+        propertyValues = instance.getPropertyValues();
+    }
+
+    /**
+     * Creates a property builder from a property.
+     *
+     * @param base the property instance
+     */
+    public PropertyBuilder(Property base) {
+        if (base.getKey() == null) {
+            key = new PropertyKey(base.getPropertyName());
+            propertyName = base.getPropertyName();
+        } else {
+            key = base.getKey();
+            propertyName = key.getPropertyName();
+        }
+        propertyValues = base.getPropertyValues();
+    }
+
+    /**
+     * Sets the key to be used by the builder.
+     *
+     * @param key key value
+     * @return self
+     */
+    public PropertyBuilder key(PropertyKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the property name to be used by the builder.
+     *
+     * @param name property name value
+     * @return self
+     */
+    public PropertyBuilder propertyName(PropertyName name) {
+        propertyName = name;
+        return this;
+    }
+
+    /**
+     * Sets the property value to be used by the builder.
+     *
+     * @param values property values
+     * @return self
+     */
+    public PropertyBuilder propertyValues(PropertyValues values) {
+        propertyValues = values;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public PropertyBuilder addAugmentation(Class<Property> augmentationType,
+            Property augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public PropertyBuilder removeAugmentation(Class<Property>
+            augmentationType) {
+            augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a property from this builder instance.
+     *
+     * @return property
+     */
+    public Property build() {
+        return new PropertyImpl(this);
+    }
+
+    /**
+     * The implementation of property interface.
+     */
+    private static final class PropertyImpl implements Property {
+
+        private final PropertyKey key;
+        private final PropertyName propertyName;
+        private final PropertyValues propertyValues;
+        private final Map<Class<? extends Property>, Property> augmentation;
+
+        private PropertyImpl(PropertyBuilder base) {
+            if (base.key == null) {
+                key = new PropertyKey(base.propertyName);
+                propertyName = base.propertyName;
+            } else {
+                key = base.key;
+                propertyName = key.getPropertyName();
+            }
+            this.propertyValues = base.propertyValues;
+                augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public PropertyKey getKey() {
+            return key;
+        }
+
+        @Override
+        public PropertyName getPropertyName() {
+            return propertyName;
+        }
+
+        @Override
+        public PropertyValues getPropertyValues() {
+            return propertyValues;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, propertyName, propertyValues,
+                    augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            PropertyImpl o = (PropertyImpl) obj;
+            return Objects.equals(key, o.key) &&
+                    Objects.equals(propertyName, o.propertyName) &&
+                    Objects.equals(propertyValues, o.propertyValues) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("propertyName", propertyName)
+                    .add("propertyValues", propertyValues)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyKey.java
new file mode 100755
index 0000000..3197a48
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/PropertyKey.java
@@ -0,0 +1,82 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import org.onosproject.nemo.model.common.PropertyName;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * The key to differentiate user roles.
+ */
+public class PropertyKey {
+    private final PropertyName propertyName;
+
+    /**
+     * Creates a property key from a given property name.
+     *
+     * @param name the property name
+     */
+    public PropertyKey(PropertyName name) {
+        propertyName = name;
+    }
+
+    /**
+     * Creates a copy from a given property key instance.
+     *
+     * @param key the property key
+     */
+    public PropertyKey(PropertyKey key) {
+        propertyName = key.propertyName;
+    }
+
+    /**
+     * Returns the property name of this instance.
+     *
+     * @return property name
+     */
+    public PropertyName getPropertyName() {
+        return propertyName;
+    }
+
+    @Override
+    public int hashCode() {
+        return propertyName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        PropertyKey other = (PropertyKey) obj;
+        return Objects.equals(propertyName, other.propertyName);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("propertyName", propertyName)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNode.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNode.java
new file mode 100755
index 0000000..92ca8bf
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNode.java
@@ -0,0 +1,45 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import org.onosproject.nemo.model.common.NodeId;
+
+/**
+ * Single subnode's information.
+ */
+public interface SubNode {
+
+    /**
+     * Returns a unique identifier for a kind of node.
+     *
+     * @return a unique identifier of node
+     */
+    NodeId getNodeId();
+
+    /**
+     * Returns the order of YANG list type.
+     *
+     * @return the order
+     */
+    long getOrder();
+
+    /**
+     * Returns primary key of YANG List Type.
+     *
+     * @return the key
+     */
+    SubNodeKey getKey();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilder.java
new file mode 100755
index 0000000..6692bab
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilder.java
@@ -0,0 +1,214 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import org.onosproject.nemo.model.common.NodeId;
+
+import com.google.common.collect.Maps;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Representation of build sub node.
+ */
+public class SubNodeBuilder {
+
+    private static final long MAX_LENGTH =  4294967295L;
+    private static final long MIN_LENGTH =  0L;
+    private static final String ERROR_LEN_MSG = "Invalid range:" +
+            " %s, expected: [[" + MIN_LENGTH + "‥" + MAX_LENGTH + "]].";
+
+    private Map<Class<? extends SubNode>, SubNode> augmentation =
+            Maps.newHashMap();
+    private SubNodeKey key;
+    private long order;
+    private NodeId nodeId;
+
+    /**
+     * Creates a new instance with default parameter.
+     */
+    public SubNodeBuilder() {
+    }
+
+    /**
+     * Creates a new instance from a given base object.
+     *
+     * @param base sub node base
+     */
+    public SubNodeBuilder(SubNode base) {
+        if (base.getKey() == null) {
+            key = new SubNodeKey(base.getNodeId());
+            base.getNodeId();
+        } else {
+            key = base.getKey();
+            key.getNodeId();
+        }
+        order = base.getOrder();
+    }
+
+    /**
+     * Sets the key to be used by the builder.
+     *
+     * @param key sub node key
+     * @return self
+     */
+    public SubNodeBuilder key(SubNodeKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the node id to be used by the builder.
+     *
+     * @param id node id
+     * @return self
+     */
+    public SubNodeBuilder nodeId(NodeId id) {
+        nodeId = id;
+        return this;
+    }
+
+    /**
+     * Sets the order id to be used by the builder.
+     *
+     * @param order the order
+     * @return self
+     */
+    public SubNodeBuilder order(long order) {
+        checkOrderRange(order);
+        this.order = order;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public SubNodeBuilder addAugmentation(
+            Class<SubNode> augmentationType, SubNode augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public SubNodeBuilder removeAugmentation(Class<SubNode> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an sub node from this builder instance.
+     *
+     * @return the sub node
+     */
+    public SubNode build() {
+        return new SubNodeImpl(this);
+    }
+
+    private static void checkOrderRange(long value) {
+        if (value < MIN_LENGTH || value > MAX_LENGTH) {
+            throw new IllegalArgumentException(
+                    String.format(ERROR_LEN_MSG, value));
+        }
+    }
+
+    /**
+     * The implementation of sub node.
+     */
+    private static final class SubNodeImpl implements SubNode {
+
+        private final SubNodeKey key;
+        private final long order;
+        private final NodeId nodeId;
+        private final Map<Class<? extends SubNode>, SubNode> augmentation;
+
+        private SubNodeImpl(SubNodeBuilder base) {
+            if (base.key == null) {
+                key = new SubNodeKey(base.nodeId);
+                nodeId = base.nodeId;
+            } else {
+                key = base.key;
+                nodeId = key.getNodeId();
+            }
+            order = base.order;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public NodeId getNodeId() {
+            return nodeId;
+        }
+
+        @Override
+        public long getOrder() {
+            return order;
+        }
+
+        @Override
+        public SubNodeKey getKey() {
+            return key;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, nodeId, order, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            SubNodeImpl o = (SubNodeImpl) obj;
+            return Objects.equals(key, o.key) &&
+                    Objects.equals(nodeId, o.nodeId) &&
+                    Objects.equals(order, o.order) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("nodeId", nodeId)
+                    .add("order", order)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeKey.java
new file mode 100755
index 0000000..5020db5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/SubNodeKey.java
@@ -0,0 +1,80 @@
+/*
+ * 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.nemo.model.object.node.instance;
+
+import org.onosproject.nemo.model.common.NodeId;
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+/**
+ * Representation of sub node key.
+ */
+public class SubNodeKey {
+    private final NodeId nodeId;
+
+    /**
+     * Creates a sub node key from a given node id.
+     *
+     * @param nodeId the node id
+     */
+    public SubNodeKey(NodeId nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    /**
+     * Creates a copy from a given sub node key.
+     *
+     * @param key the sub node key
+     */
+    public SubNodeKey(SubNodeKey key) {
+        nodeId = key.nodeId;
+    }
+
+    /**
+     * Returns the node id of this instance.
+     *
+     * @return node id
+     */
+    public NodeId getNodeId() {
+        return nodeId;
+    }
+
+    @Override
+    public int hashCode() {
+        return nodeId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        SubNodeKey other = (SubNodeKey) obj;
+        return Objects.equals(nodeId, other.nodeId);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("nodeId", nodeId).toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/package-info.java
new file mode 100755
index 0000000..1386f5b
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/instance/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Node instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.node.instance;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/package-info.java
new file mode 100755
index 0000000..84ee357
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/node/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Node classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.node;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinition.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinition.java
new file mode 100755
index 0000000..d3b750c
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinition.java
@@ -0,0 +1,226 @@
+/*
+ * 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.nemo.model.object.property.definitions;
+
+import static com.google.common.collect.ImmutableMap.Builder;
+import static com.google.common.collect.ImmutableMap.builder;
+import org.onosproject.nemo.model.common.PropertyName;
+
+/**
+ * Single property definition's information.
+ */
+public interface PropertyDefinition {
+
+    /**
+     * Returns a unique name for a kind of property.
+     *
+     * @return a name of property
+     */
+    PropertyName getPropertyName();
+
+    /**
+     * Returns the type of the property value.
+     *
+     * @return the value
+     */
+    PropertyValueType getPropertyValueType();
+
+    /**
+     * Specify whether the property is required for the object.
+     *
+     * @return required
+     */
+    IsRequired getIsRequired();
+
+    /**
+     * Specify whether the property is read-only for object.
+     *
+     * @return access
+     */
+    Access getIsReadOnly();
+
+    /**
+     * .
+     * Returns Primary Key of YANG List Type
+     *
+     * @return the key
+     */
+    PropertyDefinitionKey getKey();
+
+    /**
+     * Designates property value type.
+     */
+    enum PropertyValueType {
+
+        /** An string-valued property. */
+        STRING(0),
+
+        /** An integer-valued property. */
+        INT(1),
+
+        /** An integer-range property. */
+        RANGE(2);
+
+        int value;
+
+        private static final java.util.Map<Integer, PropertyValueType>
+                VALUE_MAP;
+
+        PropertyValueType(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns integer value.
+         *
+         * @return integer value
+         */
+        public int intValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, PropertyValueType> b = builder();
+            for (PropertyValueType enumItem : PropertyValueType.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns property value type.
+         *
+         * @param value the value for value map
+         * @return corresponding PropertyValueType item
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static PropertyValueType forValue(int value) {
+            PropertyValueType is = VALUE_MAP.get(value);
+            if (is == null) {
+                throw new IllegalArgumentException(
+                        "No PropertyValueType for value: " + value);
+            }
+            return is;
+        }
+    }
+
+    /**
+     * Designates required property.
+     */
+    enum IsRequired {
+
+        /** The property is required */
+        REQUIRED(0),
+
+        /** The property is optional */
+        OPTIONAL(1);
+
+        int value;
+
+        private static final java.util.Map<Integer, IsRequired> VALUE_MAP;
+
+
+        IsRequired(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns integer value.
+         *
+         * @return integer value
+         */
+        public int intValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, IsRequired> b = builder();
+            for (IsRequired enumItem : IsRequired.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns value map.
+         *
+         * @param value is required value to get value map
+         * @return corresponding IsRequired item
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static IsRequired forValue(int value) {
+            IsRequired is = VALUE_MAP.get(value);
+            if(is == null){
+                throw new IllegalArgumentException(
+                        "No PropertyValueType for value: " + value);
+            }
+            return is;
+        }
+    }
+
+    /**
+     * Designates property access.
+     */
+    enum Access {
+
+        /** The property can be read and written. */
+        READ_WRITE(0),
+
+        /** The property is read-only. */
+        READ_ONLY(1);
+
+        int value;
+
+        private static final java.util.Map<Integer, Access> VALUE_MAP;
+
+        Access(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns integer value.
+         *
+         * @return integer value
+         */
+        public int intValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, Access> b = builder();
+            for (Access enumItem : Access.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns the value map.
+         *
+         * @param value value to get value map
+         * @return corresponding IsReadOnly item
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static Access forValue(int value) {
+            Access is = VALUE_MAP.get(value);
+            if (is == null) {
+                throw new IllegalArgumentException(
+                        "No PropertyValueType for value: " + value);
+            }
+            return is;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilder.java
new file mode 100755
index 0000000..3e60477
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilder.java
@@ -0,0 +1,253 @@
+/*
+ * 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.nemo.model.object.property.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.PropertyName;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of property definition.
+ */
+public class PropertyDefinitionBuilder {
+
+    private final Map<Class<? extends PropertyDefinition>, PropertyDefinition>
+            augmentation = Maps.newHashMap();
+    private PropertyDefinition.Access isReadOnly;
+    private PropertyDefinition.IsRequired isRequired;
+    private PropertyDefinitionKey key;
+    private PropertyName propertyName;
+    private PropertyDefinition.PropertyValueType propertyValueType;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public PropertyDefinitionBuilder() {
+    }
+
+    /**
+     * Creates a property definition builder from a property definition object.
+     *
+     * @param base the property definition object
+     */
+    public PropertyDefinitionBuilder(PropertyDefinition base) {
+        if (base.getKey() == null) {
+            key = new PropertyDefinitionKey(base.getPropertyName());
+            propertyName = base.getPropertyName();
+        } else {
+            key = base.getKey();
+            propertyName = key.getPropertyName();
+        }
+        isReadOnly = base.getIsReadOnly();
+        isRequired = base.getIsRequired();
+        propertyValueType = base.getPropertyValueType();
+    }
+
+    /**
+     * Sets the property definition access to be used by the builder.
+     *
+     * @param readOnly property definition read-only value
+     * @return self
+     */
+    public PropertyDefinitionBuilder isReadOnly(
+    	PropertyDefinition.Access readOnly) {
+        isReadOnly = readOnly;
+        return this;
+    }
+
+    /**
+     * Sets the property definition requirement to be used by the builder.
+     *
+     * @param required property definition
+     * @return self
+     */
+    public PropertyDefinitionBuilder isRequired(
+    	PropertyDefinition.IsRequired required) {
+        isRequired = required;
+        return this;
+    }
+
+    /**
+     * Sets the property definition key to be used by the builder.
+     *
+     * @param key property definition key value
+     * @return self
+     */
+    public PropertyDefinitionBuilder key(PropertyDefinitionKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the property name to be used by the builder.
+     *
+     * @param name property name value
+     * @return self
+     */
+    public PropertyDefinitionBuilder propertyName(PropertyName name) {
+        propertyName = name;
+        return this;
+    }
+
+    /**
+     * Sets the property value type to be used by the builder.
+     *
+     * @param type property value type value
+     * @return self
+     */
+    public PropertyDefinitionBuilder propertyValueType(
+            PropertyDefinition.PropertyValueType type) {
+        propertyValueType = type;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public PropertyDefinitionBuilder addAugmentation(
+            Class<? extends PropertyDefinition> augmentationType,
+            PropertyDefinition augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public PropertyDefinitionBuilder removeAugmentation(
+            Class<?extends PropertyDefinition> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a property definition from this builder instance.
+     *
+     * @return property definition
+     */
+    public PropertyDefinition build() {
+        return new PropertyDefinitionImpl(this);
+    }
+
+    /**
+     * The implementation of property definition interface.
+     */
+    private static final class PropertyDefinitionImpl implements
+            PropertyDefinition {
+
+        private final Access isReadOnly;
+        private final IsRequired isRequired;
+        private final PropertyDefinitionKey key;
+        private final PropertyName propertyName;
+        private final PropertyValueType propertyValueType;
+        private final Map<Class<? extends PropertyDefinition>,
+                PropertyDefinition> augmentation;
+
+        private PropertyDefinitionImpl(PropertyDefinitionBuilder base) {
+            if (base.key == null) {
+                key = new PropertyDefinitionKey(base.propertyName);
+                propertyName = base.propertyName;
+            } else {
+                key = base.key;
+                propertyName = key.getPropertyName();
+            }
+            isReadOnly = base.isReadOnly;
+            isRequired = base.isRequired;
+            propertyValueType = base.propertyValueType;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public Access getIsReadOnly() {
+            return isReadOnly;
+        }
+
+        @Override
+        public IsRequired getIsRequired() {
+            return isRequired;
+        }
+
+        @Override
+        public PropertyDefinitionKey getKey() {
+            return key;
+        }
+
+        @Override
+        public PropertyName getPropertyName() {
+            return propertyName;
+        }
+
+        @Override
+        public PropertyValueType getPropertyValueType() {
+            return propertyValueType;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(isReadOnly, isRequired, key, propertyName,
+                    propertyValueType, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            PropertyDefinitionImpl o = (PropertyDefinitionImpl) obj;
+            return Objects.equals(isReadOnly, o.isReadOnly) &&
+                    Objects.equals(isRequired, o.isRequired) &&
+                    Objects.equals(key, o.key) &&
+                    Objects.equals(propertyName, o.propertyName) &&
+                    Objects.equals(propertyValueType, o.propertyValueType) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("isReadOnly", isReadOnly)
+                    .add("isRequired", isRequired)
+                    .add("key", key)
+                    .add("propertyName", propertyName)
+                    .add("propertyValueType", propertyValueType)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKey.java
new file mode 100755
index 0000000..f937b17
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKey.java
@@ -0,0 +1,82 @@
+/*
+ * 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.nemo.model.object.property.definitions;
+
+import org.onosproject.nemo.model.common.PropertyName;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * The key to differentiate user roles.
+ */
+public class PropertyDefinitionKey {
+    private final PropertyName propertyName;
+
+    /**
+     * Creates a property definition key from a given property name.
+     *
+     * @param propertyName the property name indicator
+     */
+    public PropertyDefinitionKey(PropertyName propertyName) {
+        this.propertyName = propertyName;
+    }
+
+    /**
+     * Creates a copy from a given property definition key instance.
+     *
+     * @param key the property definition key
+     */
+    public PropertyDefinitionKey(PropertyDefinitionKey key) {
+        propertyName = key.propertyName;
+    }
+
+    /**
+     * Returns the property name of this instance.
+     *
+     * @return property name
+     */
+    public PropertyName getPropertyName() {
+        return propertyName;
+    }
+
+    @Override
+    public int hashCode() {
+        return propertyName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        PropertyDefinitionKey other = (PropertyDefinitionKey) obj;
+        return Objects.equals(propertyName, other.propertyName);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("propertyName", propertyName)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/package-info.java
new file mode 100755
index 0000000..96cd497
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/definitions/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Property definitions for NEMO model.
+ */
+package org.onosproject.nemo.model.object.property.definitions;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValues.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValues.java
new file mode 100755
index 0000000..c629e03
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValues.java
@@ -0,0 +1,49 @@
+/*
+ * 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.nemo.model.object.property.instance;
+
+import org.onosproject.nemo.model.object.property.instance.property.values.IntValue;
+import org.onosproject.nemo.model.object.property.instance.property.values.RangeValue;
+import org.onosproject.nemo.model.object.property.instance.property.values.StringValue;
+
+import java.util.List;
+
+/**
+ * Single property value's information.
+ */
+public interface PropertyValues {
+
+    /**
+     * Returns a list of values for a kind of string.
+     *
+     * @return a value of string
+     */
+    List<StringValue> getStringValues();
+
+    /**
+     * Returns a list of values for a kind of integer.
+     *
+     * @return a value of integer
+     */
+    List<IntValue> getIntValues();
+
+    /**
+     * Returns value for a kind of range.
+     *
+     * @return a value of range
+     */
+    RangeValue getRangeValue();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValuesBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValuesBuilder.java
new file mode 100755
index 0000000..4c65195
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/PropertyValuesBuilder.java
@@ -0,0 +1,198 @@
+/*
+ * 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.nemo.model.object.property.instance;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.nemo.model.object.property.instance.property.values.IntValue;
+import org.onosproject.nemo.model.object.property.instance.property.values.RangeValue;
+import org.onosproject.nemo.model.object.property.instance.property.values.StringValue;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of property values.
+ */
+public class PropertyValuesBuilder {
+
+    private Map<Class<? extends PropertyValues>, PropertyValues> augmentation =
+            Maps.newHashMap();
+    private List<IntValue> intValue;
+    private List<StringValue> stringValue;
+    private RangeValue rangeValue;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public PropertyValuesBuilder() {
+    }
+
+    /**
+     * Creates a property value builder from a property value object.
+     *
+     * @param base the property value object
+     */
+    public PropertyValuesBuilder(PropertyValues base) {
+        intValue = base.getIntValues();
+        rangeValue = base.getRangeValue();
+        stringValue = base.getStringValues();
+    }
+
+    /**
+     * Sets the integer values to be used by the builder.
+     *
+     * @param values property values
+     * @return self
+     */
+    public PropertyValuesBuilder intValues(List<IntValue> values) {
+        intValue = values;
+        return this;
+    }
+
+    /**
+     * Sets the range value to be used by the builder.
+     *
+     * @param value range value
+     * @return self
+     */
+    public PropertyValuesBuilder rangeValue(RangeValue value) {
+        rangeValue = value;
+        return this;
+    }
+
+    /**
+     * Sets the string values to be used by the builder.
+     *
+     * @param values string values
+     * @return self
+     */
+    public PropertyValuesBuilder stringValues(List<StringValue> values) {
+        stringValue = values;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public PropertyValuesBuilder addAugmentation(
+            Class<? extends PropertyValues> augmentationType,
+            PropertyValues augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public PropertyValuesBuilder removeAugmentation(
+            Class<? extends PropertyValues> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a property value from this builder instance.
+     *
+     * @return property values
+     */
+    public PropertyValues build() {
+        return new PropertyValuesImpl(this);
+    }
+
+    /**
+     * The implementation of property value interface.
+     */
+    private static final class PropertyValuesImpl implements PropertyValues {
+
+        private final List<IntValue> intValue;
+        private final RangeValue rangeValue;
+        private final List<StringValue> stringValue;
+        private final Map<Class<? extends PropertyValues>, PropertyValues>
+                augmentation;
+
+        private PropertyValuesImpl(PropertyValuesBuilder base) {
+            intValue = base.intValue;
+            rangeValue = base.rangeValue;
+            stringValue = base.stringValue;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public List<IntValue> getIntValues() {
+            return intValue;
+        }
+
+        @Override
+        public RangeValue getRangeValue() {
+            return rangeValue;
+        }
+
+        @Override
+        public List<StringValue> getStringValues() {
+            return stringValue;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(intValue, rangeValue, stringValue,
+                    augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            PropertyValuesImpl o = (PropertyValuesImpl) obj;
+            return Objects.equals(intValue, o.intValue) &&
+                    Objects.equals(rangeValue, o.rangeValue) &&
+                    Objects.equals(stringValue, o.stringValue) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("intValue", intValue)
+                    .add("rangeValue", rangeValue)
+                    .add("stringValue", stringValue)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/package-info.java
new file mode 100755
index 0000000..ee95644
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Property instance classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.property.instance;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValue.java
new file mode 100755
index 0000000..4b053b8
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValue.java
@@ -0,0 +1,43 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+/**
+ * Single User role's information.
+ */
+public interface IntValue {
+
+    /**
+     * Returns the primary value of YANG list type.
+     *
+     * @return the value
+     */
+    long getValue();
+
+    /**
+     * Returns the primary order of YANG list type.
+     *
+     * @return the order
+     */
+    long getOrder();
+
+    /**
+     * Returns the primary key of YANG list type.
+     *
+     * @return the key
+     */
+    IntValueKey getKey();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueBuilder.java
new file mode 100755
index 0000000..81a52be
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueBuilder.java
@@ -0,0 +1,215 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of integer value.
+ */
+public class IntValueBuilder {
+
+    private static final long MAX_LENGTH =  4294967295L;
+    private static final long MIN_LENGTH =  0L;
+    private static final String ERROR_LEN_MSG = "Invalid range:" +
+            " %s, expected: [[" + MIN_LENGTH + "‥" + MAX_LENGTH + "]].";
+
+    private Map<Class<? extends IntValue>, IntValue> augmentation =
+            Maps.newHashMap();
+    private IntValueKey key;
+    private long order;
+    private long value;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public IntValueBuilder() {
+    }
+
+    /**
+     * Creates a integer value builder from a integer value object.
+     *
+     * @param base the integer value object
+     */
+    public IntValueBuilder(IntValue base) {
+        if (base.getKey() == null) {
+            key = new IntValueKey(base.getOrder(), base.getValue());
+            order = base.getOrder();
+            value = base.getValue();
+        } else {
+            key = base.getKey();
+            order = key.getOrder();
+            value = key.getValue();
+        }
+    }
+
+    /**
+     * Sets the integer value key to be used by the builder.
+     *
+     * @param key integer value key
+     * @return self
+     */
+    public IntValueBuilder key(IntValueKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the order to be used by the builder.
+     *
+     * @param order order value
+     * @return self
+     */
+    public IntValueBuilder order(long order) {
+        checkOrderRange(order);
+        this.order = order;
+        return this;
+    }
+
+    /**
+     * Sets the value to be used by the builder.
+     *
+     * @param value integer value
+     * @return self
+     */
+    public IntValueBuilder value(long value) {
+        this.value = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public IntValueBuilder addAugmentation(
+            Class<? extends IntValue> augmentationType,IntValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public IntValueBuilder removeAugmentation(
+            Class<? extends IntValue> augmentationType) {
+            augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a integer value from this builder instance.
+     *
+     * @return integer value
+     */
+    public IntValue build() {
+        return new IntValueImpl(this);
+    }
+
+    private static void checkOrderRange(long value) {
+        if (value < MIN_LENGTH || value > MAX_LENGTH) {
+            throw new IllegalArgumentException(
+                    String.format(ERROR_LEN_MSG, value));
+        }
+    }
+
+    /**
+     * The implementation of integer value interface.
+     */
+    private static final class IntValueImpl implements IntValue {
+
+        private final IntValueKey key;
+        private final long order;
+        private final long value;
+        private final Map<Class<? extends IntValue>, IntValue> augmentation;
+
+        private IntValueImpl(IntValueBuilder base) {
+            if (base.key == null) {
+                key = new IntValueKey(base.order, base.value);
+                order = base.order;
+                value = base.value;
+            } else {
+                key = base.key;
+                order = key.getOrder();
+                value = key.getValue();
+            }
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public IntValueKey getKey() {
+            return key;
+        }
+
+        @Override
+        public long getOrder() {
+            return order;
+        }
+
+        @Override
+        public long getValue() {
+            return value;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, order, value, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            IntValueImpl o = (IntValueImpl) obj;
+            return Objects.equals(key, o.key) &&
+                    Objects.equals(order, o.order) &&
+                    Objects.equals(value, o.value) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("order", order)
+                    .add("value", value)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKey.java
new file mode 100755
index 0000000..e890e94
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKey.java
@@ -0,0 +1,94 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * The key to differentiate integer value.
+ */
+public class IntValueKey {
+    private final long value;
+    private final long order;
+
+    /**
+     * Creates a integer value key from a given value.
+     *
+     * @param order integer value key order
+     * @param value the integer value
+     */
+    public IntValueKey(long order, long value) {
+        this.value = value;
+        this.order = order;
+    }
+
+    /**
+     * Creates a copy from a given integer value key instance.
+     *
+     * @param key the integer value key
+     */
+    public IntValueKey(IntValueKey key) {
+        value = key.value;
+        order = key.order;
+    }
+
+    /**
+     * Returns the value of this instance.
+     *
+     * @return value,if it exists
+     */
+    public long getValue() {
+        return value;
+    }
+
+    /**
+     * Returns the order of this instance.
+     *
+     * @return order,if it exists
+     */
+    public long getOrder() {
+        return order;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(value, order);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        IntValueKey o = (IntValueKey) obj;
+        return value == o.value && order == o.order;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("value", value)
+                .add("order", order)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValue.java
new file mode 100755
index 0000000..5a9d77c
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValue.java
@@ -0,0 +1,36 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+/**
+ * Single range value's information.
+ */
+public interface RangeValue {
+
+    /**
+     * Returns minimum value.
+     *
+     * @return minimum value
+     */
+    long getMin();
+
+    /**
+     * Returns maximum value.
+     *
+     * @return maximum value
+     */
+    long getMax();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValueBuilder.java
new file mode 100755
index 0000000..375e1fd
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/RangeValueBuilder.java
@@ -0,0 +1,168 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of range value.
+ */
+public class RangeValueBuilder {
+    private Map<Class<? extends RangeValue>, RangeValue> augmentation =
+            Maps.newHashMap();
+    private long max;
+    private long min;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public RangeValueBuilder() {
+    }
+
+    /**
+     * Creates a range value builder from a range value object.
+     *
+     * @param base the range value object
+     */
+    public RangeValueBuilder(RangeValue base) {
+        max = base.getMax();
+        min = base.getMin();
+    }
+
+    /**
+     * Sets the maximum value to be used by the builder.
+     *
+     * @param value maximum range value
+     * @return self
+     */
+    public RangeValueBuilder max(long value) {
+        max = value;
+        return this;
+    }
+
+    /**
+     * Sets the minimum value to be used by the builder.
+     *
+     * @param value minimum range value
+     * @return self
+     */
+    public RangeValueBuilder min(long value) {
+        min = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public RangeValueBuilder addAugmentation(
+            Class<? extends RangeValue> augmentationType,
+            RangeValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public RangeValueBuilder removeAugmentation(
+            Class<? extends RangeValue> augmentationType) {
+            augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a range value from this builder instance.
+     *
+     * @return range value
+     */
+    public RangeValue build() {
+        return new RangeValueImpl(this);
+    }
+
+    /**
+     * The implementation of range value interface.
+     */
+    private static final class RangeValueImpl implements RangeValue {
+
+        private final long max;
+        private final long min;
+        private Map<Class<? extends RangeValue>, RangeValue> augmentation;
+
+        private RangeValueImpl(RangeValueBuilder base) {
+            max = base.max;
+            min = base.min;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public long getMax() {
+            return max;
+        }
+
+        @Override
+        public long getMin() {
+            return min;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(max, min, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            RangeValueImpl o = (RangeValueImpl) obj;
+            return Objects.equals(max, o.max) &&
+                    Objects.equals(min, o.min) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("max", max)
+                    .add("min", min)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValue.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValue.java
new file mode 100755
index 0000000..c4330c5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValue.java
@@ -0,0 +1,43 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+/**
+ * Single string value's information.
+ */
+public interface StringValue {
+
+    /**
+     * Returns the primary value of YANG list type.
+     *
+     * @return the value
+     */
+    String getValue();
+
+    /**
+     * Returns the primary order of YANG list type.
+     *
+     * @return the order
+     */
+    long getOrder();
+
+    /**
+     * Returns the primary key of YANG list type.
+     *
+     * @return the key
+     */
+    StringValueKey getKey();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueBuilder.java
new file mode 100755
index 0000000..304d59c
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueBuilder.java
@@ -0,0 +1,217 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The builder of string value.
+ */
+public class StringValueBuilder {
+
+    private static final long MAX_LENGTH =  4294967295L;
+    private static final long MIN_LENGTH =  0L;
+    private static final String ERROR_LEN_MSG = "Invalid range:" +
+            " %s, expected: [[" + MIN_LENGTH + "‥" + MAX_LENGTH + "]].";
+
+    private Map<Class<? extends StringValue>, StringValue> augmentation =
+            Maps.newHashMap();
+    private StringValueKey key;
+    private long order;
+    private String value;
+
+    /**
+     * Creates a default user role builder.
+     */
+    public StringValueBuilder() {
+    }
+
+    /**
+     * Creates a string value builder from a string value object.
+     *
+     * @param base string value object
+     */
+    public StringValueBuilder(StringValue base) {
+        if (base.getKey() == null) {
+            key = new StringValueKey(base.getOrder(), base.getValue());
+            order = base.getOrder();
+            value = base.getValue();
+        } else {
+            key = base.getKey();
+            order = key.getOrder();
+            value = key.getValue();
+        }
+    }
+
+    /**
+     * Sets the string value key to be used by the builder.
+     *
+     * @param key string value key value
+     * @return self
+     */
+    public StringValueBuilder key(StringValueKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the order value to be used by the builder.
+     *
+     * @param order string order value
+     * @return self
+     */
+    public StringValueBuilder order(long order) {
+        checkOrderRange(order);
+        this.order = order;
+        return this;
+    }
+
+    /**
+     * Sets the value to be used by the builder.
+     *
+     * @param value string value
+     * @return self
+     */
+    public StringValueBuilder value(String value) {
+        this.value = value;
+        return this;
+    }
+
+    /**
+     * Adds an augmentation to the augmentation list. If the given augmentation
+     * is null, then removes the augmentation type from the map.
+     *
+     * @param augmentationType the type of argumentation
+     * @param augmentation the augmentation
+     * @return self
+     */
+    public StringValueBuilder addAugmentation(
+            Class<? extends StringValue> augmentationType,
+            StringValue augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public StringValueBuilder removeAugmentation(
+            Class<? extends StringValue> augmentationType) {
+        this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a string value from this builder instance.
+     *
+     * @return string value
+     */
+    public StringValue build() {
+        return new StringValueImpl(this);
+    }
+
+    private static void checkOrderRange(long value) {
+        if (value < MIN_LENGTH || value > MAX_LENGTH) {
+            throw new IllegalArgumentException(
+                    String.format(ERROR_LEN_MSG, value));
+        }
+    }
+
+    /**
+     * The implementation of string value interface.
+     */
+    private static final class StringValueImpl implements StringValue {
+
+        private final StringValueKey key;
+        private final long order;
+        private final String value;
+        private final Map<Class<? extends StringValue>, StringValue>
+                augmentation;
+
+        private StringValueImpl(StringValueBuilder base) {
+            if (base.key == null) {
+                key = new StringValueKey(base.order, base.value);
+                order = base.order;
+                value = base.value;
+            } else {
+                key = base.key;
+                order = key.getOrder();
+                value = key.getValue();
+            }
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public StringValueKey getKey() {
+            return key;
+        }
+
+        @Override
+        public long getOrder() {
+            return order;
+        }
+
+        @Override
+        public String getValue() {
+            return value;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, order, value, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            StringValueImpl o = (StringValueImpl) obj;
+            return Objects.equals(key, o.key) &&
+                    Objects.equals(order, o.order) &&
+                    Objects.equals(value, o.value) &&
+                    Objects.equals(augmentation, o.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("order", order)
+                    .add("value", value)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKey.java
new file mode 100755
index 0000000..479198e
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKey.java
@@ -0,0 +1,95 @@
+/*
+ * 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.nemo.model.object.property.instance.property.values;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * The key to differentiate string value.
+ */
+public class StringValueKey {
+    private final String value;
+    private final long order;
+
+    /**
+     * Creates a string value key from a given value.
+     *
+     * @param order the string value key order
+     * @param value the string value
+     */
+    public StringValueKey(long order, String value) {
+        this.order = order;
+        this.value = value;
+    }
+
+    /**
+     * Creates a copy from a given string value key instance.
+     *
+     * @param source the string value key
+     */
+    public StringValueKey(StringValueKey source) {
+        value = source.value;
+        order = source.order;
+    }
+
+    /**
+     * Returns the value of this instance.
+     *
+     * @return string value
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Returns the order of this instance.
+     *
+     * @return order the order
+     */
+    public long getOrder() {
+        return order;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(value, order);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        StringValueKey o = (StringValueKey) obj;
+        return Objects.equals(value, o.value) &&
+                Objects.equals(order, o.order);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("value", value)
+                .add("order", order)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/package-info.java
new file mode 100755
index 0000000..b85dd1e
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/instance/property/values/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Property values classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.property.instance.property.values;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/package-info.java
new file mode 100755
index 0000000..634eeba
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/object/property/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Property classes for NEMO model.
+ */
+package org.onosproject.nemo.model.object.property;
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKeyTest.java
new file mode 100644
index 0000000..193e064
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/match/item/definitions/MatchItemDefinitionKeyTest.java
@@ -0,0 +1,48 @@
+package org.onosproject.nemo.model.object.match.item.definitions;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.MatchItemName;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link MatchItemDefinitionKey}.
+ */
+public class MatchItemDefinitionKeyTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+
+    private MatchItemDefinitionKey source;
+    private MatchItemDefinitionKey copy;
+    private MatchItemDefinitionKey diff;
+
+    @Test
+    public void fromMatchItemName() {
+        source = new MatchItemDefinitionKey(new MatchItemName(NAME));
+        assertEquals(NAME_ERROR_MSG, NAME,
+                source.getMatchItemName().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        source = new MatchItemDefinitionKey(new MatchItemName(NAME));
+        copy = new MatchItemDefinitionKey(source);
+        new EqualsTester()
+                .addEqualityGroup(source, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        source = new MatchItemDefinitionKey(new MatchItemName(NAME));
+        copy = new MatchItemDefinitionKey(new MatchItemName(NAME));
+        diff = new MatchItemDefinitionKey(new MatchItemName(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(source, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilderTest.java
new file mode 100644
index 0000000..be4eec0
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionBuilderTest.java
@@ -0,0 +1,104 @@
+package org.onosproject.nemo.model.object.node.definitions;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.NodeType;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link NodeDefinitionBuilder}.
+ */
+public class NodeDefinitionBuilderTest {
+
+    private static final String TYPE = "SomeName";
+    private static final String OTHER_TYPE = "OtherName";
+    private static final String TYPE_ERROR_MSG = "name not set";
+    private static final String KEY_ERROR_MSG = "key not set";
+    private NodeDefinitionKey key;
+    private NodeType name;
+    private NodeType otherName;
+    private NodeDefinition listParam;
+    private NodeDefinition def;
+    private NodeDefinition copy;
+    private NodeDefinition diff;
+
+    @Test
+    public void buildNodeDefinitionWithNodeDefinitionKey() {
+        name = new NodeType(TYPE);
+        key = new NodeDefinitionKey(name);
+        listParam = new NodeDefinitionBuilder()
+                .key(key)
+                .build();
+        def = new NodeDefinitionBuilder()
+                .key(key)
+                .addAugmentation(NodeDefinition.class, listParam)
+                .build();
+        def = new NodeDefinitionBuilder(def)
+                .addAugmentation(NodeDefinition.class, null)
+                .build();
+        assertEquals(TYPE_ERROR_MSG, name, def.getNodeType());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void buildNodeDefinitionWithNodeType() {
+        name = new NodeType(TYPE);
+        key = new NodeDefinitionKey(name);
+        listParam = new NodeDefinitionBuilder()
+                .nodeType(name)
+                .build();
+        def = new NodeDefinitionBuilder()
+                .nodeType(name)
+                .addAugmentation(NodeDefinition.class, listParam)
+                .build();
+        def = new NodeDefinitionBuilder(def)
+                .addAugmentation(NodeDefinition.class, null)
+                .build();
+        assertEquals(TYPE_ERROR_MSG, name, def.getNodeType());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void fromNodeWithNodeKey() {
+        name = new NodeType(TYPE);
+        key = new NodeDefinitionKey(name);
+        def = new NodeDefinitionBuilder()
+                .key(key)
+                .build();
+        copy = new NodeDefinitionBuilder(def).build();
+        assertEquals(TYPE_ERROR_MSG, name, copy.getNodeType());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void fromActionWithActionName() {
+        name = new NodeType(TYPE);
+        key = new NodeDefinitionKey(name);
+        def = new NodeDefinitionBuilder()
+                .nodeType(name)
+                .build();
+        copy = new NodeDefinitionBuilder(def).build();
+        assertEquals(TYPE_ERROR_MSG, name, copy.getNodeType());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void equality() {
+        name = new NodeType(TYPE);
+        def = new NodeDefinitionBuilder()
+                .nodeType(name)
+                .build();
+        copy = new NodeDefinitionBuilder()
+                .nodeType(name)
+                .build();
+        otherName = new NodeType(OTHER_TYPE);
+        diff = new NodeDefinitionBuilder()
+                .nodeType(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKeyTest.java
new file mode 100644
index 0000000..8071d9f
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/definitions/NodeDefinitionKeyTest.java
@@ -0,0 +1,46 @@
+package org.onosproject.nemo.model.object.node.definitions;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.NodeType;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link NodeDefinitionKey}.
+ */
+public class NodeDefinitionKeyTest {
+
+    private static final String TYPE = "SomeType";
+    private static final String OTHER = "OtherType";
+    private static final String TYPE_ERROR_MSG = "type not set";
+
+    private NodeDefinitionKey key;
+    private NodeDefinitionKey copy;
+    private NodeDefinitionKey diff;
+
+    @Test
+    public void fromNodeType() {
+        key = new NodeDefinitionKey(new NodeType(TYPE));
+        assertEquals(TYPE_ERROR_MSG, TYPE, key.getNodeType().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new NodeDefinitionKey(new NodeType(TYPE));
+        copy = new NodeDefinitionKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new NodeDefinitionKey(new NodeType(TYPE));
+        copy = new NodeDefinitionKey(new NodeType(TYPE));
+        diff = new NodeDefinitionKey(new NodeType(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilderTest.java
new file mode 100644
index 0000000..cc8d8d4
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyBuilderTest.java
@@ -0,0 +1,104 @@
+package org.onosproject.nemo.model.object.node.instance;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.PropertyName;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link PropertyBuilder}.
+ */
+public class PropertyBuilderTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER_NAME = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+    private static final String KEY_ERROR_MSG = "key not set";
+    private PropertyKey key;
+    private PropertyName name;
+    private PropertyName otherName;
+    private Property listParam;
+    private Property def;
+    private Property copy;
+    private Property diff;
+
+    @Test
+    public void buildPropertyWithPropertyKey() {
+        name = new PropertyName(NAME);
+        key = new PropertyKey(name);
+        listParam = new PropertyBuilder()
+                .key(key)
+                .build();
+        def = new PropertyBuilder()
+                .key(key)
+                .addAugmentation(Property.class, listParam)
+                .build();
+        def = new PropertyBuilder(def)
+                .addAugmentation(Property.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void buildPropertyWithPropertyName() {
+        name = new PropertyName(NAME);
+        key = new PropertyKey(name);
+        listParam = new PropertyBuilder()
+                .propertyName(name)
+                .build();
+        def = new PropertyBuilder()
+                .propertyName(name)
+                .addAugmentation(Property.class, listParam)
+                .build();
+        def = new PropertyBuilder(def)
+                .addAugmentation(Property.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void fromPropertyWithPropertyKey() {
+        name = new PropertyName(NAME);
+        key = new PropertyKey(name);
+        def = new PropertyBuilder()
+                .key(key)
+                .build();
+        copy = new PropertyBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void fromPropertyWithPropertyName() {
+        name = new PropertyName(NAME);
+        key = new PropertyKey(name);
+        def = new PropertyBuilder()
+                .propertyName(name)
+                .build();
+        copy = new PropertyBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void equality() {
+        name = new PropertyName(NAME);
+        def = new PropertyBuilder()
+                .propertyName(name)
+                .build();
+        copy = new PropertyBuilder()
+                .propertyName(name)
+                .build();
+        otherName = new PropertyName(OTHER_NAME);
+        diff = new PropertyBuilder()
+                .propertyName(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyKeyTest.java
new file mode 100644
index 0000000..ba6c8bb
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/PropertyKeyTest.java
@@ -0,0 +1,47 @@
+package org.onosproject.nemo.model.object.node.instance;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.PropertyName;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link PropertyKey}.
+ */
+public class PropertyKeyTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+
+    private PropertyKey key;
+    private PropertyKey copy;
+    private PropertyKey diff;
+
+    @Test
+    public void fromPropertyName() {
+        key = new PropertyKey(new PropertyName(NAME));
+        assertEquals(NAME_ERROR_MSG, NAME, key.getPropertyName().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new PropertyKey(new PropertyName(NAME));
+        copy = new PropertyKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new PropertyKey(new PropertyName(NAME));
+        copy = new PropertyKey(new PropertyName(NAME));
+        diff = new PropertyKey(new PropertyName(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilderTest.java
new file mode 100644
index 0000000..5c1b02c
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeBuilderTest.java
@@ -0,0 +1,104 @@
+package org.onosproject.nemo.model.object.node.instance;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.NodeId;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link SubNodeBuilder}.
+ */
+public class SubNodeBuilderTest {
+
+    private static final String NODEID = "14ce424a-3e50-4a2a-ad5c-b29845158c8b";
+    private static final String OTHER = "a4ce424a-3e50-4a2a-ad5c-b29845158c8b";
+    private static final String NODEID_ERROR_MSG = "node id not set";
+    private static final String KEY_ERROR_MSG = "key not set";
+    private SubNodeKey key;
+    private NodeId name;
+    private NodeId otherName;
+    private SubNode listParam;
+    private SubNode def;
+    private SubNode copy;
+    private SubNode diff;
+
+    @Test
+    public void buildSubNodeWithSubNodeKey() {
+        name = new NodeId(NODEID);
+        key = new SubNodeKey(name);
+        listParam = new SubNodeBuilder()
+                .key(key)
+                .build();
+        def = new SubNodeBuilder()
+                .key(key)
+                .addAugmentation(SubNode.class, listParam)
+                .build();
+        def = new SubNodeBuilder(def)
+                .addAugmentation(SubNode.class, null)
+                .build();
+        assertEquals(NODEID_ERROR_MSG, name, def.getNodeId());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void buildSubNodeWithSubNodeName() {
+        name = new NodeId(NODEID);
+        key = new SubNodeKey(name);
+        listParam = new SubNodeBuilder()
+                .nodeId(name)
+                .build();
+        def = new SubNodeBuilder()
+                .nodeId(name)
+                .addAugmentation(SubNode.class, listParam)
+                .build();
+        def = new SubNodeBuilder(def)
+                .addAugmentation(SubNode.class, null)
+                .build();
+        assertEquals(NODEID_ERROR_MSG, name, def.getNodeId());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+    }
+
+    @Test
+    public void fromSubNodeWithSubNodeKey() {
+        name = new NodeId(NODEID);
+        key = new SubNodeKey(name);
+        def = new SubNodeBuilder()
+                .key(key)
+                .build();
+        copy = new SubNodeBuilder(def).build();
+        assertEquals(NODEID_ERROR_MSG, name, copy.getNodeId());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void fromSubNodeWithSubNodeName() {
+        name = new NodeId(NODEID);
+        key = new SubNodeKey(name);
+        def = new SubNodeBuilder()
+                .nodeId(name)
+                .build();
+        copy = new SubNodeBuilder(def).build();
+        assertEquals(NODEID_ERROR_MSG, name, copy.getNodeId());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+    }
+
+    @Test
+    public void equality() {
+        name = new NodeId(NODEID);
+        def = new SubNodeBuilder()
+                .nodeId(name)
+                .build();
+        copy = new SubNodeBuilder()
+                .nodeId(name)
+                .build();
+        otherName = new NodeId(OTHER);
+        diff = new SubNodeBuilder()
+                .nodeId(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeKeyTest.java
new file mode 100644
index 0000000..cbd612d
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/node/instance/SubNodeKeyTest.java
@@ -0,0 +1,47 @@
+package org.onosproject.nemo.model.object.node.instance;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.NodeId;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link SubNodeKey}.
+ */
+public class SubNodeKeyTest {
+
+    private static final String NODEID = "14ce424a-3e50-4a2a-ad5c-b29845158c8b";
+    private static final String OTHER = "a4ce424a-3e50-4a2a-ad5c-b29845158c8b";
+    private static final String NODEID_ERROR_MSG = "node id not set";
+
+    private SubNodeKey key;
+    private SubNodeKey copy;
+    private SubNodeKey diff;
+
+    @Test
+    public void fromNodeId() {
+        key = new SubNodeKey(new NodeId(NODEID));
+        assertEquals(NODEID_ERROR_MSG, NODEID, key.getNodeId().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new SubNodeKey(new NodeId(NODEID));
+        copy = new SubNodeKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new SubNodeKey(new NodeId(NODEID));
+        copy = new SubNodeKey(new NodeId(NODEID));
+        diff = new SubNodeKey(new NodeId(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilderTest.java
new file mode 100644
index 0000000..16f7006
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionBuilderTest.java
@@ -0,0 +1,121 @@
+package org.onosproject.nemo.model.object.property.definitions;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.PropertyName;
+import org.onosproject.nemo.model.object.property.definitions.PropertyDefinition.PropertyValueType;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link PropertyDefinitionBuilder}.
+ */
+public class PropertyDefinitionBuilderTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER_NAME = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+    private static final String KEY_ERROR_MSG = "key not set";
+    private static final String TYPE_ERROR_MSG = "type not set";
+
+    private PropertyDefinitionKey key;
+    private PropertyDefinition.PropertyValueType type;
+    private PropertyName name;
+    private PropertyName otherName;
+    private PropertyDefinition listParam;
+    private PropertyDefinition def;
+    private PropertyDefinition copy;
+    private PropertyDefinition diff;
+
+    @Test
+    public void buildPropertyDefinitionWithPropertyDefinitionKey() {
+        name = new PropertyName(NAME);
+        key = new PropertyDefinitionKey(name);
+        type = PropertyValueType.forValue(0);
+        listParam = new PropertyDefinitionBuilder()
+                .key(key)
+                .build();
+        def = new PropertyDefinitionBuilder()
+                .key(key)
+                .propertyValueType(type)
+                .addAugmentation(PropertyDefinition.class, listParam)
+                .build();
+        def = new PropertyDefinitionBuilder(def)
+                .addAugmentation(PropertyDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getPropertyValueType());
+    }
+
+    @Test
+    public void buildPropertyDefinitionWithPropertyName() {
+        name = new PropertyName(NAME);
+        key = new PropertyDefinitionKey(name);
+        type = PropertyValueType.forValue(0);
+        listParam = new PropertyDefinitionBuilder()
+                .propertyName(name)
+                .build();
+        def = new PropertyDefinitionBuilder()
+                .propertyValueType(type)
+                .propertyName(name)
+                .addAugmentation(PropertyDefinition.class, listParam)
+                .build();
+        def = new PropertyDefinitionBuilder(def)
+                .addAugmentation(PropertyDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getPropertyValueType());
+    }
+
+    @Test
+    public void fromPropertyWithPropertyKey() {
+        name = new PropertyName(NAME);
+        key = new PropertyDefinitionKey(name);
+        type = PropertyValueType.forValue(0);
+        def = new PropertyDefinitionBuilder()
+                .propertyValueType(type)
+                .key(key)
+                .build();
+        copy = new PropertyDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getPropertyValueType());
+    }
+
+    @Test
+    public void fromPropertyWithPropertyName() {
+        name = new PropertyName(NAME);
+        key = new PropertyDefinitionKey(name);
+        type = PropertyValueType.forValue(0);
+        def = new PropertyDefinitionBuilder()
+                .propertyValueType(type)
+                .propertyName(name)
+                .build();
+        copy = new PropertyDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getPropertyName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getPropertyValueType());
+    }
+
+    @Test
+    public void equality() {
+        name = new PropertyName(NAME);
+        def = new PropertyDefinitionBuilder()
+                .propertyName(name)
+                .build();
+        copy = new PropertyDefinitionBuilder()
+                .propertyName(name)
+                .build();
+        otherName = new PropertyName(OTHER_NAME);
+        diff = new PropertyDefinitionBuilder()
+                .propertyName(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKeyTest.java
new file mode 100644
index 0000000..5b99f74
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/definitions/PropertyDefinitionKeyTest.java
@@ -0,0 +1,48 @@
+package org.onosproject.nemo.model.object.property.definitions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.PropertyName;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link PropertyDefinitionKey}.
+ */
+public class PropertyDefinitionKeyTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+
+    private PropertyDefinitionKey key;
+    private PropertyDefinitionKey copy;
+    private PropertyDefinitionKey diff;
+
+    @Test
+    public void fromActionName() {
+        key = new PropertyDefinitionKey(new PropertyName(NAME));
+        assertEquals(NAME_ERROR_MSG, NAME, key.getPropertyName().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new PropertyDefinitionKey(new PropertyName(NAME));
+        copy = new PropertyDefinitionKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new PropertyDefinitionKey(new PropertyName(NAME));
+        copy = new PropertyDefinitionKey(new PropertyName(NAME));
+        diff = new PropertyDefinitionKey(new PropertyName(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKeyTest.java
new file mode 100644
index 0000000..53969e0
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/IntValueKeyTest.java
@@ -0,0 +1,50 @@
+package org.onosproject.nemo.model.object.property.instance.property.values;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link IntValueKey}.
+ */
+public class IntValueKeyTest {
+
+    private static final long VALUE = 1;
+    private static final long OTHER_VALUE = 2;
+    private static final String VALUE_ERROR_MSG = "value not set";
+    private static final long ORDER = 1;
+    private static final long OTHER_ORDER = 2;
+    private static final String ORDER_ERROR_MSG = "order not set";
+
+    private IntValueKey key;
+    private IntValueKey copy;
+    private IntValueKey diff;
+
+    @Test
+    public void fromIntValue() {
+        key = new IntValueKey(VALUE,ORDER);
+        assertEquals(VALUE_ERROR_MSG, VALUE, key.getValue());
+        assertEquals(ORDER_ERROR_MSG, ORDER, key.getOrder());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new IntValueKey(VALUE,ORDER);
+        copy = new IntValueKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new IntValueKey(VALUE,ORDER);
+        copy = new IntValueKey(VALUE,ORDER);
+        diff = new IntValueKey(OTHER_VALUE,OTHER_ORDER);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKeyTest.java
new file mode 100644
index 0000000..d836f3f
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/object/property/instance/property/values/StringValueKeyTest.java
@@ -0,0 +1,51 @@
+package org.onosproject.nemo.model.object.property.instance.property.values;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link StringValueKey}.
+ */
+public class StringValueKeyTest {
+
+    private static final String VALUE = "SomeValue";
+    private static final String OTHER_VALUE = "OtherValue";
+    private static final String VALUE_ERROR_MSG = "value not set";
+    private static final long ORDER = 1;
+    private static final long OTHER_ORDER = 2;
+    private static final String ORDER_ERROR_MSG = "order not set";
+
+    private StringValueKey source;
+    private StringValueKey copy;
+    private StringValueKey diff;
+
+    @Test
+    public void fromStringValueKey() {
+        source = new StringValueKey(ORDER,VALUE);
+        assertEquals(VALUE_ERROR_MSG, VALUE, source.getValue());
+        assertEquals(ORDER_ERROR_MSG, ORDER, source.getOrder());
+    }
+
+    @Test
+    public void copyConstructor() {
+        source = new StringValueKey(ORDER,VALUE);
+        copy = new StringValueKey(source);
+        new EqualsTester()
+                .addEqualityGroup(source, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        source = new StringValueKey(ORDER,VALUE);
+        copy = new StringValueKey(ORDER,VALUE);
+        diff = new StringValueKey(OTHER_ORDER,OTHER_VALUE);
+        new EqualsTester()
+                .addEqualityGroup(source, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
