Merge "Title : A part of nemo project with test"
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