[ONOS-4687] GoldenEye - Label map download issues.
Change-Id: I5b56ccc6b8bad3c585f4d33ddd6d9094751c8797
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 b415534..41e14dd 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
@@ -893,9 +893,7 @@
// Check whether device has SR-TE Capability
if (cfg.labelStackCap()) {
- if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) {
- log.error("Node label allocation for a device id {} has failed.", deviceId.toString());
- }
+ srTeHandler.allocateNodeLabel(deviceId, lsrId);
}
}
@@ -974,10 +972,7 @@
// Check whether device has SR-TE Capability
if (cfg.labelStackCap()) {
- if (!srTeHandler.allocateAdjacencyLabel(link)) {
- log.error("Unable to allocate adjacency label for a link {}.", link.toString());
- return;
- }
+ srTeHandler.allocateAdjacencyLabel(link);
}
return;
@@ -1209,16 +1204,13 @@
if (cfg.labelStackCap()) {
if (mastershipService.getLocalRole(deviceId) == MastershipRole.MASTER) {
// Allocate node-label
- if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) {
- log.error("Node label allocation for a device id {} has failed.", deviceId.toString());
- }
+ srTeHandler.allocateNodeLabel(deviceId, lsrId);
// Allocate adjacency label to links which are
// originated from this specific device id
Set<Link> links = linkService.getDeviceEgressLinks(deviceId);
for (Link link : links) {
if (!srTeHandler.allocateAdjacencyLabel(link)) {
- log.debug("Unable to allocate adjacency labels for a link {}.", link.toString());
return;
}
}
@@ -1240,40 +1232,42 @@
return false;
}
- Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels();
+ if (pceStore.getGlobalNodeLabel(deviceId) != null) {
+ Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels();
- for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) {
+ for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) {
- // Convert from DeviceId to TunnelEndPoint
- Device srcDevice = deviceService.getDevice(entry.getKey());
+ // Convert from DeviceId to TunnelEndPoint
+ Device srcDevice = deviceService.getDevice(entry.getKey());
- /*
- * If there is a slight difference in timing such that if device subsystem has removed the device but PCE
- * store still has it, just ignore such devices.
- */
- if (srcDevice == null) {
- continue;
+ /*
+ * If there is a slight difference in timing such that if device subsystem has removed the device but
+ * PCE store still has it, just ignore such devices.
+ */
+ if (srcDevice == null) {
+ continue;
+ }
+
+ String srcLsrId = srcDevice.annotations().value(LSRID);
+ if (srcLsrId == null) {
+ continue;
+ }
+
+ srTeHandler.advertiseNodeLabelRule(deviceId,
+ entry.getValue(),
+ IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH),
+ Objective.Operation.ADD, false);
}
- String srcLsrId = srcDevice.annotations().value(LSRID);
- if (srcLsrId == null) {
- continue;
- }
-
- srTeHandler.advertiseNodeLabelRule(deviceId,
- entry.getValue(),
- IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH),
- Objective.Operation.ADD, false);
- }
-
- Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels();
- for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) {
- if (entry.getKey().src().deviceId().equals(deviceId)) {
- srTeHandler.installAdjLabelRule(deviceId,
- entry.getValue(),
- entry.getKey().src().port(),
- entry.getKey().dst().port(),
- Objective.Operation.ADD);
+ Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels();
+ for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) {
+ if (entry.getKey().src().deviceId().equals(deviceId)) {
+ srTeHandler.installAdjLabelRule(deviceId,
+ entry.getValue(),
+ entry.getKey().src().port(),
+ entry.getKey().dst().port(),
+ Objective.Operation.ADD);
+ }
}
}