Merge "the first part of intent classes of NEMO project with unit tests"
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Objects.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Objects.java
new file mode 100644
index 0000000..a418882
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Objects.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.intent.structure.style.nemo.delete.input;
+
+import org.onosproject.nemo.model.common.ConnectionId;
+import org.onosproject.nemo.model.common.FlowId;
+import org.onosproject.nemo.model.common.NodeId;
+
+import java.util.List;
+
+/**
+ * Representation of objects.
+ */
+public interface Objects {
+
+ /**
+ * Returns a list of node identifiers.
+ *
+ * @return the list of node IDs
+ */
+ List<NodeId> getNodeIds();
+
+ /**
+ * Returns a list of connection identifiers.
+ *
+ * @return the list of connection IDs
+ */
+ List<ConnectionId> getConnectionIds();
+
+ /**
+ * Returns a list of flow identifiers.
+ *
+ * @return the list of flow IDs
+ */
+ List<FlowId> getFlowIds();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilder.java
new file mode 100644
index 0000000..493552f
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilder.java
@@ -0,0 +1,202 @@
+/*
+ * 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.intent.structure.style.nemo.delete.input;
+
+import org.onosproject.nemo.model.common.ConnectionId;
+import org.onosproject.nemo.model.common.FlowId;
+import org.onosproject.nemo.model.common.NodeId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Representation of objects builder.
+ */
+public class ObjectsBuilder {
+
+ private Map<Class<? extends Objects>, Objects> augmentation = new HashMap<>();
+
+ private List<ConnectionId> connectionIds;
+
+ private List<FlowId> flowIds;
+
+ private List<NodeId> nodeIds;
+
+ /**
+ * Constructs an objects builder.
+ */
+ public ObjectsBuilder() {
+ }
+
+ /**
+ * Constructs an objects builder from objects.
+ *
+ * @param base objects
+ */
+ public ObjectsBuilder(Objects base) {
+ connectionIds = base.getConnectionIds();
+ flowIds = base.getFlowIds();
+ nodeIds = base.getNodeIds();
+ if (base instanceof ObjectsImpl) {
+ ObjectsImpl impl = (ObjectsImpl) base;
+ if (!impl.augmentation.isEmpty()) {
+ this.augmentation = new HashMap<>(impl.augmentation);
+ }
+ }
+ }
+
+ /**
+ * Sets the connection ID list for the builder to use.
+ *
+ * @param value list of connection ID to set
+ * @return self
+ */
+ public ObjectsBuilder connectionIds(List<ConnectionId> value) {
+ connectionIds = value;
+ return this;
+ }
+
+ /**
+ * Sets the flow ID list for the builder to use.
+ *
+ * @param value list of flow ID to set
+ * @return self
+ */
+ public ObjectsBuilder flowIds(List<FlowId> value) {
+ flowIds = value;
+ return this;
+ }
+
+ /**
+ * Sets the node ID list for the builder to use.
+ *
+ * @param value list of node ID to set
+ * @return self
+ */
+ public ObjectsBuilder nodeIds(List<NodeId> value) {
+ nodeIds = value;
+ return this;
+ }
+
+ /**
+ * Adds augmentation by a class type and objects.
+ * If the augmentation is null, remove the augmentation type
+ * key from the hash map.
+ *
+ * @param augmentationType class extends Objects
+ * @param augmentation the objects
+ * @return self
+ */
+ public ObjectsBuilder addAugmentation(
+ Class<? extends Objects> augmentationType, Objects augmentation) {
+ if (augmentation == null) {
+ return removeAugmentation(augmentationType);
+ }
+ this.augmentation.put(augmentationType, augmentation);
+ return this;
+ }
+
+ /**
+ * Removes augmentation with a class type.
+ *
+ * @param augmentationType a class type extends Objects
+ * @return self
+ */
+ public ObjectsBuilder removeAugmentation(
+ Class<? extends Objects> augmentationType) {
+ augmentation.remove(augmentationType);
+ return this;
+ }
+
+ /**
+ * Builds objects.
+ *
+ * @return objects
+ */
+ public Objects build() {
+ return new ObjectsImpl(this);
+ }
+
+ /**
+ * Representation of the implement of Objects.
+ */
+ private static final class ObjectsImpl implements Objects {
+
+ private final List<ConnectionId> connectionIds;
+ private final List<FlowId> flowIds;
+ private final List<NodeId> nodeIds;
+
+ private final Map<Class<? extends Objects>, Objects> augmentation;
+
+ private ObjectsImpl(ObjectsBuilder builder) {
+ connectionIds = new ArrayList<>(builder.connectionIds);
+ flowIds = new ArrayList<>(builder.flowIds);
+ nodeIds = new ArrayList<>(builder.nodeIds);
+ augmentation = new HashMap<>(builder.augmentation);
+ }
+
+ @Override
+ public List<ConnectionId> getConnectionIds() {
+ return new ArrayList<>(connectionIds);
+ }
+
+ @Override
+ public List<FlowId> getFlowIds() {
+ return new ArrayList<>(flowIds);
+ }
+
+ @Override
+ public List<NodeId> getNodeIds() {
+ return new ArrayList<>(nodeIds);
+ }
+
+ @Override
+ public int hashCode() {
+ return java.util.Objects.hash(connectionIds, flowIds, nodeIds, augmentation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ObjectsImpl o = (ObjectsImpl) obj;
+ return java.util.Objects.equals(connectionIds, o.getConnectionIds()) &&
+ java.util.Objects.equals(flowIds, o.getFlowIds()) &&
+ java.util.Objects.equals(nodeIds, o.getNodeIds()) &&
+ java.util.Objects.equals(augmentation, o.augmentation);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("connection", connectionIds)
+ .add("flow", flowIds)
+ .add("node", nodeIds)
+ .add("augmentation", augmentation).toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Operations.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Operations.java
new file mode 100644
index 0000000..6d90a98
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/Operations.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.intent.structure.style.nemo.delete.input;
+
+import org.onosproject.nemo.model.common.OperationId;
+
+import java.util.List;
+
+/**
+ * Representation of the operations.
+ */
+public interface Operations {
+
+ /**
+ * Returns a list of operation identifiers.
+ *
+ * @return the list of operation IDs
+ */
+ List<OperationId> getOperationIds();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilder.java
new file mode 100644
index 0000000..09a6e68
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilder.java
@@ -0,0 +1,152 @@
+/*
+ * 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.intent.structure.style.nemo.delete.input;
+
+import org.onosproject.nemo.model.common.OperationId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Representation of operations builder.
+ */
+public class OperationsBuilder {
+
+ private Map<Class<? extends Operations>, Operations> augmentation = new HashMap<>();
+ private List<OperationId> operationIds;
+
+ /**
+ * Constructs an operations builder.
+ */
+ public OperationsBuilder() {
+ }
+
+ /**
+ * Constructs an operations builder from operations.
+ *
+ * @param base operations
+ */
+ public OperationsBuilder(Operations base) {
+ operationIds = base.getOperationIds();
+ if (base instanceof OperationsImpl) {
+ OperationsImpl impl = (OperationsImpl) base;
+ if (!impl.augmentation.isEmpty()) {
+ this.augmentation = new HashMap<>(impl.augmentation);
+ }
+ }
+ }
+
+ /**
+ * Sets the operation ID list for the builder to use.
+ *
+ * @param value list of operation ID to set
+ * @return self
+ */
+ public OperationsBuilder operationIds(List<OperationId> value) {
+ operationIds = value;
+ return this;
+ }
+
+ /**
+ * Adds augmentation by a class type and operations.
+ * If the augmentation is null, remove the augmentation type
+ * key from the hash map.
+ *
+ * @param augmentationType class extends Operations
+ * @param augmentation the operations
+ * @return self
+ */
+ public OperationsBuilder addAugmentation(
+ Class<? extends Operations> augmentationType, Operations augmentation) {
+ if (augmentation == null) {
+ return removeAugmentation(augmentationType);
+ }
+ this.augmentation.put(augmentationType, augmentation);
+ return this;
+ }
+
+ /**
+ * Remove augmentation with a class type.
+ *
+ * @param augmentationType a class type extends Operations
+ * @return self
+ */
+ public OperationsBuilder removeAugmentation(Class<? extends Operations> augmentationType) {
+ augmentation.remove(augmentationType);
+ return this;
+ }
+
+ /**
+ * Builds operations.
+ *
+ * @return operations
+ */
+ public Operations build() {
+ return new OperationsImpl(this);
+ }
+
+ /**
+ * Representation of the implement of Operations.
+ */
+ private static final class OperationsImpl implements Operations {
+
+ private final List<OperationId> operationIds;
+ private final Map<Class<? extends Operations>, Operations> augmentation;
+
+ private OperationsImpl(OperationsBuilder builder) {
+ operationIds = new ArrayList<>(builder.operationIds);
+ augmentation = new HashMap<>(builder.augmentation);
+ }
+
+ @Override
+ public List<OperationId> getOperationIds() {
+ return new ArrayList<>(operationIds);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(operationIds, augmentation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OperationsImpl o = (OperationsImpl) obj;
+ return Objects.equals(operationIds, o.getOperationIds()) &&
+ Objects.equals(augmentation, o.augmentation);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("operation", operationIds)
+ .add("augmentation", augmentation).toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/package-info.java
new file mode 100644
index 0000000..a2e0ee9
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/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.
+ */
+
+/**
+ * Delete input classes for NEMO model.
+ */
+package org.onosproject.nemo.model.intent.structure.style.nemo.delete.input;
\ No newline at end of file
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/main/java/org/onosproject/nemo/model/user/NemoUserData.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/NemoUserData.java
new file mode 100644
index 0000000..e01e9ca
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/NemoUserData.java
@@ -0,0 +1,28 @@
+/*
+ * 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.user;
+
+/**
+ * All Users' information data.
+ */
+public interface NemoUserData {
+ /**
+ * Returns all user roles information.
+ *
+ * @return user roles
+ */
+ UserRoles getUserRoles();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserInstance.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserInstance.java
new file mode 100644
index 0000000..d9b266b
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserInstance.java
@@ -0,0 +1,55 @@
+/*
+ * 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.user;
+
+import org.onosproject.nemo.model.common.UserId;
+import org.onosproject.nemo.model.common.UserName;
+import org.onosproject.nemo.model.common.UserPassword;
+import org.onosproject.nemo.model.common.UserRoleName;
+
+/**
+ * User instance which contains user information.
+ */
+public interface UserInstance {
+
+ /**
+ * Returns the unique ID for a user.
+ *
+ * @return user id object
+ */
+ UserId getUserId();
+
+ /**
+ * Returns the user-visible and unique name for a user.
+ *
+ * @return user
+ */
+ UserName getUserName();
+
+ /**
+ * Returns the password of a user.
+ *
+ * @return user password
+ */
+ UserPassword getUserPassword();
+
+ /**
+ * Returns the role of a user.
+ *
+ * @return user role name
+ */
+ UserRoleName getUserRole();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRoles.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRoles.java
new file mode 100644
index 0000000..a600be5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRoles.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.user;
+
+import org.onosproject.nemo.model.user.roles.UserRole;
+
+import java.util.List;
+
+/**
+ * User roles' information.
+ *
+ */
+public interface UserRoles {
+
+ /**
+ * Returns a list of user roles.
+ *
+ * @return user role list
+ */
+ List<UserRole> getUserRoles();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRolesBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRolesBuilder.java
new file mode 100644
index 0000000..d49b406
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/UserRolesBuilder.java
@@ -0,0 +1,120 @@
+/*
+ * 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.user;
+
+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.user.roles.UserRole;
+
+/**
+ * The builder of user roles.
+ */
+public class UserRolesBuilder {
+
+ private Map<UserRoles, UserRoles> augmentation = new HashMap<>();
+ private List<UserRole> userRoles;
+
+ /**
+ * Creates a default user roles builder.
+ */
+ public UserRolesBuilder() {
+ }
+
+ /**
+ * Creates a user roles builder from a user roles object.
+ *
+ * @param base the user roles object
+ */
+ public UserRolesBuilder(UserRoles base) {
+ userRoles = base.getUserRoles();
+ }
+
+ /**
+ * Sets the user role list to be used by the builder.
+ *
+ * @param value user role list
+ * @return self
+ */
+ public UserRolesBuilder userRoles(List<UserRole> value) {
+ userRoles = value;
+ return this;
+ }
+
+ /**
+ * Builds the user roles from this instance.
+ *
+ * @return user roles
+ */
+ public UserRoles build() {
+ return new UserRolesImpl(this);
+ }
+
+ /**
+ * The implementation of user role interface to create an instance.
+ */
+ private static final class UserRolesImpl implements UserRoles {
+
+ private final List<UserRole> userRoles;
+ private final Map<UserRoles, UserRoles> augmentation;
+
+ private UserRolesImpl(UserRolesBuilder base) {
+ userRoles = base.userRoles;
+ augmentation = new HashMap<>(base.augmentation);
+ }
+
+ @Override
+ public List<UserRole> getUserRoles() {
+ return userRoles;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(userRoles, augmentation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null){
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ UserRoles other = (UserRoles) obj;
+ if (!Objects.equals(userRoles, other.getUserRoles())) {
+ return false;
+ }
+ UserRolesImpl otherImpl = (UserRolesImpl) obj;
+ return Objects.equals(augmentation, otherImpl.augmentation);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("user roles", userRoles)
+ .add("augmentation", augmentation)
+ .toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/package-info.java
new file mode 100644
index 0000000..3095bd9
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/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.
+ */
+
+/**
+ * User classes for NEMO model which describe users' information.
+ */
+package org.onosproject.nemo.model.user;
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRole.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRole.java
new file mode 100644
index 0000000..4fc9fe5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRole.java
@@ -0,0 +1,47 @@
+/*
+ * 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.user.roles;
+
+import org.onosproject.nemo.model.common.UserRoleDescription;
+import org.onosproject.nemo.model.common.UserRoleName;
+
+/**
+ * Single User role's information.
+ */
+public interface UserRole {
+
+ /**
+ * Returns a user-visible and unique name for a kind of role.
+ *
+ * @return a user-visible and unique name
+ */
+ UserRoleName getRoleName();
+
+ /**
+ * Returns a description of the characteristic,
+ * responsibility and purpose for a kind of role.
+ *
+ * @return a description of the role
+ */
+ UserRoleDescription getRoleDescription();
+
+ /**
+ * Returns the primary key of YANG list type.
+ *
+ * @return the key
+ */
+ UserRoleKey getKey();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleBuilder.java
new file mode 100644
index 0000000..a0696f6
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleBuilder.java
@@ -0,0 +1,179 @@
+/*
+ * 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.user.roles;
+
+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.UserRoleDescription;
+import org.onosproject.nemo.model.common.UserRoleName;
+
+/**
+ * The builder of user role.
+ */
+public class UserRoleBuilder {
+
+ private Map<UserRole, UserRole> augmentation = new HashMap<>();
+ private UserRoleKey key;
+ private UserRoleDescription roleDescription;
+ private UserRoleName roleName;
+
+ /**
+ * Creates a default user role builder.
+ */
+ public UserRoleBuilder() {
+ }
+
+ /**
+ * Creates a user role builder from a user role object.
+ *
+ * @param base the user role object
+ */
+ public UserRoleBuilder(UserRole base) {
+ if (base.getKey() == null) {
+ key = new UserRoleKey(base.getRoleName());
+ roleName = base.getRoleName();
+ } else {
+ key = base.getKey();
+ roleName = key.getRoleName();
+ }
+ roleDescription = base.getRoleDescription();
+ }
+
+ /**
+ * Sets the key to be used by the builder.
+ *
+ * @param key key value
+ * @return self
+ */
+ public UserRoleBuilder key(UserRoleKey key) {
+ this.key = key;
+ return this;
+ }
+
+ /**
+ * Sets the description to be used by the builder.
+ *
+ * @param desc the role description
+ * @return self
+ */
+ public UserRoleBuilder roleDescription(UserRoleDescription desc) {
+ roleDescription = desc;
+ return this;
+ }
+
+ /**
+ * Sets the role name to be used by the builder.
+ *
+ * @param name user role name
+ * @return self
+ */
+ public UserRoleBuilder roleName(UserRoleName name) {
+ roleName = name;
+ return this;
+ }
+
+ /**
+ * Builds a user role from this builder instance.
+ *
+ * @return user role
+ */
+ public UserRole build() {
+ return new UserRoleImpl(this);
+ }
+
+ /**
+ * The implementation of user role interface.
+ */
+ private static final class UserRoleImpl implements UserRole {
+
+ private final UserRoleKey key;
+ private final UserRoleDescription roleDescription;
+ private final UserRoleName roleName;
+ private final Map<UserRole, UserRole> augmentation;
+
+ private UserRoleImpl(UserRoleBuilder base) {
+ if (base.key == null) {
+ key = new UserRoleKey(base.roleName);
+ roleName = base.roleName;
+ } else {
+ key = base.key;
+ roleName = key.getRoleName();
+ }
+ roleDescription = base.roleDescription;
+ augmentation = new HashMap<>(base.augmentation);
+ }
+
+ @Override
+ public UserRoleKey getKey() {
+ return key;
+ }
+
+ @Override
+ public UserRoleDescription getRoleDescription() {
+ return roleDescription;
+ }
+
+ @Override
+ public UserRoleName getRoleName() {
+ return roleName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key, roleDescription, roleName, augmentation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ UserRole other = (UserRole) obj;
+ if (!Objects.equals(roleName, other.getRoleName())) {
+ return false;
+ }
+ if (!Objects.equals(roleDescription,
+ other.getRoleDescription())) {
+ return false;
+ }
+ if (!Objects.equals(key, other.getKey())) {
+ return false;
+ }
+ UserRoleImpl otherImpl = (UserRoleImpl) obj;
+ return Objects.equals(augmentation, otherImpl.augmentation);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("key", key)
+ .add("role description", roleDescription)
+ .add("role name", roleName)
+ .add("augmentation", augmentation)
+ .toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleKey.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleKey.java
new file mode 100644
index 0000000..cd53377
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/UserRoleKey.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.user.roles;
+
+import org.onosproject.nemo.model.common.UserRoleName;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+/**
+ * The key to differentiate user roles.
+ */
+public class UserRoleKey {
+ private final UserRoleName roleName;
+
+ /**
+ * Creates a user role key from a given role name.
+ *
+ * @param roleName the role name
+ */
+ public UserRoleKey(UserRoleName roleName) {
+ this.roleName = roleName;
+ }
+
+ /**
+ * Creates a copy from a given user role key instance.
+ *
+ * @param source the user role key
+ */
+ public UserRoleKey(UserRoleKey source) {
+ this.roleName = source.roleName;
+ }
+
+ /**
+ * Returns the user role name of this instance.
+ *
+ * @return role name
+ */
+ public UserRoleName getRoleName() {
+ return roleName;
+ }
+
+ @Override
+ public int hashCode() {
+ return roleName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ UserRoleKey other = (UserRoleKey) obj;
+ return Objects.equals(roleName, other.roleName);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("rolename", roleName).toString();
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/package-info.java
new file mode 100644
index 0000000..ada7ed5
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/user/roles/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.
+ */
+
+/**
+ * User role classes for NEMO model which describe user role information.
+ */
+package org.onosproject.nemo.model.user.roles;
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilderTest.java
new file mode 100644
index 0000000..7916fb1
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/ObjectsBuilderTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.intent.structure.style.nemo.delete.input;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.ConnectionId;
+import org.onosproject.nemo.model.common.FlowId;
+import org.onosproject.nemo.model.common.NodeId;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link ObjectsBuilder}.
+ */
+public class ObjectsBuilderTest {
+
+ private static final String OBJECTS_ERROR_MSG =
+ "objects not set";
+ private static final String ID = "00000000-0000-0000-0000-000000000000";
+ private static final String OTHER_ID = "00000000-0000-0000-0000-000000000001";
+
+ private List<ConnectionId> connectionIdList;
+ private List<ConnectionId> otherConnectionIdList;
+ private List<FlowId> flowIdList;
+ private List<FlowId> otherFlowIdList;
+ private List<NodeId> nodeIdList;
+ private List<NodeId> otherNodeIdList;
+ private Objects objects;
+ private Objects copy;
+ private Objects diff;
+ private ConnectionId connectionID;
+ private ConnectionId otherconnectionID;
+
+ @Test
+ public void buildObjectsWithOperationIDlist() {
+ connectionIdList = new ArrayList<>();
+ flowIdList = new ArrayList<>();
+ nodeIdList = new ArrayList<>();
+ objects = new ObjectsBuilder()
+ .connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ assertEquals(OBJECTS_ERROR_MSG, connectionIdList,
+ objects.getConnectionIds());
+ assertEquals(OBJECTS_ERROR_MSG, flowIdList, objects.getFlowIds());
+ assertEquals(OBJECTS_ERROR_MSG, nodeIdList, objects.getNodeIds());
+ }
+
+ @Test
+ public void fromObjects() {
+ connectionIdList = new ArrayList<>();
+ flowIdList = new ArrayList<>();
+ nodeIdList = new ArrayList<>();
+ objects = new ObjectsBuilder()
+ .connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ copy = new ObjectsBuilder(objects).build();
+ assertEquals(OBJECTS_ERROR_MSG, connectionIdList,
+ copy.getConnectionIds());
+ }
+
+ @Test
+ public void equality() {
+ connectionIdList = new ArrayList<>();
+ flowIdList = new ArrayList<>();
+ nodeIdList = new ArrayList<>();
+ objects = new ObjectsBuilder()
+ .connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ otherConnectionIdList = new ArrayList<>();
+ otherConnectionIdList.add(null);
+ otherFlowIdList = new ArrayList<>();
+ otherFlowIdList.add(null);
+ otherNodeIdList = new ArrayList<>();
+ otherNodeIdList.add(null);
+ copy = new ObjectsBuilder().connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ diff = new ObjectsBuilder().connectionIds(otherConnectionIdList)
+ .flowIds(otherFlowIdList).nodeIds(otherNodeIdList)
+ .build();
+ new EqualsTester()
+ .addEqualityGroup(objects, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+
+ @Test
+ public void equalityTwo() {
+ connectionID = new ConnectionId(ID);
+ otherconnectionID = new ConnectionId(OTHER_ID);
+ connectionIdList = new ArrayList<>();
+ connectionIdList.add(connectionID);
+ flowIdList = new ArrayList<>();
+ nodeIdList = new ArrayList<>();
+ objects = new ObjectsBuilder()
+ .connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ otherConnectionIdList = new ArrayList<>();
+ otherConnectionIdList.add(otherconnectionID);
+ copy = new ObjectsBuilder()
+ .connectionIds(connectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ diff = new ObjectsBuilder()
+ .connectionIds(otherConnectionIdList)
+ .flowIds(flowIdList).nodeIds(nodeIdList)
+ .build();
+ new EqualsTester()
+ .addEqualityGroup(objects, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilderTest.java
new file mode 100644
index 0000000..ceed8c5
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/structure/style/nemo/delete/input/OperationsBuilderTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.intent.structure.style.nemo.delete.input;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.OperationId;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link OperationsBuilder}.
+ */
+public class OperationsBuilderTest {
+
+ private static final String OPERATIONS_ERROR_MSG =
+ "operations not set";
+ private static final String ID = "00000000-0000-0000-0000-000000000000";
+ private static final String OTHER_ID = "00000000-0000-0000-0000-000000000001";
+
+ private List<OperationId> operationIdList;
+ private List<OperationId> otherList;
+ private Operations operations;
+ private Operations copy;
+ private Operations diff;
+ private OperationId operationID;
+ private OperationId otheroperationID;
+
+ @Test
+ public void buildOperationsWithOperationIDlist() {
+ operationIdList = new ArrayList<>();
+ operations = new OperationsBuilder()
+ .operationIds(operationIdList)
+ .build();
+ assertEquals(OPERATIONS_ERROR_MSG, operationIdList,
+ operations.getOperationIds());
+ }
+
+ @Test
+ public void fromOperations() {
+ operationIdList = new ArrayList<>();
+ operations = new OperationsBuilder()
+ .operationIds(operationIdList)
+ .build();
+ copy = new OperationsBuilder(operations).build();
+ assertEquals(OPERATIONS_ERROR_MSG, operationIdList,
+ copy.getOperationIds());
+ }
+
+ @Test
+ public void equality() {
+ operationIdList = new ArrayList<>();
+ operations = new OperationsBuilder().operationIds(operationIdList).build();
+ otherList = new ArrayList<>();
+ otherList.add(null);
+ copy = new OperationsBuilder().operationIds(operationIdList).build();
+ diff = new OperationsBuilder().operationIds(otherList).build();
+ new EqualsTester()
+ .addEqualityGroup(operations, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+
+ @Test
+ public void equalityTwo() {
+ operationID = new OperationId(ID);
+ otheroperationID = new OperationId(OTHER_ID);
+ operationIdList = new ArrayList<>();
+ operationIdList.add(operationID);
+ operations = new OperationsBuilder().operationIds(operationIdList).build();
+ otherList = new ArrayList<>();
+ otherList.add(otheroperationID);
+ copy = new OperationsBuilder().operationIds(operationIdList).build();
+ diff = new OperationsBuilder().operationIds(otherList).build();
+ new EqualsTester()
+ .addEqualityGroup(operations, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+}
\ 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
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/user/UserRolesBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/user/UserRolesBuilderTest.java
new file mode 100644
index 0000000..e3f01df
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/user/UserRolesBuilderTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.user;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserRoleDescription;
+import org.onosproject.nemo.model.common.UserRoleName;
+import org.onosproject.nemo.model.user.roles.UserRole;
+import org.onosproject.nemo.model.user.roles.UserRoleBuilder;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link UserRolesBuilder}.
+ */
+public class UserRolesBuilderTest {
+
+ private static final String ROLES_ERROR_MSG = "user roles not set";
+ private static final String NAME = "SomeName";
+ private static final String OTHER_NAME = "OtherName";
+ private static final String DESC = "SomeDescription";
+
+ private List<UserRole> roleList;
+ private List<UserRole> otherList;
+ private UserRoles roles;
+ private UserRoles copy;
+ private UserRoles diff;
+ private UserRoleDescription desc;
+ private UserRoleName name;
+ private UserRoleName otherName;
+ private UserRole role;
+ private UserRole otherRole;
+
+ @Test
+ public void buildUserRoleWithUserRoles() {
+ roleList = new ArrayList<>();
+ roles = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ assertEquals(ROLES_ERROR_MSG, roleList, roles.getUserRoles());
+ }
+
+ @Test
+ public void fromUserRoleWithUserRoles() {
+ roleList = new ArrayList<>();
+ roles = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ copy = new UserRolesBuilder(roles).build();
+ assertEquals(ROLES_ERROR_MSG, roleList, copy.getUserRoles());
+ }
+
+ @Test
+ public void equality() {
+ roleList = new ArrayList<>();
+ roles = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ otherList = new ArrayList<>();
+ otherList.add(null);
+ copy = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ diff = new UserRolesBuilder()
+ .userRoles(otherList)
+ .build();
+ new EqualsTester()
+ .addEqualityGroup(roles, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+
+ @Test
+ public void equalityTwo() {
+ name = new UserRoleName(NAME);
+ otherName = new UserRoleName(OTHER_NAME);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(name)
+ .build();
+ roleList = new ArrayList<>();
+ roleList.add(role);
+ roles = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ otherList = new ArrayList<>();
+ otherRole = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(otherName)
+ .build();
+ otherList.add(otherRole);
+ copy = new UserRolesBuilder()
+ .userRoles(roleList)
+ .build();
+ diff = new UserRolesBuilder()
+ .userRoles(otherList)
+ .build();
+ new EqualsTester()
+ .addEqualityGroup(roles, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleBuilderTest.java
new file mode 100644
index 0000000..0ed2cd0
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleBuilderTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.user.roles;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserRoleDescription;
+import org.onosproject.nemo.model.common.UserRoleName;
+
+import com.google.common.testing.EqualsTester;
+/**
+ * Unit tests for {@link UserRoleBuilder}.
+ */
+public class UserRoleBuilderTest {
+
+ private static final String NAME = "SomeName";
+ private static final String OTHER_NAME = "OtherName";
+ private static final String DESC = "SomeDescription";
+ private static final String NAME_ERROR_MSG = "name not set";
+ private static final String DESC_ERROR_MSG = "description not set";
+ private static final String KEY_ERROR_MSG = "key not set";
+
+ private UserRoleKey key;
+ private UserRoleDescription desc;
+ private UserRoleName name;
+ private UserRoleName otherName;
+ private UserRole role;
+ private UserRole copy;
+ private UserRole diff;
+
+ @Test
+ public void buildUserRoleWithUserRoleKey() {
+ name = new UserRoleName(NAME);
+ key = new UserRoleKey(name);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .key(key)
+ .build();
+ assertEquals(NAME_ERROR_MSG, name, role.getRoleName());
+ assertEquals(KEY_ERROR_MSG, key, role.getKey());
+ assertEquals(DESC_ERROR_MSG, desc, role.getRoleDescription());
+ }
+
+ @Test
+ public void buildUserRoleWithRoleName() {
+ name = new UserRoleName(NAME);
+ key = new UserRoleKey(name);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(name)
+ .build();
+ assertEquals(NAME_ERROR_MSG, name, role.getRoleName());
+ assertEquals(KEY_ERROR_MSG, key, role.getKey());
+ assertEquals(DESC_ERROR_MSG, desc, role.getRoleDescription());
+ }
+
+ @Test
+ public void fromUserRoleWithRoleKey() {
+ name = new UserRoleName(NAME);
+ key = new UserRoleKey(name);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .key(key)
+ .build();
+ copy = new UserRoleBuilder(role).build();
+ assertEquals(NAME_ERROR_MSG, name, copy.getRoleName());
+ assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+ assertEquals(DESC_ERROR_MSG, desc, copy.getRoleDescription());
+ }
+
+ @Test
+ public void fromUserRoleWithRoleName() {
+ name = new UserRoleName(NAME);
+ key = new UserRoleKey(name);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(name)
+ .build();
+ copy = new UserRoleBuilder(role).build();
+ assertEquals(NAME_ERROR_MSG, name, copy.getRoleName());
+ assertEquals(KEY_ERROR_MSG, key, copy.getKey());
+ assertEquals(DESC_ERROR_MSG, desc, copy.getRoleDescription());
+ }
+
+ @Test
+ public void equality() {
+ name = new UserRoleName(NAME);
+ desc = new UserRoleDescription(DESC);
+ role = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(name)
+ .build();
+ copy = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(name)
+ .build();
+ otherName = new UserRoleName(OTHER_NAME);
+ diff = new UserRoleBuilder()
+ .roleDescription(desc)
+ .roleName(otherName)
+ .build();
+ new EqualsTester()
+ .addEqualityGroup(role, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleKeyTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleKeyTest.java
new file mode 100644
index 0000000..d5686be
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/user/roles/UserRoleKeyTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.user.roles;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserRoleName;
+import org.onosproject.nemo.model.user.roles.UserRoleKey;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for {@link UserRoleKey}.
+ */
+public class UserRoleKeyTest {
+
+ private static final String NAME = "SomeName";
+ private static final String OTHER = "OtherName";
+
+ private UserRoleKey key;
+ private UserRoleKey copy;
+ private UserRoleKey diff;
+
+ @Test
+ public void fromUserRoleName() {
+ key = new UserRoleKey(new UserRoleName(NAME));
+ assertEquals("name not set", NAME, key.getRoleName().getValue());
+ }
+
+ @Test
+ public void copyConstructor() {
+ key = new UserRoleKey(new UserRoleName(NAME));
+ copy = new UserRoleKey(key);
+ new EqualsTester()
+ .addEqualityGroup(key, copy)
+ .testEquals();
+ }
+
+ @Test
+ public void equality() {
+ key = new UserRoleKey(new UserRoleName(NAME));
+ copy = new UserRoleKey(new UserRoleName(NAME));
+ diff = new UserRoleKey(new UserRoleName(OTHER));
+ new EqualsTester()
+ .addEqualityGroup(key, copy)
+ .addEqualityGroup(diff)
+ .testEquals();
+ }
+}
\ No newline at end of file