Merge "user classes of model in onos-nemo"
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