diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitions.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitions.java
new file mode 100644
index 0000000..9f3cf78
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitions.java
@@ -0,0 +1,33 @@
+/*
+ * 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.operation;
+
+import java.util.List;
+
+import org.onosproject.nemo.model.operation.action.definitions.ActionDefinition;
+
+/**
+ * The definition of a group of actions.
+ */
+public interface ActionDefinitions {
+
+    /**
+     * Returns a group of action definitions.
+     *
+     * @return the list of action definitions
+     */
+    List<ActionDefinition> getActionDefinitions();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilder.java
new file mode 100644
index 0000000..039dc92
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilder.java
@@ -0,0 +1,162 @@
+/*
+ * 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.operation;
+
+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.operation.action.definitions.ActionDefinition;
+
+/**
+ * Representation of building an action definitions.
+ */
+public class ActionDefinitionsBuilder {
+
+    private Map<Class<? extends ActionDefinitions>, ActionDefinitions>
+            augmentation = new HashMap<>();
+    private List<ActionDefinition> actionDefinition;
+
+    /**
+     * Creates a default action definitions builder.
+     */
+    public ActionDefinitionsBuilder() {
+    }
+
+    /**
+     * Creates an action definitions builder from a given action definitions.
+     *
+     * @param base the action definitions
+     */
+    public ActionDefinitionsBuilder(ActionDefinitions base) {
+        actionDefinition = base.getActionDefinitions();
+        if (base instanceof ActionDefinitionsImpl) {
+            ActionDefinitionsImpl impl = (ActionDefinitionsImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the action definition to be used by the builder.
+     *
+     * @param definition action definition
+     * @return self
+     */
+    public ActionDefinitionsBuilder actionDefinitions(
+            List<ActionDefinition> definition) {
+        actionDefinition = 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 ActionDefinitionsBuilder addAugmentation(
+            Class<? extends ActionDefinitions> augmentationType,
+            ActionDefinitions augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation = new HashMap<>();
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Deletes an augmentation from the augmentation list.
+     *
+     * @param augmentationType the type of argumentation
+     * @return self
+     */
+    public ActionDefinitionsBuilder removeAugmentation(
+            Class<? extends ActionDefinitions> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an action definitions from this builder instance.
+     *
+     * @return action definitions
+     */
+    public ActionDefinitions build() {
+        return new ActionDefinitionsImpl(this);
+    }
+
+    /**
+     * The implementation of action definitions.
+     */
+    private static final class ActionDefinitionsImpl
+            implements ActionDefinitions {
+
+        private final List<ActionDefinition> actionDefinition;
+        private final Map<Class<? extends ActionDefinitions>,
+                ActionDefinitions> augmentation;
+
+        private ActionDefinitionsImpl(ActionDefinitionsBuilder base) {
+            actionDefinition = base.actionDefinition;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public List<ActionDefinition> getActionDefinitions() {
+            return actionDefinition;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(actionDefinition, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ActionDefinitions other = (ActionDefinitions) obj;
+            if (!Objects.equals(actionDefinition,
+                    other.getActionDefinitions())) {
+                return false;
+            }
+            ActionDefinitionsImpl otherImpl = (ActionDefinitionsImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("actionDefinition", actionDefinition)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitions.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitions.java
new file mode 100644
index 0000000..7c0b3e9
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitions.java
@@ -0,0 +1,33 @@
+/*
+ * 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.operation;
+
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.ConditionParameterDefinition;
+
+import java.util.List;
+
+/**
+ * The definition of a group of condition parameter.
+ */
+public interface ConditionParameterDefinitions {
+
+    /**
+     * Returns a group of condition parameter.
+     *
+     * @return the list of condition parameter
+     */
+    List<ConditionParameterDefinition> getDefinitions();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilder.java
new file mode 100644
index 0000000..4cdf1ef
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilder.java
@@ -0,0 +1,170 @@
+/*
+ * 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.operation;
+
+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.operation.condition.parameter.definitions.ConditionParameterDefinition;
+
+/**
+ * Representation of building a condition parameter definitions.
+ */
+public class ConditionParameterDefinitionsBuilder {
+
+    private Map<Class<? extends ConditionParameterDefinitions>,
+            ConditionParameterDefinitions> augmentation = new HashMap<>();
+    private List<ConditionParameterDefinition> conditionParameterDefinition;
+
+    /**
+     * Creates a default condition parameter definitions builder.
+     */
+    public ConditionParameterDefinitionsBuilder() {
+    }
+
+    /**
+     * Creates a action definitions builder from a given
+     * condition parameter definitions.
+     *
+     * @param base the condition parameter definitions
+     * @throws ClassCastException if the given class can not cast
+     */
+    public ConditionParameterDefinitionsBuilder(
+            ConditionParameterDefinitions base) {
+        conditionParameterDefinition = base.getDefinitions();
+        if (base instanceof ConditionParameterDefinitions) {
+            ConditionParameterDefinitionsImpl impl =
+                    (ConditionParameterDefinitionsImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the condition parameter definitions to be used by the builder.
+     *
+     * @param definition condition parameter definitions
+     * @return self
+     */
+    public ConditionParameterDefinitionsBuilder conditionParameterDefinitions(
+                    List<ConditionParameterDefinition> definition) {
+        conditionParameterDefinition = 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 ConditionParameterDefinitionsBuilder addAugmentation(
+            Class<? extends ConditionParameterDefinitions> augmentationType,
+            ConditionParameterDefinitions 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 ConditionParameterDefinitionsBuilder removeAugmentation(
+            Class<? extends ConditionParameterDefinitions> augmentationType) {
+        this.augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a condition parameter definitions from this builder instance.
+     *
+     * @return condition parameter definitions
+     */
+    public ConditionParameterDefinitions build() {
+        return new ConditionParameterDefinitionsImpl(this);
+    }
+
+    /**
+     * The implementation of condition parameter definitions.
+     */
+    private static final class ConditionParameterDefinitionsImpl implements
+            ConditionParameterDefinitions {
+
+        private final List<ConditionParameterDefinition>
+                conditionParameterDefinition;
+        private final Map<Class<? extends ConditionParameterDefinitions>,
+                ConditionParameterDefinitions> augmentation;
+
+        private ConditionParameterDefinitionsImpl(
+                ConditionParameterDefinitionsBuilder base) {
+            conditionParameterDefinition = base.conditionParameterDefinition;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public List<ConditionParameterDefinition> getDefinitions() {
+            return conditionParameterDefinition;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ConditionParameterDefinitions other =
+                    (ConditionParameterDefinitions) obj;
+            if (!Objects.equals(conditionParameterDefinition,
+                    other.getDefinitions())) {
+                return false;
+            }
+            ConditionParameterDefinitionsImpl otherImpl =
+                    (ConditionParameterDefinitionsImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(conditionParameterDefinition, augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("conditionParameterDefinition",
+                            conditionParameterDefinition)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/NemoOperationData.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/NemoOperationData.java
new file mode 100644
index 0000000..f89d59d
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/NemoOperationData.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.operation;
+
+/**
+ * All NEMO operation data's description.
+ */
+public interface NemoOperationData {
+
+    /**
+     * Returns all condition parameter definitions.
+     *
+     * @return condition parameter definitions
+     */
+    ConditionParameterDefinitions getConditionParameterDefinitions();
+
+    /**
+     * Returns all action definitions.
+     *
+     * @return action definitions
+     */
+    ActionDefinitions getActionDefinitions();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinition.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinition.java
new file mode 100644
index 0000000..a32b9fa
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinition.java
@@ -0,0 +1,106 @@
+/*
+ * 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.operation.action.definitions;
+
+import static com.google.common.collect.ImmutableMap.builder;
+
+import java.util.Map;
+
+import org.onosproject.nemo.model.common.ActionName;
+
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * The definition of an action.
+ */
+public interface ActionDefinition {
+
+    /**
+     * Returns the name of an action definition.
+     *
+     * @return the action name
+     */
+    ActionName getActionName();
+
+    /**
+     * Returns the type of a parameter value.
+     *
+     * @return the type
+     */
+    ParameterValueType getParameterValueType();
+
+    /**
+     * Returns the primary key of YANG type list.
+     *
+     * @return the action definition key
+     */
+    ActionDefinitionKey getKey();
+
+    /**
+     * Types of parameter value.
+     */
+    enum ParameterValueType {
+
+        /** A string-valued parameter. */
+        STRING(0),
+
+        /** An integer-valued parameter. */
+        INT(1),
+
+        /** An integer-range parameter. */
+        RANGE(2);
+
+        private static final Map<Integer, ParameterValueType> VALUE_MAP;
+
+        int value;
+
+        ParameterValueType(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns the value of this action definition.
+         *
+         * @return the value
+         */
+        public int getIntValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, ParameterValueType> b = builder();
+            for (ParameterValueType enumItem : ParameterValueType.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns the type from the given parameter value.
+         *
+         * @param value the given value
+         * @return corresponding type constant
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static ParameterValueType forValue(int value) {
+            ParameterValueType type = VALUE_MAP.get(value);
+            if (type == null) {
+                throw new IllegalArgumentException();
+            }
+            return type;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilder.java
new file mode 100644
index 0000000..a949a78
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilder.java
@@ -0,0 +1,220 @@
+/*
+ * 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.operation.action.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.ActionName;
+
+/**
+ * Representation of building an action definition.
+ */
+public class ActionDefinitionBuilder {
+
+    private Map<Class<? extends ActionDefinition>, ActionDefinition>
+            augmentation = new HashMap<>();
+    private ActionName actionName;
+    private ActionDefinitionKey key;
+    private ActionDefinition.ParameterValueType pvType;
+
+    /**
+     * Creates a default action definition builder.
+     */
+    public ActionDefinitionBuilder() {
+    }
+
+    /**
+     * Creates an action definition builder from a given action definition.
+     *
+     * @param base the action definition
+     */
+    public ActionDefinitionBuilder(ActionDefinition base) {
+        if (base.getKey() == null) {
+            key = new ActionDefinitionKey(base.getActionName());
+            actionName = base.getActionName();
+        } else {
+            key = base.getKey();
+            actionName = key.getActionName();
+        }
+        pvType = base.getParameterValueType();
+        if (base instanceof ActionDefinitionImpl) {
+            ActionDefinitionImpl impl = (ActionDefinitionImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the action name to be used by the builder.
+     *
+     * @param name the action name
+     * @return self
+     */
+    public ActionDefinitionBuilder actionName(ActionName name) {
+        actionName = name;
+        return this;
+    }
+
+    /**
+     * Sets the action definition key to be used by the builder.
+     *
+     * @param key action definition key
+     * @return self
+     */
+    public ActionDefinitionBuilder key(ActionDefinitionKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the parameter value type to be used by the builder.
+     *
+     * @param type parameter value type
+     * @return self
+     */
+    public ActionDefinitionBuilder parameterValueType(
+            ActionDefinition.ParameterValueType type) {
+        pvType = 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 ActionDefinitionBuilder addAugmentation(
+            Class<? extends ActionDefinition> augmentationType,
+            ActionDefinition 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 ActionDefinitionBuilder removeAugmentation(
+            Class<? extends ActionDefinition> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an action definition from this builder instance.
+     *
+     * @return action definition
+     */
+    public ActionDefinition build() {
+        return new ActionDefinitionImpl(this);
+    }
+
+    /**
+     * The implementation of action definition.
+     */
+    private static final class ActionDefinitionImpl
+            implements ActionDefinition {
+
+        private final ActionName actionName;
+        private final ActionDefinitionKey key;
+        private final ParameterValueType parameterValueType;
+        private final Map<Class<? extends ActionDefinition>, ActionDefinition>
+                augmentation;
+
+        private ActionDefinitionImpl(ActionDefinitionBuilder base) {
+            if (base.key == null) {
+                key = new ActionDefinitionKey(base.actionName);
+                actionName = base.actionName;
+            } else {
+                key = base.key;
+                actionName = key.getActionName();
+            }
+            parameterValueType = base.pvType;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public ActionName getActionName() {
+            return actionName;
+        }
+
+        @Override
+        public ActionDefinitionKey getKey() {
+            return key;
+        }
+
+        @Override
+        public ParameterValueType getParameterValueType() {
+            return parameterValueType;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(actionName, key, parameterValueType, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ActionDefinition other = (ActionDefinition) obj;
+            if (!Objects.equals(actionName,
+                    other.getActionName())) {
+                return false;
+            }
+            if (!Objects.equals(key,
+                    other.getKey())) {
+                return false;
+            }
+            if (!Objects.equals(parameterValueType,
+                    other.getParameterValueType())) {
+                return false;
+            }
+            ActionDefinitionImpl otherImpl = (ActionDefinitionImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("actionName", actionName)
+                    .add("key", key)
+                    .add("parameterValueType", parameterValueType)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKey.java
new file mode 100644
index 0000000..aacd456
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKey.java
@@ -0,0 +1,84 @@
+/*
+ * 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.operation.action.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.ActionName;
+
+/**
+ * The key to action definition.
+ */
+public class ActionDefinitionKey {
+
+    private final ActionName actionName;
+
+    /**
+     * Creates an action definition key from a given action name.
+     *
+     * @param actionName the action name
+     */
+    public ActionDefinitionKey(ActionName actionName) {
+        this.actionName = actionName;
+    }
+
+    /**
+     * Creates a copy from a given action definition key.
+     *
+     * @param key the action definition key
+     */
+    public ActionDefinitionKey(ActionDefinitionKey key) {
+        actionName = key.actionName;
+    }
+
+    /**
+     * Returns the action name of this instance.
+     *
+     * @return the action name
+     */
+    public ActionName getActionName() {
+        return actionName;
+    }
+
+    @Override
+    public int hashCode() {
+        return actionName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ActionDefinitionKey other = (ActionDefinitionKey) obj;
+        return Objects.equals(actionName, other.actionName);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("actionName", actionName)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/definitions/package-info.java
new file mode 100644
index 0000000..49839ff
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/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.
+ */
+
+/**
+ * Action definition classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.action.definitions;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/package-info.java
new file mode 100644
index 0000000..aea81db
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/action/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.
+ */
+
+/**
+ * Operation action description classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.action;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/package-info.java
new file mode 100644
index 0000000..a23cf12
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/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.
+ */
+
+/**
+ * Operation condition classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.condition;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinition.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinition.java
new file mode 100644
index 0000000..8987857
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinition.java
@@ -0,0 +1,113 @@
+/*
+ * 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.operation.condition.parameter.definitions;
+
+import static com.google.common.collect.ImmutableMap.builder;
+
+import java.util.Map;
+
+import org.onosproject.nemo.model.common.ParameterName;
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.condition.parameter.definition.ParameterMatchPatterns;
+
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * The definition of a condition parameter.
+ */
+public interface ConditionParameterDefinition {
+
+    /**
+     * Returns the name of an parameter definition.
+     *
+     * @return the parameter name
+     */
+    ParameterName getParameterName();
+
+    /**
+     * Returns the type of a parameter value.
+     *
+     * @return the type
+     */
+    ParameterValueType getParameterValueType();
+
+    /**
+     * Returns the parameter match patterns.
+     *
+     * @return the patterns
+     */
+    ParameterMatchPatterns getParameterMatchPatterns();
+
+    /**
+     * Returns the primary key of YANG type list.
+     *
+     * @return the action definition key
+     */
+    ConditionParameterDefinitionKey getKey();
+
+    /**
+     * Types of parameter value.
+     */
+    enum ParameterValueType {
+        /** A string-valued parameter. */
+        STRING(0),
+
+        /** An integer-valued parameter. */
+        INT(1),
+
+        /** An integer-range parameter. */
+        RANGE(2);
+
+        private static final Map<Integer, ParameterValueType> VALUE_MAP;
+
+        int value;
+
+        ParameterValueType(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns the value of this definition.
+         *
+         * @return the value
+         */
+        public int getIntValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, ParameterValueType> b = builder();
+            for (ParameterValueType enumItem : ParameterValueType.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns the type from the given value.
+         *
+         * @param value the given value
+         * @return corresponding type constant
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static ParameterValueType forValue(int value) {
+            ParameterValueType type = VALUE_MAP.get(value);
+            if (type == null) {
+                throw new IllegalArgumentException();
+            }
+            return type;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilder.java
new file mode 100644
index 0000000..7eadd84
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilder.java
@@ -0,0 +1,250 @@
+/*
+ * 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.operation.condition.parameter.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.ParameterName;
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.condition.parameter.definition.ParameterMatchPatterns;
+
+/**
+ * Representation of building a condition parameter definition.
+ */
+public class ConditionParameterDefinitionBuilder {
+
+    private Map<Class<? extends ConditionParameterDefinition>,
+            ConditionParameterDefinition> augmentation = new HashMap<>();
+    private ConditionParameterDefinitionKey key;
+    private ParameterMatchPatterns parameterMatchPatterns;
+    private ParameterName parameterName;
+    private ConditionParameterDefinition.ParameterValueType parameterValueType;
+
+    /**
+     * Creates a default condition parameter definition builder.
+     */
+    public ConditionParameterDefinitionBuilder() {
+    }
+
+    /**
+     * Creates a condition parameter builder from a given condition parameter
+     * definition.
+     *
+     * @param base the condition parameter definition
+     */
+    public ConditionParameterDefinitionBuilder(
+            ConditionParameterDefinition base){
+        if (base.getKey() == null) {
+            key = new ConditionParameterDefinitionKey(base.getParameterName());
+            parameterName = base.getParameterName();
+        } else {
+            key = base.getKey();
+            parameterName = key.getParameterName();
+        }
+        parameterMatchPatterns = base.getParameterMatchPatterns();
+        parameterValueType = base.getParameterValueType();
+        if (base instanceof ConditionParameterDefinitionImpl) {
+            ConditionParameterDefinitionImpl impl =
+                    (ConditionParameterDefinitionImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                this.augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the condition parameter definition key to be used by the builder.
+     *
+     * @param key condition parameter definition key
+     * @return self
+     */
+    public ConditionParameterDefinitionBuilder key(
+            ConditionParameterDefinitionKey key) {
+        this.key = key;
+        return this;
+    }
+
+    /**
+     * Sets the condition parameter match patterns to be used by the builder.
+     *
+     * @param patterns condition parameter match patterns
+     * @return self
+     */
+    public ConditionParameterDefinitionBuilder parameterMatchPatterns(
+            ParameterMatchPatterns patterns) {
+        parameterMatchPatterns = patterns;
+        return this;
+    }
+
+    /**
+     * Sets the parameter name to be used by the builder.
+     *
+     * @param name the parameter name
+     * @return self
+     */
+    public ConditionParameterDefinitionBuilder parameterName(
+            ParameterName name) {
+        parameterName = name;
+        return this;
+    }
+
+    /**
+     * Sets the parameter value type to be used by the builder.
+     *
+     * @param type parameter value type
+     * @return self
+     */
+    public ConditionParameterDefinitionBuilder parameterValueType(
+            ConditionParameterDefinition.ParameterValueType type) {
+        parameterValueType = 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 ConditionParameterDefinitionBuilder addAugmentation(
+            Class<? extends ConditionParameterDefinition> augmentationType,
+            ConditionParameterDefinition 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 ConditionParameterDefinitionBuilder removeAugmentation(
+            Class<? extends ConditionParameterDefinition> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a condition parameter definition from this builder instance.
+     *
+     * @return condition parameter definition
+     */
+    public ConditionParameterDefinition build() {
+        return new ConditionParameterDefinitionImpl(this);
+    }
+
+    /**
+     * The implementation of condition parameter definition.
+     */
+    private static final class ConditionParameterDefinitionImpl
+            implements ConditionParameterDefinition {
+
+        private final ConditionParameterDefinitionKey key;
+        private final ParameterMatchPatterns parameterMatchPatterns;
+        private final ParameterName parameterName;
+        private final ParameterValueType parameterValueType;
+        private final Map<Class<? extends ConditionParameterDefinition>,
+                ConditionParameterDefinition> augmentation;
+
+        private ConditionParameterDefinitionImpl(
+                ConditionParameterDefinitionBuilder base) {
+            if (base.key == null) {
+                key = new ConditionParameterDefinitionKey(base.parameterName);
+                parameterName = base.parameterName;
+            } else {
+                key = base.key;
+                parameterName = key.getParameterName();
+            }
+            parameterMatchPatterns = base.parameterMatchPatterns;
+            parameterValueType = base.parameterValueType;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public ConditionParameterDefinitionKey getKey() {
+            return key;
+        }
+
+        @Override
+        public ParameterMatchPatterns getParameterMatchPatterns() {
+            return parameterMatchPatterns;
+        }
+
+        @Override
+        public ParameterName getParameterName() {
+            return parameterName;
+        }
+
+        @Override
+        public ParameterValueType getParameterValueType() {
+            return parameterValueType;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(key, parameterMatchPatterns,
+                    parameterName, parameterValueType, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if( obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ConditionParameterDefinition other = (ConditionParameterDefinition) obj;
+            if (!Objects.equals(key, other.getKey())) {
+                return false;
+            }
+            if (!Objects.equals(parameterMatchPatterns, other.getParameterMatchPatterns())) {
+                return false;
+            }
+            if (!Objects.equals(parameterName, other.getParameterName())) {
+                return false;
+            }
+            if (!Objects.equals(parameterValueType, other.getParameterValueType())) {
+                return false;
+            }
+            ConditionParameterDefinitionImpl otherImpl = (ConditionParameterDefinitionImpl) obj;
+            return Objects.equals(augmentation, otherImpl.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("key", key)
+                    .add("parameterMatchPatterns", parameterMatchPatterns)
+                    .add("parameterName", parameterName)
+                    .add("parameterValueType", parameterValueType)
+                    .add("augmentation", augmentation)
+                    .toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKey.java
new file mode 100644
index 0000000..d0d787c
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKey.java
@@ -0,0 +1,86 @@
+/*
+ * 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.operation.condition.parameter.definitions;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+import org.onosproject.nemo.model.common.ParameterName;
+
+/**
+ * The key to condition parameter definition.
+ */
+public class ConditionParameterDefinitionKey {
+
+    private final ParameterName parameterName;
+
+    /**
+     * Creates a condition parameter definition from a given parameter name.
+     *
+     * @param parameterName the parameter name
+     */
+    public ConditionParameterDefinitionKey(ParameterName parameterName) {
+        this.parameterName = parameterName;
+    }
+
+    /**
+     * Creates a copy from a given condition parameter definition key.
+     *
+     * @param key the condition parameter definition key
+     */
+    public ConditionParameterDefinitionKey(
+            ConditionParameterDefinitionKey key) {
+        parameterName = key.parameterName;
+    }
+
+    /**
+     * Returns the parameter name of this instance.
+     *
+     * @return the parameter name
+     */
+    public ParameterName getParameterName() {
+        return parameterName;
+    }
+
+    @Override
+    public int hashCode() {
+        return parameterName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ConditionParameterDefinitionKey other =
+                (ConditionParameterDefinitionKey) obj;
+        return Objects.equals(parameterName, other.parameterName);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("parameterName", parameterName)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/ParameterMatchPatterns.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/ParameterMatchPatterns.java
new file mode 100644
index 0000000..7d5e123
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/ParameterMatchPatterns.java
@@ -0,0 +1,107 @@
+/*
+ * 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.operation.condition.parameter
+        .definitions.condition.parameter.definition;
+
+import static com.google.common.collect.ImmutableMap.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * The definition of parameter match patterns.
+ */
+public interface ParameterMatchPatterns {
+
+    /**
+     * Returns the parameter match pattern.
+     *
+     * @return the parameter match pattern
+     */
+    List<ParameterMatchPattern> getParameterMatchPattern();
+
+    /**
+     * The match pattern types of the parameter.
+     */
+    enum ParameterMatchPattern {
+        /** The parameter is less than the other. */
+        LESS_THAN(0),
+
+        /** The parameter is not less than the other. */
+        NOT_LESS_THAN(1),
+
+        /** The parameter equals to the other. */
+        EQUAL(2),
+
+        /** The parameter does not equal to the other. */
+        NOT_EQUAL(3),
+
+        /** The parameter is greater than the other. */
+        GREATER_THAN(4),
+
+        /** The parameter is not greater than the other. */
+        NOT_GREATER_THAN(5),
+
+        /** The parameter is between two parameters. */
+        BETWEEN(6),
+
+        /** The parameter is periodical. */
+        PERIODICAL(7);
+
+        private static final Map<Integer, ParameterMatchPattern> VALUE_MAP;
+
+        int value;
+
+        ParameterMatchPattern(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns the value of this parameter match pattern.
+         *
+         * @return the value
+         */
+        public int getIntValue() {
+            return value;
+        }
+
+        static {
+            Builder<Integer, ParameterMatchPattern> b = builder();
+            for (ParameterMatchPattern enumItem :
+                ParameterMatchPattern.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns the parameter match pattern from the given value.
+         *
+         * @param value the given value
+         * @return the parameter match pattern
+         * @throws IllegalArgumentException if there is no mapping
+         */
+        public static ParameterMatchPattern forValue(int value) {
+            ParameterMatchPattern pattern = VALUE_MAP.get(value);
+            if (pattern == null) {
+                throw new IllegalArgumentException();
+            }
+            return pattern;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/package-info.java
new file mode 100644
index 0000000..d21c478
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/condition/parameter/definition/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * The parameter definition pattern classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation.condition.parameter.
+        definitions.condition.parameter.definition;
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/package-info.java
new file mode 100644
index 0000000..c42f25f
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/condition/parameter/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.
+ */
+
+/**
+ * Parameter definitions classes for NEMO model which describe parameter.
+ */
+package org.onosproject.nemo.model.operation.condition.parameter.definitions;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/operation/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/package-info.java
new file mode 100644
index 0000000..ade6de1
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/operation/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.
+ */
+
+/**
+ * Operation description classes for NEMO model.
+ */
+package org.onosproject.nemo.model.operation;
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilderTest.java
new file mode 100644
index 0000000..10d4046
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ActionDefinitionsBuilderTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.operation;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ActionName;
+import org.onosproject.nemo.model.operation.action.definitions.ActionDefinition;
+import org.onosproject.nemo.model.operation.action.definitions.ActionDefinitionBuilder;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ActionDefinitionsBuilder}.
+ */
+public class ActionDefinitionsBuilderTest {
+
+    private static final String DEFINITIONS_ERROR_MSG = "definitions not set";
+    private static final String NAME = "SomeName";
+    private static final String OTHER_NAME = "OtherName";
+
+    private List<ActionDefinition> definitionList;
+    private List<ActionDefinition> otherList;
+    private ActionDefinitions definitions;
+    private ActionDefinitions copy;
+    private ActionDefinitions diff;
+    private ActionName name;
+    private ActionName otherName;
+    private ActionDefinition definition;
+    private ActionDefinition otherDefinition;
+
+    @Test
+    public void buildActionDefinitionWithActionDefinitions() {
+        definitionList = new ArrayList<>();
+        definitions = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        assertEquals(DEFINITIONS_ERROR_MSG, definitionList,
+                definitions.getActionDefinitions());
+    }
+
+    @Test
+    public void fromActionDefinitionWithActionDefinitions() {
+        definitionList = new ArrayList<>();
+        definitions = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        copy = new ActionDefinitionsBuilder(definitions).build();
+        assertEquals(DEFINITIONS_ERROR_MSG, definitionList,
+                copy.getActionDefinitions());
+    }
+
+    @Test
+    public void equality() {
+        definitionList = new ArrayList<>();
+        definitions = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        otherList = new ArrayList<>();
+        otherList.add(null);
+        copy = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        diff = new ActionDefinitionsBuilder()
+                .actionDefinitions(otherList)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(definitions, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+
+    @Test
+    public void equalityTwo() {
+        name = new ActionName(NAME);
+        otherName = new ActionName(OTHER_NAME);
+        definition = new ActionDefinitionBuilder()
+                .actionName(name)
+                .build();
+        definitionList = new ArrayList<>();
+        definitionList.add(definition);
+        definitions = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        otherList = new ArrayList<>();
+        otherDefinition = new ActionDefinitionBuilder()
+                .actionName(otherName)
+                .build();
+        otherList.add(otherDefinition);
+        copy = new ActionDefinitionsBuilder()
+                .actionDefinitions(definitionList)
+                .build();
+        diff = new ActionDefinitionsBuilder()
+                .actionDefinitions(otherList)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(definitions, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilderTest.java
new file mode 100644
index 0000000..f52c760
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/ConditionParameterDefinitionsBuilderTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.operation;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ParameterName;
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.ConditionParameterDefinition;
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.ConditionParameterDefinitionBuilder;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ConditionParameterDefinitionsBuilder}.
+ */
+public class ConditionParameterDefinitionsBuilderTest {
+
+    private static final String DEFINITIONS_ERROR_MSG = "definitions not set";
+    private static final String NAME = "SomeName";
+    private static final String OTHER_NAME = "OtherName";
+
+    private List<ConditionParameterDefinition> definitionList;
+    private List<ConditionParameterDefinition> otherList;
+    private ConditionParameterDefinitions definitions;
+    private ConditionParameterDefinitions copy;
+    private ConditionParameterDefinitions diff;
+    private ParameterName name;
+    private ParameterName otherName;
+    private ConditionParameterDefinition definition;
+    private ConditionParameterDefinition otherdefinition;
+
+    @Test
+    public void buildConditionParameterDefinitionWithParameterDefinitions() {
+        definitionList = new ArrayList<>();
+        definitions = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        assertEquals(DEFINITIONS_ERROR_MSG, definitionList,
+                definitions.getDefinitions());
+    }
+
+    @Test
+    public void fromConditionParameterDefinitionWithParameterDefinitions() {
+        definitionList = new ArrayList<>();
+        definitions = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        copy = new ConditionParameterDefinitionsBuilder(definitions).build();
+        assertEquals(DEFINITIONS_ERROR_MSG, definitionList,
+                copy.getDefinitions());
+    }
+
+    @Test
+    public void equality() {
+        definitionList = new ArrayList<>();
+        definitions = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        otherList = new ArrayList<>();
+        otherList.add(null);
+        copy = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        diff = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(otherList)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(definitions, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+
+    @Test
+    public void equalityTwo() {
+        name = new ParameterName(NAME);
+        otherName = new ParameterName(OTHER_NAME);
+        definition = new ConditionParameterDefinitionBuilder()
+                .parameterName(name)
+                .build();
+        definitionList = new ArrayList<>();
+        definitionList.add(definition);
+        definitions = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        otherList = new ArrayList<>();
+        otherdefinition = new ConditionParameterDefinitionBuilder()
+                .parameterName(otherName)
+                .build();
+        otherList.add(otherdefinition);
+        copy = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(definitionList)
+                .build();
+        diff = new ConditionParameterDefinitionsBuilder()
+                .conditionParameterDefinitions(otherList)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(definitions, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilderTest.java
new file mode 100644
index 0000000..8f8fc67
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionBuilderTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.operation.action.definitions;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ActionName;
+import org.onosproject.nemo.model.operation.action.definitions.ActionDefinition
+        .ParameterValueType;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ActionDefinitionBuilder}.
+ */
+public class ActionDefinitionBuilderTest {
+
+    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 static final int PARAMETER_VALUE_TYPE_VALID = 0;
+    private static final int PARAMETER_VALUE_TYPE_NOT_VALID = 100;
+
+    private ActionDefinitionKey key;
+    private ActionDefinition.ParameterValueType type;
+    private ActionName name;
+    private ActionName otherName;
+    private ActionDefinition listParam;
+    private ActionDefinition def;
+    private ActionDefinition copy;
+    private ActionDefinition diff;
+
+    @Test
+    public void buildActionDefinitionWithActionDefinitionKey() {
+        name = new ActionName(NAME);
+        key = new ActionDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        listParam = new ActionDefinitionBuilder()
+                .key(key)
+                .build();
+        def = new ActionDefinitionBuilder()
+                .key(key)
+                .parameterValueType(type)
+                .addAugmentation(ActionDefinition.class, listParam)
+                .build();
+        def = new ActionDefinitionBuilder(def)
+                .addAugmentation(ActionDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getActionName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void buildActionDefinitionWithActionName() {
+        name = new ActionName(NAME);
+        key = new ActionDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        listParam = new ActionDefinitionBuilder()
+                .actionName(name)
+                .build();
+        def = new ActionDefinitionBuilder()
+                .parameterValueType(type)
+                .actionName(name)
+                .addAugmentation(ActionDefinition.class, listParam)
+                .build();
+        def = new ActionDefinitionBuilder(def)
+                .addAugmentation(ActionDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getActionName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void fromActionWithActionKey() {
+        name = new ActionName(NAME);
+        key = new ActionDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        def = new ActionDefinitionBuilder()
+                .parameterValueType(type)
+                .key(key)
+                .build();
+        copy = new ActionDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getActionName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void fromActionWithActionName() {
+        name = new ActionName(NAME);
+        key = new ActionDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        def = new ActionDefinitionBuilder()
+                .parameterValueType(type)
+                .actionName(name)
+                .build();
+        copy = new ActionDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getActionName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void equality() {
+        name = new ActionName(NAME);
+        def = new ActionDefinitionBuilder()
+                .actionName(name)
+                .build();
+        copy = new ActionDefinitionBuilder()
+                .actionName(name)
+                .build();
+        otherName = new ActionName(OTHER_NAME);
+        diff = new ActionDefinitionBuilder()
+                .actionName(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void parameterValueTypeNotValid() {
+        ParameterValueType.forValue(PARAMETER_VALUE_TYPE_NOT_VALID);
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKeyTest.java
new file mode 100644
index 0000000..c1110dd
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/action/definitions/ActionDefinitionKeyTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.operation.action.definitions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ActionName;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ActionDefinitionKey}.
+ */
+public class ActionDefinitionKeyTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+
+    private ActionDefinitionKey key;
+    private ActionDefinitionKey copy;
+    private ActionDefinitionKey diff;
+
+    @Test
+    public void fromActionName() {
+        key = new ActionDefinitionKey(new ActionName(NAME));
+        assertEquals(NAME_ERROR_MSG, NAME, key.getActionName().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new ActionDefinitionKey(new ActionName(NAME));
+        copy = new ActionDefinitionKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new ActionDefinitionKey(new ActionName(NAME));
+        copy = new ActionDefinitionKey(new ActionName(NAME));
+        diff = new ActionDefinitionKey(new ActionName(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/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilderTest.java
new file mode 100644
index 0000000..42995e1
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionBuilderTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.operation.condition.parameter.definitions;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ParameterName;
+import org.onosproject.nemo.model.operation.condition.parameter.definitions.ConditionParameterDefinition.ParameterValueType;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ConditionParameterDefinitionBuilder}.
+ */
+public class ConditionParameterDefinitionBuilderTest {
+
+    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 static final int PARAMETER_VALUE_TYPE_VALID = 0;
+    private static final int PARAMETER_VALUE_TYPE_NOT_VALID = 100;
+
+    private ConditionParameterDefinitionKey key;
+    private ConditionParameterDefinition.ParameterValueType type;
+    private ParameterName name;
+    private ParameterName otherName;
+    private ConditionParameterDefinition listParam;
+    private ConditionParameterDefinition def;
+    private ConditionParameterDefinition copy;
+    private ConditionParameterDefinition diff;
+
+    @Test
+    public void buildConditionParameterDefinitionWithParameterDefinitionKey() {
+        name = new ParameterName(NAME);
+        key = new ConditionParameterDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        listParam = new ConditionParameterDefinitionBuilder()
+                .key(key)
+                .parameterValueType(type)
+                .build();
+        def = new ConditionParameterDefinitionBuilder()
+                .key(key)
+                .parameterValueType(type)
+                .addAugmentation(ConditionParameterDefinition.class, listParam)
+                .build();
+        def = new ConditionParameterDefinitionBuilder(def)
+                .addAugmentation(ConditionParameterDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getParameterName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void buildConditionParameterDefinitionWithParameterName() {
+        name = new ParameterName(NAME);
+        key = new ConditionParameterDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        listParam = new ConditionParameterDefinitionBuilder()
+                .key(key)
+                .build();
+        def = new ConditionParameterDefinitionBuilder()
+                .parameterName(name)
+                .parameterValueType(type)
+                .addAugmentation(ConditionParameterDefinition.class, listParam)
+                .build();
+        def = new ConditionParameterDefinitionBuilder(def)
+                .addAugmentation(ConditionParameterDefinition.class, null)
+                .build();
+        assertEquals(NAME_ERROR_MSG, name, def.getParameterName());
+        assertEquals(KEY_ERROR_MSG, key, def.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void fromConditionParameterDefinitionWithParameterDefinitionKey() {
+        name = new ParameterName(NAME);
+        key = new ConditionParameterDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        def = new ConditionParameterDefinitionBuilder()
+                .key(key)
+                .parameterValueType(type)
+                .build();
+        copy = new ConditionParameterDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getParameterName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void fromConditionParameterWithParameterName() {
+        name = new ParameterName(NAME);
+        key = new ConditionParameterDefinitionKey(name);
+        type = ParameterValueType.forValue(PARAMETER_VALUE_TYPE_VALID);
+        def = new ConditionParameterDefinitionBuilder()
+                .parameterName(name)
+                .parameterValueType(type)
+                .build();
+        copy = new ConditionParameterDefinitionBuilder(def).build();
+        assertEquals(NAME_ERROR_MSG, name, copy.getParameterName());
+        assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+        assertEquals(TYPE_ERROR_MSG, type, def.getParameterValueType());
+    }
+
+    @Test
+    public void equality() {
+        name = new ParameterName(NAME);
+        def = new ConditionParameterDefinitionBuilder()
+                .parameterName(name)
+                .build();
+        copy = new ConditionParameterDefinitionBuilder()
+                .parameterName(name)
+                .build();
+        otherName = new ParameterName(OTHER_NAME);
+        diff = new ConditionParameterDefinitionBuilder()
+                .parameterName(otherName)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void parameterValueTypeNotValid() {
+        ParameterValueType.forValue(PARAMETER_VALUE_TYPE_NOT_VALID);
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKeyTest.java
new file mode 100644
index 0000000..ea6a9ad
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/operation/condition/parameter/definitions/ConditionParameterDefinitionKeyTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.operation.condition.parameter.definitions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ParameterName;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ConditionParameterDefinitionKey}.
+ */
+public class ConditionParameterDefinitionKeyTest {
+
+    private static final String NAME = "SomeName";
+    private static final String OTHER = "OtherName";
+    private static final String NAME_ERROR_MSG = "name not set";
+
+    private ConditionParameterDefinitionKey key;
+    private ConditionParameterDefinitionKey copy;
+    private ConditionParameterDefinitionKey diff;
+
+    @Test
+    public void fromParameterName() {
+        key = new ConditionParameterDefinitionKey(new ParameterName(NAME));
+        assertEquals(NAME_ERROR_MSG, NAME, key.getParameterName().getValue());
+    }
+
+    @Test
+    public void copyConstructor() {
+        key = new ConditionParameterDefinitionKey(new ParameterName(NAME));
+        copy = new ConditionParameterDefinitionKey(key);
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .testEquals();
+    }
+
+    @Test
+    public void equality() {
+        key = new ConditionParameterDefinitionKey(new ParameterName(NAME));
+        copy = new ConditionParameterDefinitionKey(new ParameterName(NAME));
+        diff = new ConditionParameterDefinitionKey(new ParameterName(OTHER));
+        new EqualsTester()
+                .addEqualityGroup(key, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
