[ONOS-1959][ONOS-2007][ONOS-2008][ONOS-2009][ONOS-2010][ONOS-2011][ONOS-2016][ONOS-2017][ONOS-2018]
1.fix bug in query subscription command in Tunnel management
2.add RemoveTunnelByIdCommand
3.add UpdateTunnelBandWithCommand
4.add QueryAllTunnelsCommand
5.add queryAllTunnels api in TunnelService and TunnelStore
6.store the Path of the tunnel in the store
7.remove to check parameters iif they are null in the construtors of
DefaultTunnel.e.g
8.add the method of querying in SB
9.Fix the bug that the src/dst end point of Vlan-type tunnel is the
instance of OpticalTunnelEndPoint
10. invert the verb-noun into noun-verb for tunnel commands and label
commands

Change-Id: I90378b37c2bc73b58e6f8f234f009d64f07f758e
diff --git a/cli/src/main/java/org/onosproject/cli/net/DestroyGlobalLabelResourcePoolCommand.java b/cli/src/main/java/org/onosproject/cli/net/DestroyGlobalLabelResourcePoolCommand.java
deleted file mode 100644
index 31d38a4..0000000
--- a/cli/src/main/java/org/onosproject/cli/net/DestroyGlobalLabelResourcePoolCommand.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.onosproject.cli.net;
-
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
-
-@Command(scope = "onos", name = "destroy-global-label-resource-pool",
-description = "Destroys global label resource pool")
-public class DestroyGlobalLabelResourcePoolCommand extends AbstractShellCommand {
-    @Override
-    protected void execute() {
-        LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
-        lrs.destroyGlobalPool();
-    }
-
-}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DestroyLabelResourcePoolCommand.java b/cli/src/main/java/org/onosproject/cli/net/DestroyLabelResourcePoolCommand.java
deleted file mode 100644
index 925f0f1..0000000
--- a/cli/src/main/java/org/onosproject/cli/net/DestroyLabelResourcePoolCommand.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.onosproject.cli.net;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
-
-@Command(scope = "onos", name = "destroy-label-resource-pool",
-    description = "Destroys label resource pool by a specific device id")
-public class DestroyLabelResourcePoolCommand extends AbstractShellCommand {
-    @Argument(index = 0, name = "deviceId", description = "Device identity", required = true, multiValued = false)
-    String deviceId = null;
-
-    @Override
-    protected void execute() {
-        LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
-        lrs.destroyDevicePool(DeviceId.deviceId(deviceId));
-    }
-
-}
diff --git a/cli/src/main/java/org/onosproject/cli/net/GetGlobalLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/GetGlobalLabelResourceCommand.java
deleted file mode 100644
index 9be6725..0000000
--- a/cli/src/main/java/org/onosproject/cli/net/GetGlobalLabelResourceCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.onosproject.cli.net;
-
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.incubator.net.resource.label.LabelResourcePool;
-import org.onosproject.incubator.net.resource.label.LabelResourceService;
-
-@Command(scope = "onos", name = "get-global-label-resource-pool",
-      description = "Gets global label resource pool information.")
-public class GetGlobalLabelResourceCommand extends AbstractShellCommand {
-    private static final String FMT = "deviceid=%s, beginLabel=%s,"
-            + "endLabel=%s, totalNum=%s, usedNum=%s, currentUsedMaxLabelId=%s,"
-            + "releaseLabelIds=%s";
-
-    @Override
-    protected void execute() {
-        LabelResourceService lrs = get(LabelResourceService.class);
-        LabelResourcePool pool = lrs.getGlobalLabelResourcePool();
-        if (pool != null) {
-            print(FMT, pool.deviceId().toString(), pool.beginLabel(),
-                  pool.endLabel(), pool.totalNum(), pool.usedNum(),
-                  pool.currentUsedMaxLabelId(), pool.releaseLabelId()
-                          .toString());
-        }
-    }
-
-}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ApplyGlobalLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
similarity index 66%
rename from cli/src/main/java/org/onosproject/cli/net/ApplyGlobalLabelResourceCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
index f9fd7e1..a8e8f2e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ApplyGlobalLabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import java.util.Collection;
@@ -10,9 +25,9 @@
 import org.onosproject.incubator.net.resource.label.LabelResource;
 import org.onosproject.incubator.net.resource.label.LabelResourceService;
 
