1. move tunnel 3 commands to onos-cli
2. add OCH ODU OMS port type;
3. fix some bugs in pcep tunnel provider and topology provider
4. Optimization of the command line tools of tunnel

Change-Id: I323ede971795c8fe6ecddc40e1061f42a8243867

fix tunnel provider bugs.

Change-Id: I323ede971795c8fe6ecddc40e1061f42a8243867
diff --git a/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/PcepTopologyProvider.java b/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/PcepTopologyProvider.java
index 9ef9412..5910202 100644
--- a/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/PcepTopologyProvider.java
+++ b/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/PcepTopologyProvider.java
@@ -15,6 +15,10 @@
  */
 package org.onosproject.provider.pcep.topology.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.pcep.api.PcepDpid.uri;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -27,7 +31,6 @@
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onlab.packet.ChassisId;
 import org.onosproject.cluster.ClusterService;
-import org.onosproject.cluster.NodeId;
 import org.onosproject.mastership.MastershipAdminService;
 import org.onosproject.mastership.MastershipService;
 import org.onosproject.net.ConnectPoint;
@@ -57,6 +60,7 @@
 import org.onosproject.pcep.api.PcepController;
 import org.onosproject.pcep.api.PcepDpid;
 import org.onosproject.pcep.api.PcepLink;
+import org.onosproject.pcep.api.PcepLink.PortType;
 import org.onosproject.pcep.api.PcepLinkListener;
 import org.onosproject.pcep.api.PcepOperator.OperationType;
 import org.onosproject.pcep.api.PcepSwitch;
