Avantika-Huawei

Cherry picks from 1.6 branch

Change-Id: I596247425802fc759463bcf77ea3c885f3161581
...@@ -254,6 +254,7 @@ public class PceManager implements PceService { ...@@ -254,6 +254,7 @@ public class PceManager implements PceService {
254 254
255 tunnelConsumerIdGen = coreService.getIdGenerator(TUNNEL_CONSUMER_ID_GEN_TOPIC); 255 tunnelConsumerIdGen = coreService.getIdGenerator(TUNNEL_CONSUMER_ID_GEN_TOPIC);
256 localLspIdIdGen = coreService.getIdGenerator(LOCAL_LSP_ID_GEN_TOPIC); 256 localLspIdIdGen = coreService.getIdGenerator(LOCAL_LSP_ID_GEN_TOPIC);
257 + localLspIdIdGen.getNewId(); // To prevent 0, the 1st value generated from being used in protocol.
257 localLspIdFreeList = storageService.<Short>setBuilder() 258 localLspIdFreeList = storageService.<Short>setBuilder()
258 .withName("pcepLocalLspIdDeletedList") 259 .withName("pcepLocalLspIdDeletedList")
259 .withSerializer(Serializer.using(KryoNamespaces.API)) 260 .withSerializer(Serializer.using(KryoNamespaces.API))
......
...@@ -406,15 +406,6 @@ public final class PceccSrTeBeHandler { ...@@ -406,15 +406,6 @@ public final class PceccSrTeBeHandler {
406 DeviceId deviceId = null; 406 DeviceId deviceId = null;
407 for (Iterator<Link> iterator = linkList.iterator(); iterator.hasNext();) { 407 for (Iterator<Link> iterator = linkList.iterator(); iterator.hasNext();) {
408 link = iterator.next(); 408 link = iterator.next();
409 - // Add source device label now
410 - deviceId = link.src().deviceId();
411 - nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
412 - if (nodeLabelId == null) {
413 - log.error("Unable to find node label for a device id {} in store.", deviceId.toString());
414 - return null;
415 - }
416 - labelStack.add(nodeLabelId);
417 -
418 // Add adjacency label for this link 409 // Add adjacency label for this link
419 adjLabelId = pceStore.getAdjLabel(link); 410 adjLabelId = pceStore.getAdjLabel(link);
420 if (adjLabelId == null) { 411 if (adjLabelId == null) {
...@@ -422,11 +413,7 @@ public final class PceccSrTeBeHandler { ...@@ -422,11 +413,7 @@ public final class PceccSrTeBeHandler {
422 return null; 413 return null;
423 } 414 }
424 labelStack.add(adjLabelId); 415 labelStack.add(adjLabelId);
425 - }
426 416
427 - // This is the last link in path
428 - // Add destination device label now.
429 - if (link != null) {
430 deviceId = link.dst().deviceId(); 417 deviceId = link.dst().deviceId();
431 nodeLabelId = pceStore.getGlobalNodeLabel(deviceId); 418 nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
432 if (nodeLabelId == null) { 419 if (nodeLabelId == null) {
......
...@@ -417,11 +417,8 @@ public class PceccSrTeBeHandlerTest { ...@@ -417,11 +417,8 @@ public class PceccSrTeBeHandlerTest {
417 // Compute label stack 417 // Compute label stack
418 LabelStack labelStack = srTeHandler.computeLabelStack(path1); 418 LabelStack labelStack = srTeHandler.computeLabelStack(path1);
419 419
420 - // check node-label of D1.deviceId()
421 List<LabelResourceId> labelList = labelStack.labelResources(); 420 List<LabelResourceId> labelList = labelStack.labelResources();
422 Iterator<LabelResourceId> iterator = labelList.iterator(); 421 Iterator<LabelResourceId> iterator = labelList.iterator();
423 - labelId = iterator.next();
424 - assertThat(labelId, is(LabelResourceId.labelResourceId(4097)));
425 422
426 // check adjacency label of D1.deviceId() 423 // check adjacency label of D1.deviceId()
427 labelId = iterator.next(); 424 labelId = iterator.next();
......
...@@ -438,6 +438,7 @@ public class PcepClientControllerImpl implements PcepClientController { ...@@ -438,6 +438,7 @@ public class PcepClientControllerImpl implements PcepClientController {
438 // When there are no LSPs to sync, directly end-of-sync PCRpt will come and the 438 // When there are no LSPs to sync, directly end-of-sync PCRpt will come and the
439 // list will be null. 439 // list will be null.
440 syncStateRptList = Collections.EMPTY_LIST; 440 syncStateRptList = Collections.EMPTY_LIST;
441 + log.debug("No LSPs reported from PCC during sync.");
441 } 442 }
442 443
443 Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator(); 444 Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator();
...@@ -502,8 +503,8 @@ public class PcepClientControllerImpl implements PcepClientController { ...@@ -502,8 +503,8 @@ public class PcepClientControllerImpl implements PcepClientController {
502 } catch (PcepParseException e) { 503 } catch (PcepParseException e) {
503 log.error("Exception occured while sending initiate delete message {}", e.getMessage()); 504 log.error("Exception occured while sending initiate delete message {}", e.getMessage());
504 } 505 }
506 + continue;
505 } 507 }
506 - continue;
507 } 508 }
508 509
509 if (!lspObj.getCFlag()) { 510 if (!lspObj.getCFlag()) {
......
...@@ -186,6 +186,7 @@ public class PcepClientImpl implements PcepClientDriver { ...@@ -186,6 +186,7 @@ public class PcepClientImpl implements PcepClientDriver {
186 186
187 @Override 187 @Override
188 public void setLspDbSyncStatus(PcepSyncStatus syncStatus) { 188 public void setLspDbSyncStatus(PcepSyncStatus syncStatus) {
189 + log.debug("LSP DB sync status set from {} to {}", this.lspDbSyncStatus, syncStatus);
189 this.lspDbSyncStatus = syncStatus; 190 this.lspDbSyncStatus = syncStatus;
190 } 191 }
191 192
...@@ -199,7 +200,7 @@ public class PcepClientImpl implements PcepClientDriver { ...@@ -199,7 +200,7 @@ public class PcepClientImpl implements PcepClientDriver {
199 200
200 PcepSyncStatus syncOldStatus = labelDbSyncStatus(); 201 PcepSyncStatus syncOldStatus = labelDbSyncStatus();
201 this.labelDbSyncStatus = syncStatus; 202 this.labelDbSyncStatus = syncStatus;
202 - 203 + log.debug("Label DB sync status set from {} to {}", syncOldStatus, syncStatus);
203 if ((syncOldStatus == PcepSyncStatus.IN_SYNC) && (syncStatus == PcepSyncStatus.SYNCED)) { 204 if ((syncOldStatus == PcepSyncStatus.IN_SYNC) && (syncStatus == PcepSyncStatus.SYNCED)) {
204 // Perform end of LSP DB sync actions. 205 // Perform end of LSP DB sync actions.
205 this.agent.analyzeSyncMsgList(pccId); 206 this.agent.analyzeSyncMsgList(pccId);
......
...@@ -59,6 +59,14 @@ public class PcepNaiIpv4Adjacency implements PcepNai { ...@@ -59,6 +59,14 @@ public class PcepNaiIpv4Adjacency implements PcepNai {
59 return ST_TYPE; 59 return ST_TYPE;
60 } 60 }
61 61
62 + public int getLocalIpv4Addr() {
63 + return localIpv4Addr;
64 + }
65 +
66 + public int getRemoteIpv4Addr() {
67 + return remoteIpv4Addr;
68 + }
69 +
62 @Override 70 @Override
63 public int write(ChannelBuffer bb) { 71 public int write(ChannelBuffer bb) {
64 int iLenStartIndex = bb.writerIndex(); 72 int iLenStartIndex = bb.writerIndex();
......
...@@ -84,7 +84,7 @@ public class SrEroSubObject implements PcepValueType { ...@@ -84,7 +84,7 @@ public class SrEroSubObject implements PcepValueType {
84 */ 84 */
85 protected static final Logger log = LoggerFactory.getLogger(SrEroSubObject.class); 85 protected static final Logger log = LoggerFactory.getLogger(SrEroSubObject.class);
86 86
87 - public static final short TYPE = 0x60; //TODO : type to be defined 87 + public static final short TYPE = 0x24; //TODO : type to be defined
88 public static final short LENGTH = 12; 88 public static final short LENGTH = 12;
89 public static final short VALUE_LENGTH = 10; 89 public static final short VALUE_LENGTH = 10;
90 public static final int SET = 1; 90 public static final int SET = 1;
...@@ -243,9 +243,10 @@ public class SrEroSubObject implements PcepValueType { ...@@ -243,9 +243,10 @@ public class SrEroSubObject implements PcepValueType {
243 @Override 243 @Override
244 public int write(ChannelBuffer c) { 244 public int write(ChannelBuffer c) {
245 int iLenStartIndex = c.writerIndex(); 245 int iLenStartIndex = c.writerIndex();
246 - 246 + c.writeByte(TYPE);
247 - c.writeShort(TYPE); 247 + // Store the position of object length
248 - c.writeShort(LENGTH); 248 + int objectLenIndex = c.writerIndex();
249 + c.writeByte(0);
249 250
250 short temp = 0; 251 short temp = 0;
251 if (bMFlag) { 252 if (bMFlag) {
...@@ -264,13 +265,14 @@ public class SrEroSubObject implements PcepValueType { ...@@ -264,13 +265,14 @@ public class SrEroSubObject implements PcepValueType {
264 temp = (short) (temp | tempST); 265 temp = (short) (temp | tempST);
265 c.writeShort(temp); 266 c.writeShort(temp);
266 if (bMFlag) { 267 if (bMFlag) {
267 - int tempSid = (int) sid << 12; 268 + int tempSid = sid << 12;
268 c.writeInt(tempSid); 269 c.writeInt(tempSid);
269 } else { 270 } else {
270 c.writeInt(sid); 271 c.writeInt(sid);
271 } 272 }
272 nai.write(c); 273 nai.write(c);
273 274
275 + c.setByte(objectLenIndex, (c.writerIndex() - iLenStartIndex));
274 return c.writerIndex() - iLenStartIndex; 276 return c.writerIndex() - iLenStartIndex;
275 } 277 }
276 278
......
...@@ -10,6 +10,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; ...@@ -10,6 +10,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
10 import org.apache.felix.scr.annotations.Service; 10 import org.apache.felix.scr.annotations.Service;
11 import org.onlab.packet.Ethernet; 11 import org.onlab.packet.Ethernet;
12 import org.onlab.packet.IPv4; 12 import org.onlab.packet.IPv4;
13 +import org.onlab.packet.MacAddress;
13 import org.onlab.packet.TCP; 14 import org.onlab.packet.TCP;
14 import org.onosproject.net.AnnotationKeys; 15 import org.onosproject.net.AnnotationKeys;
15 import org.onosproject.net.ConnectPoint; 16 import org.onosproject.net.ConnectPoint;
...@@ -90,6 +91,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid ...@@ -90,6 +91,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid
90 91
91 Ethernet eth = new Ethernet(); 92 Ethernet eth = new Ethernet();
92 eth.setEtherType(Ethernet.TYPE_IPV4); 93 eth.setEtherType(Ethernet.TYPE_IPV4);
94 + eth.setDestinationMACAddress(MacAddress.NONE);
93 eth.setPayload(ipv4); 95 eth.setPayload(ipv4);
94 96
95 // Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID. 97 // Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID.
......