[ONOS-4707] GoldenEye - SR-TE LSPs setup issues
Change-Id: I03f169147227876323cac1315975b57f52d514b5
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
index d4d4808..c0326b6 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
@@ -254,6 +254,7 @@
tunnelConsumerIdGen = coreService.getIdGenerator(TUNNEL_CONSUMER_ID_GEN_TOPIC);
localLspIdIdGen = coreService.getIdGenerator(LOCAL_LSP_ID_GEN_TOPIC);
+ localLspIdIdGen.getNewId(); // To prevent 0, the 1st value generated from being used in protocol.
localLspIdFreeList = storageService.<Short>setBuilder()
.withName("pcepLocalLspIdDeletedList")
.withSerializer(Serializer.using(KryoNamespaces.API))
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 1ee817c..07b4fec 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
@@ -1091,15 +1091,6 @@
pcepTunnelApiMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
int srpId = SrpIdGenerators.create();
TunnelId tunnelId = tunnel.tunnelId();
- int plspId = 0;
-
- if (!(pcepTunnelApiMapper.checkFromTunnelDBQueue(tunnelId))) {
- log.error("Tunnel doesnot exists. Tunnel id {}" + tunnelId.toString());
- return;
- } else {
- PcepTunnelData pcepTunnelDbData = pcepTunnelApiMapper.getDataFromTunnelDBQueue(tunnelId);
- plspId = pcepTunnelDbData.plspId();
- }
PcepValueType tlv;
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
@@ -1121,8 +1112,11 @@
String localLspIdString = tunnel.annotations().value(LOCAL_LSP_ID);
String pccTunnelIdString = tunnel.annotations().value(PCC_TUNNEL_ID);
+ String pLspIdString = tunnel.annotations().value(PLSP_ID);
+
short localLspId = 0;
short pccTunnelId = 0;
+ int plspId = 0;
if (localLspIdString != null) {
localLspId = Short.valueOf(localLspIdString);
@@ -1132,6 +1126,10 @@
pccTunnelId = Short.valueOf(pccTunnelIdString);
}
+ if (pLspIdString != null) {
+ plspId = Integer.valueOf(pLspIdString);
+ }
+
tlv = new StatefulIPv4LspIdentifiersTlv((((IpTunnelEndPoint) tunnel.src())
.ip().getIp4Address().toInt()),
localLspId, pccTunnelId, 0, (((IpTunnelEndPoint) tunnel.dst()).ip()