@@ -64,10 +68,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.pcep.api.PcepDpid.uri;
-
 /**
  * Provider which uses an PCEP controller to detect network infrastructure
  * topology.
@@ -130,7 +130,7 @@
     }
 
     private List<PortDescription> buildPortDescriptions(List<Long> ports,
-                                                        String portType) {
+                                                        PortType portType) {
         final List<PortDescription> portDescs = new ArrayList<>();
         for (long port : ports) {
             portDescs.add(buildPortDescription(port, portType));
@@ -138,11 +138,11 @@
         return portDescs;
     }
 
-    private PortDescription buildPortDescription(long port, String portType) {
+    private PortDescription buildPortDescription(long port, PortType portType) {
         final PortNumber portNo = PortNumber.portNumber(port);
         final boolean enabled = true;
         DefaultAnnotations extendedAttributes = DefaultAnnotations.builder()
-                .set("portType", portType).build();
+                .set("portType", String.valueOf(portType)).build();
         return new DefaultPortDescription(portNo, enabled, extendedAttributes);
     }
 
@@ -246,14 +246,22 @@
             PcepSwitch sw = controller.getSwitch(dpid);
             checkNotNull(sw, "device should not null.");
             // The default device type is switch.
-            Device.Type deviceType = Device.Type.SWITCH;
             ChassisId cId = new ChassisId(dpid.value());
+            Device.Type deviceType = null;
 
-            // Device subType: ROADM,OTN,ROUTER.
-            DefaultAnnotations extendedAttributes = DefaultAnnotations
-                    .builder()
-                    .set("subType", String.valueOf(sw.getDeviceSubType()))
-                    .build();
+            switch (sw.getDeviceType()) {
+            case ROADM:
+                deviceType = Device.Type.ROADM;
+                break;
+            case OTN:
+                deviceType = Device.Type.SWITCH;
+                break;
+            case ROUTER:
+                deviceType = Device.Type.ROUTER;
+                break;
+            default:
+                deviceType = Device.Type.OTHER;
+            }
 
             DeviceDescription description = new DefaultDeviceDescription(
                                                                          devicdId.uri(),
@@ -262,12 +270,7 @@
                                                                          sw.hardwareDescription(),
                                                                          sw.softwareDescription(),
                                                                          sw.serialNumber(),
-                                                                         cId,
-                                                                         extendedAttributes);
-            NodeId localNode = clusterService.getLocalNode().id();
-            mastershipAdminService.setRole(localNode, devicdId,
-                                           MastershipRole.MASTER);
-            mastershipService.relinquishMastership(devicdId);
+                                                                         cId);
             deviceProviderService.deviceConnected(devicdId, description);
 
         }
@@ -322,19 +325,15 @@
     @Override
     public void triggerProbe(DeviceId deviceId) {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     public void roleChanged(DeviceId deviceId, MastershipRole newRole) {
-        // NodeId localNode = clusterService.getLocalNode().id();
-        // mastershipService.setRole(localNode, deviceId, newRole);
-
     }
 
     @Override
     public boolean isReachable(DeviceId deviceId) {
         // TODO Auto-generated method stub
-        return false;
+        return true;
     }
 }
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
index ec4d3dd..766715f 100644
--- a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -78,6 +78,7 @@
     private static final Logger log = getLogger(PcepTunnelProvider.class);
     private static final long MAX_BANDWIDTH = 99999744;
     private static final long MIN_BANDWIDTH = 64;
+    private static final String BANDWIDTH_UINT = "kbps";
     static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default";
 
     private static final String TUNNLE_NOT_NULL = "Create failed,The given port may be wrong or has been occupied.";
@@ -154,10 +155,11 @@
     @Override
     public TunnelId tunnelAdded(TunnelDescription tunnel) {
 
-        long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith"));
+        long bandwidth = Long
+                .parseLong(tunnel.annotations().value("bandwidth"));
 
         if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) {
-            System.out.println("Update failed, invalid bandwidth.");
+            error("Update failed, invalid bandwidth.");
             return null;
         }
 
@@ -175,8 +177,7 @@
 
         // type
         if (tunnel.type() != Tunnel.Type.VLAN) {
-            System.out
-                    .println("Llegal tunnel type. Only support VLAN tunnel creation.");
+            error("Illegal tunnel type. Only support VLAN tunnel creation.");
             return null;
         }
 
@@ -198,18 +199,17 @@
         Tunnel tunnelOld = tunnelQueryById(tunnel.id());
         checkNotNull(tunnelOld, "The tunnel id is not exsited.");
         if (tunnelOld.type() != Tunnel.Type.VLAN) {
-            System.out
-                    .println("Llegal tunnel type. Only support VLAN tunnel deletion.");
+            error("Llegal tunnel type. Only support VLAN tunnel deletion.");
             return;
         }
         String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
         checkNotNull(pcepTunnelId, "The tunnel id is not exsited.");
-        if (controller.deleteTunnel(pcepTunnelId)) {
-            log.info("delete tunnel:" + pcepTunnelId + "ok.");
+        if (!controller.deleteTunnel(pcepTunnelId)) {
+            error("Delete tunnel failed, Maybe some devices have been disconnected.");
+            return;
         }
         tunnelMap.remove(pcepTunnelId);
         service.tunnelRemoved(tunnel);
-
     }
 
     @Override
@@ -217,13 +217,13 @@
 
         Tunnel tunnelOld = tunnelQueryById(tunnel.id());
         if (tunnelOld.type() != Tunnel.Type.VLAN) {
-            System.out
-                    .println("Llegal tunnel type. Only support VLAN tunnel update.");
+            error("Llegal tunnel type. Only support VLAN tunnel update.");
             return;
         }
-        long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith"));
+        long bandwidth = Long
+                .parseLong(tunnel.annotations().value("bandwidth"));
         if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) {
-            System.out.println("Update failed, invalid bandwidth.");
+            error("Update failed, invalid bandwidth.");
             return;
         }
         String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
@@ -231,13 +231,17 @@
         checkNotNull(pcepTunnelId, "Invalid tunnel id");
         if (!controller.updateTunnelBandwidth(pcepTunnelId, bandwidth)) {
 
-            System.out.println("Update failed,maybe invalid bandwidth.");
+            error("Update failed,maybe invalid bandwidth.");
             return;
 
         }
         service.tunnelUpdated(tunnel);
     }
 
+    private void error(String info) {
+        System.err.println(info);
+    }
+
     // Short-hand for creating a connection point.
     private ConnectPoint connectPoint(PcepDpid id, long port) {
         return new ConnectPoint(deviceId(uri(id)), portNumber(port));
@@ -334,22 +338,13 @@
                                                     true);
 
         // basic annotations
-        DefaultAnnotations annotations = DefaultAnnotations.builder()
-                .set("bandWith", String.valueOf(pcepTunnel.bandWidth()))
+        DefaultAnnotations annotations = DefaultAnnotations
+                .builder()
                 .set("SLA", String.valueOf(pcepTunnel.getSla()))
+                .set("bandwidth",
+                     String.valueOf(pcepTunnel.bandWidth()) + BANDWIDTH_UINT)
                 .set("index", String.valueOf(pcepTunnel.id())).build();
 
-        // if (path != null) {
-        //
-        // DefaultAnnotations extendAnnotations = DefaultAnnotations.builder()
-        // .set("pathNum", String.valueOf(hopNum))
-        // // .set("path", pathString)
-        // .set("pathType", String.valueOf(pcepTunnel.getPathType()))
-        // .build();
-        // annotations = DefaultAnnotations.merge(annotations,
-        // extendAnnotations);
-        // }
-
         // a VLAN tunnel always carry OCH tunnel, this annotation is the index
         // of a OCH tunnel.
         if (pcepTunnel.underLayTunnelId() != 0) {
diff --git a/providers/pom.xml b/providers/pom.xml
index e3b38a3..27f6d8b 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -37,7 +37,6 @@
         <module>host</module>
         <module>netconf</module>
         <module>null</module>
-        <module>tunnel</module>
         <module>pcep</module>
     </modules>
 
diff --git a/providers/tunnel/pom.xml b/providers/tunnel/pom.xml
deleted file mode 100644
index f55812b..0000000
--- a/providers/tunnel/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2014 Open Networking Laboratory
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.onosproject</groupId>
-        <artifactId>onos-providers</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>onos-tunnel-provider</artifactId>
-    <packaging>bundle</packaging>
-
-    <description>tunnel southbound providers</description>
-
-    <properties>
-        <onos.app.name>org.onosproject.tunnel</onos.app.name>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-cli</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-api</artifactId>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-</project>
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
deleted file mode 100644
index 1405615..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.provider.tunnel;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onosproject.cfg.ComponentConfigService;
-import org.onosproject.net.ElementId;
-import org.onosproject.net.Path;
-import org.onosproject.net.provider.AbstractProvider;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.incubator.net.tunnel.Tunnel;
-import org.onosproject.incubator.net.tunnel.TunnelDescription;
-import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.incubator.net.tunnel.TunnelProvider;
-import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry;
-import org.onosproject.incubator.net.tunnel.TunnelProviderService;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-
-/**
- * Provider of a fake network environment, i.e. devices, links, hosts, etc. To
- * be used for benchmarking only.
- */
-@Component(immediate = true)
-@Service
-public class DefaultTunnelProvider extends AbstractProvider
-        implements TunnelProvider {
-
-    private static final Logger log = getLogger(DefaultTunnelProvider.class);
-
-    static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default";
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected ComponentConfigService cfgService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected TunnelProviderRegistry tunnelProviderRegistry;
-
-    TunnelProviderService service;
-
-    /**
-     * Creates a Tunnel provider.
-     */
-    public DefaultTunnelProvider() {
-        super(new ProviderId("default", PROVIDER_ID));
-    }
-
-    @Activate
-    public void activate(ComponentContext context) {
-        service = tunnelProviderRegistry.register(this);
-        log.info("Started");
-    }
-
-    @Deactivate
-    public void deactivate(ComponentContext context) {
-        tunnelProviderRegistry.unregister(this);
-        log.info("Stopped");
-    }
-
-    @Override
-    public void setupTunnel(Tunnel tunnel, Path path) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void releaseTunnel(Tunnel tunnel) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void releaseTunnel(ElementId srcElement, Tunnel tunnel) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void updateTunnel(Tunnel tunnel, Path path) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public TunnelId tunnelAdded(TunnelDescription tunnel) {
-        return service.tunnelAdded(tunnel);
-    }
-
-    @Override
-    public void tunnelRemoved(TunnelDescription tunnel) {
-        service.tunnelRemoved(tunnel);
-    }
-
-    @Override
-    public void tunnelUpdated(TunnelDescription tunnel) {
-        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/TunnelCreateCommand.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelCreateCommand.java
deleted file mode 100644
index 4b595f1..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelCreateCommand.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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.provider.tunnel.cli;
-
-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.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.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 = "tunnel-create",
-description = "Supports for creating a tunnel by using IP address and optical as tunnel end point now.")
-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 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 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;
-    @Option(name = "-g", aliases = "--groupId",
-            description = "Group flow table id which a tunnel match up", required = false, multiValued = false)
-    String groupId = null;
-
-    @Option(name = "-n", aliases = "--tunnelName",
-            description = "The name of tunnels", required = false, multiValued = false)
-    String tunnelName = 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";
-
-    @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;
-            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));
-            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.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;
-        }
-
-        SparseAnnotations annotations = DefaultAnnotations
-                .builder()
-                .set("bandwidth", bandwidth == null && "".equals(bandwidth) ? "0" : bandwidth)
-                .build();
-        TunnelDescription tunnel = new DefaultTunnelDescription(
-                                                                null,
-                                                                srcPoint,
-                                                                dstPoint,
-                                                                trueType,
-                                                                new DefaultGroupId(
-                                                                                   Integer.valueOf(groupId)
-                                                                                           .intValue()),
-                                                                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
deleted file mode 100644
index fb680ef..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelRemoveCommand.java
+++ /dev/null
@@ -1,169 +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.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
deleted file mode 100644
index 9cd3ddb..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/TunnelUpdateCommand.java
+++ /dev/null
@@ -1,61 +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 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/java/org/onosproject/provider/tunnel/cli/package-info.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/package-info.java
deleted file mode 100644
index 0fd7d25..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Null provider CLI commands and completers.
- */
-package org.onosproject.provider.tunnel.cli;
diff --git a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/package-info.java b/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/package-info.java
deleted file mode 100644
index f5143c1..0000000
--- a/providers/tunnel/src/main/java/org/onosproject/provider/tunnel/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Set of null south-bound providers which permit simulating a network
- * topology using fake devices, links, hosts, etc.
- */
-package org.onosproject.provider.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
deleted file mode 100644
index df9a3a5..0000000
--- a/providers/tunnel/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
-    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
-        <command>
-            <action class="org.onosproject.provider.tunnel.cli.TunnelCreateCommand"/>
-        </command>
-        <command>
-            <action class="org.onosproject.provider.tunnel.cli.TunnelRemoveCommand"/>
-        </command>
-        <command>
-            <action class="org.onosproject.provider.tunnel.cli.TunnelUpdateCommand"/>
-        </command>
-    </command-bundle>
-</blueprint>