ONOS-5549 TE Tunnel attributes management API

Change-Id: I22f85009f1620cb972fec4a1d0e4bbc357c042e7
diff --git a/apps/pom.xml b/apps/pom.xml
index 05b92c9..f52b44d 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -80,6 +80,7 @@
         <module>rabbitmq</module>
         <module>learning-switch</module>
         <module>tenbi</module>
+        <module>tetunnel</module>
     </modules>
 
     <properties>
diff --git a/apps/tetunnel/api/pom.xml b/apps/tetunnel/api/pom.xml
new file mode 100755
index 0000000..1e9a65d
--- /dev/null
+++ b/apps/tetunnel/api/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>onos-tetunnel</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-app-tetunnel-api</artifactId>
+    <packaging>bundle</packaging>
+    <description>IETF TE Tunnel attributes management API</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-tetopology-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelAdminService.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelAdminService.java
new file mode 100644
index 0000000..5b97b6a
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelAdminService.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.tetunnel.api;
+
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.tetunnel.api.tunnel.TeTunnel;
+import org.onosproject.tetunnel.api.tunnel.TeTunnelKey;
+
+import java.util.List;
+
+/**
+ * Service for administering the TE Tunnel attributes.
+ * <p>
+ * Please note that this service works with the existing Tunnel subsystem
+ * together, just as an extension to the tunnel subsystem, and only focuses
+ * on TE Tunnel attributes management.
+ */
+public interface TeTunnelAdminService extends TeTunnelService {
+
+    /**
+     * Creates a TE Tunnel with the supplied attributes, and returns an
+     * identifier for the tunnel on success, or null on failure.
+     *
+     * @param teTunnel TE Tunnel attributes
+     * @return created tunnel identifier or null if failed
+     */
+    TunnelId createTeTunnel(TeTunnel teTunnel);
+
+    /**
+     * Sets the corresponding Tunnel identifier of the TE Tunnel specified
+     * by the given key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @param tunnelId corresponding tunnel identifier
+     */
+    void setTunnelId(TeTunnelKey teTunnelKey, TunnelId tunnelId);
+
+    /**
+     * Updates TE Tunnel attributes with supplied information, the old
+     * attributes will be totally overwrote by the new attributes.
+     *
+     * @param teTunnel new TE Tunnel attributes
+     */
+    void updateTeTunnel(TeTunnel teTunnel);
+
+    /**
+     * Updates state of a TE tunnel specified by the given key.
+     *
+     * @param key TE tunnel key
+     * @param state new state of the tunnel
+     */
+    void updateTunnelState(TeTunnelKey key, Tunnel.State state);
+
+    /**
+     * Removes a TE Tunnel specified by the given key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     */
+    void removeTeTunnel(TeTunnelKey teTunnelKey);
+
+    /**
+     * Sets segment tunnels of a E2E cross-domain tunnel.
+     *
+     * @param e2eTunnelKey key of the E2E tunnel
+     * @param segmentTunnels list of segment tunnels
+     */
+    void setSegmentTunnel(TeTunnelKey e2eTunnelKey,
+                          List<TeTunnelKey> segmentTunnels);
+
+    //TODO: add interfaces for teGlobal and teLspState
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelProviderService.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelProviderService.java
new file mode 100755
index 0000000..4b510b1
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelProviderService.java
@@ -0,0 +1,66 @@
+/*
+ * 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.tetunnel.api;
+
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.tetunnel.api.tunnel.TeTunnel;
+import org.onosproject.tetunnel.api.tunnel.TeTunnelKey;
+
+/**
+ * Service through which tunnel providers can inject TE Tunnel attributes
+ * into the system.
+ * <p>
+ * Please note that this service works with the existing Tunnel subsystem
+ * together, just as an extension to the tunnel subsystem, and only focus on TE
+ * Tunnel attributes management.
+ */
+public interface TeTunnelProviderService {
+
+    /**
+     * Signals that a TE Tunnel is created with supplied attributes.
+     *
+     * @param teTunnel new created TE Tunnel attributes
+     * @return created tunnel identifier or null if failed
+     */
+    TunnelId teTunnelAdded(TeTunnel teTunnel);
+
+    /**
+     * Signals that a TE Tunnel with specified attributes is removed.
+     *
+     * @param teTunnel removed TE Tunnel
+     */
+    void teTunnelRemoved(TeTunnel teTunnel);
+
+    /**
+     * Updates TE Tunnel attributes with supplied information, the old
+     * attributes will be totally overwrote by the new attributes.
+     *
+     * @param teTunnel new TE Tunnel attributes
+     */
+    void updateTeTunnel(TeTunnel teTunnel);
+
+    /**
+     * Updates state of a TE tunnel specified by the given key.
+     *
+     * @param key TE tunnel key
+     * @param state new state of the tunnel
+     */
+    void updateTunnelState(TeTunnelKey key, Tunnel.State state);
+
+    //TODO: add interfaces for teGlobal and teLspState
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelService.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelService.java
new file mode 100755
index 0000000..d4dd4b3
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelService.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.tetunnel.api;
+
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+import org.onosproject.tetunnel.api.tunnel.TeTunnel;
+import org.onosproject.tetunnel.api.tunnel.TeTunnelKey;
+
+import java.util.Collection;
+
+/**
+ * Service for TE Tunnel attributes management.
+ * <p>
+ * Please note that this service works with the existing Tunnel subsystem
+ * together, just as an extension to the tunnel subsystem, and only focus on TE
+ * Tunnel attributes management.
+ */
+public interface TeTunnelService {
+
+    /**
+     * Returns the TE Tunnel with the specified key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @return TeTunnel or null if one with the given key is not known
+     */
+    TeTunnel getTeTunnel(TeTunnelKey teTunnelKey);
+
+    /**
+     * Returns the TE Tunnel with the specified identifier.
+     *
+     * @param tunnelId corresponding tunnel identifier
+     * @return TeTunnel or null if one with the given identifier is not known
+     */
+    TeTunnel getTeTunnel(TunnelId tunnelId);
+
+    /**
+     * Returns the corresponding tunnel identifier of a TE tunnel with the
+     * specified key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @return corresponding tunnel identifier or null if one with the given
+     * key is not known
+     */
+    TunnelId getTunnelId(TeTunnelKey teTunnelKey);
+
+    /**
+     * Returns a collection of currently known TE tunnels.
+     *
+     * @return collection of TE tunnels
+     */
+    Collection<TeTunnel> getTeTunnels();
+
+    /**
+     * Returns a collection of currently known TE Tunnels filtered by the
+     * specified TE tunnel type.
+     *
+     * @param type TE tunnel type to filter by
+     * @return filtered collection of TE tunnels
+     */
+    Collection<TeTunnel> getTeTunnels(TeTunnel.Type type);
+
+    /**
+     * Returns a collection of currently known TE tunnels filtered by specified
+     * TE topology key.
+     *
+     * @param teTopologyKey TE topology key to filter by
+     * @return filtered collection of TE tunnels
+     */
+    Collection<TeTunnel> getTeTunnels(TeTopologyKey teTopologyKey);
+
+    //TODO: add interfaces for teGlobal and teLspState
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelStore.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelStore.java
new file mode 100755
index 0000000..84b795d
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/TeTunnelStore.java
@@ -0,0 +1,117 @@
+/*
+ * 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.tetunnel.api;
+
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+import org.onosproject.tetunnel.api.tunnel.TeTunnel;
+import org.onosproject.tetunnel.api.tunnel.TeTunnelKey;
+
+import java.util.Collection;
+
+/**
+ * Manages TE tunnel attributes.
+ * <p>
+ * Please note that this service works with the existing Tunnel subsystem
+ * together, just as an extension to the tunnel subsystem, and only focus on TE
+ * Tunnel attributes management.
+ */
+public interface TeTunnelStore {
+
+    /**
+     * Creates a TE Tunnel with the supplied attributes, and returns true on
+     * success, or false on failure.
+     *
+     * @param teTunnel TE Tunnel attributes
+     * @return true on success, or false on failure
+     */
+    boolean addTeTunnel(TeTunnel teTunnel);
+
+    /**
+     * Sets the corresponding Tunnel identifier of the TE Tunnel specified
+     * by the given key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @param tunnelId corresponding tunnel identifier
+     */
+    void setTunnelId(TeTunnelKey teTunnelKey, TunnelId tunnelId);
+
+    /**
+     * Returns the corresponding Tunnel identifier of the TE tunnel.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @return corresponding Tunnel identifier
+     */
+    TunnelId getTunnelId(TeTunnelKey teTunnelKey);
+
+    /**
+     * Updates TE Tunnel attributes with supplied information, the old
+     * attributes will be totally overwrote by the new attributes.
+     *
+     * @param teTunnel new TE Tunnel attributes
+     */
+    void updateTeTunnel(TeTunnel teTunnel);
+
+    /**
+     * Removes a TE Tunnel specified by the given key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     */
+    void removeTeTunnel(TeTunnelKey teTunnelKey);
+
+    /**
+     * Returns the TE Tunnel with the specified key.
+     *
+     * @param teTunnelKey TE Tunnel key
+     * @return TeTunnel or null if one with the given key is not known
+     */
+    TeTunnel getTeTunnel(TeTunnelKey teTunnelKey);
+
+    /**
+     * Returns the TE Tunnel with the specified identifier.
+     *
+     * @param tunnelId corresponding tunnel identifier
+     * @return TeTunnel or null if one with the given identifier is not known
+     */
+    TeTunnel getTeTunnel(TunnelId tunnelId);
+
+
+    /**
+     * Returns a collection of currently known TE Tunnels.
+     *
+     * @return collection of TeTunnels
+     */
+    Collection<TeTunnel> getTeTunnels();
+
+    /**
+     * Returns a collection of currently known TE Tunnels filtered by the
+     * specified TE tunnel type.
+     *
+     * @param type TE tunnel type to filter by
+     * @return filtered collection of TE tunnels
+     */
+    Collection<TeTunnel> getTeTunnels(TeTunnel.Type type);
+
+    /**
+     * Returns a collection of currently known TE tunnels filtered by specified
+     * TE topology key.
+     *
+     * @param teTopologyKey TE topology key to filter by
+     * @return filtered collection of TE tunnels
+     */
+    Collection<TeTunnel> getTeTunnels(TeTopologyKey teTopologyKey);
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/TeLspKey.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/TeLspKey.java
new file mode 100755
index 0000000..9ea8e8d
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/TeLspKey.java
@@ -0,0 +1,102 @@
+/*
+ * 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.tetunnel.api.lsp;
+
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+/**
+ * Representation of a TE LSP key, which identifies a TE Label-switched path
+ * globally.
+ */
+public class TeLspKey extends TeTopologyKey {
+
+    private final long teLspId;
+
+    /**
+     * Creates an instance of TeLspKey with supplied information.
+     *
+     * @param providerId provider identifier
+     * @param clientId   client identifier
+     * @param topologyId topology identifier
+     * @param teLspId TE LSP identifier
+     */
+    public TeLspKey(long providerId, long clientId,
+                    long topologyId, long teLspId) {
+        super(providerId, clientId, topologyId);
+        this.teLspId = teLspId;
+    }
+
+    /**
+     * Creates an instance of TeLspKey with specified TeTopologyKey and
+     * supplied TE LSP identifier.
+     *
+     * @param key the key of TE Topology to which this LSP belongs
+     * @param teLspId TE LSP identifier
+     */
+    public TeLspKey(TeTopologyKey key, long teLspId) {
+        super(key.providerId(), key.clientId(), key.topologyId());
+        this.teLspId = teLspId;
+    }
+
+    /**
+     * Returns the TE LSP identifier corresponding to this key.
+     *
+     * @return TE LSP identifier
+     */
+    public long teLspId() {
+        return teLspId;
+    }
+
+    /**
+     * Returns the key of the TE topology to which this LSP belongs.
+     *
+     * @return corresponding TE topology key
+     */
+    public TeTopologyKey teTopologyKey() {
+        return new TeTopologyKey(providerId(), clientId(), topologyId());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), teLspId);
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
+            return true;
+        }
+        if (object instanceof TeLspKey) {
+            if (!super.equals(object)) {
+                return false;
+            }
+            TeLspKey that = (TeLspKey) object;
+            return Objects.equal(this.teLspId, that.teLspId);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper()
+                .add("topologyId", topologyId())
+                .add("teLspId", teLspId)
+                .toString();
+    }
+}
+
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/package-info.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/package-info.java
new file mode 100644
index 0000000..e276993
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/lsp/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.
+ */
+
+/**
+ * IETF TE Tunnel LSP management API.
+ */
+package org.onosproject.tetunnel.api.lsp;
\ No newline at end of file
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/package-info.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/package-info.java
new file mode 100644
index 0000000..5af0a6b
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/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.
+ */
+
+/**
+ * IETF TE Tunnel attributes management service API.
+ */
+package org.onosproject.tetunnel.api;
\ No newline at end of file
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/DefaultTeTunnel.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/DefaultTeTunnel.java
new file mode 100755
index 0000000..686731c
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/DefaultTeTunnel.java
@@ -0,0 +1,297 @@
+/*
+ * 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.tetunnel.api.tunnel;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+import org.onosproject.tetunnel.api.tunnel.path.TePath;
+
+import java.util.List;
+
+/**
+ * Default TE tunnel implementation.
+ */
+public class DefaultTeTunnel implements TeTunnel {
+
+    private final TeTunnelKey teTunnelKey;
+    private final String name;
+    private final Type type;
+    private final LspProtectionType lspProtectionType;
+    private final State adminState;
+    private final TeNodeKey srcNode;
+    private final TeNodeKey dstNode;
+    private final TtpKey srcTp;
+    private final TtpKey dstTp;
+    private final List<TePath> primaryPaths;
+
+    private List<TeTunnelKey> segmentTunnels = null;
+    private TeTunnelKey e2eTunnel = null;
+
+    /**
+     * Creates a TE tunnel with supplied information.
+     *
+     * @param teTunnelKey TE tunnel key
+     * @param name TE tunnel name
+     * @param type TE tunnel type
+     * @param lspProtectionType LSP protection type of the TE tunnel
+     * @param adminState TE tunnel administrative state
+     * @param srcNode source TE node
+     * @param dstNode destination TE node
+     * @param srcTp source termination point
+     * @param dstTp destination termination point
+     * @param primaryPaths primary paths
+     */
+    protected DefaultTeTunnel(TeTunnelKey teTunnelKey, String name, Type type,
+                           LspProtectionType lspProtectionType,
+                              State adminState, TeNodeKey srcNode,
+                           TeNodeKey dstNode, TtpKey srcTp, TtpKey dstTp,
+                           List<TePath> primaryPaths) {
+        this.teTunnelKey = teTunnelKey;
+        this.name = name;
+        this.type = type;
+        this.lspProtectionType = lspProtectionType;
+        this.adminState = adminState;
+        this.srcNode = srcNode;
+        this.dstNode = dstNode;
+        this.srcTp = srcTp;
+        this.dstTp = dstTp;
+        this.primaryPaths = Lists.newArrayList(primaryPaths);
+    }
+
+    @Override
+    public TeTunnelKey teTunnelKey() {
+        return teTunnelKey;
+    }
+
+    @Override
+    public String name() {
+        return name;
+    }
+
+    @Override
+    public Type type() {
+        return type;
+    }
+
+    @Override
+    public LspProtectionType lspProtectionType() {
+        return lspProtectionType;
+    }
+
+    @Override
+    public State adminStatus() {
+        return adminState;
+    }
+
+    @Override
+    public TeNodeKey srcNode() {
+        return srcNode;
+    }
+
+    @Override
+    public TeNodeKey dstNode() {
+        return dstNode;
+    }
+
+    @Override
+    public List<TePath> primaryPaths() {
+        return ImmutableList.copyOf(primaryPaths);
+    }
+
+    @Override
+    public List<TeTunnelKey> segmentTunnels() {
+        return ImmutableList.copyOf(segmentTunnels);
+    }
+
+    @Override
+    public void segmentTunnels(List<TeTunnelKey> segmentTunnels) {
+        this.segmentTunnels = Lists.newArrayList(segmentTunnels);
+    }
+
+    @Override
+    public TeTunnelKey e2eTunnel() {
+        return e2eTunnel;
+    }
+
+    @Override
+    public void e2eTunnel(TeTunnelKey e2eTunnel) {
+        this.e2eTunnel = e2eTunnel;
+    }
+
+    @Override
+    public TtpKey srcTp() {
+        return srcTp;
+    }
+
+    @Override
+    public TtpKey dstTp() {
+        return dstTp;
+    }
+
+
+    /**
+     * Creates a new default TE tunnel builder.
+     *
+     * @return default builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder for default TE tunnel objects.
+     */
+    public static class Builder {
+
+        private TeTunnelKey teTunnelKey = null;
+        private String name = "";
+        private Type type = null;
+        private LspProtectionType lspProtectionType = null;
+        private State adminState = State.UP;
+        private TeNodeKey srcNode = null;
+        private TeNodeKey dstNode = null;
+        private TtpKey srcTp = null;
+        private TtpKey dstTp = null;
+        private List<TePath> primaryPaths = Lists.newArrayList();
+
+        /**
+         * Builds a default TE tunnel object from the accumulated parameters.
+         *
+         * @return default TE tunnel object
+         */
+        public DefaultTeTunnel build() {
+            return new DefaultTeTunnel(teTunnelKey, name, type,
+                                       lspProtectionType,
+                                       adminState, srcNode, dstNode,
+                                       srcTp, dstTp, primaryPaths);
+        }
+
+        /**
+         * Sets TE tunnel key to be used by this builder.
+         *
+         * @param teTunnelKey TE tunnel key
+         * @return self
+         */
+        public Builder teTunnelKey(TeTunnelKey teTunnelKey) {
+            this.teTunnelKey = teTunnelKey;
+            return this;
+        }
+
+        /**
+         * Sets TE tunnel name to be used by this builder.
+         *
+         * @param name TE tunnel name
+         * @return self
+         */
+        public Builder name(String name) {
+            this.name = name;
+            return this;
+        }
+
+        /**
+         * Sets TE tunnel type to be used by this builder.
+         *
+         * @param type TE tunnel type
+         * @return self
+         */
+        public Builder type(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        /**
+         * Sets tunnel LSP protection type to be used by this builder.
+         *
+         * @param lspProtectionType protection type
+         * @return self
+         */
+        public Builder lspProtectionType(LspProtectionType lspProtectionType) {
+            this.lspProtectionType = lspProtectionType;
+            return this;
+        }
+
+        /**
+         * Sets administrative state to be used by this builder.
+         *
+         * @param adminState administrative state
+         * @return self
+         */
+        public Builder adminState(State adminState) {
+            this.adminState = adminState;
+            return this;
+        }
+
+        /**
+         * Sets source node key to be used by this builder.
+         *
+         * @param srcNode source node key
+         * @return self
+         */
+        public Builder srcNode(TeNodeKey srcNode) {
+            this.srcNode = srcNode;
+            return this;
+        }
+
+        /**
+         * Sets destination node key to be used by this builder.
+         *
+         * @param dstNode destination node key
+         * @return self
+         */
+        public Builder dstNode(TeNodeKey dstNode) {
+            this.dstNode = dstNode;
+            return this;
+        }
+
+        /**
+         * Sets source termination point key to be used by this builder.
+         *
+         * @param srcTp source termination point key
+         * @return self
+         */
+        public Builder srcTp(TtpKey srcTp) {
+            this.srcTp = srcTp;
+            return this;
+        }
+
+        /**
+         * Sets destination point key to be used by this builder.
+         *
+         * @param dstTp destination point key
+         * @return self
+         */
+        public Builder dstTp(TtpKey dstTp) {
+            this.dstTp = dstTp;
+            return this;
+        }
+
+        /**
+         * Sets primary paths to be used by this builder.
+         *
+         * @param primaryPaths list of TePath
+         * @return self
+         */
+        public Builder primaryPaths(List<TePath> primaryPaths) {
+            if (primaryPaths != null) {
+            this.primaryPaths = primaryPaths;
+            }
+            return this;
+        }
+    }
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnel.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnel.java
new file mode 100755
index 0000000..0c1bd2f
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnel.java
@@ -0,0 +1,195 @@
+/*
+ * 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.tetunnel.api.tunnel;
+
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+import org.onosproject.tetunnel.api.tunnel.path.TePath;
+
+import java.util.List;
+
+/**
+ * Representation of a TE tunnel attributes.
+ */
+public interface TeTunnel {
+
+    /**
+     * TE tunnel types.
+     */
+    enum Type {
+        /**
+         * Designates TE point-to-point tunnel.
+         */
+        P2P,
+        /**
+         * Designates TE point-to-multipoint tunnel.
+         */
+        P2MP,
+        /**
+         * Designates RSVP-TE path signaling tunnel.
+         */
+        PATH_SIGNALING_RSVPTE,
+        /**
+         * Designates Segment-routing path signaling tunnel.
+         */
+        PATH_SIGNALING_SR
+    }
+
+    /**
+     * LSP protection types.
+     */
+    enum LspProtectionType {
+        /**
+         * Designates LSP protection "Unprotected".
+         */
+        LSP_PROT_UNPROTECTED,
+        /**
+         * Designates LSP protection "Rerouting without Extra-Traffic".
+         */
+        LSP_PROT_REROUTE,
+        /**
+         * Designates LSP protection "(Full) Rerouting".
+         */
+        LSP_PROT_REROUTE_EXTRA,
+        /**
+         * Designates LSP protection "1+1 Unidirectional Protection".
+         */
+        LSP_PROT_UNIDIR_1_TO_1,
+        /**
+         * Designates LSP protection "1+1 Bidirectional Protection".
+         */
+        LSP_PROT_BIDIR_1_TO_1,
+        /**
+         * Designates LSP protection "1:N Protection with Extra-Traffic".
+         */
+        LSP_PROT_1_FOR_N
+    }
+
+    /**
+     * TE Tunnel state.
+     */
+    enum State {
+        /**
+         * Designates the tunnel is down (non-operational).
+         */
+        DOWN,
+        /**
+         * Designates the tunnel is up.
+         */
+        UP
+    }
+
+    /**
+     * Returns the TE tunnel key.
+     *
+     * @return TE tunnel key
+     */
+    TeTunnelKey teTunnelKey();
+
+    /**
+     * Returns the name of the TE tunnel.
+     *
+     * @return name of the TE tunnel
+     */
+    String name();
+
+    /**
+     * Returns the type of the TE tunnel.
+     *
+     * @return type of the TE tunnel
+     */
+    Type type();
+
+    /**
+     * Returns the key of source TE node of this TE tunnel.
+     *
+     * @return key of the source TE node
+     */
+    TeNodeKey srcNode();
+
+    /**
+     * Returns key of the source TE termination point of this tunnel.
+     *
+     * @return key of the source TE termination point
+     */
+    TtpKey srcTp();
+
+    /**
+     * Returns key of the destination TE node of this TE tunnel.
+     *
+     * @return key of the destination TE node
+     */
+    TeNodeKey dstNode();
+
+    /**
+     * Returns key of the destination TE termination point of this TE tunnel.
+     *
+     * @return key of the destination TE termination point
+     */
+    TtpKey dstTp();
+
+    /**
+     * Returns the TE LSP protection type of the TE tunnel.
+     *
+     * @return TE LSP protection type of the TE tunnel
+     */
+    LspProtectionType lspProtectionType();
+
+    /**
+     * Returns the TE tunnel administrative state.
+     *
+     * @return TE tunnel administrative state
+     */
+    State adminStatus();
+
+    /**
+     * Returns primary paths of this TE tunnel.
+     *
+     * @return a list of TE paths
+     */
+    List<TePath> primaryPaths();
+
+    /**
+     * Returns segment tunnels of this (E2E cross-domain) tunnel.
+     *
+     * @return a list of keys of the segment tunnels
+     */
+    List<TeTunnelKey> segmentTunnels();
+
+    /**
+     * Sets segment tunnels of this (E2E cross-domain) tunnel.
+     *
+     * @param segmentTunnels a list of keys of segment tunnels
+     */
+    void segmentTunnels(List<TeTunnelKey> segmentTunnels);
+
+    /**
+     * Returns key of the E2E tunnel of this (segment) tunnel.
+     *
+     * @return key of the corresponding E2E TE tunnel
+     */
+    TeTunnelKey e2eTunnel();
+
+    /**
+     * Sets the E2E tunnel of this (segment) tunnel.
+     *
+     * @param e2eTunnel key of the corresponding E2E tunnel
+     */
+    void e2eTunnel(TeTunnelKey e2eTunnel);
+
+    //TODO: add more required TE attributes
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelEndpoint.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelEndpoint.java
new file mode 100755
index 0000000..b73a243
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelEndpoint.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.tetunnel.api.tunnel;
+
+import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+import java.util.Objects;
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * TE tunnel endpoint implementation.
+ */
+public class TeTunnelEndpoint implements TunnelEndPoint {
+
+    private final TeNodeKey teNodeKey;
+    private final TtpKey ttpKey;
+
+    /**
+     * Creates a TE tunnel end point instance with supplied information.
+     *
+     * @param teNodeKey key of the TE node of this end point
+     * @param ttpKey key of the TE termination point of this end point
+     */
+    public TeTunnelEndpoint(TeNodeKey teNodeKey, TtpKey ttpKey) {
+        this.teNodeKey = teNodeKey;
+        this.ttpKey = ttpKey;
+    }
+
+    /**
+     * Returns key of the TE node of this end point.
+     *
+     * @return key of corresponding TE node
+     */
+    public TeNodeKey teNodeKey() {
+        return teNodeKey;
+    }
+
+    /**
+     * Returns key of the TE termination point of this end point.
+     *
+     * @return key of corresponding TE termination point
+     */
+    public TtpKey ttpKey() {
+        return ttpKey;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(teNodeKey, ttpKey);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof TeTunnelEndpoint) {
+            final TeTunnelEndpoint other = (TeTunnelEndpoint) obj;
+            return Objects.equals(this.teNodeKey, other.teNodeKey) &&
+                    Objects.equals(this.ttpKey, other.ttpKey);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("teNodeKey", teNodeKey)
+                .add("ttpKey", ttpKey)
+                .toString();
+    }
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelKey.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelKey.java
new file mode 100755
index 0000000..7d80782
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/TeTunnelKey.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.tetunnel.api.tunnel;
+
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of a TE tunnel key, which identifies a TE tunnel globally.
+ */
+public class TeTunnelKey extends TeTopologyKey {
+
+    private final long teTunnelId;
+
+    /**
+     * Creates an instance of TE tunnel key with supplied information.
+     *
+     * @param providerId provider identifier
+     * @param clientId client identifier
+     * @param topologyId topology identifier
+     * @param teTunnelId TE tunnel identifier
+     */
+    public TeTunnelKey(long providerId, long clientId,
+                     long topologyId, long teTunnelId) {
+        super(providerId, clientId, topologyId);
+        this.teTunnelId = teTunnelId;
+    }
+
+    /**
+     * Creates an instance of TE tunnel key with specified TeTopologyKey and
+     * supplied TE tunnel identifier.
+     *
+     * @param key the key of TE topology to which this tunnel belongs
+     * @param tunnelId TE tunnel identifier
+     */
+    public TeTunnelKey(TeTopologyKey key, long tunnelId) {
+        super(key.providerId(), key.clientId(), key.topologyId());
+        this.teTunnelId = tunnelId;
+    }
+
+    /**
+     * Returns the TE tunnel identifier.
+     *
+     * @return TE tunnel identifier
+     */
+    public long teTunnelId() {
+        return teTunnelId;
+    }
+
+    /**
+     * Returns key of the TE topology to which this tunnel belongs.
+     *
+     * @return corresponding TE topology key
+     */
+    public TeTopologyKey teTopologyKey() {
+        return new TeTopologyKey(providerId(), clientId(), topologyId());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), teTunnelId);
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
+            return true;
+        }
+        if (object instanceof TeTunnelKey) {
+            if (!super.equals(object)) {
+                return false;
+            }
+            TeTunnelKey that = (TeTunnelKey) object;
+            return Objects.equal(this.teTunnelId, that.teTunnelId);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper()
+                .add("topologyId", topologyId())
+                .add("teTunnelId", teTunnelId)
+                .toString();
+    }
+}
+
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/package-info.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/package-info.java
new file mode 100644
index 0000000..fdfebe9
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/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.
+ */
+
+/**
+ * IETF TE Tunnel attributes management API.
+ */
+package org.onosproject.tetunnel.api.tunnel;
\ No newline at end of file
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePath.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePath.java
new file mode 100755
index 0000000..ce9d17d
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePath.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.tetunnel.api.tunnel.path;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetunnel.api.lsp.TeLspKey;
+
+import java.util.List;
+
+/**
+ * Default implementation of TE path.
+ */
+public class DefaultTePath implements TePath {
+
+    private final Type type;
+    private final List<TeLspKey> lsps;
+    private final List<TeRouteSubobject> explicitRoute;
+    private final List<TePath> secondaryPaths;
+
+    /**
+     * Creates a default implementation of TE path with supplied information.
+     *
+     * @param type type of TE Path
+     * @param lsps LSPs of the TE Path
+     * @param explicitRoute explicit route of the (Explicit) TE path
+     * @param secondaryPaths secondary paths of the TE path
+     */
+    public DefaultTePath(Type type, List<TeLspKey> lsps,
+                         List<TeRouteSubobject> explicitRoute,
+                         List<TePath> secondaryPaths) {
+        this.type = type;
+        if (lsps == null) {
+            this.lsps = Lists.newArrayList();
+        } else {
+            this.lsps = Lists.newArrayList(lsps);
+        }
+        if (explicitRoute == null) {
+            this.explicitRoute = Lists.newArrayList();
+        } else {
+            this.explicitRoute = Lists.newArrayList(explicitRoute);
+        }
+        if (secondaryPaths == null) {
+            this.secondaryPaths = Lists.newArrayList();
+        } else {
+            this.secondaryPaths = Lists.newArrayList(secondaryPaths);
+        }
+    }
+
+    @Override
+    public Type type() {
+        return type;
+    }
+
+    @Override
+    public List<TeLspKey> lsps() {
+        return ImmutableList.copyOf(lsps);
+    }
+
+    @Override
+    public List<TeRouteSubobject> explicitRoute() {
+        return ImmutableList.copyOf(explicitRoute);
+    }
+
+    @Override
+    public List<TePath> secondaryPaths() {
+        return ImmutableList.copyOf(secondaryPaths);
+    }
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePathSelection.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePathSelection.java
new file mode 100755
index 0000000..220d7f7
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTePathSelection.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tetunnel.api.tunnel.path;
+
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+/**
+ * Default implementation of TE path selection.
+ */
+public class DefaultTePathSelection implements TePathSelection {
+
+    private final TeTopologyKey teTopologyKey;
+    private final long costLimit;
+    private final short hopLimit;
+
+    /**
+     * Creates a default implementation of TE path selection with supplied
+     * information.
+     *
+     * @param teTopologyKey key of corresponding TE topology
+     * @param costLimit cost limit of the TE path
+     * @param hopLimit hot limit of the TE path
+     */
+    public DefaultTePathSelection(TeTopologyKey teTopologyKey,
+                                  long costLimit, short hopLimit) {
+        this.teTopologyKey = teTopologyKey;
+        this.costLimit = costLimit;
+        this.hopLimit = hopLimit;
+    }
+
+    @Override
+    public TeTopologyKey teTopologyKey() {
+        return teTopologyKey;
+    }
+
+    @Override
+    public long costLimit() {
+        return costLimit;
+    }
+
+    @Override
+    public short hopLimit() {
+        return hopLimit;
+    }
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTeRouteUnnumberedLink.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTeRouteUnnumberedLink.java
new file mode 100755
index 0000000..abe42e6
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/DefaultTeRouteUnnumberedLink.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.tetunnel.api.tunnel.path;
+
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+
+/**
+ * Default implementation of a TE unnumbered link route object.
+ */
+public class DefaultTeRouteUnnumberedLink implements TeRouteUnnumberedLink {
+
+    private final TeNodeKey node;
+    private final TtpKey ttp;
+
+    /**
+     * Creates a default implementation of a TE unnumbered link route object.
+     *
+     * @param node key of TE node of the route subobject
+     * @param ttp  key of TE termination point of the route subobject
+     */
+    public DefaultTeRouteUnnumberedLink(TeNodeKey node, TtpKey ttp) {
+        this.node = node;
+        this.ttp = ttp;
+    }
+
+    @Override
+    public Type type() {
+        return Type.UNNUMBERED_LINK;
+    }
+
+    @Override
+    public TeNodeKey node() {
+        return node;
+    }
+
+    @Override
+    public TtpKey ttp() {
+        return ttp;
+    }
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePath.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePath.java
new file mode 100755
index 0000000..09eaec5
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePath.java
@@ -0,0 +1,71 @@
+/*
+ * 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.tetunnel.api.tunnel.path;
+
+import org.onosproject.tetunnel.api.lsp.TeLspKey;
+
+import java.util.List;
+
+/**
+ * Representation of a TE tunnel path.
+ */
+public interface TePath {
+
+    /**
+     * Types of TE path.
+     */
+    enum Type {
+        /**
+         * Designates a dynamically computed path.
+         */
+        DYNAMIC,
+        /**
+         * Designates a path with explicit route.
+         */
+        EXPLICIT
+    }
+
+    /**
+     * Returns type of this TE path.
+     *
+     * @return type of this TE path
+     */
+    Type type();
+
+    /**
+     * Returns keys of TE LSPs of this TE path.
+     *
+     * @return list of keys of TE LSPs
+     */
+    List<TeLspKey> lsps();
+
+    /**
+     * Returns specified route of ths (Explicit) TE path.
+     *
+     * @return list of TE route subobjects.
+     */
+    List<TeRouteSubobject> explicitRoute();
+
+    /**
+     * Returns secondary TE paths of this TE path.
+     *
+     * @return list of secondary TE paths.
+     */
+    List<TePath> secondaryPaths();
+
+    //TODO add more attributes here.
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePathSelection.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePathSelection.java
new file mode 100755
index 0000000..f53af4b
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TePathSelection.java
@@ -0,0 +1,48 @@
+/*
+ * 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.tetunnel.api.tunnel.path;
+
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+/**
+ * Representation of a TE tunnel path selection attributes.
+ */
+public interface TePathSelection {
+
+    /**
+     * Returns key of corresponding TE topology of the TE path.
+     *
+     * @return key of corresponding TE topology
+     */
+    TeTopologyKey teTopologyKey();
+
+    /**
+     * Returns cost limit of the TE path.
+     *
+     * @return cost limit
+     */
+    long costLimit();
+
+    /**
+     * Returns hop limit of the TE path.
+     *
+     * @return hop limit
+     */
+    short hopLimit();
+
+    //TODO add more attributes here.
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteSubobject.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteSubobject.java
new file mode 100755
index 0000000..c5a8444
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteSubobject.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.tetunnel.api.tunnel.path;
+
+/**
+ * Representation of a TE LSP route element.
+ */
+public interface TeRouteSubobject {
+
+    /**
+     * Types of TE route subobject.
+     */
+    enum Type {
+        /**
+         * Designates Unnumbered link route sub-object.
+         */
+        UNNUMBERED_LINK,
+        /**
+         * Designates a label route sub-object.
+         */
+        LABEL,
+        /**
+         * Designates an IPv4 address route sub-object.
+         */
+        IPV4_ADDRESS,
+        /**
+         * Designates an IPv6 address route sub-object.
+         */
+        IPV6_ADDRESS
+    }
+
+    /**
+     * Return type of the route subobject.
+     *
+     * @return type of route subobject
+     */
+    Type type();
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteUnnumberedLink.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteUnnumberedLink.java
new file mode 100755
index 0000000..1ea1a1c
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/TeRouteUnnumberedLink.java
@@ -0,0 +1,40 @@
+/*
+ * 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.tetunnel.api.tunnel.path;
+
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+
+/**
+ * Representation of a UnnumberedLink as a TE LSP route element.
+ */
+public interface TeRouteUnnumberedLink extends TeRouteSubobject {
+
+    /**
+     * Returns node of this route subobject.
+     *
+     * @return TE node key
+     */
+    TeNodeKey node();
+
+    /**
+     * Returns termination point of this route subobject.
+     *
+     * @return TE termination point key
+     */
+    TtpKey ttp();
+}
diff --git a/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/package-info.java b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/package-info.java
new file mode 100644
index 0000000..27c1c33
--- /dev/null
+++ b/apps/tetunnel/api/src/main/java/org/onosproject/tetunnel/api/tunnel/path/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.
+ */
+
+/**
+ * IETF TE Tunnel paths management API.
+ */
+package org.onosproject.tetunnel.api.tunnel.path;
\ No newline at end of file
diff --git a/apps/tetunnel/app/app.xml b/apps/tetunnel/app/app.xml
new file mode 100644
index 0000000..14e55aa
--- /dev/null
+++ b/apps/tetunnel/app/app.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+<app name="org.onosproject.tetunnel" origin="HUAWEI" version="${project.version}"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/onos-app-tetunnel-api/${project.version}</artifact>
+</app>
\ No newline at end of file
diff --git a/apps/tetunnel/app/features.xml b/apps/tetunnel/app/features.xml
new file mode 100644
index 0000000..7297390
--- /dev/null
+++ b/apps/tetunnel/app/features.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+  ~ 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <feature>onos-api</feature>
+        <bundle>mvn:${project.groupId}/onos-app-tetopology-api/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-app-tetunnel-api/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+    </feature>
+</features>
\ No newline at end of file
diff --git a/apps/tetunnel/app/pom.xml b/apps/tetunnel/app/pom.xml
new file mode 100644
index 0000000..95419f6
--- /dev/null
+++ b/apps/tetunnel/app/pom.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>onos-tetunnel</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-app-tetunnel</artifactId>
+    <description>IETF TE Tunnel attributes management implementation</description>
+</project>
\ No newline at end of file
diff --git a/apps/tetunnel/app/src/main/java/org/onosproject/tetunnel/impl/package-info.java b/apps/tetunnel/app/src/main/java/org/onosproject/tetunnel/impl/package-info.java
new file mode 100644
index 0000000..e2fca78
--- /dev/null
+++ b/apps/tetunnel/app/src/main/java/org/onosproject/tetunnel/impl/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.
+ */
+
+/**
+ * IETF TE Tunnel attributes management implementation.
+ */
+package org.onosproject.tetunnel.impl;
\ No newline at end of file
diff --git a/apps/tetunnel/pom.xml b/apps/tetunnel/pom.xml
new file mode 100644
index 0000000..897000d
--- /dev/null
+++ b/apps/tetunnel/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>onos-apps</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.8.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-tetunnel</artifactId>
+    <packaging>pom</packaging>
+
+    <description>IETF TE Tunnel attributes management</description>
+
+    <modules>
+        <module>api</module>
+        <module>app</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-incubator-api</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file