diff --git a/providers/pcep/app/app.xml b/providers/pcep/app/app.xml
new file mode 100644
index 0000000..e5e3db0
--- /dev/null
+++ b/providers/pcep/app/app.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<app name="org.onosproject.pcep" origin="ON.Lab" version="${project.version}"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</artifact>
+</app>
diff --git a/providers/pcep/app/features.xml b/providers/pcep/app/features.xml
new file mode 100644
index 0000000..6557463
--- /dev/null
+++ b/providers/pcep/app/features.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <feature>onos-api</feature>
+        <bundle>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</bundle>
+    </feature>
+</features>
diff --git a/providers/pcep/app/pom.xml b/providers/pcep/app/pom.xml
new file mode 100644
index 0000000..f9a5d66
--- /dev/null
+++ b/providers/pcep/app/pom.xml
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.onosproject</groupId>
+		<artifactId>onos-pcep-providers</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<artifactId>onos-pcep</artifactId>
+	<packaging>pom</packaging>
+	<dependencies>
+		<dependency>
+			<groupId>org.onosproject</groupId>
+			<artifactId>onos-app-pcep-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.onosproject</groupId>
+			<artifactId>onos-pcep-provider-topology</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.onosproject</groupId>
+			<artifactId>onos-pcep-provider-tunnel</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+	</dependencies>
+</project>
\ No newline at end of file
diff --git a/providers/pcep/pom.xml b/providers/pcep/pom.xml
new file mode 100644
index 0000000..41f7c9b
--- /dev/null
+++ b/providers/pcep/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.onosproject</groupId>
+    <artifactId>onos-providers</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+  <artifactId>onos-pcep-providers</artifactId>
+  <packaging>pom</packaging>
+  <modules>
+  	<module>topology</module>
+  	<module>tunnel</module>
+  	<module>app</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/providers/pcep/topology/pom.xml b/providers/pcep/topology/pom.xml
new file mode 100644
index 0000000..8d2a781
--- /dev/null
+++ b/providers/pcep/topology/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.onosproject</groupId>
+    <artifactId>onos-pcep-providers</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+  <artifactId>onos-pcep-provider-topology</artifactId>
+  <packaging>bundle</packaging>
+  	<dependencies>
+		<dependency>
+			<groupId>org.onosproject</groupId>
+			<artifactId>onos-app-pcep-api</artifactId>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file
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
new file mode 100644
index 0000000..9ef9412
--- /dev/null
+++ b/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/PcepTopologyProvider.java
@@ -0,0 +1,340 @@
+/*
+ * 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.pcep.topology.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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.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;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Link.Type;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.link.DefaultLinkDescription;
+import org.onosproject.net.link.LinkDescription;
+import org.onosproject.net.link.LinkProvider;
+import org.onosproject.net.link.LinkProviderRegistry;
+import org.onosproject.net.link.LinkProviderService;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcep.api.PcepController;
+import org.onosproject.pcep.api.PcepDpid;
+import org.onosproject.pcep.api.PcepLink;
+import org.onosproject.pcep.api.PcepLinkListener;
+import org.onosproject.pcep.api.PcepOperator.OperationType;
+import org.onosproject.pcep.api.PcepSwitch;
+import org.onosproject.pcep.api.PcepSwitchListener;
+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.
+ */
+@Component(immediate = true)
+public class PcepTopologyProvider extends AbstractProvider
+        implements LinkProvider, DeviceProvider {
+
+    public PcepTopologyProvider() {
+        super(new ProviderId("pcep", "org.onosproject.provider.pcep"));
+    }
+
+    private static final Logger log = LoggerFactory
+            .getLogger(PcepTopologyProvider.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkProviderRegistry linkProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceProviderRegistry deviceProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PcepController controller;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MastershipAdminService mastershipAdminService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MastershipService mastershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    private DeviceProviderService deviceProviderService;
+    private LinkProviderService linkProviderService;
+    // List<Long> srcportList = new ArrayList<Long>();
+    HashSet<Long> portSet = new HashSet<>();
+    private InternalLinkProvider listener = new InternalLinkProvider();
+
+    @Activate
+    public void activate() {
+        linkProviderService = linkProviderRegistry.register(this);
+        deviceProviderService = deviceProviderRegistry.register(this);
+        controller.addListener(listener);
+        controller.addLinkListener(listener);
+    }
+
+    @Deactivate
+    public void deactivate() {
+        linkProviderRegistry.unregister(this);
+        linkProviderService = null;
+        controller.removeListener(listener);
+        controller.removeLinkListener(listener);
+    }
+
+    private List<PortDescription> buildPortDescriptions(List<Long> ports,
+                                                        String portType) {
+        final List<PortDescription> portDescs = new ArrayList<>();
+        for (long port : ports) {
+            portDescs.add(buildPortDescription(port, portType));
+        }
+        return portDescs;
+    }
+
+    private PortDescription buildPortDescription(long port, String portType) {
+        final PortNumber portNo = PortNumber.portNumber(port);
+        final boolean enabled = true;
+        DefaultAnnotations extendedAttributes = DefaultAnnotations.builder()
+                .set("portType", portType).build();
+        return new DefaultPortDescription(portNo, enabled, extendedAttributes);
+    }
+
+    /**
+     * Build link annotations from pcep link description.the annotations consist
+     * of lots of property of Huawei device.
+     *
+     * @param linkDesc
+     * @return
+     */
+    private DefaultAnnotations buildLinkAnnotations(PcepLink linkDesc) {
+        DefaultAnnotations extendedAttributes = DefaultAnnotations
+                .builder()
+                .set("subType", String.valueOf(linkDesc.linkSubType()))
+                .set("workState", linkDesc.linkState())
+                .set("distance", String.valueOf(linkDesc.linkDistance()))
+                .set("capType", linkDesc.linkCapacityType().toLowerCase())
+                .set("avail_" + linkDesc.linkCapacityType().toLowerCase(),
+                     String.valueOf(linkDesc.linkAvailValue()))
+                .set("max_" + linkDesc.linkCapacityType().toLowerCase(),
+                     String.valueOf(linkDesc.linkMaxValue())).build();
+
+        return extendedAttributes;
+    }
+
+    /**
+     * Build a LinkDescription from a PCEPLink.
+     *
+     * @param pceLink
+     * @return LinkDescription
+     */
+    private LinkDescription buildLinkDescription(PcepLink pceLink) {
+        LinkDescription ld;
+
+        DeviceId srcDeviceID = deviceId(uri(pceLink.linkSrcDeviceID()));
+        DeviceId dstDeviceID = deviceId(uri(pceLink.linkDstDeviceId()));
+
+        if (deviceService.getDevice(srcDeviceID) == null
+                || deviceService.getDevice(dstDeviceID) == null) {
+            log.info("the device of the link is not exited" + srcDeviceID
+                    + dstDeviceID);
+            return null;
+        }
+        // update port info
+        long srcPort = pceLink.linkSrcPort();
+        portSet.add(srcPort);
+        List<Long> srcportList = new ArrayList<Long>();
+        srcportList.addAll(portSet);
+        deviceProviderService
+                .updatePorts(srcDeviceID,
+                             buildPortDescriptions(srcportList,
+                                                   pceLink.portType()));
+
+        ConnectPoint src = new ConnectPoint(srcDeviceID,
+                                            PortNumber.portNumber(pceLink
+                                                    .linkSrcPort()));
+
+        ConnectPoint dst = new ConnectPoint(dstDeviceID,
+                                            PortNumber.portNumber(pceLink
+                                                    .linkDstPort()));
+        DefaultAnnotations extendedAttributes = buildLinkAnnotations(pceLink);
+
+        // construct the link
+        ld = new DefaultLinkDescription(src, dst, Type.OPTICAL,
+                                        extendedAttributes);
+        return ld;
+    }
+
+    private void processLinkUpdate(LinkDescription linkDescription) {
+
+        // dst changed, delete the original link,if the dst device is not in
+        // other links ,delete it.
+        if (linkService.getLink(linkDescription.src(), linkDescription.dst()) == null) {
+            // in face,one src one link
+            Set<Link> links = linkService
+                    .getIngressLinks(linkDescription.src());
+            for (Link link : links) {
+                linkProviderService.linkVanished((LinkDescription) link);
+                if (linkService.getDeviceLinks(link.dst().deviceId()).size() == 0) {
+                    deviceProviderService.deviceDisconnected(link.dst()
+                            .deviceId());
+                }
+            }
+
+        }
+        linkProviderService.linkDetected(linkDescription);
+
+    }
+
+    private class InternalLinkProvider
+            implements PcepSwitchListener, PcepLinkListener {
+
+        @Override
+        public void switchAdded(PcepDpid dpid) {
+            // TODO Auto-generated method stub
+
+            if (deviceProviderService == null) {
+                return;
+            }
+            DeviceId devicdId = deviceId(uri(dpid));
+            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 subType: ROADM,OTN,ROUTER.
+            DefaultAnnotations extendedAttributes = DefaultAnnotations
+                    .builder()
+                    .set("subType", String.valueOf(sw.getDeviceSubType()))
+                    .build();
+
+            DeviceDescription description = new DefaultDeviceDescription(
+                                                                         devicdId.uri(),
+                                                                         deviceType,
+                                                                         sw.manufacturerDescription(),
+                                                                         sw.hardwareDescription(),
+                                                                         sw.softwareDescription(),
+                                                                         sw.serialNumber(),
+                                                                         cId,
+                                                                         extendedAttributes);
+            NodeId localNode = clusterService.getLocalNode().id();
+            mastershipAdminService.setRole(localNode, devicdId,
+                                           MastershipRole.MASTER);
+            mastershipService.relinquishMastership(devicdId);
+            deviceProviderService.deviceConnected(devicdId, description);
+
+        }
+
+        @Override
+        public void switchRemoved(PcepDpid dpid) {
+            // TODO Auto-generated method stub
+
+            if (deviceProviderService == null || linkProviderService == null) {
+                return;
+            }
+            deviceProviderService.deviceDisconnected(deviceId(uri(dpid)));
+
+            linkProviderService.linksVanished(DeviceId.deviceId(uri(dpid)));
+        }
+
+        @Override
+        public void switchChanged(PcepDpid dpid) {
+            // TODO Auto-generated method stub
+
+        }
+
+        @Override
+        public void handlePCEPlink(PcepLink link) {
+
+            OperationType operType = link.getOperationType();
+            LinkDescription ld = buildLinkDescription(link);
+            if (ld == null) {
+                log.error("Invalid link info.");
+                return;
+            }
+            switch (operType) {
+            case ADD:
+                linkProviderService.linkDetected(ld);
+                break;
+            case UPDATE:
+                processLinkUpdate(ld);
+                break;
+
+            case DELETE:
+                linkProviderService.linkVanished(ld);
+                break;
+
+            default:
+                break;
+
+            }
+        }
+
+    }
+
+    @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;
+    }
+}
diff --git a/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/package-info.java b/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/package-info.java
new file mode 100644
index 0000000..c119266
--- /dev/null
+++ b/providers/pcep/topology/src/main/java/org/onosproject/provider/pcep/topology/impl/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ *Provider that uses PCEP controller as a means of infrastructure topology discovery.
+ */
+package org.onosproject.provider.pcep.topology.impl;
\ No newline at end of file
diff --git a/providers/pcep/tunnel/pom.xml b/providers/pcep/tunnel/pom.xml
new file mode 100644
index 0000000..c909d23
--- /dev/null
+++ b/providers/pcep/tunnel/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.onosproject</groupId>
+		<artifactId>onos-pcep-providers</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<artifactId>onos-pcep-provider-tunnel</artifactId>
+	<packaging>bundle</packaging>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.onosproject</groupId>
+			<artifactId>onos-app-pcep-api</artifactId>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file
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
new file mode 100644
index 0000000..ec4d3dd
--- /dev/null
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -0,0 +1,458 @@
+/*
+ * 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.pcep.tunnel.impl;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.net.PortNumber.portNumber;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+
+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.core.DefaultGroupId;
+import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
+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.incubator.net.tunnel.TunnelProviderRegistry;
+import org.onosproject.incubator.net.tunnel.TunnelProviderService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.DefaultPath;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.ElementId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcep.api.PcepController;
+import org.onosproject.pcep.api.PcepDpid;
+import org.onosproject.pcep.api.PcepHopNodeDescription;
+import org.onosproject.pcep.api.PcepOperator.OperationType;
+import org.onosproject.pcep.api.PcepTunnel;
+import org.onosproject.pcep.api.PcepTunnel.PATHTYPE;
+import org.onosproject.pcep.api.PcepTunnelListener;
+import org.slf4j.Logger;
+
+import static org.onosproject.pcep.api.PcepDpid.*;
+
+/**
+ * Provider which uses an PCEP controller to detect, update, create network
+ * tunnels.
+ */
+@Component(immediate = true)
+@Service
+public class PcepTunnelProvider extends AbstractProvider
+        implements TunnelProvider {
+
+    private static final Logger log = getLogger(PcepTunnelProvider.class);
+    private static final long MAX_BANDWIDTH = 99999744;
+    private static final long MIN_BANDWIDTH = 64;
+    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.";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected TunnelProviderRegistry tunnelProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PcepController controller;
+
+    TunnelProviderService service;
+
+    HashMap<String, TunnelId> tunnelMap = new HashMap<String, TunnelId>();
+
+    private InnerTunnerProvider listener = new InnerTunnerProvider();
+
+    /**
+     * Creates a Tunnel provider.
+     */
+    public PcepTunnelProvider() {
+        super(new ProviderId("default", PROVIDER_ID));
+    }
+
+    @Activate
+    public void activate() {
+        service = tunnelProviderRegistry.register(this);
+        controller.addTunnelListener(listener);
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        tunnelProviderRegistry.unregister(this);
+        controller.removeTunnelListener(listener);
+        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) {
+
+        long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith"));
+
+        if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) {
+            System.out.println("Update failed, invalid bandwidth.");
+            return null;
+        }
+
+        // endpoints
+        OpticalTunnelEndPoint src = (org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint) tunnel
+                .src();
+        OpticalTunnelEndPoint dst = (OpticalTunnelEndPoint) tunnel.dst();
+        // devices
+        DeviceId srcId = (DeviceId) src.elementId().get();
+        DeviceId dstId = (DeviceId) dst.elementId().get();
+
+        // ports
+        long srcPort = src.portNumber().get().toLong();
+        long dstPort = dst.portNumber().get().toLong();
+
+        // type
+        if (tunnel.type() != Tunnel.Type.VLAN) {
+            System.out
+                    .println("Llegal tunnel type. Only support VLAN tunnel creation.");
+            return null;
+        }
+
+        PcepTunnel pcepTunnel = controller.applyTunnel(srcId, dstId, srcPort,
+                                                       dstPort, bandwidth,
+                                                       tunnel.tunnelName()
+                                                               .value());
+
+        checkNotNull(pcepTunnel, TUNNLE_NOT_NULL);
+        TunnelDescription tunnelAdded = buildOpticalTunnel(pcepTunnel, null);
+        TunnelId tunnelId = service.tunnelAdded(tunnelAdded);
+
+        tunnelMap.put(String.valueOf(pcepTunnel.id()), tunnelId);
+        return tunnelId;
+    }
+
+    @Override
+    public void tunnelRemoved(TunnelDescription tunnel) {
+        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.");
+            return;
+        }
+        String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
+        checkNotNull(pcepTunnelId, "The tunnel id is not exsited.");
+        if (controller.deleteTunnel(pcepTunnelId)) {
+            log.info("delete tunnel:" + pcepTunnelId + "ok.");
+        }
+        tunnelMap.remove(pcepTunnelId);
+        service.tunnelRemoved(tunnel);
+
+    }
+
+    @Override
+    public void tunnelUpdated(TunnelDescription tunnel) {
+
+        Tunnel tunnelOld = tunnelQueryById(tunnel.id());
+        if (tunnelOld.type() != Tunnel.Type.VLAN) {
+            System.out
+                    .println("Llegal tunnel type. Only support VLAN tunnel update.");
+            return;
+        }
+        long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith"));
+        if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) {
+            System.out.println("Update failed, invalid bandwidth.");
+            return;
+        }
+        String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
+
+        checkNotNull(pcepTunnelId, "Invalid tunnel id");
+        if (!controller.updateTunnelBandwidth(pcepTunnelId, bandwidth)) {
+
+            System.out.println("Update failed,maybe invalid bandwidth.");
+            return;
+
+        }
+        service.tunnelUpdated(tunnel);
+    }
+
+    // Short-hand for creating a connection point.
+    private ConnectPoint connectPoint(PcepDpid id, long port) {
+        return new ConnectPoint(deviceId(uri(id)), portNumber(port));
+    }
+
+    // Short-hand for creating a link.
+    private Link link(PcepDpid src, long sp, PcepDpid dst, long dp) {
+        return new DefaultLink(id(), connectPoint(src, sp), connectPoint(dst,
+                                                                         dp),
+                               Link.Type.TUNNEL);
+    }
+
+    // Creates a path that leads through the given devices.
+    private Path createPath(List<PcepHopNodeDescription> hopList,
+                            PATHTYPE pathtype) {
+        if (hopList == null || hopList.size() == 0) {
+            return null;
+        }
+        List<Link> links = new ArrayList<>();
+        for (int i = 1; i < hopList.size() - 1; i = i + 2) {
+            links.add(link(hopList.get(i).getDeviceId(), hopList.get(i)
+                    .getPortNum(), hopList.get(i + 1).getDeviceId(), hopList
+                    .get(i + 1).getPortNum()));
+        }
+
+        int hopNum = hopList.size() - 2;
+        DefaultAnnotations extendAnnotations = DefaultAnnotations.builder()
+                .set("pathNum", String.valueOf(hopNum))
+                .set("pathType", String.valueOf(pathtype)).build();
+        return new DefaultPath(id(), links, hopNum, extendAnnotations);
+    }
+
+    // convert the path description to a string.
+    public String pathToString(List<Link> links) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("{");
+        for (Link link : links) {
+            builder.append("(Device:" + link.src().deviceId() + "  Port:"
+                    + link.src().port().toLong());
+            builder.append(" Device:" + link.dst().deviceId() + "  Port:"
+                    + link.dst().port().toLong());
+            builder.append(")");
+        }
+        builder.append("}");
+        return builder.toString();
+    }
+
+    // build a TunnelDescription.
+    private TunnelDescription buildOpticalTunnel(PcepTunnel pcepTunnel,
+                                                 TunnelId tunnelId) {
+        TunnelEndPoint srcPoint = null;
+        TunnelEndPoint dstPoint = null;
+        Tunnel.Type tunnelType = null;
+        TunnelName name = TunnelName.tunnelName(pcepTunnel.name());
+
+        // add path after codes of tunnel's path merged
+        Path path = createPath(pcepTunnel.getHopList(),
+                               pcepTunnel.getPathType());
+
+        OpticalTunnelEndPoint.Type endPointType = null;
+        switch (pcepTunnel.type()) {
+        case OCH:
+            tunnelType = Tunnel.Type.OCH;
+            endPointType = OpticalTunnelEndPoint.Type.LAMBDA;
+            break;
+
+        case OTN:
+            tunnelType = Tunnel.Type.ODUK;
+            endPointType = OpticalTunnelEndPoint.Type.TIMESLOT;
+            break;
+
+        case UNI:
+            tunnelType = Tunnel.Type.VLAN;
+            endPointType = null;
+            break;
+
+        default:
+            break;
+        }
+        DeviceId srcDid = deviceId(uri(pcepTunnel.srcDeviceID()));
+        DeviceId dstDid = deviceId(uri(pcepTunnel.dstDeviceId()));
+        PortNumber srcPort = PortNumber.portNumber(pcepTunnel.srcPort());
+        PortNumber dstPort = PortNumber.portNumber(pcepTunnel.dstPort());
+
+        srcPoint = new DefaultOpticalTunnelEndPoint(id(), Optional.of(srcDid),
+                                                    Optional.of(srcPort), null,
+                                                    endPointType,
+                                                    OpticalLogicId.logicId(0),
+                                                    true);
+        dstPoint = new DefaultOpticalTunnelEndPoint(id(), Optional.of(dstDid),
+                                                    Optional.of(dstPort), null,
+                                                    endPointType,
+                                                    OpticalLogicId.logicId(0),
+                                                    true);
+
+        // basic annotations
+        DefaultAnnotations annotations = DefaultAnnotations.builder()
+                .set("bandWith", String.valueOf(pcepTunnel.bandWidth()))
+                .set("SLA", String.valueOf(pcepTunnel.getSla()))
+                .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) {
+            DefaultAnnotations extendAnnotations = DefaultAnnotations
+                    .builder()
+                    .set("underLayTunnelIndex",
+                         String.valueOf(pcepTunnel.underLayTunnelId())).build();
+            annotations = DefaultAnnotations.merge(annotations,
+                                                   extendAnnotations);
+
+        }
+        TunnelDescription tunnel = new DefaultTunnelDescription(
+                                                                tunnelId,
+                                                                srcPoint,
+                                                                dstPoint,
+                                                                tunnelType,
+                                                                new DefaultGroupId(
+                                                                                   0),
+                                                                id(), name,
+                                                                path,
+                                                                annotations);
+        return tunnel;
+
+    }
+
+    /**
+     * Get the tunnelID according to the tunnel key.
+     *
+     * @param tunnelKey tunnel key
+     * @return corresponding tunnel id of the a tunnel key.
+     */
+    private TunnelId getTunnelId(String tunnelKey) {
+
+        for (String key : tunnelMap.keySet()) {
+            if (key.equals(tunnelKey)) {
+                return tunnelMap.get(key);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Get the tunnel key according to the tunnelID.
+     *
+     * @param tunnelId tunnel id
+     * @return corresponding a tunnel key of the tunnel id.
+     */
+    private String getPCEPTunnelKey(TunnelId tunnelId) {
+        for (String key : tunnelMap.keySet()) {
+            if (tunnelMap.get(key).id() == tunnelId.id()) {
+                return key;
+            }
+        }
+        return null;
+
+    }
+
+    private class InnerTunnerProvider implements PcepTunnelListener {
+
+        @Override
+        public void handlePCEPTunnel(PcepTunnel pcepTunnel) {
+
+            TunnelDescription tunnel = null;
+            // instance and id identify a tunnel together
+            String tunnelKey = String.valueOf(pcepTunnel.getInstance())
+                    + String.valueOf(pcepTunnel.id());
+
+            if (tunnelKey == null || "".equals(tunnelKey)) {
+                log.error("Invalid PCEP tunnel");
+                return;
+            }
+
+            TunnelId tunnelId = getTunnelId(tunnelKey);
+
+            tunnel = buildOpticalTunnel(pcepTunnel, tunnelId);
+
+            OperationType operType = pcepTunnel.getOperationType();
+            switch (operType) {
+            case ADD:
+                tunnelId = service.tunnelAdded(tunnel);
+                tunnelMap.put(tunnelKey, tunnelId);
+                break;
+
+            case UPDATE:
+                service.tunnelUpdated(tunnel);
+                break;
+
+            case DELETE:
+                service.tunnelRemoved(tunnel);
+                tunnelMap.remove(tunnelKey);
+                break;
+
+            default:
+                log.error("Invalid tunnel operation");
+
+            }
+
+        }
+    }
+
+    @Override
+    public Tunnel tunnelQueryById(TunnelId tunnelId) {
+        return service.tunnelQueryById(tunnelId);
+    }
+
+}
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/package-info.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/package-info.java
new file mode 100644
index 0000000..5074eec
--- /dev/null
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ *Provider that uses PCEP controller as a means of infrastructure tunnel discovery.
+ */
+package org.onosproject.provider.pcep.tunnel.impl;
\ No newline at end of file
