Avantika-Huawei
Committed by Gerrit Code Review

[ONOS-4663] [ONOS-4664] ST defect fixes in session establishment/sync

Change-Id: I0bdb4ad08295fe30c488e9170923847112fab647
...@@ -1281,6 +1281,9 @@ public class PceManager implements PceService { ...@@ -1281,6 +1281,9 @@ public class PceManager implements PceService {
1281 LabelResourceId.labelResourceId(0), 1281 LabelResourceId.labelResourceId(0),
1282 IpPrefix.valueOf(END_OF_SYNC_IP_PREFIX), 1282 IpPrefix.valueOf(END_OF_SYNC_IP_PREFIX),
1283 Objective.Operation.ADD, true); 1283 Objective.Operation.ADD, true);
1284 +
1285 + log.debug("End of label DB sync for device {}", deviceId);
1286 +
1284 if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) { 1287 if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) {
1285 // Allocate node-label to this specific device. 1288 // Allocate node-label to this specific device.
1286 allocateNodeLabel(specificDevice); 1289 allocateNodeLabel(specificDevice);
...@@ -1304,6 +1307,7 @@ public class PceManager implements PceService { ...@@ -1304,6 +1307,7 @@ public class PceManager implements PceService {
1304 public void process(PacketContext context) { 1307 public void process(PacketContext context) {
1305 // Stop processing if the packet has been handled, since we 1308 // Stop processing if the packet has been handled, since we
1306 // can't do any more to it. 1309 // can't do any more to it.
1310 + log.debug("Received trigger for label DB sync.");
1307 if (context.isHandled()) { 1311 if (context.isHandled()) {
1308 return; 1312 return;
1309 } 1313 }
......
...@@ -177,18 +177,23 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { ...@@ -177,18 +177,23 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler {
177 * The socket IP is stored in channel. 177 * The socket IP is stored in channel.
178 */ 178 */
179 LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv(); 179 LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv();
180 - for (PcepValueType optionalTlv : optionalTlvs) { 180 + if (optionalTlvs != null) {
181 - if (optionalTlv instanceof NodeAttributesTlv) { 181 + for (PcepValueType optionalTlv : optionalTlvs) {
182 - List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv) 182 + if (optionalTlv instanceof NodeAttributesTlv) {
183 - .getllNodeAttributesSubTLVs(); 183 + List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv)
184 - for (PcepValueType subTlv : subTlvs) { 184 + .getllNodeAttributesSubTLVs();
185 - if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) { 185 + if (subTlvs == null) {
186 - h.thispccId = PccId.pccId(IpAddress
187 - .valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt()));
188 break; 186 break;
189 } 187 }
188 + for (PcepValueType subTlv : subTlvs) {
189 + if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) {
190 + h.thispccId = PccId.pccId(IpAddress
191 + .valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt()));
192 + break;
193 + }
194 + }
195 + break;
190 } 196 }
191 - break;
192 } 197 }
193 } 198 }
194 199
......
...@@ -236,8 +236,10 @@ public class PcepClientControllerImpl implements PcepClientController { ...@@ -236,8 +236,10 @@ public class PcepClientControllerImpl implements PcepClientController {
236 ListIterator<PcepStateReport> listIterator = ((PcepReportMsg) msg).getStateReportList().listIterator(); 236 ListIterator<PcepStateReport> listIterator = ((PcepReportMsg) msg).getStateReportList().listIterator();
237 while (listIterator.hasNext()) { 237 while (listIterator.hasNext()) {
238 PcepStateReport stateRpt = listIterator.next(); 238 PcepStateReport stateRpt = listIterator.next();
239 - if (stateRpt.getLspObject().getSFlag()) { 239 + PcepLspObject lspObj = stateRpt.getLspObject();
240 + if (lspObj.getSFlag()) {
240 if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) { 241 if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) {
242 + log.debug("LSP DB sync started for PCC {}", pc.getPccId().id().toString());
241 // Initialize LSP DB sync and temporary cache. 243 // Initialize LSP DB sync and temporary cache.
242 pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC); 244 pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC);
243 pc.initializeSyncMsgList(pccId); 245 pc.initializeSyncMsgList(pccId);
...@@ -247,13 +249,16 @@ public class PcepClientControllerImpl implements PcepClientController { ...@@ -247,13 +249,16 @@ public class PcepClientControllerImpl implements PcepClientController {
247 249
248 // Don't send to provider as of now. 250 // Don't send to provider as of now.
249 continue; 251 continue;
250 - } else { 252 + } else if (lspObj.getPlspId() == 0) {
251 - if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC) { 253 + if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC
254 + || pc.lspDbSyncStatus() == PcepSyncStatus.NOT_SYNCED) {
252 // Set end of LSPDB sync. 255 // Set end of LSPDB sync.
256 + log.debug("LSP DB sync completed for PCC {}", pc.getPccId().id().toString());
253 pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED); 257 pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED);
254 258
255 // Call packet provider to initiate label DB sync (only if PCECC capable). 259 // Call packet provider to initiate label DB sync (only if PCECC capable).
256 if (pc.capability().pceccCapability()) { 260 if (pc.capability().pceccCapability()) {
261 + log.debug("Trigger label DB sync for PCC {}", pc.getPccId().id().toString());
257 pc.setLabelDbSyncStatus(IN_SYNC); 262 pc.setLabelDbSyncStatus(IN_SYNC);
258 for (PcepPacketListener l : pcepPacketListener) { 263 for (PcepPacketListener l : pcepPacketListener) {
259 l.sendPacketIn(pccId); 264 l.sendPacketIn(pccId);
......
...@@ -107,6 +107,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid ...@@ -107,6 +107,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid
107 } 107 }
108 108
109 if (pccDeviceId == null) { 109 if (pccDeviceId == null) {
110 + log.error("Device not found to perform label DB sync.");
110 return; 111 return;
111 } 112 }
112 113
......
...@@ -141,7 +141,7 @@ public class PcepTopologyProvider extends AbstractProvider ...@@ -141,7 +141,7 @@ public class PcepTopologyProvider extends AbstractProvider
141 141
142 private final ConfigFactory<DeviceId, DeviceCapability> configFactory = 142 private final ConfigFactory<DeviceId, DeviceCapability> configFactory =
143 new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY, 143 new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY,
144 - DeviceCapability.class, "deviceCapability", true) { 144 + DeviceCapability.class, "deviceCapability", false) {
145 @Override 145 @Override
146 public DeviceCapability createConfig() { 146 public DeviceCapability createConfig() {
147 return new DeviceCapability(); 147 return new DeviceCapability();
......