-@Command(scope = "onos", name = "apply-global-label-resource-pool",
+@Command(scope = "onos", name = "global-label-apply",
       description = "Apply global labels from global resource pool")
-public class ApplyGlobalLabelResourceCommand extends AbstractShellCommand {
+public class GlobalLabelApplyCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "applyNum",
             description = "Applying number means how many labels applications want to use.",
             required = true, multiValued = false)
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java
new file mode 100644
index 0000000..92f39cc
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.resource.label.LabelResourcePool;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+
+@Command(scope = "onos", name = "global-label-pool",
+      description = "Gets global label resource pool information.")
+public class GlobalLabelCommand extends AbstractShellCommand {
+    private static final String FMT = "deviceid=%s, beginLabel=%s,"
+            + "endLabel=%s, totalNum=%s, usedNum=%s, currentUsedMaxLabelId=%s,"
+            + "releaseLabelIds=%s";
+
+    @Override
+    protected void execute() {
+        LabelResourceService lrs = get(LabelResourceService.class);
+        LabelResourcePool pool = lrs.getGlobalLabelResourcePool();
+        if (pool != null) {
+            print(FMT, pool.deviceId().toString(), pool.beginLabel(),
+                  pool.endLabel(), pool.totalNum(), pool.usedNum(),
+                  pool.currentUsedMaxLabelId(), pool.releaseLabelId()
+                          .toString());
+        }
+    }
+
+}
diff --git a/cli/src/main/java/org/onosproject/cli/net/CreateGlobalLabelResourcePoolCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
similarity index 60%
rename from cli/src/main/java/org/onosproject/cli/net/CreateGlobalLabelResourcePoolCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
index ef9fbe8..3e22667 100644
--- a/cli/src/main/java/org/onosproject/cli/net/CreateGlobalLabelResourcePoolCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import org.apache.karaf.shell.commands.Argument;
@@ -9,9 +24,9 @@
 /**
  * create label resource pool by specific device id.
  */
-@Command(scope = "onos", name = "create-global-label-resource-pool",
+@Command(scope = "onos", name = "global-label-pool-create",
 description = "Creates global label resource pool.")
-public class CreateGlobalLabelResourcePoolCommand extends AbstractShellCommand {
+public class GlobalLabelPoolCreateCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "beginLabel",
             description = "The first label of global label resource pool.",
             required = true, multiValued = false)
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestoryCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestoryCommand.java
new file mode 100644
index 0000000..ae1bee6
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestoryCommand.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+
+@Command(scope = "onos", name = "global-label-pool-destroy",
+description = "Destroys global label resource pool")
+public class GlobalLabelPoolDestoryCommand extends AbstractShellCommand {
+    @Override
+    protected void execute() {
+        LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
+        lrs.destroyGlobalPool();
+    }
+
+}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ReleaseGlobalLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
similarity index 61%
rename from cli/src/main/java/org/onosproject/cli/net/ReleaseGlobalLabelResourceCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
index 4a5718b..737f796 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ReleaseGlobalLabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import java.util.HashSet;
@@ -9,9 +24,9 @@
 import org.onosproject.incubator.net.resource.label.LabelResourceId;
 import org.onosproject.incubator.net.resource.label.LabelResourceService;
 
-@Command(scope = "onos", name = "release-global-label-resource-pool",
+@Command(scope = "onos", name = "global-label-release",
 description = "Releases labels to global label resource pool.")
-public class ReleaseGlobalLabelResourceCommand extends AbstractShellCommand {
+public class GlobalLabelReleaseCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "releaseLabelIds",
             description = "Represents for the label ids that are released. They are splited by dot symbol",
             required = true, multiValued = false)
diff --git a/cli/src/main/java/org/onosproject/cli/net/ApplyLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
similarity index 70%
rename from cli/src/main/java/org/onosproject/cli/net/ApplyLabelResourceCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
index dabd391..c88d41c 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ApplyLabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import java.util.Collection;
@@ -11,9 +26,9 @@
 import org.onosproject.incubator.net.resource.label.LabelResource;
 import org.onosproject.incubator.net.resource.label.LabelResourceService;
 
-@Command(scope = "onos", name = "apply-label-resource-pool",
+@Command(scope = "onos", name = "label-apply",
       description = "Apply label resource from device pool by specific device id")
-public class ApplyLabelResourceCommand extends AbstractShellCommand {
+public class LabelApplyCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "deviceId",
             description = "Device identity",
             required = true, multiValued = false)
diff --git a/cli/src/main/java/org/onosproject/cli/net/CreateLabelResourcePoolCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
similarity index 65%
rename from cli/src/main/java/org/onosproject/cli/net/CreateLabelResourcePoolCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
index 1be3e33..78a6d19 100644
--- a/cli/src/main/java/org/onosproject/cli/net/CreateLabelResourcePoolCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import org.apache.karaf.shell.commands.Argument;
@@ -10,9 +25,9 @@
 /**
  * create label resource pool by specific device id.
  */
-@Command(scope = "onos", name = "create-label-resource-pool",
+@Command(scope = "onos", name = "label-pool-create",
      description = "Creates label resource pool by a specific device id")
-public class CreateLabelResourcePoolCommand extends AbstractShellCommand {
+public class LabelPoolCreateCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "deviceId", description = "Device identity", required = true, multiValued = false)
     String deviceId = null;
     @Argument(index = 1, name = "beginLabel",
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java
new file mode 100644
index 0000000..6445de6
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+
+@Command(scope = "onos", name = "label-pool-destroy",
+    description = "Destroys label resource pool by a specific device id")
+public class LabelPoolDestroyCommand extends AbstractShellCommand {
+    @Argument(index = 0, name = "deviceId", description = "Device identity", required = true, multiValued = false)
+    String deviceId = null;
+
+    @Override
+    protected void execute() {
+        LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
+        lrs.destroyDevicePool(DeviceId.deviceId(deviceId));
+    }
+
+}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ReleaseLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
similarity index 71%
rename from cli/src/main/java/org/onosproject/cli/net/ReleaseLabelResourceCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
index 9805e0d..cc52204 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ReleaseLabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import org.apache.karaf.shell.commands.Argument;
@@ -12,9 +27,9 @@
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
 
-@Command(scope = "onos", name = "release-label-resource-pool",
+@Command(scope = "onos", name = "label-release",
 description = "Releases label ids to label resource pool by a specific device id")
-public class ReleaseLabelResourceCommand extends AbstractShellCommand {
+public class LabelReleaseCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "deviceId",
             description = "Device identity",
             required = true, multiValued = false)
diff --git a/cli/src/main/java/org/onosproject/cli/net/GetLabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
similarity index 66%
rename from cli/src/main/java/org/onosproject/cli/net/GetLabelResourceCommand.java
rename to cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
index fa91b21..fe263c6 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GetLabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2014-2015 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.cli.net;
 
 import org.apache.karaf.shell.commands.Argument;
@@ -7,9 +22,9 @@
 import org.onosproject.incubator.net.resource.label.LabelResourcePool;
 import org.onosproject.incubator.net.resource.label.LabelResourceService;
 
-@Command(scope = "onos", name = "get-label-resource-pool",
+@Command(scope = "onos", name = "label-pool",
       description = "Gets label resource pool information by a specific device id")
-public class GetLabelResourceCommand extends AbstractShellCommand {
+public class LabelResourceCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "deviceId",
             description = "Device identity", required = true, multiValued = false)
     String deviceId = null;
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
index 61188d2..3db4e86 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
@@ -16,97 +16,189 @@
 package org.onosproject.cli.net;
 
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Optional;
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.DefaultApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.OpticalLogicId;
 import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.TunnelName;
 import org.onosproject.incubator.net.tunnel.TunnelService;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.ProviderId;
 
 /**
- * Borrows all tunnels between specific source tunnel end point and specific
- * destination tunnel end point. Supports for IP address and optical as tunnel end point now. It's used by consumers.
+ * Borrows tunnels. It's used by consumers.
  */
-@Command(scope = "onos", name = "borrow-tunnels",
-description = "Borrows all tunnels between specific source tunnel end point"
-        + " and specific destination tunnel end point."
-        + " Supports for IP address and optical as tunnel end point now. It's used by consumers.")
+@Command(scope = "onos", name = "tunnel-borrow", description = "Borrows tunnels. It's used by consumers.")
 public class TunnelBorrowCommand extends AbstractShellCommand {
-    @Argument(index = 0, name = "consumerId", description = "consumer id means application id.",
-            required = true, multiValued = false)
+
+    @Argument(index = 0, name = "consumerId",
+            description = "consumer id means application id.", required = true, multiValued = false)
     String consumerId = null;
-    @Argument(index = 1, name = "src", description = "Source tunnel point."
+
+    @Option(name = "-s", aliases = "--src", description = "Source tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise src means IP address.", required = true, multiValued = false)
+            + " Otherwise src means IP address.", required = false, multiValued = false)
     String src = null;
-    @Argument(index = 2, name = "dst", description = "Destination tunnel point."
+
+    @Option(name = "-d", aliases = "--dst", description = "Destination tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise dst means IP address.", required = true, multiValued = false)
+            + " Otherwise dst means IP address.", required = false, multiValued = false)
     String dst = null;
 
-    @Argument(index = 3, name = "type", description = "The type of tunnels,"
-            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
+    @Option(name = "-t", aliases = "--type", description = "The type of tunnels,"
+            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = false, multiValued = false)
     String type = null;
+
+    @Option(name = "-i", aliases = "--tunnelId",
+            description = "the tunnel identity.", required = false, multiValued = false)
+    String tunnelId = null;
+
+    @Option(name = "-n", aliases = "--tunnelName",
+            description = "The name of tunnels", required = false, multiValued = false)
+    String tunnelName = null;
     private static final String FMT = "src=%s, dst=%s,"
             + "type=%s, state=%s, producerName=%s, tunnelName=%s,"
             + "groupId=%s";
 
     @Override
     protected void execute() {
+        Collection<Tunnel> tunnelSet = null;
+        Tunnel.Type trueType = null;
         TunnelService service = get(TunnelService.class);
         ApplicationId appId = new DefaultApplicationId(1, consumerId);
         ProviderId producerName = new ProviderId("default",
                                                  "org.onosproject.provider.tunnel.default");
-        TunnelEndPoint srcPoint = null;
-        TunnelEndPoint dstPoint = null;
-        if ("MPLS".equals(type) || "VLAN".equals(type) || "VXLAN".equals(type)
-                || "GRE".equals(type)) {
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("ODUK".equals(type) || "OCH".equals(type)) {
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else {
-            print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
-            return;
+        if (!isNull(src) && !isNull(dst) && !isNull(type)) {
+            TunnelEndPoint srcPoint = null;
+            TunnelEndPoint dstPoint = null;
+            if ("MPLS".equals(type)) {
+                trueType = Tunnel.Type.MPLS;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VXLAN".equals(type)) {
+                trueType = Tunnel.Type.VXLAN;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("GRE".equals(type)) {
+                trueType = Tunnel.Type.GRE;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VLAN".equals(type)) {
+                trueType = Tunnel.Type.VLAN;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("ODUK".equals(type)) {
+                trueType = Tunnel.Type.ODUK;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("OCH".equals(type)) {
+                trueType = Tunnel.Type.OCH;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else {
+                print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
+                return;
+            }
+            tunnelSet = service.borrowTunnel(appId, srcPoint, dstPoint, trueType);
         }
-        Collection<Tunnel> tunnelSet = service.borrowTunnel(appId, srcPoint, dstPoint);
+        if (!isNull(tunnelId)) {
+            TunnelId id = TunnelId.valueOf(tunnelId);
+            Tunnel tunnel = service.borrowTunnel(appId, id);
+            tunnelSet = new HashSet<Tunnel>();
+            tunnelSet.add(tunnel);
+        }
+        if (!isNull(tunnelName)) {
+            TunnelName name = TunnelName.tunnelName(tunnelName);
+            tunnelSet = service.borrowTunnel(appId, name);
+        }
         for (Tunnel tunnel : tunnelSet) {
             print(FMT, tunnel.src(), tunnel.dst(), tunnel.type(),
                   tunnel.state(), tunnel.providerId(), tunnel.tunnelName(),
@@ -114,4 +206,7 @@
         }
     }
 
+    private boolean isNull(String s) {
+        return s == null || "".equals(s);
+    }
 }
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelDeleteCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelDeleteCommand.java
deleted file mode 100644
index 9be0da8..0000000
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelDeleteCommand.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2014-2015 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.cli.net;
-
-import java.util.Optional;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onlab.packet.IpAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.OpticalLogicId;
-import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.TunnelAdminService;
-import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
-
-/**
- * Supports for deleting all tunnels by using IP address and optical as tunnel
- * end point now. It's used by consumers.
- */
-@Command(scope = "onos", name = "delete-tunnels", description = "Supports for deleting all tunnels by using IP address"
-        + " and optical as tunnel end point now. It's used by consumers.")
-public class TunnelDeleteCommand extends AbstractShellCommand {
-    static String applicationId = "DEFAULT_APP_ID";
-    @Argument(index = 0, name = "src", description = "Source tunnel point."
-            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise src means IP address.", required = true, multiValued = false)
-    String src = null;
-    @Argument(index = 1, name = "dst", description = "Destination tunnel point."
-            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise dst means IP address.", required = true, multiValued = false)
-    String dst = null;
-
-    @Argument(index = 2, name = "type", description = "The type of tunnels,"
-            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
-    String type = null;
-
-    @Override
-    protected void execute() {
-        TunnelAdminService adminService = get(TunnelAdminService.class);
-        ProviderId producerName = new ProviderId("default",
-                                                 "org.onosproject.provider.tunnel.default");
-        TunnelEndPoint srcPoint = null;
-        TunnelEndPoint dstPoint = null;
-        if ("MPLS".equals(type) || "VLAN".equals(type) || "VXLAN".equals(type) || "GRE".equals(type)) {
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("ODUK".equals(type) || "OCH".equals(type)) {
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else {
-            print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
-            return;
-        }
-
-        adminService.removeTunnels(srcPoint, dstPoint, producerName);
-    }
-
-}
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
index 4e1fe28..e1bf52a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
@@ -16,96 +16,209 @@
 package org.onosproject.cli.net;
 
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Optional;
 
-import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.OpticalLogicId;
 import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelId;
 import org.onosproject.incubator.net.tunnel.TunnelService;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.ProviderId;
 
 /**
- * Supports for querying all tunnels by using IP address and optical as tunnel
- * end point now. It's used by consumers.
+ * Supports for querying tunnels. It's used by consumers.
  */
-@Command(scope = "onos", name = "query-tunnels", description = "Supports for querying all tunnels by using IP address"
-        + " and optical as tunnel end point now."
+@Command(scope = "onos", name = "tunnels", description = "Supports for querying tunnels."
         + " It's used by consumers.")
 public class TunnelQueryCommand extends AbstractShellCommand {
-    @Argument(index = 0, name = "src", description = "Source tunnel point."
+    @Option(name = "-s", aliases = "--src", description = "Source tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise src means IP address.", required = true, multiValued = false)
+            + " Otherwise src means IP address.", required = false, multiValued = false)
     String src = null;
-    @Argument(index = 1, name = "dst", description = "Destination tunnel point."
+    @Option(name = "-d", aliases = "--dst", description = "Destination tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise dst means IP address.", required = true, multiValued = false)
+            + " Otherwise dst means IP address.", required = false, multiValued = false)
     String dst = null;
 
-    @Argument(index = 2, name = "type", description = "The type of tunnels,"
-            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
+    @Option(name = "-t", aliases = "--type", description = "The type of tunnels,"
+            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = false, multiValued = false)
     String type = null;
 
-    private static final String FMT = "src=%s, dst=%s,"
+    @Option(name = "-i", aliases = "--tunnelId",
+            description = "the tunnel identity.", required = false, multiValued = false)
+    String tunnelId = null;
+
+    private static final String FMT = "tunnelId=%s, src=%s, dst=%s,"
             + "type=%s, state=%s, producerName=%s, tunnelName=%s,"
-            + "groupId=%s";
+            + "groupId=%s, path=%s%s";
 
     @Override
     protected void execute() {
+        Tunnel.Type trueType = null;
         TunnelService service = get(TunnelService.class);
         ProviderId producerName = new ProviderId("default",
                                                  "org.onosproject.provider.tunnel.default");
-        TunnelEndPoint srcPoint = null;
-        TunnelEndPoint dstPoint = null;
-        if ("MPLS".equals(type) || "VLAN".equals(type) || "VXLAN".equals(type)
-                || "GRE".equals(type)) {
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("ODUK".equals(type) || "OCH".equals(type)) {
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else {
-            print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
-            return;
+        Collection<Tunnel> tunnelSet = null;
+        if (isNull(src) && isNull(dst) && isNull(type) && isNull(tunnelId)) {
+            tunnelSet = service.queryAllTunnels();
         }
-        Collection<Tunnel> tunnelSet = service.queryTunnel(srcPoint, dstPoint);
-        for (Tunnel tunnel : tunnelSet) {
-            print(FMT, tunnel.src().toString(), tunnel.dst().toString(), tunnel.type(),
-                  tunnel.state(), tunnel.providerId(), tunnel.tunnelName(),
-                  tunnel.groupId());
+
+        if (!isNull(src) && !isNull(dst) && !isNull(type)) {
+            TunnelEndPoint srcPoint = null;
+            TunnelEndPoint dstPoint = null;
+            if ("MPLS".equals(type) || "VXLAN".equals(type)
+                    || "GRE".equals(type)) {
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VLAN".equals(type)) {
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("ODUK".equals(type)) {
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("OCH".equals(type)) {
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else {
+                print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
+                return;
+            }
+            tunnelSet = service.queryTunnel(srcPoint, dstPoint);
+        }
+        if (!isNull(type)) {
+            if ("MPLS".equals(type)) {
+                trueType = Tunnel.Type.MPLS;
+            } else if ("VLAN".equals(type)) {
+                trueType = Tunnel.Type.VLAN;
+            } else if ("VXLAN".equals(type)) {
+                trueType = Tunnel.Type.VXLAN;
+            } else if ("GRE".equals(type)) {
+                trueType = Tunnel.Type.GRE;
+            } else if ("ODUK".equals(type)) {
+                trueType = Tunnel.Type.ODUK;
+            } else if ("OCH".equals(type)) {
+                trueType = Tunnel.Type.OCH;
+            } else {
+                print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
+                return;
+            }
+            tunnelSet = service.queryTunnel(trueType);
+        }
+        if (!isNull(tunnelId)) {
+            TunnelId id = TunnelId.valueOf(tunnelId);
+            Tunnel tunnel = service.queryTunnel(id);
+            tunnelSet = new HashSet<Tunnel>();
+            tunnelSet.add(tunnel);
+        }
+        if (tunnelSet != null) {
+            for (Tunnel tunnel : tunnelSet) {
+                print(FMT, tunnel.tunnelId(), tunnel.src().toString(), tunnel.dst().toString(),
+                      tunnel.type(), tunnel.state(), tunnel.providerId(),
+                      tunnel.tunnelName(), tunnel.groupId(),
+                      showPath(tunnel.path()),
+                      annotations(tunnel.annotations()));
+            }
         }
     }
 
+    private String showPath(Path path) {
+        if (path == null) {
+            return "";
+        }
+        StringBuilder builder = new StringBuilder("(");
+        for (Link link : path.links()) {
+            builder.append("(DeviceId:" + link.src().deviceId() + " Port:"
+                    + link.src().port().toString());
+            builder.append(" DeviceId:" + link.dst().deviceId() + " Port:"
+                    + link.dst().port().toString() + ")");
+        }
+        builder.append(annotations(path.annotations()) + ")");
+        return builder.toString();
+    }
+
+    private boolean isNull(String s) {
+        return s == null || "".equals(s);
+    }
 }
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
index 45d1e78..92db926 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
@@ -29,7 +29,7 @@
  * Query all tunnel subscriptions of consumer by consumer id.
  * It's used by consumers.
  */
-@Command(scope = "onos", name = "query-tunnel-subscriptions",
+@Command(scope = "onos", name = "tunnel-subscriptions",
       description = "Query all request orders of consumer by consumer id. It's used by consumers.")
 public class TunnelQuerySubscriptionCommand extends AbstractShellCommand {
     @Argument(index = 0, name = "consumerId",
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
index 3de8f00..2b7d7bb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
@@ -19,90 +19,180 @@
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.DefaultApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.OpticalLogicId;
 import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.TunnelName;
 import org.onosproject.incubator.net.tunnel.TunnelService;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.ProviderId;
 
 /**
- * Returns all tunnels between specific source tunnel end point and specific
- * destination tunnel end point. Supports for IP address and optical as tunnel
- * end point now. It's used by consumers.
+ * Returns tunnels. It's used by consumers.
  */
-@Command(scope = "onos", name = "return-tunnels",
-description = "Returns all tunnels between specific source tunnel end point and specific "
-        + " destination tunnel end point. Supports for IP address and optical as tunnel end point now."
-        + " It's used by consumers.")
+@Command(scope = "onos", name = "tunnel-return",
+description = "Returns tunnels. It's used by consumers.")
 public class TunnelReturnCommand extends AbstractShellCommand {
-    @Argument(index = 0, name = "consumerId", description = "consumer id means application id.",
-            required = true, multiValued = false)
+    @Argument(index = 0, name = "consumerId",
+            description = "consumer id means application id.", required = true, multiValued = false)
     String consumerId = null;
-    @Argument(index = 1, name = "src", description = "Source tunnel point."
+
+    @Option(name = "-s", aliases = "--src", description = "Source tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise src means IP address.", required = true, multiValued = false)
+            + " Otherwise src means IP address.", required = false, multiValued = false)
     String src = null;
-    @Argument(index = 2, name = "dst", description = "Destination tunnel point."
+
+    @Option(name = "-d", aliases = "--dst", description = "Destination tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
             + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise dst means IP address.", required = true, multiValued = false)
+            + " Otherwise dst means IP address.", required = false, multiValued = false)
     String dst = null;
 
-    @Argument(index = 3, name = "type", description = "The type of tunnels,"
-            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
+    @Option(name = "-t", aliases = "--type", description = "The type of tunnels,"
+            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = false, multiValued = false)
     String type = null;
 
+    @Option(name = "-i", aliases = "--tunnelId",
+            description = "the tunnel identity.", required = false, multiValued = false)
+    String tunnelId = null;
+
+    @Option(name = "-n", aliases = "--tunnelName",
+            description = "The name of tunnels", required = false, multiValued = false)
+    String tunnelName = null;
+
     @Override
     protected void execute() {
+        Tunnel.Type trueType = null;
         TunnelService service = get(TunnelService.class);
         ApplicationId appId = new DefaultApplicationId(1, consumerId);
         ProviderId producerName = new ProviderId("default",
                                                  "org.onosproject.provider.tunnel.default");
-        TunnelEndPoint srcPoint = null;
-        TunnelEndPoint dstPoint = null;
-        if ("MPLS".equals(type) || "VLAN".equals(type) || "VXLAN".equals(type)
-                || "GRE".equals(type)) {
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("ODUK".equals(type) || "OCH".equals(type)) {
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else {
-            print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
-            return;
+        if (!isNull(src) && !isNull(dst) && !isNull(type)) {
+            TunnelEndPoint srcPoint = null;
+            TunnelEndPoint dstPoint = null;
+            if ("MPLS".equals(type)) {
+                trueType = Tunnel.Type.MPLS;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VXLAN".equals(type)) {
+                trueType = Tunnel.Type.VXLAN;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("GRE".equals(type)) {
+                trueType = Tunnel.Type.GRE;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VLAN".equals(type)) {
+                trueType = Tunnel.Type.VLAN;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            null,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("ODUK".equals(type)) {
+                trueType = Tunnel.Type.ODUK;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("OCH".equals(type)) {
+                trueType = Tunnel.Type.OCH;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.TIMESLOT,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else {
+                print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
+                return;
+            }
+            service.returnTunnel(appId, srcPoint, dstPoint, trueType);
         }
-        service.returnTunnel(appId, srcPoint, dstPoint);
+        if (!isNull(tunnelId)) {
+            TunnelId id = TunnelId.valueOf(tunnelId);
+            service.returnTunnel(appId, id);
+        }
+        if (!isNull(tunnelName)) {
+            TunnelName name = TunnelName.tunnelName(tunnelName);
+            service.returnTunnel(appId, name);
+        }
     }
-
+    private boolean isNull(String s) {
+        return s == null || "".equals(s);
+    }
 }
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index d92129a..5fbe61c 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -338,40 +338,37 @@
         </command>
         
         <command>
-            <action class="org.onosproject.cli.net.GetGlobalLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.GlobalLabelCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.GetLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.LabelResourceCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.CreateGlobalLabelResourcePoolCommand"/>
+            <action class="org.onosproject.cli.net.GlobalLabelPoolCreateCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.CreateLabelResourcePoolCommand"/>
+            <action class="org.onosproject.cli.net.LabelPoolCreateCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.DestroyGlobalLabelResourcePoolCommand"/>
+            <action class="org.onosproject.cli.net.GlobalLabelPoolDestoryCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.DestroyGlobalLabelResourcePoolCommand"/>
+            <action class="org.onosproject.cli.net.LabelPoolDestroyCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.ReleaseGlobalLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.GlobalLabelReleaseCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.ReleaseLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.LabelReleaseCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.ApplyGlobalLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.GlobalLabelApplyCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.cli.net.ApplyLabelResourceCommand"/>
+            <action class="org.onosproject.cli.net.LabelApplyCommand"/>
         </command>
         <!-- tunnel commands -->
         <command>
-            <action class="org.onosproject.cli.net.TunnelDeleteCommand"/>
-        </command>
-        <command>
             <action class="org.onosproject.cli.net.TunnelBorrowCommand"/>
         </command>
         <command>
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java
index c6e4119..f80dfac 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java
@@ -15,7 +15,6 @@
  */
 package org.onosproject.incubator.net.tunnel;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.MoreObjects.toStringHelper;
 
 import java.util.Objects;
@@ -55,9 +54,6 @@
                         Optional<PortNumber> number, Optional<OpticalTunnelEndPoint> parentPoint,
                         Type type, OpticalLogicId id, boolean isGlobal, Annotations... annotations) {
         super(providerId, annotations);
-        checkNotNull(type, "type cannot be null");
-        checkNotNull(id, "id cannot be null");
-        checkNotNull(isGlobal, "isGlobal cannot be null");
         this.elementId = elementId;
         this.portNumber = number;
         this.parentPoint = parentPoint;
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java
old mode 100644
new mode 100755
index 62a5dcb..5f448e0
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Open Networking Laboratory
+ * Copyright 2014-2015 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.
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.MoreObjects.toStringHelper;
 
 import java.util.Objects;
@@ -25,6 +23,7 @@
 import org.onosproject.net.AbstractModel;
 import org.onosproject.net.Annotations;
 import org.onosproject.net.NetworkResource;
+import org.onosproject.net.Path;
 import org.onosproject.net.provider.ProviderId;
 
 /**
@@ -43,6 +42,7 @@
     private final TunnelId tunnelId; // tunnel identify generated by
                                      // ONOS as primary key
     private final TunnelName tunnelName; // name of a tunnel
+    private final Path path;
 
     /**
      * Creates an active infrastructure tunnel using the supplied information.
@@ -54,14 +54,15 @@
      * @param groupId groupId
      * @param tunnelId tunnelId
      * @param tunnelName tunnel name
+     * @param path the path of tunnel
      * @param annotations optional key/value annotations
      */
     public DefaultTunnel(ProviderId producerName, TunnelEndPoint src,
                          TunnelEndPoint dst, Type type, DefaultGroupId groupId,
-                         TunnelId tunnelId, TunnelName tunnelName,
+                         TunnelId tunnelId, TunnelName tunnelName, Path path,
                          Annotations... annotations) {
         this(producerName, src, dst, type, Tunnel.State.ACTIVE, groupId,
-             tunnelId, tunnelName, annotations);
+             tunnelId, tunnelName, path, annotations);
     }
 
     /**
@@ -75,18 +76,14 @@
      * @param groupId groupId
      * @param tunnelId tunnelId
      * @param tunnelName tunnel name
+     * @param path the path of tunnel
      * @param annotations optional key/value annotations
      */
     public DefaultTunnel(ProviderId producerName, TunnelEndPoint src,
                          TunnelEndPoint dst, Type type, State state,
                          DefaultGroupId groupId, TunnelId tunnelId,
-                         TunnelName tunnelName, Annotations... annotations) {
+                         TunnelName tunnelName, Path path, Annotations... annotations) {
         super(producerName, annotations);
-        checkNotNull(producerName, "producerName cannot be null");
-        checkNotNull(src, "src cannot be null");
-        checkNotNull(dst, "dst cannot be null");
-        checkNotNull(type, "type cannot be null");
-        checkNotNull(state, "state cannot be null");
         this.src = src;
         this.dst = dst;
         this.type = type;
@@ -94,6 +91,7 @@
         this.groupId = groupId;
         this.tunnelId = tunnelId;
         this.tunnelName = tunnelName;
+        this.path = path;
     }
 
     @Override
@@ -136,10 +134,16 @@
         return tunnelName;
     }
 
+
+    @Override
+    public Path path() {
+        return path;
+    }
+
     @Override
     public int hashCode() {
         return Objects.hash(src, dst, type, groupId, tunnelId, tunnelName,
-                            state);
+                            state, path);
     }
 
     @Override
@@ -155,7 +159,8 @@
                     && Objects.equals(this.groupId, other.groupId)
                     && Objects.equals(this.tunnelId, other.tunnelId)
                     && Objects.equals(this.tunnelName, other.tunnelName)
-                    && Objects.equals(this.state, other.state);
+                    && Objects.equals(this.state, other.state)
+                    && Objects.equals(this.path, other.path);
         }
         return false;
     }
@@ -165,7 +170,7 @@
         return toStringHelper(this).add("src", src).add("dst", dst)
                 .add("type", type).add("state", state).add("groupId", groupId)
                 .add("producerTunnelId", tunnelId)
-                .add("tunnelName", tunnelName).toString();
+                .add("tunnelName", tunnelName)
+                .add("path", path).toString();
     }
-
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
old mode 100644
new mode 100755
index e4c4d89..347021d
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
@@ -13,12 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import org.onosproject.core.DefaultGroupId;
 import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.Path;
 import org.onosproject.net.SparseAnnotations;
 import org.onosproject.net.provider.ProviderId;
 
@@ -39,6 +38,7 @@
     // tunnel producer
     private final ProviderId producerName; // tunnel producer name
     private final TunnelName tunnelName; // name of a tunnel
+    private final Path path;
 
     /**
      * Creates a tunnel description using the supplied information.
@@ -50,6 +50,7 @@
      * @param groupId groupId
      * @param producerName tunnel producer
      * @param tunnelName tunnel name
+     * @param path the path of tunnel
      * @param annotations optional key/value annotations
      */
     public DefaultTunnelDescription(TunnelId id, TunnelEndPoint src,
@@ -57,12 +58,9 @@
                                     DefaultGroupId groupId,
                                     ProviderId producerName,
                                     TunnelName tunnelName,
+                                    Path path,
                                     SparseAnnotations... annotations) {
         super(annotations);
-        checkNotNull(producerName, "producerName cannot be null");
-        checkNotNull(src, "src cannot be null");
-        checkNotNull(dst, "dst cannot be null");
-        checkNotNull(type, "type cannot be null");
         this.tunnelId = id;
         this.src = src;
         this.dst = dst;
@@ -70,6 +68,7 @@
         this.groupId = groupId;
         this.producerName = producerName;
         this.tunnelName = tunnelName;
+        this.path = path;
     }
 
     @Override
@@ -107,6 +106,12 @@
         return tunnelName;
     }
 
+
+    @Override
+    public Path path() {
+        return path;
+    }
+
     @Override
     public String toString() {
         return MoreObjects.toStringHelper(this)
@@ -117,7 +122,7 @@
                 .add("tunnelName", tunnelName())
                 .add("producerName", producerName())
                 .add("groupId", groupId())
+                .add("path", path)
                 .toString();
     }
-
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java
old mode 100644
new mode 100755
index 8b80b86..edbbe1b
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
 import org.onosproject.core.DefaultGroupId;
 import org.onosproject.net.Annotated;
 import org.onosproject.net.NetworkResource;
+import org.onosproject.net.Path;
 import org.onosproject.net.Provided;
 
 /**
@@ -144,4 +144,10 @@
      */
     NetworkResource resource();
 
+    /**
+     * Returns the path of the tunnel.
+     *
+     * @return the path of the tunnel
+     */
+    Path path();
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java
old mode 100644
new mode 100755
index eca8fdd..dbcbc63
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java
@@ -13,14 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
 import org.onosproject.core.DefaultGroupId;
+import org.onosproject.incubator.net.tunnel.Tunnel.Type;
 import org.onosproject.net.Annotated;
 import org.onosproject.net.Description;
+import org.onosproject.net.Path;
 import org.onosproject.net.provider.ProviderId;
-import org.onosproject.incubator.net.tunnel.Tunnel.Type;
 
 /**
  * Describes a tunnel.
@@ -75,4 +75,11 @@
      * @return Tunnel Name
      */
     TunnelName tunnelName();
+
+    /**
+     * Returns the path of the tunnel.
+     *
+     * @return the path of the tunnel
+     */
+    Path path();
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java
index b596700..0cbad8c 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.incubator.net.tunnel;
 
-import static com.google.common.base.Preconditions.checkArgument;
 
 /**
  * Representation of a Tunnel Id.
@@ -35,8 +34,7 @@
     }
 
     public static TunnelId valueOf(String value) {
-        checkArgument(value.startsWith("0x"));
-         return new TunnelId(Long.parseLong(value.substring("0x".length()), 16));
+         return new TunnelId(Long.parseLong(value));
     }
 
     /**
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java
index f01bb61..1107fc1 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java
@@ -102,4 +102,12 @@
      * @param tunnel tunnel information
      */
     void tunnelUpdated(TunnelDescription tunnel);
+
+    /**
+     * Signals that the a tunnel was queried.
+     * It's used by producers.
+     * @param tunnelId tunnel identity
+     * @return tunnel entity
+     */
+    Tunnel tunnelQueryById(TunnelId tunnelId);
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java
index 9049299..84f8f24 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java
@@ -45,4 +45,12 @@
      */
     void tunnelUpdated(TunnelDescription tunnel);
 
+    /**
+     * Signals that the a tunnel was queried.
+     *
+     * @param tunnelId tunnel identity
+     * @return tunnel entity
+     */
+    Tunnel tunnelQueryById(TunnelId tunnelId);
+
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
index f2611fa..3cce69b 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
 import java.util.Collection;
 
 import org.onosproject.core.ApplicationId;
+import org.onosproject.incubator.net.tunnel.Tunnel.Type;
 import org.onosproject.net.Annotations;
 
 /**
@@ -83,7 +83,7 @@
      * @return collection of available Tunnels
      */
     Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
-                                       TunnelEndPoint dst, Tunnel.Type type,
+                                       TunnelEndPoint dst, Type type,
                                        Annotations... annotations);
 
     /**
@@ -122,7 +122,7 @@
      * @return success or fail
      */
     boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
-                              TunnelEndPoint dst, Tunnel.Type type,
+                              TunnelEndPoint dst, Type type,
                               Annotations... annotations);
 
     /**
@@ -160,7 +160,7 @@
      * @param type tunnel type
      * @return Collection of tunnels
      */
-    Collection<Tunnel> queryTunnel(Tunnel.Type type);
+    Collection<Tunnel> queryTunnel(Type type);
 
     /**
      * Returns all tunnels between source point and destination point.
@@ -174,6 +174,13 @@
     /**
      * Returns all tunnels.
      *
+     * @return Collection of tunnels
+     */
+    Collection<Tunnel> queryAllTunnels();
+
+    /**
+     * Returns all tunnels.
+     *
      * @return all tunnels
      */
     int tunnelCount();
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java
index 3286ef2..b773611 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java
@@ -13,15 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel;
 
 import java.util.Collection;
 
 import org.onosproject.core.ApplicationId;
+import org.onosproject.incubator.net.tunnel.Tunnel.Type;
 import org.onosproject.net.Annotations;
 import org.onosproject.net.provider.ProviderId;
-import org.onosproject.incubator.net.tunnel.Tunnel.Type;
 import org.onosproject.store.Store;
 
 /**
@@ -215,6 +214,13 @@
 
     /**
      * Returns all tunnels.
+     *
+     * @return Collection of tunnels
+     */
+    Collection<Tunnel> queryAllTunnels();
+
+    /**
+     * Returns all tunnels.
      * @return all tunnels
      */
     int tunnelCount();
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java b/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java
index bab9ff0..ae94991 100644
--- a/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2015 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.incubator.net.tunnel;
 
 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
@@ -50,13 +34,13 @@
         ProviderId producerName2 = new ProviderId("producer2", "13");
         Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
                                       Tunnel.State.ACTIVE, groupId, tunnelId,
-                                      tunnelName);
+                                      tunnelName, null);
         Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
                                       Tunnel.State.ACTIVE, groupId, tunnelId,
-                                      tunnelName);
+                                      tunnelName, null);
         Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH,
                                       Tunnel.State.ACTIVE, groupId, tunnelId,
-                                      tunnelName);
+                                      tunnelName, null);
         new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
                 .testEquals();
     }
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java b/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java
index 6f330a7..a58e10b 100644
--- a/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2015 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.incubator.net.tunnel;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -53,7 +37,7 @@
         ProviderId producerName1 = new ProviderId("producer1", "13");
         Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
                                       Tunnel.State.ACTIVE, groupId, tunnelId,
-                                      tunnelName);
+                                      tunnelName, null);
         TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1);
         assertThat(e1, is(notNullValue()));
         assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED));
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
index 94daed0..2836ea5 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
@@ -91,9 +91,9 @@
         checkNotNull(deviceId, "deviceId is not null");
         checkNotNull(beginLabel, "beginLabel is not null");
         checkNotNull(endLabel, "beginLabel is not null");
-        checkArgument(beginLabel.labelId() < 0 || endLabel.labelId() < 0,
+        checkArgument(beginLabel.labelId() >= 0 || endLabel.labelId() >= 0,
                       "The value of beginLabel and the value of endLabel must be both positive number.");
-        checkArgument(beginLabel.labelId() > endLabel.labelId(),
+        checkArgument(beginLabel.labelId() <= endLabel.labelId(),
                       "The value of endLabel must be greater than the value of endLabel.");
         return store.createDevicePool(deviceId, beginLabel, endLabel);
     }
@@ -103,10 +103,10 @@
                                     LabelResourceId endLabel) {
         checkNotNull(beginLabel, "beginLabel is not null");
         checkNotNull(endLabel, "beginLabel is not null");
-        checkArgument(beginLabel.labelId() < 0 || endLabel.labelId() < 0,
-                      "The value of beginLabel and the value of endLabel must be both positive number.");
-        checkArgument(beginLabel.labelId() > endLabel.labelId(),
-                      "The value of endLabel must be greater than the value of endLabel.");
+        checkArgument(beginLabel.labelId() >= 0 && endLabel.labelId() >= 0,
+                "The value of beginLabel and the value of endLabel must be both positive number.");
+        checkArgument(beginLabel.labelId() <= endLabel.labelId(),
+                "The value of endLabel must be greater than the value of endLabel.");
         return store.createGlobalPool(beginLabel, endLabel);
     }
 
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
index c2c9975..3350cd1 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.net.tunnel.impl;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -31,14 +30,9 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.event.EventDeliveryService;
 import org.onosproject.event.ListenerRegistry;
-import org.onosproject.net.Annotations;
-import org.onosproject.net.Path;
-import org.onosproject.net.provider.AbstractProviderRegistry;
-import org.onosproject.net.provider.AbstractProviderService;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultTunnel;
-import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.Tunnel.Type;
+import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelAdminService;
 import org.onosproject.incubator.net.tunnel.TunnelDescription;
 import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
@@ -53,6 +47,11 @@
 import org.onosproject.incubator.net.tunnel.TunnelStore;
 import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate;
 import org.onosproject.incubator.net.tunnel.TunnelSubscription;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.Path;
+import org.onosproject.net.provider.AbstractProviderRegistry;
+import org.onosproject.net.provider.AbstractProviderService;
+import org.onosproject.net.provider.ProviderId;
 import org.slf4j.Logger;
 
 /**
@@ -277,6 +276,12 @@
         return store.queryTunnel(src, dst);
     }
 
+
+    @Override
+    public Collection<Tunnel> queryAllTunnels() {
+        return store.queryAllTunnels();
+    }
+
     @Override
     public int tunnelCount() {
         return store.tunnelCount();
@@ -313,6 +318,7 @@
                                                     tunnel.groupId(),
                                                     tunnel.id(),
                                                     tunnel.tunnelName(),
+                                                    tunnel.path(),
                                                     tunnel.annotations());
             return store.createOrUpdateTunnel(storedTunnel);
         }
@@ -325,6 +331,7 @@
                                                     tunnel.groupId(),
                                                     tunnel.id(),
                                                     tunnel.tunnelName(),
+                                                    tunnel.path(),
                                                     tunnel.annotations());
             store.createOrUpdateTunnel(storedTunnel);
         }
@@ -333,18 +340,28 @@
         public void tunnelRemoved(TunnelDescription tunnel) {
             if (tunnel.id() != null) {
                 store.deleteTunnel(tunnel.id());
+                return;
             }
             if (tunnel.src() != null && tunnel.dst() != null
                     && tunnel.type() != null) {
                 store.deleteTunnel(tunnel.src(), tunnel.dst(), tunnel.type(),
                                    provider().id());
+                return;
             }
             if (tunnel.src() != null && tunnel.dst() != null
                     && tunnel.type() == null) {
                 store.deleteTunnel(tunnel.src(), tunnel.dst(), provider().id());
+                return;
             }
         }
 
+
+        @Override
+        public Tunnel tunnelQueryById(TunnelId tunnelId) {
+            return store.queryTunnel(tunnelId);
+        }
+
+
     }
 
     private class InternalStoreDelegate implements TunnelStoreDelegate {
@@ -355,4 +372,5 @@
             }
         }
     }
+
 }
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java
index 09a558d..bc1edf1 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java
@@ -15,7 +15,6 @@
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -25,9 +24,6 @@
 import org.apache.felix.scr.annotations.Service;
 import org.onlab.util.KryoNamespace;
 import org.onosproject.cluster.ClusterService;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.device.DeviceService;
 import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
 import org.onosproject.incubator.net.resource.label.LabelResource;
 import org.onosproject.incubator.net.resource.label.LabelResourceDelegate;
@@ -37,6 +33,9 @@
 import org.onosproject.incubator.net.resource.label.LabelResourcePool;
 import org.onosproject.incubator.net.resource.label.LabelResourceRequest;
 import org.onosproject.incubator.net.resource.label.LabelResourceStore;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.device.DeviceService;
 import org.onosproject.store.AbstractStore;
 import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
 import org.onosproject.store.cluster.messaging.ClusterMessage;
@@ -44,11 +43,10 @@
 import org.onosproject.store.flow.ReplicaInfo;
 import org.onosproject.store.flow.ReplicaInfoService;
 import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.serializers.KryoSerializer;
-import org.onosproject.store.serializers.custom.DistributedStoreSerializers;
 import org.onosproject.store.service.ConsistentMap;
 import org.onosproject.store.service.Serializer;
 import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.Versioned;
 import org.slf4j.Logger;
 
 import com.google.common.collect.ImmutableSet;
@@ -67,9 +65,6 @@
     private static final String POOL_MAP_NAME = "labelresourcepool";
 
     private static final String GLOBAL_RESOURCE_POOL_DEVICE_ID = "global_resource_pool_device_id";
-    // primary data:
-    // read/write needs to be locked
-    private final ReentrantReadWriteLock resourcePoolLock = new ReentrantReadWriteLock();
 
     private ConsistentMap<DeviceId, LabelResourcePool> resourcePool = null;
 
@@ -92,41 +87,24 @@
     private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 8;
     private static final long PEER_REQUEST_TIMEOUT_MS = 5000;
 
-    protected static final KryoSerializer SERIALIZER = new KryoSerializer() {
-        @Override
-        protected void setupKryoPool() {
-            serializerPool = KryoNamespace.newBuilder()
-                    .register(DistributedStoreSerializers.STORE_COMMON)
-                    .nextId(DistributedStoreSerializers.STORE_CUSTOM_BEGIN)
+    private static final Serializer SERIALIZER = Serializer
+            .using(new KryoNamespace.Builder().register(KryoNamespaces.API)
                     .register(LabelResourceEvent.class)
                     .register(LabelResourcePool.class).register(DeviceId.class)
                     .register(LabelResourceRequest.class)
                     .register(LabelResourceRequest.Type.class)
                     .register(LabelResourceEvent.Type.class)
                     .register(DefaultLabelResource.class)
-                    .register(LabelResourceId.class).build();
-        }
-    };
+                    .register(LabelResourceId.class)
+                    .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID).build());
 
     @Activate
     public void activate() {
 
         resourcePool = storageService
                 .<DeviceId, LabelResourcePool>consistentMapBuilder()
-                .withName(POOL_MAP_NAME).withSerializer(new Serializer() {
-                    KryoNamespace kryo = new KryoNamespace.Builder()
-                            .register(KryoNamespaces.API).build();
-
-                    @Override
-                    public <T> byte[] encode(T object) {
-                        return kryo.serialize(object);
-                    }
-
-                    @Override
-                    public <T> T decode(byte[] bytes) {
-                        return kryo.deserialize(bytes);
-                    }
-                }).withPartitionsDisabled().build();
+                .withName(POOL_MAP_NAME).withSerializer(SERIALIZER)
+                .withPartitionsDisabled().build();
         messageHandlingExecutor = Executors
                 .newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE,
                                     groupedThreads("onos/store/flow",
@@ -142,7 +120,7 @@
                                        log.trace("received get flow entry request for {}",
                                                  operation);
                                        boolean b = internalCreate(operation);
-                                           message.respond(SERIALIZER.encode(b));
+                                       message.respond(SERIALIZER.encode(b));
                                    }
                                }, messageHandlingExecutor);
         clusterCommunicator
@@ -156,7 +134,7 @@
                                        log.trace("received get flow entry request for {}",
                                                  deviceId);
                                        boolean b = internalDestroy(deviceId);
-                                           message.respond(SERIALIZER.encode(b));
+                                       message.respond(SERIALIZER.encode(b));
                                    }
                                }, messageHandlingExecutor);
         clusterCommunicator
@@ -170,8 +148,8 @@
                                        log.trace("received get flow entry request for {}",
                                                  request);
                                        final Collection<LabelResource> resource = internalApply(request);
-                                           message.respond(SERIALIZER
-                                                   .encode(resource));
+                                       message.respond(SERIALIZER
+                                               .encode(resource));
                                    }
                                }, messageHandlingExecutor);
         clusterCommunicator
@@ -185,8 +163,8 @@
                                        log.trace("received get flow entry request for {}",
                                                  request);
                                        final boolean isSuccess = internalRelease(request);
-                                           message.respond(SERIALIZER
-                                                   .encode(isSuccess));
+                                       message.respond(SERIALIZER
+                                               .encode(isSuccess));
                                    }
                                }, messageHandlingExecutor);
         log.info("Started");
@@ -256,18 +234,16 @@
     }
 
     private boolean internalCreate(LabelResourcePool pool) {
-        resourcePoolLock.writeLock().lock();
-        LabelResourcePool poolOld = resourcePool.get(pool.deviceId()).value();
+        Versioned<LabelResourcePool> poolOld = resourcePool
+                .get(pool.deviceId());
         if (poolOld == null) {
             resourcePool.put(pool.deviceId(), pool);
-            resourcePoolLock.writeLock().unlock();
             LabelResourceEvent event = new LabelResourceEvent(
                                                               Type.POOL_CREATED,
                                                               pool);
             notifyDelegate(event);
             return true;
         }
-        resourcePoolLock.writeLock().unlock();
         return false;
     }
 
@@ -301,12 +277,12 @@
     }
 
     private boolean internalDestroy(DeviceId deviceId) {
-        LabelResourcePool poolOld = resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> poolOld = resourcePool.get(deviceId);
         if (poolOld != null) {
             resourcePool.remove(deviceId);
             LabelResourceEvent event = new LabelResourceEvent(
                                                               Type.POOL_CREATED,
-                                                              poolOld);
+                                                              poolOld.value());
             notifyDelegate(event);
         }
         log.info("success to destroy the label resource pool of device id {}",
@@ -349,15 +325,14 @@
     }
 
     private Collection<LabelResource> internalApply(LabelResourceRequest request) {
-        resourcePoolLock.writeLock().lock();
         DeviceId deviceId = request.deviceId();
         long applyNum = request.applyNum();
-        LabelResourcePool pool = resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> poolOld = resourcePool.get(deviceId);
+        LabelResourcePool pool = poolOld.value();
         Collection<LabelResource> result = new HashSet<LabelResource>();
         long freeNum = this.getFreeNumOfDevicePool(deviceId);
         if (applyNum > freeNum) {
             log.info("the free number of the label resource pool of deviceId {} is not enough.");
-            resourcePoolLock.writeLock().unlock();
             return Collections.emptyList();
         }
         Set<LabelResource> releaseLabels = new HashSet<LabelResource>(
@@ -393,7 +368,6 @@
                                                           current, freeLabel);
         resourcePool.put(deviceId, newPool);
         log.info("success to apply label resource");
-        resourcePoolLock.writeLock().unlock();
         return result;
     }
 
@@ -440,12 +414,11 @@
     }
 
     private boolean internalRelease(LabelResourceRequest request) {
-        resourcePoolLock.writeLock().lock();
         DeviceId deviceId = request.deviceId();
         Collection<LabelResource> release = request.releaseCollection();
-        LabelResourcePool pool = resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> poolOld = resourcePool.get(deviceId);
+        LabelResourcePool pool = poolOld.value();
         if (pool == null) {
-            resourcePoolLock.writeLock().unlock();
             log.info("the label resource pool of device id {} does not exist");
             return false;
         }
@@ -480,34 +453,34 @@
                                                           current, s);
         resourcePool.put(deviceId, newPool);
         log.info("success to release label resource");
-        resourcePoolLock.writeLock().unlock();
         return true;
     }
 
     @Override
     public boolean isDevicePoolFull(DeviceId deviceId) {
-        LabelResourcePool pool = resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> pool = resourcePool.get(deviceId);
         if (pool == null) {
             return true;
         }
-        return pool.currentUsedMaxLabelId() == pool.endLabel()
-                && pool.releaseLabelId().size() == 0 ? true : false;
+        return pool.value().currentUsedMaxLabelId() == pool.value().endLabel()
+                && pool.value().releaseLabelId().size() == 0 ? true : false;
     }
 
     @Override
     public long getFreeNumOfDevicePool(DeviceId deviceId) {
-        LabelResourcePool pool = resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> pool = resourcePool.get(deviceId);
         if (pool == null) {
             return 0;
         }
-        return pool.endLabel().labelId()
-                - pool.currentUsedMaxLabelId().labelId()
-                + pool.releaseLabelId().size();
+        return pool.value().endLabel().labelId()
+                - pool.value().currentUsedMaxLabelId().labelId()
+                + pool.value().releaseLabelId().size();
     }
 
     @Override
     public LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId) {
-        return resourcePool.get(deviceId).value();
+        Versioned<LabelResourcePool> pool = resourcePool.get(deviceId);
+        return pool == null ? null : pool.value();
     }
 
     @Override
@@ -564,8 +537,7 @@
 
     private <T> T complete(Future<T> future) {
         try {
-            return future.get(PEER_REQUEST_TIMEOUT_MS,
-                                                TimeUnit.MILLISECONDS);
+            return future.get(PEER_REQUEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
             log.error("Interrupted while waiting for operation to complete.", e);
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
index b49743c..7d99586 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Open Networking Laboratory
+ * Copyright 2014-2015 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.
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.incubator.store.tunnel.impl;
 
 import static org.slf4j.LoggerFactory.getLogger;
@@ -37,8 +36,6 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.core.IdGenerator;
-import org.onosproject.net.Annotations;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultTunnel;
 import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.Tunnel.Type;
@@ -49,6 +46,10 @@
 import org.onosproject.incubator.net.tunnel.TunnelStore;
 import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate;
 import org.onosproject.incubator.net.tunnel.TunnelSubscription;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.provider.ProviderId;
 import org.onosproject.store.AbstractStore;
 import org.onosproject.store.app.GossipApplicationStore.InternalState;
 import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
@@ -126,6 +127,10 @@
                 .<Tunnel.Type, Set<TunnelId>>eventuallyConsistentMapBuilder()
                 .withName("type_tunnel").withSerializer(serializer)
                 .withClockService(new WallclockClockManager<>()).build();
+        orderRelationship = storageService
+                .<ApplicationId, Set<TunnelSubscription>>eventuallyConsistentMapBuilder()
+                .withName("type_tunnel").withSerializer(serializer)
+                .withClockService(new WallclockClockManager<>()).build();
         idGenerator = coreService.getIdGenerator(runnelOpTopoic);
         log.info("Started");
     }
@@ -148,13 +153,15 @@
                 log.info("This tunnel[" + tunnel.tunnelId() + "] is not available.");
                 return tunnel.tunnelId();
             }
-            Tunnel newT = new DefaultTunnel(tunnel.providerId(), tunnel.src(),
-                                            tunnel.dst(), tunnel.type(),
-                                            tunnel.state(), tunnel.groupId(),
+            DefaultAnnotations oldAnno = (DefaultAnnotations) old.annotations();
+            SparseAnnotations newAnno = (SparseAnnotations) tunnel.annotations();
+            Tunnel newT = new DefaultTunnel(old.providerId(), old.src(),
+                                            old.dst(), old.type(),
+                                            old.state(), old.groupId(),
                                             old.tunnelId(),
-                                            tunnel.tunnelName(),
-                                            tunnel.annotations());
-            tunnelIdAsKeyStore.remove(tunnel.tunnelId());
+                                            old.tunnelName(),
+                                            old.path(),
+                                            DefaultAnnotations.merge(oldAnno, newAnno));
             tunnelIdAsKeyStore.put(tunnel.tunnelId(), newT);
             TunnelEvent event = new TunnelEvent(
                                                 TunnelEvent.Type.TUNNEL_UPDATED,
@@ -168,6 +175,7 @@
                                             tunnel.state(), tunnel.groupId(),
                                             tunnelId,
                                             tunnel.tunnelName(),
+                                            tunnel.path(),
                                             tunnel.annotations());
             TunnelKey key = TunnelKey.tunnelKey(tunnel.src(), tunnel.dst());
             tunnelIdAsKeyStore.put(tunnelId, newT);
@@ -463,6 +471,11 @@
     }
 
     @Override
+    public Collection<Tunnel> queryAllTunnels() {
+        return tunnelIdAsKeyStore.values();
+    }
+
+    @Override
     public int tunnelCount() {
         return tunnelIdAsKeyStore.size();
     }
@@ -515,5 +528,4 @@
                     .add("dst", dst).toString();
         }
     }
-
 }
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java
index b110a0c..1405615 100644
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java
+++ b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java
@@ -67,14 +67,12 @@
 
     @Activate
     public void activate(ComponentContext context) {
-        cfgService.registerProperties(getClass());
         service = tunnelProviderRegistry.register(this);
         log.info("Started");
     }
 
     @Deactivate
     public void deactivate(ComponentContext context) {
-        cfgService.unregisterProperties(getClass(), false);
         tunnelProviderRegistry.unregister(this);
         log.info("Stopped");
     }
@@ -130,4 +128,9 @@
         service.tunnelUpdated(tunnel);
     }
 
+    @Override
+    public Tunnel tunnelQueryById(TunnelId tunnelId) {
+        return service.tunnelQueryById(tunnelId);
+    }
+
 }
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/RemoveTunnelCommand.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/RemoveTunnelCommand.java
deleted file mode 100644
index 27721e7..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/RemoveTunnelCommand.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2014-2015 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.provider.tunnel.cli;
-
-import java.util.Optional;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onlab.packet.IpAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
-import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.OpticalLogicId;
-import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.Tunnel;
-import org.onosproject.incubator.net.tunnel.TunnelDescription;
-import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
-import org.onosproject.incubator.net.tunnel.TunnelProvider;
-
-/**
- * Supports for removing all tunnels by using IP address and optical as tunnel
- * end point now. It's used by producers.
- */
-@Command(scope = "onos", name = "remove-tunnels", description = "Supports for removing all tunnels by using IP address"
-        + " and optical as tunnel end point now. It's used by producers.")
-public class RemoveTunnelCommand extends AbstractShellCommand {
-    @Argument(index = 0, name = "src", description = "Source tunnel point."
-            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise src means IP address.", required = true, multiValued = false)
-    String src = null;
-    @Argument(index = 1, name = "dst", description = "Destination tunnel point."
-            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
-            + " Otherwise dst means IP address.", required = true, multiValued = false)
-    String dst = null;
-
-    @Argument(index = 2, name = "type", description = "The type of tunnels,"
-            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
-    String type = null;
-
-    @Override
-    protected void execute() {
-        TunnelProvider service = get(TunnelProvider.class);
-        ProviderId producerName = new ProviderId("default",
-                                                 "org.onosproject.provider.tunnel.default");
-        TunnelEndPoint srcPoint = null;
-        TunnelEndPoint dstPoint = null;
-        Tunnel.Type trueType = null;
-        if ("MPLS".equals(type)) {
-            trueType = Tunnel.Type.MPLS;
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("VLAN".equals(type)) {
-            trueType = Tunnel.Type.VLAN;
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("VXLAN".equals(type)) {
-            trueType = Tunnel.Type.VXLAN;
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("GRE".equals(type)) {
-            trueType = Tunnel.Type.GRE;
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
-        } else if ("ODUK".equals(type)) {
-            trueType = Tunnel.Type.ODUK;
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else if ("OCH".equals(type)) {
-            trueType = Tunnel.Type.OCH;
-            String[] srcArray = src.split("-");
-            String[] dstArray = dst.split("-");
-            srcPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(srcArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(srcArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-            dstPoint = new DefaultOpticalTunnelEndPoint(
-                                                        producerName,
-                                                        Optional.of(DeviceId
-                                                                .deviceId(dstArray[0])),
-                                                        Optional.of(PortNumber
-                                                                .portNumber(dstArray[1])),
-                                                        null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
-                                                        OpticalLogicId
-                                                                .logicId(0),
-                                                        true);
-        } else {
-            print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
-            return;
-        }
-        TunnelDescription tunnel = new DefaultTunnelDescription(null, srcPoint,
-                                                                dstPoint,
-                                                                trueType, null,
-                                                                producerName,
-                                                                null);
-        service.tunnelRemoved(tunnel);
-    }
-
-}
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/CreateTunnelCommand.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelCreateCommand.java
similarity index 76%
rename from providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/CreateTunnelCommand.java
rename to providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelCreateCommand.java
index 495402b..4b595f1 100644
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/CreateTunnelCommand.java
+++ b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelCreateCommand.java
@@ -15,20 +15,14 @@
  */
 package org.onosproject.provider.tunnel.cli;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 import java.util.Optional;
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.core.DefaultGroupId;
-import org.onosproject.net.DefaultAnnotations;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
@@ -40,40 +34,45 @@
 import org.onosproject.incubator.net.tunnel.TunnelId;
 import org.onosproject.incubator.net.tunnel.TunnelName;
 import org.onosproject.incubator.net.tunnel.TunnelProvider;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.provider.ProviderId;
 
 /**
  * Supports for creating a tunnel by using IP address and optical as tunnel end
  * point.
  */
-@Command(scope = "onos", name = "create-tunnels",
+@Command(scope = "onos", name = "tunnel-create",
 description = "Supports for creating a tunnel by using IP address and optical as tunnel end point now.")
-public class CreateTunnelCommand extends AbstractShellCommand {
+public class TunnelCreateCommand extends AbstractShellCommand {
 
     @Argument(index = 0, name = "src", description = "Source tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If creates a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
+            + " If creates a ODUK or OCH or VLAN type tunnel, the formatter of this argument is DeviceId-PortNumber."
             + " Otherwise src means IP address.", required = true, multiValued = false)
     String src = null;
 
     @Argument(index = 1, name = "dst", description = "Destination tunnel point."
             + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
-            + " If creates a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
+            + " If creates a ODUK or OCH or VLAN type tunnel, the formatter of this argument is DeviceId-PortNumber."
             + " Otherwise dst means IP address.", required = true, multiValued = false)
     String dst = null;
     @Argument(index = 2, name = "type", description = "The type of tunnels,"
             + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = true, multiValued = false)
     String type = null;
-    @Argument(index = 3, name = "groupId",
-            description = "Group flow table id which a tunnel match up", required = true, multiValued = false)
+    @Option(name = "-g", aliases = "--groupId",
+            description = "Group flow table id which a tunnel match up", required = false, multiValued = false)
     String groupId = null;
 
-    @Argument(index = 4, name = "tunnelName",
+    @Option(name = "-n", aliases = "--tunnelName",
             description = "The name of tunnels", required = false, multiValued = false)
     String tunnelName = null;
 
-    @Argument(index = 5, name = "bandWith",
-            description = "The bandWith attribute of tunnel", required = false, multiValued = false)
-    String bandWith = null;
+    @Option(name = "-b", aliases = "--bandwidth",
+            description = "The bandwidth attribute of tunnel", required = false, multiValued = false)
+    String bandwidth = null;
 
     private static final String FMT = "The tunnel identity is %s";
 
@@ -91,8 +90,30 @@
             dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
         } else if ("VLAN".equals(type)) {
             trueType = Tunnel.Type.VLAN;
-            srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
-            dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
+            String[] srcArray = src.split("-");
+            String[] dstArray = dst.split("-");
+            srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                        producerName,
+                                                        Optional.of(DeviceId
+                                                                .deviceId(srcArray[0])),
+                                                        Optional.of(PortNumber
+                                                                .portNumber(srcArray[1])),
+                                                        null,
+                                                        null,
+                                                        OpticalLogicId
+                                                                .logicId(0),
+                                                        true);
+            dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                        producerName,
+                                                        Optional.of(DeviceId
+                                                                .deviceId(dstArray[0])),
+                                                        Optional.of(PortNumber
+                                                                .portNumber(dstArray[1])),
+                                                        null,
+                                                        null,
+                                                        OpticalLogicId
+                                                                .logicId(0),
+                                                        true);
         } else if ("VXLAN".equals(type)) {
             trueType = Tunnel.Type.VXLAN;
             srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
@@ -103,10 +124,8 @@
             dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
         } else if ("ODUK".equals(type)) {
             trueType = Tunnel.Type.ODUK;
-            String[] srcArray = src.split("||");
-            checkArgument(srcArray.length < 2, "Illegal src formatter.");
-            String[] dstArray = dst.split("||");
-            checkArgument(dstArray.length < 2, "Illegal dst formatter.");
+            String[] srcArray = src.split("-");
+            String[] dstArray = dst.split("-");
             srcPoint = new DefaultOpticalTunnelEndPoint(
                                                         producerName,
                                                         Optional.of(DeviceId
@@ -140,7 +159,7 @@
                                                         Optional.of(PortNumber
                                                                 .portNumber(srcArray[1])),
                                                         null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
+                                                        OpticalTunnelEndPoint.Type.TIMESLOT,
                                                         OpticalLogicId
                                                                 .logicId(0),
                                                         true);
@@ -151,7 +170,7 @@
                                                         Optional.of(PortNumber
                                                                 .portNumber(dstArray[1])),
                                                         null,
-                                                        OpticalTunnelEndPoint.Type.LAMBDA,
+                                                        OpticalTunnelEndPoint.Type.TIMESLOT,
                                                         OpticalLogicId
                                                                 .logicId(0),
                                                         true);
@@ -162,7 +181,7 @@
 
         SparseAnnotations annotations = DefaultAnnotations
                 .builder()
-                .set("bandWith", bandWith == null && "".equals(bandWith) ? "0" : bandWith)
+                .set("bandwidth", bandwidth == null && "".equals(bandwidth) ? "0" : bandwidth)
                 .build();
         TunnelDescription tunnel = new DefaultTunnelDescription(
                                                                 null,
@@ -175,6 +194,7 @@
                                                                 producerName,
                                                                 TunnelName
                                                                         .tunnelName(tunnelName),
+                                                                        null,
                                                                 annotations);
         TunnelId tunnelId = service.tunnelAdded(tunnel);
         print(FMT, tunnelId.id());
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelRemoveCommand.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelRemoveCommand.java
new file mode 100644
index 0000000..fb680ef
--- /dev/null
+++ b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelRemoveCommand.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2014-2015 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.provider.tunnel.cli;
+
+import java.util.Optional;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
+import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.OpticalLogicId;
+import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelDescription;
+import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.TunnelProvider;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.ProviderId;
+
+/**
+ * Supports for removing tunnels. It's used by producers.
+ */
+@Command(scope = "onos", name = "tunnel-remove", description = "Supports for removing tunnels. It's used by producers.")
+public class TunnelRemoveCommand extends AbstractShellCommand {
+    @Option(name = "-s", aliases = "--src", description = "Source tunnel point."
+            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
+            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
+            + " Otherwise src means IP address.", required = false, multiValued = false)
+    String src = null;
+    @Option(name = "-d", aliases = "--dst", description = "Destination tunnel point."
+            + " Only supports for IpTunnelEndPoint and OpticalTunnelEndPoint as end point now."
+            + " If deletess a ODUK or OCH type tunnel, the formatter of this argument is DeviceId-PortNumber."
+            + " Otherwise dst means IP address.", required = false, multiValued = false)
+    String dst = null;
+
+    @Option(name = "-t", aliases = "--type", description = "The type of tunnels,"
+            + " It includes MPLS, VLAN, VXLAN, GRE, ODUK, OCH", required = false, multiValued = false)
+    String type = null;
+
+    @Option(name = "-i", aliases = "--tunnelId",
+            description = "the tunnel identity.", required = false, multiValued = false)
+    String tunnelId = null;
+
+    @Override
+    protected void execute() {
+        TunnelDescription tunnel = null;
+        TunnelProvider service = get(TunnelProvider.class);
+        ProviderId producerName = new ProviderId("default",
+                                                 "org.onosproject.provider.tunnel.default");
+        if (!isNull(src) && !isNull(dst) && !isNull(type)) {
+            TunnelEndPoint srcPoint = null;
+            TunnelEndPoint dstPoint = null;
+            Tunnel.Type trueType = null;
+            if ("MPLS".equals(type)) {
+                trueType = Tunnel.Type.MPLS;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VLAN".equals(type)) {
+                trueType = Tunnel.Type.VLAN;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("VXLAN".equals(type)) {
+                trueType = Tunnel.Type.VXLAN;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("GRE".equals(type)) {
+                trueType = Tunnel.Type.GRE;
+                srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(src));
+                dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress
+                        .valueOf(dst));
+            } else if ("ODUK".equals(type)) {
+                trueType = Tunnel.Type.ODUK;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else if ("OCH".equals(type)) {
+                trueType = Tunnel.Type.OCH;
+                String[] srcArray = src.split("-");
+                String[] dstArray = dst.split("-");
+                srcPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(srcArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(srcArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+                dstPoint = new DefaultOpticalTunnelEndPoint(
+                                                            producerName,
+                                                            Optional.of(DeviceId
+                                                                    .deviceId(dstArray[0])),
+                                                            Optional.of(PortNumber
+                                                                    .portNumber(dstArray[1])),
+                                                            null,
+                                                            OpticalTunnelEndPoint.Type.LAMBDA,
+                                                            OpticalLogicId
+                                                                    .logicId(0),
+                                                            true);
+            } else {
+                print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
+                return;
+            }
+
+            tunnel = new DefaultTunnelDescription(null, srcPoint, dstPoint,
+                                                  trueType, null, producerName,
+                                                  null, null);
+            service.tunnelRemoved(tunnel);
+        }
+        if (!isNull(tunnelId)) {
+            TunnelId id = TunnelId.valueOf(tunnelId);
+            tunnel = new DefaultTunnelDescription(id, null, null, null, null,
+                                                  producerName, null, null);
+            service.tunnelRemoved(tunnel);
+        }
+    }
+
+    private boolean isNull(String s) {
+        return s == null || "".equals(s);
+    }
+}
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelUpdateCommand.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelUpdateCommand.java
new file mode 100644
index 0000000..9cd3ddb
--- /dev/null
+++ b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelUpdateCommand.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2014-2015 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.provider.tunnel.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
+import org.onosproject.incubator.net.tunnel.TunnelDescription;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.TunnelProvider;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.SparseAnnotations;
+
+/**
+ * Supports for updating a tunnel by tunnel identity.
+ * It's used by producers.
+ */
+@Command(scope = "onos", name = "tunnel-update",
+description = "Supports for updating a tunnel by tunnel identity."
+        + " It's used by producers.")
+public class TunnelUpdateCommand extends AbstractShellCommand {
+    @Argument(index = 0, name = "tunnelId", description = "the tunnel identity.",
+            required = true, multiValued = false)
+    String tunnelId = null;
+
+    @Option(name = "-b", aliases = "--bandwidth",
+            description = "The bandwidth attribute of tunnel", required = false, multiValued = false)
+    String bandwidth = null;
+
+    @Override
+    protected void execute() {
+        TunnelProvider service = get(TunnelProvider.class);
+        TunnelId id = TunnelId.valueOf(tunnelId);
+        SparseAnnotations annotations = DefaultAnnotations
+                .builder()
+                .set("bandwidth", bandwidth)
+                .build();
+        TunnelDescription tunnel = new DefaultTunnelDescription(id, null,
+                                                                null,
+                                                                null, null,
+                                                                null,
+                                                                null, null, annotations);
+        service.tunnelUpdated(tunnel);
+    }
+
+}
diff --git a/providers/tunnel/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/providers/tunnel/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 5f135a5..df9a3a5 100644
--- a/providers/tunnel/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/providers/tunnel/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -17,10 +17,13 @@
 
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
         <command>
-            <action class="org.onosproject.provider.tunnel.cli.CreateTunnelCommand"/>
+            <action class="org.onosproject.provider.tunnel.cli.TunnelCreateCommand"/>
         </command>
         <command>
-            <action class="org.onosproject.provider.tunnel.cli.RemoveTunnelCommand"/>
+            <action class="org.onosproject.provider.tunnel.cli.TunnelRemoveCommand"/>
+        </command>
+        <command>
+            <action class="org.onosproject.provider.tunnel.cli.TunnelUpdateCommand"/>
         </command>
     </command-bundle>
 </blueprint>