Avantika-Huawei

Cherry picks from 1.6 branch

Change-Id: I596247425802fc759463bcf77ea3c885f3161581
......@@ -254,6 +254,7 @@ public class PceManager implements PceService {
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))
......
......@@ -406,15 +406,6 @@ public final class PceccSrTeBeHandler {
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 @@ public final class PceccSrTeBeHandler {
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) {
......
......@@ -417,11 +417,8 @@ public class PceccSrTeBeHandlerTest {
// 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();
......
......@@ -438,6 +438,7 @@ public class PcepClientControllerImpl implements PcepClientController {
// 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 @@ public class PcepClientControllerImpl implements PcepClientController {
} catch (PcepParseException e) {
log.error("Exception occured while sending initiate delete message {}", e.getMessage());
}
continue;
}
continue;
}
if (!lspObj.getCFlag()) {
......
......@@ -186,6 +186,7 @@ public class PcepClientImpl implements PcepClientDriver {
@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 @@ public class PcepClientImpl implements PcepClientDriver {
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);
......
......@@ -59,6 +59,14 @@ public class PcepNaiIpv4Adjacency implements PcepNai {
return ST_TYPE;
}
public int getLocalIpv4Addr() {
return localIpv4Addr;
}
public int getRemoteIpv4Addr() {
return remoteIpv4Addr;
}
@Override
public int write(ChannelBuffer bb) {
int iLenStartIndex = bb.writerIndex();
......
......@@ -84,7 +84,7 @@ public class SrEroSubObject implements PcepValueType {
*/
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 @@ public class SrEroSubObject implements PcepValueType {
@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 @@ public class SrEroSubObject implements PcepValueType {
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;
}
......
......@@ -10,6 +10,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
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 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid
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.
......