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 {
LabelResourceId.labelResourceId(0),
IpPrefix.valueOf(END_OF_SYNC_IP_PREFIX),
Objective.Operation.ADD, true);
log.debug("End of label DB sync for device {}", deviceId);
if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) {
// Allocate node-label to this specific device.
allocateNodeLabel(specificDevice);
......@@ -1304,6 +1307,7 @@ public class PceManager implements PceService {
public void process(PacketContext context) {
// Stop processing if the packet has been handled, since we
// can't do any more to it.
log.debug("Received trigger for label DB sync.");
if (context.isHandled()) {
return;
}
......
......@@ -177,18 +177,23 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler {
* The socket IP is stored in channel.
*/
LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv();
for (PcepValueType optionalTlv : optionalTlvs) {
if (optionalTlv instanceof NodeAttributesTlv) {
List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv)
.getllNodeAttributesSubTLVs();
for (PcepValueType subTlv : subTlvs) {
if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) {
h.thispccId = PccId.pccId(IpAddress
.valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt()));
if (optionalTlvs != null) {
for (PcepValueType optionalTlv : optionalTlvs) {
if (optionalTlv instanceof NodeAttributesTlv) {
List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv)
.getllNodeAttributesSubTLVs();
if (subTlvs == null) {
break;
}
for (PcepValueType subTlv : subTlvs) {
if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) {
h.thispccId = PccId.pccId(IpAddress
.valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt()));
break;
}
}
break;
}
break;
}
}
......
......@@ -236,8 +236,10 @@ public class PcepClientControllerImpl implements PcepClientController {
ListIterator<PcepStateReport> listIterator = ((PcepReportMsg) msg).getStateReportList().listIterator();
while (listIterator.hasNext()) {
PcepStateReport stateRpt = listIterator.next();
if (stateRpt.getLspObject().getSFlag()) {
PcepLspObject lspObj = stateRpt.getLspObject();
if (lspObj.getSFlag()) {
if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) {
log.debug("LSP DB sync started for PCC {}", pc.getPccId().id().toString());
// Initialize LSP DB sync and temporary cache.
pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC);
pc.initializeSyncMsgList(pccId);
......@@ -247,13 +249,16 @@ public class PcepClientControllerImpl implements PcepClientController {
// Don't send to provider as of now.
continue;
} else {
if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC) {
} else if (lspObj.getPlspId() == 0) {
if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC
|| pc.lspDbSyncStatus() == PcepSyncStatus.NOT_SYNCED) {
// Set end of LSPDB sync.
log.debug("LSP DB sync completed for PCC {}", pc.getPccId().id().toString());
pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED);
// Call packet provider to initiate label DB sync (only if PCECC capable).
if (pc.capability().pceccCapability()) {
log.debug("Trigger label DB sync for PCC {}", pc.getPccId().id().toString());
pc.setLabelDbSyncStatus(IN_SYNC);
for (PcepPacketListener l : pcepPacketListener) {
l.sendPacketIn(pccId);
......
......@@ -107,6 +107,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid
}
if (pccDeviceId == null) {
log.error("Device not found to perform label DB sync.");
return;
}
......
......@@ -141,7 +141,7 @@ public class PcepTopologyProvider extends AbstractProvider
private final ConfigFactory<DeviceId, DeviceCapability> configFactory =
new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY,
DeviceCapability.class, "deviceCapability", true) {
DeviceCapability.class, "deviceCapability", false) {
@Override
public DeviceCapability createConfig() {
return new DeviceCapability();
......