Cherry picks from 1.6 branch
Change-Id: I596247425802fc759463bcf77ea3c885f3161581
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/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceccSrTeBeHandler.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceccSrTeBeHandler.java
index 63eed1b..0a79716 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceccSrTeBeHandler.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceccSrTeBeHandler.java
@@ -406,15 +406,6 @@
DeviceId deviceId = null;
for (Iterator<Link> iterator = linkList.iterator(); iterator.hasNext();) {
link = iterator.next();
- // Add source device label now
- deviceId = link.src().deviceId();
- nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
- if (nodeLabelId == null) {
- log.error("Unable to find node label for a device id {} in store.", deviceId.toString());
- return null;
- }
- labelStack.add(nodeLabelId);
-
// Add adjacency label for this link
adjLabelId = pceStore.getAdjLabel(link);
if (adjLabelId == null) {
@@ -422,11 +413,7 @@
return null;
}
labelStack.add(adjLabelId);
- }
- // This is the last link in path
- // Add destination device label now.
- if (link != null) {
deviceId = link.dst().deviceId();
nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
if (nodeLabelId == null) {
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceccSrTeBeHandlerTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceccSrTeBeHandlerTest.java
index 70f7376..be5cd2e 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceccSrTeBeHandlerTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceccSrTeBeHandlerTest.java
@@ -417,11 +417,8 @@
// Compute label stack
LabelStack labelStack = srTeHandler.computeLabelStack(path1);
- // check node-label of D1.deviceId()
List<LabelResourceId> labelList = labelStack.labelResources();
Iterator<LabelResourceId> iterator = labelList.iterator();
- labelId = iterator.next();
- assertThat(labelId, is(LabelResourceId.labelResourceId(4097)));
// check adjacency label of D1.deviceId()
labelId = iterator.next();
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
index 00a7a20..46768a7 100644
--- a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
@@ -438,6 +438,7 @@
// When there are no LSPs to sync, directly end-of-sync PCRpt will come and the
// list will be null.
syncStateRptList = Collections.EMPTY_LIST;
+ log.debug("No LSPs reported from PCC during sync.");
}
Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator();
@@ -502,8 +503,8 @@
} catch (PcepParseException e) {
log.error("Exception occured while sending initiate delete message {}", e.getMessage());
}
+ continue;
}
- continue;
}
if (!lspObj.getCFlag()) {
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientImpl.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientImpl.java
index 42d4b07..927b4c7 100644
--- a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientImpl.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientImpl.java
@@ -186,6 +186,7 @@
@Override
public void setLspDbSyncStatus(PcepSyncStatus syncStatus) {
+ log.debug("LSP DB sync status set from {} to {}", this.lspDbSyncStatus, syncStatus);
this.lspDbSyncStatus = syncStatus;
}
@@ -199,7 +200,7 @@
PcepSyncStatus syncOldStatus = labelDbSyncStatus();
this.labelDbSyncStatus = syncStatus;
-
+ log.debug("Label DB sync status set from {} to {}", syncOldStatus, syncStatus);
if ((syncOldStatus == PcepSyncStatus.IN_SYNC) && (syncStatus == PcepSyncStatus.SYNCED)) {
// Perform end of LSP DB sync actions.
this.agent.analyzeSyncMsgList(pccId);
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4Adjacency.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4Adjacency.java
index 7716873..5d01912 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4Adjacency.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4Adjacency.java
@@ -59,6 +59,14 @@
return ST_TYPE;
}
+ public int getLocalIpv4Addr() {
+ return localIpv4Addr;
+ }
+
+ public int getRemoteIpv4Addr() {
+ return remoteIpv4Addr;
+ }
+
@Override
public int write(ChannelBuffer bb) {
int iLenStartIndex = bb.writerIndex();
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/SrEroSubObject.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/SrEroSubObject.java
index 57b719e..947ba28 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/SrEroSubObject.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/SrEroSubObject.java
@@ -84,7 +84,7 @@
*/
protected static final Logger log = LoggerFactory.getLogger(SrEroSubObject.class);
- public static final short TYPE = 0x60; //TODO : type to be defined
+ public static final short TYPE = 0x24; //TODO : type to be defined
public static final short LENGTH = 12;
public static final short VALUE_LENGTH = 10;
public static final int SET = 1;
@@ -243,9 +243,10 @@
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
-
- c.writeShort(TYPE);
- c.writeShort(LENGTH);
+ c.writeByte(TYPE);
+ // Store the position of object length
+ int objectLenIndex = c.writerIndex();
+ c.writeByte(0);
short temp = 0;
if (bMFlag) {
@@ -264,13 +265,14 @@
temp = (short) (temp | tempST);
c.writeShort(temp);
if (bMFlag) {
- int tempSid = (int) sid << 12;
+ int tempSid = sid << 12;
c.writeInt(tempSid);
} else {
c.writeInt(sid);
}
nai.write(c);
+ c.setByte(objectLenIndex, (c.writerIndex() - iLenStartIndex));
return c.writerIndex() - iLenStartIndex;
}
diff --git a/providers/pcep/packet/src/main/java/org/onosproject/provider/pcep/packet/impl/PcepPacketProvider.java b/providers/pcep/packet/src/main/java/org/onosproject/provider/pcep/packet/impl/PcepPacketProvider.java
index 13a2f99..41cf375 100644
--- a/providers/pcep/packet/src/main/java/org/onosproject/provider/pcep/packet/impl/PcepPacketProvider.java
+++ b/providers/pcep/packet/src/main/java/org/onosproject/provider/pcep/packet/impl/PcepPacketProvider.java
@@ -10,6 +10,7 @@
import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
+import org.onlab.packet.MacAddress;
import org.onlab.packet.TCP;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ConnectPoint;
@@ -90,6 +91,7 @@
Ethernet eth = new Ethernet();
eth.setEtherType(Ethernet.TYPE_IPV4);
+ eth.setDestinationMACAddress(MacAddress.NONE);
eth.setPayload(ipv4);
// Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID.
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 7af0040..d9eedb4 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
@@ -28,6 +28,8 @@
import org.onlab.packet.IpAddress;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.core.DefaultGroupId;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
import org.onosproject.incubator.net.tunnel.DefaultTunnel;
import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
@@ -59,6 +61,7 @@
import org.onosproject.net.ElementId;
import org.onosproject.net.IpElementId;
import org.onosproject.net.Link;
+import org.onosproject.net.NetworkResource;
import org.onosproject.net.Path;
import org.onosproject.net.PortNumber;
import org.onosproject.net.SparseAnnotations;
@@ -95,6 +98,7 @@
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.protocol.PcepMetricObject;
import org.onosproject.pcepio.protocol.PcepMsgPath;
+import org.onosproject.pcepio.protocol.PcepNai;
import org.onosproject.pcepio.protocol.PcepReportMsg;
import org.onosproject.pcepio.protocol.PcepSrpObject;
import org.onosproject.pcepio.protocol.PcepStateReport;
@@ -102,7 +106,10 @@
import org.onosproject.pcepio.protocol.PcepUpdateRequest;
import org.onosproject.pcepio.types.IPv4SubObject;
import org.onosproject.pcepio.types.PathSetupTypeTlv;
+import org.onosproject.pcepio.types.PcepNaiIpv4Adjacency;
+import org.onosproject.pcepio.types.PcepNaiIpv4NodeId;
import org.onosproject.pcepio.types.PcepValueType;
+import org.onosproject.pcepio.types.SrEroSubObject;
import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
import org.onosproject.pcepio.types.SymbolicPathNameTlv;
import org.osgi.service.component.ComponentContext;
@@ -115,6 +122,7 @@
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
@@ -845,7 +853,7 @@
* Creates list of hops for ERO object from Path.
*
* @param path network path
- * @return list of ipv4 subobjects
+ * @return list of ERO subobjects
*/
private LinkedList<PcepValueType> createPcepPath(Path path) {
LinkedList<PcepValueType> llSubObjects = new LinkedList<PcepValueType>();
@@ -880,6 +888,55 @@
}
/**
+ * Creates label stack for ERO object from network resource.
+ *
+ * @param labelStack
+ * @param path (hop list)
+ * @return list of ERO subobjects
+ */
+ private LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path) {
+ checkNotNull(labelStack);
+
+ LinkedList<PcepValueType> llSubObjects = new LinkedList<PcepValueType>();
+ Iterator<Link> links = path.links().iterator();
+ LabelResourceId label = null;
+ Link link = null;
+ PcepValueType subObj = null;
+ PcepNai nai = null;
+ Device dstNode = null;
+ long srcPortNo, dstPortNo;
+
+ ListIterator<LabelResourceId> labelListIterator = labelStack.labelResources().listIterator();
+ while (labelListIterator.hasNext()) {
+ label = labelListIterator.next();
+ link = links.next();
+
+ srcPortNo = link.src().port().toLong();
+ srcPortNo = ((srcPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? srcPortNo & SET : srcPortNo;
+
+ dstPortNo = link.dst().port().toLong();
+ dstPortNo = ((dstPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? dstPortNo & SET : dstPortNo;
+
+ nai = new PcepNaiIpv4Adjacency((int) srcPortNo, (int) dstPortNo);
+ subObj = new SrEroSubObject(PcepNaiIpv4Adjacency.ST_TYPE, false, false, false, true, (int) label.labelId(),
+ nai);
+ llSubObjects.add(subObj);
+
+ dstNode = deviceService.getDevice(link.dst().deviceId());
+ nai = new PcepNaiIpv4NodeId(Ip4Address.valueOf(dstNode.annotations().value(LSRID)).toInt());
+
+ if (!labelListIterator.hasNext()) {
+ log.error("Malformed label stack.");
+ }
+ label = labelListIterator.next();
+ subObj = new SrEroSubObject(PcepNaiIpv4NodeId.ST_TYPE, false, false, false, true, (int) label.labelId(),
+ nai);
+ llSubObjects.add(subObj);
+ }
+ return llSubObjects;
+ }
+
+ /**
* Creates PcInitiated lsp request list for setup tunnel.
*
* @param tunnel mpls tunnel
@@ -893,7 +950,14 @@
PcepClient pc, int srpId)
throws PcepParseException {
PcepValueType tlv;
- LinkedList<PcepValueType> llSubObjects = createPcepPath(path);
+ LinkedList<PcepValueType> llSubObjects = null;
+
+ NetworkResource labelStack = tunnel.resource();
+ if (labelStack != null && labelStack instanceof DefaultLabelStack) {
+ llSubObjects = createPcepLabelStack((DefaultLabelStack) labelStack, path);
+ } else {
+ llSubObjects = createPcepPath(path);
+ }
if (llSubObjects == null || llSubObjects.size() == 0) {
log.error("There is no link information to create tunnel");
@@ -932,8 +996,8 @@
llOptionalTlv.add(tlv);
//build LSP object
- PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true).setOFlag((byte) 0).setPlspId(0)
- .setOptionalTlv(llOptionalTlv).build();
+ PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true).setDFlag(true).setOFlag((byte) 0)
+ .setPlspId(0).setOptionalTlv(llOptionalTlv).build();
//build ENDPOINTS object
PcepEndPointsObject endpointsobj = pc.factory().buildEndPointsObject()
@@ -1036,15 +1100,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>();
@@ -1066,8 +1121,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);
@@ -1077,6 +1135,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()
@@ -1119,7 +1181,14 @@
PcepValueType tlv;
int plspId = 0;
- LinkedList<PcepValueType> llSubObjects = createPcepPath(path);
+ LinkedList<PcepValueType> llSubObjects = null;
+ NetworkResource labelStack = tunnel.resource();
+ if (labelStack != null && labelStack instanceof DefaultLabelStack) {
+ llSubObjects = createPcepLabelStack((DefaultLabelStack) labelStack, path);
+ } else {
+ llSubObjects = createPcepPath(path);
+ }
+
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcepUpdateRequest> llUpdateRequestList = new LinkedList<PcepUpdateRequest>();
@@ -1329,7 +1398,7 @@
DefaultTunnelDescription td = new DefaultTunnelDescription(tunnel.tunnelId(), tunnel.src(),
tunnel.dst(), tunnel.type(), tunnel.groupId(),
providerId, tunnel.tunnelName(), path,
- annotations);
+ tunnel.resource(), annotations);
if (CREATE == pcepTunnelData.requestType()) {
pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData);
@@ -1355,7 +1424,8 @@
// though there are no labels to download for SR-TE.
if ((pcepLspStatus == PcepLspStatus.GOING_UP)
&& (LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE)) == SR_WITHOUT_SIGNALLING)) {
- updateTunnel(tunnel, tunnel.path());
+ // Query again to get latest tunnel updated with protocol values from PCRpt msg.
+ updateTunnel(service.tunnelQueryById(tunnel.tunnelId()), tunnel.path());
}
}
@@ -1391,12 +1461,10 @@
while (listIterator.hasNext()) {
PcepValueType tlv = listIterator.next();
-
switch (tlv.getType()) {
case PathSetupTypeTlv.TYPE:
lspType = LspType.values()[Integer.valueOf(((PathSetupTypeTlv) tlv).getPst())];
break;
-
default:
break;
}
@@ -1417,38 +1485,48 @@
}
PcepAttribute attributes = msgPath.getPcepAttribute();
+ float bandwidth = 0;
int cost = 0;
- if (attributes != null && attributes.getMetricObjectList() != null) {
- ListIterator<PcepMetricObject> iterator = attributes.getMetricObjectList().listIterator();
- PcepMetricObject metricObj = iterator.next();
+ if (attributes != null) {
+ if (attributes.getMetricObjectList() != null) {
+ ListIterator<PcepMetricObject> iterator = attributes.getMetricObjectList().listIterator();
+ PcepMetricObject metricObj = iterator.next();
- while (metricObj != null) {
- if (metricObj.getBType() == IGP_METRIC) {
- costType = "COST";
- } else if (metricObj.getBType() == TE_METRIC) {
- costType = "TE_COST";
+ while (metricObj != null) {
+ if (metricObj.getBType() == IGP_METRIC) {
+ costType = "COST";
+ } else if (metricObj.getBType() == TE_METRIC) {
+ costType = "TE_COST";
+ }
+ if (costType != null) {
+ cost = metricObj.getMetricVal();
+ log.debug("Path cost {}", cost);
+ break;
+ }
+ metricObj = iterator.next();
}
-
- if (costType != null) {
- cost = metricObj.getMetricVal();
- log.debug("Path cost {}", cost);
- break;
- }
- metricObj = iterator.next();
+ }
+ if (attributes.getBandwidthObject() != null) {
+ bandwidth = attributes.getBandwidthObject().getBandwidth();
}
}
- Path path = buildPathFromEroObj(eroObj, providerId, cost);
-
- float bandwidth = 0;
- if (msgPath.getBandwidthObject() != null) {
- bandwidth = msgPath.getBandwidthObject().getBandwidth();
+ List<Object> eroSubObjList = buildPathFromEroObj(eroObj, providerId);
+ List<Link> links = new ArrayList<>();
+ List<LabelResourceId> labels = new ArrayList<>();
+ for (Object linkOrLabel : eroSubObjList) {
+ if (linkOrLabel instanceof Link) {
+ links.add((Link) linkOrLabel);
+ } else if (linkOrLabel instanceof Integer) {
+ labels.add(LabelResourceId.labelResourceId(((Integer) linkOrLabel).longValue()));
+ }
}
- /*
- * To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action
- * from PCE.
- */
+ Path path = new DefaultPath(providerId, links, cost, EMPTY);
+ NetworkResource labelStack = new DefaultLabelStack(labels);
+
+ // To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action
+ // from PCE.
PcepSrpObject srpObj = stateRpt.getSrpObject();
LspType lspType = getLspType(srpObj);
@@ -1463,11 +1541,9 @@
case StatefulIPv4LspIdentifiersTlv.TYPE:
ipv4LspIdenTlv = (StatefulIPv4LspIdentifiersTlv) tlv;
break;
-
case SymbolicPathNameTlv.TYPE:
pathNameTlv = (SymbolicPathNameTlv) tlv;
break;
-
default:
break;
}
@@ -1540,7 +1616,7 @@
annotations = getAnnotations(lspObj, ipv4LspIdenTlv, bandwidth, lspType, costType);
td = new DefaultTunnelDescription(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, new DefaultGroupId(
- 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path,
+ 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path, labelStack,
annotations);
// Do not support PCC initiated LSP after LSP DB sync is completed.
@@ -1573,7 +1649,7 @@
TunnelId tId = tunnelAdded(td, tunnelState);
Tunnel tunnelInserted = new DefaultTunnel(providerId, tunnelEndPointSrc, tunnelEndPointDst, MPLS,
tunnelState, new DefaultGroupId(0), tId, TunnelName.tunnelName(String.valueOf(pathNameTlv
- .getValue())), path, annotations);
+ .getValue())), path, labelStack, annotations);
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnelInserted, path, LSP_STATE_RPT);
pcepTunnelData.setStatefulIpv4IndentifierTlv(ipv4LspIdenTlv);
@@ -1589,7 +1665,7 @@
if (lspObj.getDFlag()) {
annotations = getAnnotations(lspObj, ipv4LspIdenTlv, bandwidth, lspType, costType);
td = new DefaultTunnelDescription(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, new DefaultGroupId(
- 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path,
+ 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path, labelStack,
annotations);
tunnelUpdateInDelegatedCase(pccId, annotations, td, providerId);
}
@@ -1629,15 +1705,14 @@
*
* @param eroObj ERO object
* @param providerId provider id
- * @param cost cost of path
- * @return path object
+ * @return list of links and labels
*/
- private Path buildPathFromEroObj(PcepEroObject eroObj, ProviderId providerId, int cost) {
+ private List<Object> buildPathFromEroObj(PcepEroObject eroObj, ProviderId providerId) {
checkNotNull(eroObj);
- List<Link> links = new ArrayList<Link>();
+ List<Object> subObjList = new ArrayList<>();
LinkedList<PcepValueType> llSubObj = eroObj.getSubObjects();
if (0 == llSubObj.size()) {
- log.debug("ERO in report message does not have hop information");
+ log.error("ERO in report message does not have hop information");
return null;
}
ListIterator<PcepValueType> tlvIterator = llSubObj.listIterator();
@@ -1665,16 +1740,34 @@
.dst(dst)
.type(Link.Type.DIRECT)
.build();
- links.add(link);
+ subObjList.add(link);
src = dst;
}
break;
+ case SrEroSubObject.TYPE:
+ SrEroSubObject srEroSubObj = (SrEroSubObject) subObj;
+ subObjList.add(srEroSubObj.getSid());
+
+ if (srEroSubObj.getSt() == PcepNaiIpv4Adjacency.ST_TYPE) {
+ PcepNaiIpv4Adjacency nai = (PcepNaiIpv4Adjacency) (srEroSubObj.getNai());
+ IpAddress srcIp = IpAddress.valueOf(nai.getLocalIpv4Addr());
+ src = new ConnectPoint(IpElementId.ipElement(srcIp), PortNumber.portNumber(0));
+ IpAddress dstIp = IpAddress.valueOf(nai.getRemoteIpv4Addr());
+ dst = new ConnectPoint(IpElementId.ipElement(dstIp), PortNumber.portNumber(0));
+ Link link = DefaultLink.builder()
+ .providerId(providerId)
+ .src(src)
+ .dst(dst)
+ .type(Link.Type.DIRECT)
+ .build();
+ subObjList.add(link);
+ }
default:
// the other sub objects are not required
}
}
- return new DefaultPath(providerId, links, cost, EMPTY);
+ return subObjList;
}
@Override