PCE WEB and pcep tunnel related defect fix

Change-Id: I5682982a4fc7a897517f3683cee4b2b5232783f5
diff --git a/apps/pce/pceweb/src/main/resources/app/view/pcewebTopov/pcewebTopovDemo.js b/apps/pce/pceweb/src/main/resources/app/view/pcewebTopov/pcewebTopovDemo.js
index 06d6771..646fd43 100644
--- a/apps/pce/pceweb/src/main/resources/app/view/pcewebTopov/pcewebTopovDemo.js
+++ b/apps/pce/pceweb/src/main/resources/app/view/pcewebTopov/pcewebTopovDemo.js
@@ -344,7 +344,7 @@
                 bw: bandValue,
                 bwtype: bandType,
                 ctype: costTypeVal,
-                tunnelname: tunnelIdUpd
+                tunnelid: tunnelIdUpd
         });
 
         flash.flash('update path message');
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 1397385..1fec4b3 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
@@ -86,6 +86,7 @@
 import org.onosproject.pcep.controller.PcepLspStatus;
 import org.onosproject.pcep.controller.PcepLspSyncAction;
 import org.onosproject.pcep.controller.SrpIdGenerators;
+import org.onosproject.pcep.controller.PcepSyncStatus;
 import org.onosproject.pcepio.exceptions.PcepParseException;
 import org.onosproject.pcepio.protocol.PcInitiatedLspRequest;
 import org.onosproject.pcepio.protocol.PcepAttribute;
@@ -1034,6 +1035,11 @@
      */
     private void pcepSetupTunnel(Tunnel tunnel, Path path, PcepClient pc) {
         try {
+            if (!(pc.lspDbSyncStatus().equals(PcepSyncStatus.SYNCED))) {
+                log.error("Setup tunnel has failed as LSP DB sync is not finished");
+                return;
+            }
+
             int srpId = SrpIdGenerators.create();
             Collection<Tunnel> tunnels = tunnelService.queryTunnel(tunnel.src(), tunnel.dst());
             for (Tunnel t : tunnels) {
@@ -1087,6 +1093,11 @@
      */
     private void pcepReleaseTunnel(Tunnel tunnel, PcepClient pc) {
         try {
+            if (!(pc.lspDbSyncStatus().equals(PcepSyncStatus.SYNCED))) {
+                log.error("Release tunnel has failed as LSP DB sync is not finished");
+                return;
+            }
+
             PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnel, DELETE);
             pcepTunnelApiMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
             int srpId = SrpIdGenerators.create();