diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInput.java
new file mode 100644
index 0000000..fe4d1a4
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInput.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+/**
+ * Representation of the beginning transaction input.
+ */
+public interface BeginTransactionInput {
+
+    /**
+     * Returns a unique identifier for a user.
+     *
+     * @return the user's identifier
+     */
+    UserId getUserId();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilder.java
new file mode 100644
index 0000000..3686429
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilder.java
@@ -0,0 +1,158 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Representation of the beginning transaction input builder.
+ */
+public class BeginTransactionInputBuilder {
+
+    private Map<Class<? extends BeginTransactionInput>, BeginTransactionInput>
+            augmentation = new HashMap<>();
+
+    private UserId userId;
+
+    /**
+     * Creates a beginning transaction input builder.
+     */
+    public BeginTransactionInputBuilder() {
+    }
+
+    /**
+     * Creates a beginning transaction input builder from
+     * a beginning transaction input.
+     *
+     * @param base a beginning transaction input builder object
+     */
+    public BeginTransactionInputBuilder(BeginTransactionInput base) {
+        userId = base.getUserId();
+        if (base instanceof BeginTransactionInputImpl) {
+            BeginTransactionInputImpl impl = (BeginTransactionInputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the user ID for the builder to use.
+     *
+     * @param id user's ID to set
+     * @return self
+     */
+    public BeginTransactionInputBuilder userId(UserId id) {
+        userId = id;
+        return this;
+    }
+
+    /**
+     * Adds augmentation by a class type and a beginning transaction input.
+     * If the augmentation is null, remove the augmentation type
+     * key from the hash map.
+     *
+     * @param augmentationType class extends BeginTransactionInput
+     * @param augmentation a beginning transaction input object
+     * @return self
+     */
+    public BeginTransactionInputBuilder addAugmentation(
+            Class<? extends BeginTransactionInput> augmentationType,
+            BeginTransactionInput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType class extends BeginTransactionInput
+     * @return self
+     */
+    public BeginTransactionInputBuilder removeAugmentation(
+            Class<? extends BeginTransactionInput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a beginning transaction input object.
+     *
+     * @return beginning transaction input object
+     */
+    public BeginTransactionInput build() {
+        return new BeginTransactionInputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of BeginTransactionInput.
+     */
+    private static final class BeginTransactionInputImpl
+            implements BeginTransactionInput {
+
+        private final UserId userId;
+
+        private final Map<Class<? extends BeginTransactionInput>,
+                BeginTransactionInput> augmentation;
+
+        private BeginTransactionInputImpl(BeginTransactionInputBuilder base) {
+            userId = base.userId;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public UserId getUserId() {
+            return userId;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(userId, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            BeginTransactionInputImpl other = (BeginTransactionInputImpl) obj;
+            return Objects.equals(userId, other.getUserId()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("userId", userId)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutput.java
new file mode 100644
index 0000000..47cbc8b
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of the beginning transaction output.
+ */
+public interface BeginTransactionOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilder.java
new file mode 100644
index 0000000..fe2948f
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilder.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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of the beginning transaction output builder.
+ */
+public class BeginTransactionOutputBuilder extends DefaultOutputBuilderBase {
+
+    private Map<Class<? extends BeginTransactionOutput>, BeginTransactionOutput>
+            augmentation = new HashMap<>();
+
+    /**
+     * Creates a beginning transaction output builder.
+     */
+    public BeginTransactionOutputBuilder() {
+    }
+
+    /**
+     * Creates the beginning transaction output builder from a RPC result.
+     *
+     * @param rpc a common RPC result
+     */
+    public BeginTransactionOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Creates a beginning transaction output builder from
+     * a beginning transaction output.
+     *
+     * @param base beginning transaction output object
+     */
+    public BeginTransactionOutputBuilder(BeginTransactionOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof BeginTransactionOutputImpl) {
+            BeginTransactionOutputImpl impl = (BeginTransactionOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and a beginning transaction output.
+     * If the augmentation is null, remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType class extends BeginTransactionOutput interface
+     * @param augmentation a beginning transaction output
+     * @return self
+     */
+    public BeginTransactionOutputBuilder addAugmentation(
+            Class<? extends BeginTransactionOutput> augmentationType,
+            BeginTransactionOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType class extends BeginTransactionOutput interface
+     * @return self
+     */
+    public BeginTransactionOutputBuilder removeAugmentation(
+            Class<? extends BeginTransactionOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a beginning transaction output object.
+     *
+     * @return a beginning transaction output object
+     */
+    public BeginTransactionOutput build() {
+        return new BeginTransactionOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of BeginTransactionOutput.
+     */
+    private static final class BeginTransactionOutputImpl
+            extends DefaultOutputImplBase
+            implements BeginTransactionOutput {
+
+        private final Map<Class<? extends BeginTransactionOutput>,
+                BeginTransactionOutput> augmentation;
+
+        private BeginTransactionOutputImpl(BeginTransactionOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            BeginTransactionOutputImpl other =
+                    (BeginTransactionOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/CommonRpcResult.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/CommonRpcResult.java
new file mode 100644
index 0000000..fe4d95f
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/CommonRpcResult.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.intent;
+
+import java.util.Map;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Representation of common RPC result.
+ */
+public interface CommonRpcResult {
+
+    /**
+     * Returns result code.
+     *
+     * @return result code
+     */
+    Code getResultCode();
+
+    /**
+     * Returns message.
+     *
+     * @return message
+     */
+    String getMessage();
+
+    /**
+     * Representation of result code enum.
+     */
+    enum Code {
+
+        /**
+         * The invoked RPC was executed successfully.
+         */
+        OK(0),
+
+        /**
+         * An error occurred while executing the RPC.
+         */
+        ERROR(1);
+
+        private static final Map<Integer, Code> VALUE_MAP;
+
+        int value;
+
+        Code(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Returns integer value.
+         *
+         * @return integer value
+         */
+        public int intValue() {
+            return value;
+        }
+
+        static {
+            ImmutableMap.Builder<Integer, Code> b = ImmutableMap.builder();
+            for (Code enumItem : Code.values()) {
+                b.put(enumItem.value, enumItem);
+            }
+            VALUE_MAP = b.build();
+        }
+
+        /**
+         * Returns result code by value.
+         *
+         * @param value a map key value
+         * @return corresponding result code constant
+         */
+        public static Code forValue(int value) {
+            Code code = VALUE_MAP.get(value);
+            if (code == null) {
+                throw new IllegalArgumentException(
+                        String.format("Param %d is not valid", value));
+            }
+            return code;
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutput.java
new file mode 100644
index 0000000..64ee555
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutput.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+/**
+ * Representation of the default output.
+ */
+public interface DefaultOutput {
+
+    /**
+     * Returns message.
+     *
+     * @return message
+     */
+    String getMessage();
+
+    /**
+     * Returns result code.
+     *
+     * @return result code
+     */
+    Code getResultCode();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputBuilderBase.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputBuilderBase.java
new file mode 100644
index 0000000..fe19437
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputBuilderBase.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.intent;
+
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+/**
+ * Representation of the base of output builder.
+ */
+public class DefaultOutputBuilderBase {
+
+    /**
+     * Message for the builder to use.
+     */
+    protected String message;
+    /**
+     * Result code for the builder to use.
+     */
+    protected Code resultCode;
+
+    /**
+     * Sets the message for the builder to use.
+     *
+     * @param msg message to set
+     * @return self
+     */
+    public DefaultOutputBuilderBase message(String msg) {
+        message = msg;
+        return this;
+    }
+
+    /**
+     * Sets the result code for the builder to use.
+     *
+     * @param code result code to set
+     * @return self
+     */
+    public DefaultOutputBuilderBase resultCode(Code code) {
+        resultCode = code;
+        return this;
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputImplBase.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputImplBase.java
new file mode 100644
index 0000000..1a816ba
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/DefaultOutputImplBase.java
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+/**
+ * Representation of the base of output implement.
+ */
+public abstract class DefaultOutputImplBase {
+
+    /**
+     * Message.
+     */
+    protected String message = null;
+
+    /**
+     * Result code.
+     */
+    protected Code resultCode = null;
+
+    /**
+     * Returns message.
+     *
+     * @return message
+     */
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * Returns result code.
+     *
+     * @return result code
+     */
+    public Code getResultCode() {
+        return resultCode;
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInput.java
new file mode 100644
index 0000000..4d138dd
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInput.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+/**
+ * Representation of the end transaction input.
+ */
+public interface EndTransactionInput {
+
+    /**
+     * Returns user's identifier.
+     *
+     * @return user's identifier
+     */
+    UserId getUserId();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilder.java
new file mode 100644
index 0000000..c88ed0e
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilder.java
@@ -0,0 +1,158 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Representation of the end transaction input builder.
+ */
+public class EndTransactionInputBuilder {
+
+    private Map<Class<? extends EndTransactionInput>, EndTransactionInput>
+            augmentation = new HashMap<>();
+
+    private UserId userId;
+
+    /**
+     * Creates an end transaction input builder.
+     */
+    public EndTransactionInputBuilder() {
+    }
+
+    /**
+     * Creates an end transaction input builder from
+     * the end transaction input.
+     *
+     * @param base EndTransactionInput object
+     */
+    public EndTransactionInputBuilder(EndTransactionInput base) {
+        userId = base.getUserId();
+        if (base instanceof EndTransactionInputImpl) {
+            EndTransactionInputImpl impl = (EndTransactionInputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the user ID for the builder to use.
+     *
+     * @param id user's ID
+     * @return self
+     */
+    public EndTransactionInputBuilder userId(UserId id) {
+        userId = id;
+        return this;
+    }
+
+    /**
+     * Adds augmentation by a class type and an end transaction input.
+     * If the augmentation is null, remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType class extends EndTransactionInput
+     * @param augmentation EndTransactionInput object
+     * @return self
+     */
+    public EndTransactionInputBuilder addAugmentation(
+            Class<? extends EndTransactionInput> augmentationType,
+            EndTransactionInput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation a class type.
+     *
+     * @param augmentationType class that extends EndTransactionInput
+     * @return self
+     */
+    public EndTransactionInputBuilder removeAugmentation(
+            Class<? extends EndTransactionInput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds an end transaction input builder object.
+     *
+     * @return an end transaction input builder object
+     */
+    public EndTransactionInput build() {
+        return new EndTransactionInputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of EndTransactionInput.
+     */
+    private static final class EndTransactionInputImpl
+            implements EndTransactionInput {
+
+        private final UserId userId;
+
+        private final Map<Class<? extends EndTransactionInput>,
+                EndTransactionInput> augmentation;
+
+        private EndTransactionInputImpl(EndTransactionInputBuilder base) {
+            userId = base.userId;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public UserId getUserId() {
+            return userId;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(userId, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            EndTransactionInputImpl other = (EndTransactionInputImpl) obj;
+            return Objects.equals(userId, other.getUserId()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("userId", userId)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutput.java
new file mode 100644
index 0000000..fe7ac22
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of the end transaction output.
+ */
+public interface EndTransactionOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilder.java
new file mode 100644
index 0000000..5692c73
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilder.java
@@ -0,0 +1,151 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of the end transaction output builder.
+ */
+public class EndTransactionOutputBuilder extends DefaultOutputBuilderBase {
+
+    private Map<Class<? extends EndTransactionOutput>, EndTransactionOutput>
+            augmentation = new HashMap<>();
+
+    /**
+     * Creates an end transaction output builder object.
+     */
+    public EndTransactionOutputBuilder() {
+    }
+
+    /**
+     * Creates an end transaction output builder object from a RPC result.
+     *
+     * @param rpc a common RPC result
+     */
+    public EndTransactionOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Creates an end transaction output builder object from
+     * the end transaction output.
+     *
+     * @param base end transaction output object
+     */
+    public EndTransactionOutputBuilder(EndTransactionOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof EndTransactionOutputImpl) {
+            EndTransactionOutputImpl impl = (EndTransactionOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and an end transaction output.
+     * If the augmentation is null, remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType class that extends EndTransactionOutput
+     * @param augmentation EndTransactionOutput object
+     * @return self
+     */
+    public EndTransactionOutputBuilder addAugmentation(
+            Class<? extends EndTransactionOutput> augmentationType,
+            EndTransactionOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType class that extends EndTransactionOutput
+     * @return self
+     */
+    public EndTransactionOutputBuilder removeAugmentation(
+            Class<? extends EndTransactionOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Returns an end transaction output object.
+     *
+     * @return an end transaction output object
+     */
+    public EndTransactionOutput build() {
+        return new EndTransactionOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of EndTransactionOutput.
+     */
+    private static final class EndTransactionOutputImpl
+            extends DefaultOutputImplBase
+            implements EndTransactionOutput {
+
+        private final Map<Class<? extends EndTransactionOutput>,
+                EndTransactionOutput> augmentation;
+
+        private EndTransactionOutputImpl(EndTransactionOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            EndTransactionOutputImpl other = (EndTransactionOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInput.java
new file mode 100644
index 0000000..d0be471
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInput.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+/**
+ * Representation of language style request input.
+ */
+public interface LanguageStyleNemoRequestInput {
+
+    /**
+     * Returns user's identifier.
+     *
+     * @return user identifier
+     */
+    UserId getUserId();
+
+    /**
+     * Returns statement.
+     *
+     * @return statement
+     */
+    String getNemoStatement();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilder.java
new file mode 100644
index 0000000..705d750
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilder.java
@@ -0,0 +1,185 @@
+/*
+ * 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;
+
+import org.onosproject.nemo.model.common.UserId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Representation of language style request input object builder.
+ */
+public class LanguageStyleNemoRequestInputBuilder {
+
+    private Map<Class<? extends LanguageStyleNemoRequestInput>,
+            LanguageStyleNemoRequestInput> augmentation = new HashMap<>();
+
+    private String nemoStatement;
+
+    private UserId userId;
+
+    /**
+     * Creates a language style request input builder.
+     */
+    public LanguageStyleNemoRequestInputBuilder() {
+    }
+
+    /**
+     * Creates a language style request input builder from
+     * the language style request input.
+     *
+     * @param base language style request input object
+     */
+    public LanguageStyleNemoRequestInputBuilder(LanguageStyleNemoRequestInput base) {
+        nemoStatement = base.getNemoStatement();
+        userId = base.getUserId();
+        if (base instanceof LanguageStyleNemoRequestInputImpl) {
+            LanguageStyleNemoRequestInputImpl impl =
+                    (LanguageStyleNemoRequestInputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Sets the statement for the builder to use.
+     *
+     * @param statement statement
+     * @return self
+     */
+    public LanguageStyleNemoRequestInputBuilder nemoStatement(String statement) {
+        nemoStatement = statement;
+        return this;
+    }
+
+    /**
+     * Sets the user ID for the builder to use.
+     *
+     * @param id user ID
+     * @return self
+     */
+    public LanguageStyleNemoRequestInputBuilder userId(UserId id) {
+        userId = id;
+        return this;
+    }
+
+    /**
+     * Adds augmentation by a class type and a language style request input.
+     * If the augmentation is null,remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType type that extends LanguageStyleNemoRequestInput
+     * @param augmentation an language style request input object
+     * @return self
+     */
+    public LanguageStyleNemoRequestInputBuilder addAugmentation(
+            Class<? extends LanguageStyleNemoRequestInput> augmentationType,
+            LanguageStyleNemoRequestInput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType type that extends LanguageStyleNemoRequestInput
+     * @return self
+     */
+    public LanguageStyleNemoRequestInputBuilder removeAugmentation(
+            Class<? extends LanguageStyleNemoRequestInput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a language style request input object.
+     *
+     * @return a language style request input object
+     */
+    public LanguageStyleNemoRequestInput build() {
+        return new LanguageStyleNemoRequestInputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of LanguageStyleNemoRequestInput.
+     */
+    private static final class LanguageStyleNemoRequestInputImpl
+            implements LanguageStyleNemoRequestInput {
+
+        private final String nemoStatement;
+
+        private final UserId userId;
+
+        private final Map<Class<? extends LanguageStyleNemoRequestInput>,
+                LanguageStyleNemoRequestInput> augmentation;
+
+        private LanguageStyleNemoRequestInputImpl(
+                LanguageStyleNemoRequestInputBuilder base) {
+            nemoStatement = base.nemoStatement;
+            userId = base.userId;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public String getNemoStatement() {
+            return nemoStatement;
+        }
+
+        @Override
+        public UserId getUserId() {
+            return userId;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(nemoStatement, userId, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            LanguageStyleNemoRequestInputImpl other =
+                    (LanguageStyleNemoRequestInputImpl) obj;
+            return Objects.equals(nemoStatement, other.getNemoStatement()) &&
+                    Objects.equals(userId, other.getUserId()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("nemoStatement", nemoStatement)
+                    .add("userId", userId)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutput.java
new file mode 100644
index 0000000..e571974
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of the language style request output.
+ */
+public interface LanguageStyleNemoRequestOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilder.java
new file mode 100644
index 0000000..bf96be6
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilder.java
@@ -0,0 +1,155 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of language style request output builder.
+ */
+public class LanguageStyleNemoRequestOutputBuilder
+        extends DefaultOutputBuilderBase {
+
+    private Map<Class<? extends LanguageStyleNemoRequestOutput>,
+            LanguageStyleNemoRequestOutput> augmentation = new HashMap<>();
+
+    /**
+     * Constructs a language style request output builder object.
+     */
+    public LanguageStyleNemoRequestOutputBuilder() {
+    }
+
+    /**
+     * Constructs a language style request output builder object.
+     *
+     * @param rpc common RPC result
+     */
+    public LanguageStyleNemoRequestOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Constructs a language style request output object.
+     *
+     * @param base language style request output object
+     */
+    public LanguageStyleNemoRequestOutputBuilder(
+            LanguageStyleNemoRequestOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof LanguageStyleNemoRequestOutputImpl) {
+            LanguageStyleNemoRequestOutputImpl impl =
+                    (LanguageStyleNemoRequestOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and a language style request output.
+     * If the augmentation is null, remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType type that extends LanguageStyleNemoRequestOutput
+     * @param augmentation language style request output object
+     * @return self
+     */
+    public LanguageStyleNemoRequestOutputBuilder addAugmentation(
+            Class<? extends LanguageStyleNemoRequestOutput> augmentationType,
+            LanguageStyleNemoRequestOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType type that extends LanguageStyleNemoRequestOutput
+     * @return self
+     */
+    public LanguageStyleNemoRequestOutputBuilder removeAugmentation(
+            Class<? extends LanguageStyleNemoRequestOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a language style request output object.
+     *
+     * @return a language style request output object
+     */
+    public LanguageStyleNemoRequestOutput build() {
+        return new LanguageStyleNemoRequestOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of LanguageStyleNemoRequestOutput.
+     */
+    private static final class LanguageStyleNemoRequestOutputImpl
+            extends DefaultOutputImplBase
+            implements LanguageStyleNemoRequestOutput {
+
+        private final Map<Class<? extends LanguageStyleNemoRequestOutput>,
+                LanguageStyleNemoRequestOutput> augmentation;
+
+        private LanguageStyleNemoRequestOutputImpl(
+                LanguageStyleNemoRequestOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            LanguageStyleNemoRequestOutputImpl other =
+                    (LanguageStyleNemoRequestOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserInput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserInput.java
new file mode 100644
index 0000000..76631d8
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserInput.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.intent;
+
+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;
+
+/**
+ * Representation of register user input.
+ */
+public interface RegisterUserInput {
+
+    /**
+     * Returns user's identifier.
+     *
+     * @return a unique ID for a user.
+     */
+    UserId getUserId();
+
+    /**
+     * Returns user's name.
+     *
+     * @return a user-visible and unique name for the user.
+     */
+    UserName getUserName();
+
+    /**
+     * Returns user's password.
+     *
+     * @return a password of a user.
+     */
+    UserPassword getUserPassword();
+
+    /**
+     * Returns user's role.
+     *
+     * @return a role of a user.
+     */
+    UserRoleName getUserRole();
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutput.java
new file mode 100644
index 0000000..6652dbd
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of register user output.
+ */
+public interface RegisterUserOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilder.java
new file mode 100644
index 0000000..58ca040
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilder.java
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of register user output builder.
+ */
+public class RegisterUserOutputBuilder extends DefaultOutputBuilderBase {
+
+    private Map<Class<? extends RegisterUserOutput>, RegisterUserOutput>
+            augmentation = new HashMap<>();
+
+    public RegisterUserOutputBuilder() {
+    }
+
+    /**
+     * Constructs the register user output builder from a result code.
+     *
+     * @param rpc common RPC result
+     */
+    public RegisterUserOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Constructs register user output builder.
+     *
+     * @param base register user output object
+     */
+    public RegisterUserOutputBuilder(RegisterUserOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof RegisterUserOutputImpl) {
+            RegisterUserOutputImpl impl = (RegisterUserOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and a register user output.
+     * If the augmentation is null, remove the augmentation type key
+     * from the hash map.
+     *
+     * @param augmentationType type that extends RegisterUserOutput
+     * @param augmentation register user output object
+     * @return self
+     */
+    public RegisterUserOutputBuilder addAugmentation(
+            Class<? extends RegisterUserOutput> augmentationType,
+            RegisterUserOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType type that extends RegisterUserOutput
+     * @return self
+     */
+    public RegisterUserOutputBuilder removeAugmentation(
+            Class<? extends RegisterUserOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds a register user output object.
+     *
+     * @return the register user output object
+     */
+    public RegisterUserOutput build() {
+        return new RegisterUserOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of RegisterUserOutput.
+     */
+    private static final class RegisterUserOutputImpl
+            extends DefaultOutputImplBase
+            implements RegisterUserOutput {
+
+        private final Map<Class<? extends RegisterUserOutput>, RegisterUserOutput>
+                augmentation;
+
+        private RegisterUserOutputImpl(RegisterUserOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            RegisterUserOutputImpl other = (RegisterUserOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutput.java
new file mode 100644
index 0000000..a406d3d
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of structure style delete output.
+ */
+public interface StructureStyleNemoDeleteOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilder.java
new file mode 100644
index 0000000..0feb8ec
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilder.java
@@ -0,0 +1,158 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of structure style delete output builder.
+ */
+public class StructureStyleNemoDeleteOutputBuilder
+        extends DefaultOutputBuilderBase {
+
+    Map<Class<? extends StructureStyleNemoDeleteOutput>,
+            StructureStyleNemoDeleteOutput> augmentation
+            = new HashMap<>();
+
+    /**
+     * Constructs structure style delete output builder.
+     */
+    public StructureStyleNemoDeleteOutputBuilder() {
+    }
+
+    /**
+     * Constructs structure style delete output builder
+     * from a RPC result.
+     *
+     * @param rpc common RPC result
+     */
+    public StructureStyleNemoDeleteOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Constructs structure style delete output builder from
+     * a structure style delete output.
+     *
+     * @param base structure style delete output object
+     */
+    public StructureStyleNemoDeleteOutputBuilder(
+            StructureStyleNemoDeleteOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof StructureStyleNemoDeleteOutputImpl) {
+            StructureStyleNemoDeleteOutputImpl impl =
+                    (StructureStyleNemoDeleteOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and a structure style delete
+     * output object.If the augmentation is null,remove the augmentation
+     * type key from the hash map.
+     *
+     * @param augmentationType type that extends StructureStyleNemoDeleteOutput
+     * @param augmentation structure style delete output object
+     * @return self
+     */
+    public StructureStyleNemoDeleteOutputBuilder addAugmentation(
+            Class<? extends StructureStyleNemoDeleteOutput> augmentationType,
+            StructureStyleNemoDeleteOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType type that extends StructureStyleNemoDeleteOutput
+     * @return self
+     */
+    public StructureStyleNemoDeleteOutputBuilder removeAugmentation(
+            Class<? extends StructureStyleNemoDeleteOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds structure style delete output object.
+     *
+     * @return structure style delete output object
+     */
+    public StructureStyleNemoDeleteOutput build() {
+        return new StructureStyleNemoDeleteOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of StructureStyleNemoDeleteOutput.
+     */
+    private static final class StructureStyleNemoDeleteOutputImpl
+            extends DefaultOutputImplBase
+            implements StructureStyleNemoDeleteOutput {
+
+        private final Map<Class<? extends StructureStyleNemoDeleteOutput>,
+                StructureStyleNemoDeleteOutput> augmentation;
+
+        private StructureStyleNemoDeleteOutputImpl(
+                StructureStyleNemoDeleteOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            StructureStyleNemoDeleteOutputImpl other =
+                    (StructureStyleNemoDeleteOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutput.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutput.java
new file mode 100644
index 0000000..a47cfb8
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutput.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Representation of structure style update output.
+ */
+public interface StructureStyleNemoUpdateOutput extends DefaultOutput {
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilder.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilder.java
new file mode 100644
index 0000000..49c3449
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilder.java
@@ -0,0 +1,156 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of the structure style update output builder.
+ */
+public class StructureStyleNemoUpdateOutputBuilder extends DefaultOutputBuilderBase {
+
+    private Map<Class<? extends StructureStyleNemoUpdateOutput>,
+            StructureStyleNemoUpdateOutput>
+            augmentation = new HashMap<>();
+
+    /**
+     * Constructs a structure style update output builder.
+     */
+    public StructureStyleNemoUpdateOutputBuilder() {
+    }
+
+    /**
+     * Constructs a structure style update output builder
+     * from a RPC result.
+     *
+     * @param rpc common RPC result
+     */
+    public StructureStyleNemoUpdateOutputBuilder(CommonRpcResult rpc) {
+        resultCode = rpc.getResultCode();
+        message = rpc.getMessage();
+    }
+
+    /**
+     * Constructs structure style update output builder from
+     * a structure style update output object.
+     *
+     * @param base structure style update output object
+     */
+    public StructureStyleNemoUpdateOutputBuilder(
+            StructureStyleNemoUpdateOutput base) {
+        message = base.getMessage();
+        resultCode = base.getResultCode();
+        if (base instanceof StructureStyleNemoUpdateOutputImpl) {
+            StructureStyleNemoUpdateOutputImpl impl = (StructureStyleNemoUpdateOutputImpl) base;
+            if (!impl.augmentation.isEmpty()) {
+                augmentation = new HashMap<>(impl.augmentation);
+            }
+        }
+    }
+
+    /**
+     * Adds augmentation by a class type and a structure style update output.
+     * If the augmentation is null, remove the augmentation type key from
+     * the hash map.
+     *
+     * @param augmentationType type that extends StructureStyleNemoUpdateOutput
+     * @param augmentation StructureStyleNemoUpdateOutput object
+     * @return self
+     */
+    public StructureStyleNemoUpdateOutputBuilder addAugmentation(
+            Class<? extends StructureStyleNemoUpdateOutput> augmentationType,
+            StructureStyleNemoUpdateOutput augmentation) {
+        if (augmentation == null) {
+            return removeAugmentation(augmentationType);
+        }
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    /**
+     * Removes augmentation by a class type.
+     *
+     * @param augmentationType type that extends StructureStyleNemoUpdateOutput
+     * @return self
+     */
+    public StructureStyleNemoUpdateOutputBuilder removeAugmentation(
+            Class<? extends StructureStyleNemoUpdateOutput> augmentationType) {
+        augmentation.remove(augmentationType);
+        return this;
+    }
+
+    /**
+     * Builds the structure style update output object.
+     *
+     * @return the structure style update output object
+     */
+    public StructureStyleNemoUpdateOutput build() {
+        return new StructureStyleNemoUpdateOutputImpl(this);
+    }
+
+    /**
+     * Representation of the implement of StructureStyleNemoUpdateOutput.
+     */
+    private static final class StructureStyleNemoUpdateOutputImpl
+            extends DefaultOutputImplBase
+            implements StructureStyleNemoUpdateOutput {
+
+        private final Map<Class<? extends StructureStyleNemoUpdateOutput>,
+                StructureStyleNemoUpdateOutput> augmentation;
+
+        private StructureStyleNemoUpdateOutputImpl(
+                StructureStyleNemoUpdateOutputBuilder base) {
+            message = base.message;
+            resultCode = base.resultCode;
+            augmentation = new HashMap<>(base.augmentation);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(message, resultCode, augmentation);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            StructureStyleNemoUpdateOutputImpl other =
+                    (StructureStyleNemoUpdateOutputImpl) obj;
+            return Objects.equals(message, other.getMessage()) &&
+                    Objects.equals(resultCode, other.getResultCode()) &&
+                    Objects.equals(augmentation, other.augmentation);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("message", message)
+                    .add("resultCode", resultCode)
+                    .add("augmentation", augmentation).toString();
+        }
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/main/java/org/onosproject/nemo/model/intent/package-info.java b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/package-info.java
new file mode 100644
index 0000000..763e922
--- /dev/null
+++ b/nemoengine/src/main/java/org/onosproject/nemo/model/intent/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.
+ */
+
+/**
+ * Intent classes for NEMO model.
+ */
+package org.onosproject.nemo.model.intent;
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilderTest.java
new file mode 100644
index 0000000..5621411
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionInputBuilderTest.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.intent;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserId;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link BeginTransactionInputBuilder}.
+ */
+public class BeginTransactionInputBuilderTest {
+
+    private static final String ID = "00000000-0000-0000-0000-000000000000";
+    private static final String OTHER_ID = "00000000-0000-0000-0000-000000000001";
+    private static final String ID_ERROR_MSG = "id not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private UserId userID;
+    private UserId otherID;
+    private BeginTransactionInput listParam;
+    private BeginTransactionInput def;
+    private BeginTransactionInput copy;
+    private BeginTransactionInput diff;
+
+    @Test
+    public void buildBeginTransactionInputWithUserID() {
+        userID = new UserId(ID);
+        listParam = new BeginTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        def = new BeginTransactionInputBuilder()
+                .userId(userID)
+                .addAugmentation(BeginTransactionInput.class, listParam)
+                .build();
+        def = new BeginTransactionInputBuilder(def)
+                .addAugmentation(BeginTransactionInput.class, null)
+                .build();
+        assertEquals(ID_ERROR_MSG, userID, def.getUserId());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromBeginTransactionInput() {
+        userID = new UserId(ID);
+        def = new BeginTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        copy = new BeginTransactionInputBuilder(def).build();
+        assertEquals(ID_ERROR_MSG, userID, copy.getUserId());
+    }
+
+    @Test
+    public void equality() {
+        userID = new UserId(ID);
+        def = new BeginTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        copy = new BeginTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        otherID = new UserId(OTHER_ID);
+        diff = new BeginTransactionInputBuilder()
+                .userId(otherID)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilderTest.java
new file mode 100644
index 0000000..fa9a0ec
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/BeginTransactionOutputBuilderTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.intent;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link BeginTransactionOutputBuilder}.
+ */
+public class BeginTransactionOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private BeginTransactionOutput listParam;
+    private BeginTransactionOutput def;
+    private BeginTransactionOutput copy;
+    private BeginTransactionOutput diff;
+
+    @Test
+    public void buildBeginTransactionOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((BeginTransactionOutputBuilder)
+                new BeginTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((BeginTransactionOutputBuilder) new BeginTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(BeginTransactionOutput.class, listParam)
+                .build();
+        def = new BeginTransactionOutputBuilder(def)
+                .addAugmentation(BeginTransactionOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromBeginTransactionOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((BeginTransactionOutputBuilder) new BeginTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new BeginTransactionOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((BeginTransactionOutputBuilder) new BeginTransactionOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        copy = ((BeginTransactionOutputBuilder) new BeginTransactionOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((BeginTransactionOutputBuilder) new BeginTransactionOutputBuilder()
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilderTest.java
new file mode 100644
index 0000000..bd4b76c
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionInputBuilderTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserId;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link EndTransactionInputBuilder}.
+ */
+public class EndTransactionInputBuilderTest {
+
+    private static final String ID = "00000000-0000-0000-0000-000000000000";
+    private static final String OTHER_ID = "00000000-0000-0000-0000-000000000001";
+    private static final String ID_ERROR_MSG = "id not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private UserId userID;
+    private UserId otherID;
+    private EndTransactionInput listParam;
+    private EndTransactionInput def;
+    private EndTransactionInput copy;
+    private EndTransactionInput diff;
+
+    @Test
+    public void buildEndTransactionInputWithUserID() {
+        userID = new UserId(ID);
+        listParam = new EndTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        def = new EndTransactionInputBuilder()
+                .userId(userID)
+                .addAugmentation(EndTransactionInput.class, listParam)
+                .build();
+        def = new EndTransactionInputBuilder(def)
+                .addAugmentation(EndTransactionInput.class, null)
+                .build();
+        assertEquals(ID_ERROR_MSG, userID, def.getUserId());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromEndTransactionInput() {
+        userID = new UserId(ID);
+        def = new EndTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        copy = new EndTransactionInputBuilder(def).build();
+        assertEquals(ID_ERROR_MSG, userID, copy.getUserId());
+    }
+
+    @Test
+    public void equality() {
+        userID = new UserId(ID);
+        def = new EndTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        copy = new EndTransactionInputBuilder()
+                .userId(userID)
+                .build();
+        otherID = new UserId(OTHER_ID);
+        diff = new EndTransactionInputBuilder()
+                .userId(otherID)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilderTest.java
new file mode 100644
index 0000000..e12289f
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/EndTransactionOutputBuilderTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.intent;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link EndTransactionOutputBuilder}.
+ */
+public class EndTransactionOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private EndTransactionOutput listParam;
+    private EndTransactionOutput def;
+    private EndTransactionOutput copy;
+    private EndTransactionOutput diff;
+
+    @Test
+    public void buildEndTransactionOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((EndTransactionOutputBuilder)
+                new EndTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((EndTransactionOutputBuilder) new EndTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(EndTransactionOutput.class, listParam)
+                .build();
+        def = new EndTransactionOutputBuilder(def)
+                .addAugmentation(EndTransactionOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromEndTransactionOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((EndTransactionOutputBuilder) new EndTransactionOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new EndTransactionOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((EndTransactionOutputBuilder) new EndTransactionOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        copy = ((EndTransactionOutputBuilder) new EndTransactionOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((EndTransactionOutputBuilder) new EndTransactionOutputBuilder()
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilderTest.java
new file mode 100644
index 0000000..227acc8
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestInputBuilderTest.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;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.common.UserId;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link LanguageStyleNemoRequestInputBuilder}.
+ */
+public class LanguageStyleNemoRequestInputBuilderTest {
+
+    private static final String ID = "00000000-0000-0000-0000-000000000000";
+    private static final String OTHER_ID = "00000000-0000-0000-0000-000000000001";
+    private static final String STATEMENT = "SomeStatement";
+    private static final String OTHER_STATEMENT= "OtherStatement";
+    private static final String ID_ERROR_MSG = "id not set";
+    private static final String STATEMENT_ERROR_MSG = "statement not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private UserId userID;
+    private UserId otherID;
+    private LanguageStyleNemoRequestInput listParam;
+    private LanguageStyleNemoRequestInput def;
+    private LanguageStyleNemoRequestInput copy;
+    private LanguageStyleNemoRequestInput diff;
+
+    @Test
+    public void buildLanguageStyleNemoRequestInputWithUserID() {
+        userID = new UserId(ID);
+        listParam = new LanguageStyleNemoRequestInputBuilder()
+                .userId(userID)
+                .nemoStatement(STATEMENT)
+                .build();
+        def = new LanguageStyleNemoRequestInputBuilder()
+                .userId(userID)
+                .nemoStatement(STATEMENT)
+                .addAugmentation(LanguageStyleNemoRequestInput.class, listParam)
+                .build();
+        def = new LanguageStyleNemoRequestInputBuilder(def)
+                .addAugmentation(LanguageStyleNemoRequestInput.class, null)
+                .build();
+        assertEquals(ID_ERROR_MSG, userID, def.getUserId());
+        assertEquals(STATEMENT_ERROR_MSG, STATEMENT, def.getNemoStatement());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromLanguageStyleNemoRequestInput() {
+        userID = new UserId(ID);
+        def = new LanguageStyleNemoRequestInputBuilder()
+                .userId(userID)
+                .nemoStatement(STATEMENT)
+                .build();
+        copy = new LanguageStyleNemoRequestInputBuilder(def).build();
+        assertEquals(ID_ERROR_MSG, userID, copy.getUserId());
+        assertEquals(STATEMENT_ERROR_MSG, STATEMENT, copy.getNemoStatement());
+    }
+
+    @Test
+    public void equality() {
+        userID = new UserId(ID);
+        def = new LanguageStyleNemoRequestInputBuilder()
+                .userId(userID)
+                .nemoStatement(STATEMENT)
+                .build();
+        copy = new LanguageStyleNemoRequestInputBuilder(def)
+                .build();
+        otherID = new UserId(OTHER_ID);
+        diff = new LanguageStyleNemoRequestInputBuilder()
+                .userId(otherID)
+                .nemoStatement(OTHER_STATEMENT)
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilderTest.java
new file mode 100644
index 0000000..2271458
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/LanguageStyleNemoRequestOutputBuilderTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link LanguageStyleNemoRequestOutputBuilder}.
+ */
+public class LanguageStyleNemoRequestOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private LanguageStyleNemoRequestOutput listParam;
+    private LanguageStyleNemoRequestOutput def;
+    private LanguageStyleNemoRequestOutput copy;
+    private LanguageStyleNemoRequestOutput diff;
+
+    @Test
+    public void buildLanguageStyleNemoRequestOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(LanguageStyleNemoRequestOutput.class, listParam)
+                .build();
+        def = new LanguageStyleNemoRequestOutputBuilder(def)
+                .addAugmentation(LanguageStyleNemoRequestOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromLanguageStyleNemoRequestOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new LanguageStyleNemoRequestOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        copy = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((LanguageStyleNemoRequestOutputBuilder)
+                new LanguageStyleNemoRequestOutputBuilder()
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilderTest.java
new file mode 100644
index 0000000..4181ffb
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/RegisterUserOutputBuilderTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.nemo.model.intent;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link RegisterUserOutputBuilder}.
+ */
+public class RegisterUserOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private RegisterUserOutput listParam;
+    private RegisterUserOutput def;
+    private RegisterUserOutput copy;
+    private RegisterUserOutput diff;
+
+    @Test
+    public void buildRegisterUserOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((RegisterUserOutputBuilder)
+                new RegisterUserOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((RegisterUserOutputBuilder) new RegisterUserOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(RegisterUserOutput.class, listParam)
+                .build();
+        def = new RegisterUserOutputBuilder(def)
+                .addAugmentation(RegisterUserOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromRegisterUserOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((RegisterUserOutputBuilder) new RegisterUserOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new RegisterUserOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((RegisterUserOutputBuilder) new RegisterUserOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        copy = ((RegisterUserOutputBuilder) new RegisterUserOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((RegisterUserOutputBuilder) new RegisterUserOutputBuilder()
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilderTest.java
new file mode 100644
index 0000000..9bf0636
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoDeleteOutputBuilderTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link StructureStyleNemoDeleteOutputBuilder}.
+ */
+public class StructureStyleNemoDeleteOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private StructureStyleNemoDeleteOutput listParam;
+    private StructureStyleNemoDeleteOutput def;
+    private StructureStyleNemoDeleteOutput copy;
+    private StructureStyleNemoDeleteOutput diff;
+
+    @Test
+    public void buildStructureStyleNemoDeleteOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(StructureStyleNemoDeleteOutput.class, listParam)
+                .build();
+        def = new StructureStyleNemoDeleteOutputBuilder(def)
+                .addAugmentation(StructureStyleNemoDeleteOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromStructureStyleNemoDeleteOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new StructureStyleNemoDeleteOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        copy = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((StructureStyleNemoDeleteOutputBuilder)
+                new StructureStyleNemoDeleteOutputBuilder()
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
diff --git a/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilderTest.java b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilderTest.java
new file mode 100644
index 0000000..4638c22
--- /dev/null
+++ b/nemoengine/src/test/java/org/onosproject/nemo/model/intent/StructureStyleNemoUpdateOutputBuilderTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onosproject.nemo.model.intent.CommonRpcResult.Code;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Unit tests for {@link StructureStyleNemoUpdateOutputBuilder}.
+ */
+public class StructureStyleNemoUpdateOutputBuilderTest {
+
+    private static final String MESSAGE = "SomeMessage";
+    private static final int OK = 1;
+    private static final int ERROR = 0;
+    private static final String MESSAGE_ERROR_MSG = "message not set";
+    private static final String CODE_ERROR_MSG = "result code not set";
+    private static final String AUGMENTATION_ERROR_MSG = "augmentation not equal";
+
+    private Code resultCode;
+    private Code otherResultCode;
+    private StructureStyleNemoUpdateOutput listParam;
+    private StructureStyleNemoUpdateOutput def;
+    private StructureStyleNemoUpdateOutput copy;
+    private StructureStyleNemoUpdateOutput diff;
+
+    @Test
+    public void buildStructureStyleNemoUpdateOutput() {
+        resultCode = Code.forValue(OK);
+        listParam = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        def = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .addAugmentation(StructureStyleNemoUpdateOutput.class, listParam)
+                .build();
+        def = new StructureStyleNemoUpdateOutputBuilder(def)
+                .addAugmentation(StructureStyleNemoUpdateOutput.class, null)
+                .build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, def.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+        assertEquals(AUGMENTATION_ERROR_MSG, listParam, def);
+    }
+
+    @Test
+    public void fromStructureStyleNemoUpdateOutput() {
+        resultCode = Code.forValue(OK);
+        def = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = new StructureStyleNemoUpdateOutputBuilder(def).build();
+        assertEquals(MESSAGE_ERROR_MSG, MESSAGE, copy.getMessage());
+        assertEquals(CODE_ERROR_MSG, resultCode, def.getResultCode());
+    }
+
+    @Test
+    public void equality() {
+        resultCode = Code.forValue(OK);
+        def = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        copy = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(resultCode))
+                .build();
+        otherResultCode = Code.forValue(ERROR);
+        diff = ((StructureStyleNemoUpdateOutputBuilder)
+                new StructureStyleNemoUpdateOutputBuilder()
+                .message(MESSAGE)
+                .resultCode(otherResultCode))
+                .build();
+        new EqualsTester()
+                .addEqualityGroup(def, copy)
+                .addEqualityGroup(diff)
+                .testEquals();
+    }
+}
\ No newline at end of file
