Committed by
Thomas Vachuska
Making ERO non-mandatory (for end of LSP DB sync msg from cisco)
Change-Id: I28e35520b5bd5737117d8c2b84f9effa3c46bfaf (cherry picked from commit fb630488)
Showing
4 changed files
with
50 additions
and
12 deletions
... | @@ -340,7 +340,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -340,7 +340,7 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
340 | 340 | ||
341 | while (MINIMUM_COMMON_HEADER_LENGTH <= cb.readableBytes()) { | 341 | while (MINIMUM_COMMON_HEADER_LENGTH <= cb.readableBytes()) { |
342 | 342 | ||
343 | - PcepValueType tlv; | 343 | + PcepValueType tlv = null; |
344 | short hType = cb.readShort(); | 344 | short hType = cb.readShort(); |
345 | short hLength = cb.readShort(); | 345 | short hLength = cb.readShort(); |
346 | int iValue = 0; | 346 | int iValue = 0; |
... | @@ -364,7 +364,10 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -364,7 +364,10 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
364 | tlv = StatefulLspDbVerTlv.read(cb); | 364 | tlv = StatefulLspDbVerTlv.read(cb); |
365 | break; | 365 | break; |
366 | default: | 366 | default: |
367 | - throw new PcepParseException("Received unsupported TLV type :" + hType); | 367 | + // Skip the unknown TLV. |
368 | + cb.skipBytes(hLength); | ||
369 | + tlv = null; | ||
370 | + log.info("Received unsupported TLV type :" + hType + " in LSP object."); | ||
368 | } | 371 | } |
369 | // Check for the padding | 372 | // Check for the padding |
370 | int pad = hLength % 4; | 373 | int pad = hLength % 4; |
... | @@ -375,7 +378,9 @@ public class PcepLspObjectVer1 implements PcepLspObject { | ... | @@ -375,7 +378,9 @@ public class PcepLspObjectVer1 implements PcepLspObject { |
375 | } | 378 | } |
376 | } | 379 | } |
377 | 380 | ||
378 | - llOutOptionalTlv.add(tlv); | 381 | + if (tlv != null) { |
382 | + llOutOptionalTlv.add(tlv); | ||
383 | + } | ||
379 | } | 384 | } |
380 | 385 | ||
381 | if (0 < cb.readableBytes()) { | 386 | if (0 < cb.readableBytes()) { | ... | ... |
... | @@ -287,10 +287,21 @@ public class PcepOpenObjectVer1 implements PcepOpenObject { | ... | @@ -287,10 +287,21 @@ public class PcepOpenObjectVer1 implements PcepOpenObject { |
287 | default: | 287 | default: |
288 | log.debug("Unsupported TLV: " + hType); | 288 | log.debug("Unsupported TLV: " + hType); |
289 | cb.skipBytes(hLength); | 289 | cb.skipBytes(hLength); |
290 | - continue; | 290 | + tlv = null; |
291 | + } | ||
292 | + | ||
293 | + // Check for the padding | ||
294 | + int pad = hLength % 4; | ||
295 | + if (0 < pad) { | ||
296 | + pad = 4 - pad; | ||
297 | + if (pad <= cb.readableBytes()) { | ||
298 | + cb.skipBytes(pad); | ||
299 | + } | ||
291 | } | 300 | } |
292 | 301 | ||
293 | - llOptionalTlv.add(tlv); | 302 | + if (tlv != null) { |
303 | + llOptionalTlv.add(tlv); | ||
304 | + } | ||
294 | } | 305 | } |
295 | 306 | ||
296 | if (0 < cb.readableBytes()) { | 307 | if (0 < cb.readableBytes()) { | ... | ... |
... | @@ -65,8 +65,8 @@ class PcepReportMsgVer1 implements PcepReportMsg { | ... | @@ -65,8 +65,8 @@ class PcepReportMsgVer1 implements PcepReportMsg { |
65 | protected static final Logger log = LoggerFactory.getLogger(PcepReportMsgVer1.class); | 65 | protected static final Logger log = LoggerFactory.getLogger(PcepReportMsgVer1.class); |
66 | 66 | ||
67 | public static final byte PACKET_VERSION = 1; | 67 | public static final byte PACKET_VERSION = 1; |
68 | - //PACKET_MINIMUM_LENGTH = CommonHeaderLen(4)+LspObjMinLen(8)+EroObjMinLen(4) | 68 | + //PACKET_MINIMUM_LENGTH = CommonHeaderLen(4)+LspObjMinLen(8) |
69 | - public static final int PACKET_MINIMUM_LENGTH = 16; | 69 | + public static final int PACKET_MINIMUM_LENGTH = 12; |
70 | public static final PcepType MSG_TYPE = PcepType.REPORT; | 70 | public static final PcepType MSG_TYPE = PcepType.REPORT; |
71 | public static final byte REPORT_OBJ_TYPE = 1; | 71 | public static final byte REPORT_OBJ_TYPE = 1; |
72 | //Optional TLV | 72 | //Optional TLV |
... | @@ -164,9 +164,25 @@ class PcepReportMsgVer1 implements PcepReportMsg { | ... | @@ -164,9 +164,25 @@ class PcepReportMsgVer1 implements PcepReportMsg { |
164 | lspObj = PcepLspObjectVer1.read(cb); | 164 | lspObj = PcepLspObjectVer1.read(cb); |
165 | pcestateReq.setLspObject(lspObj); | 165 | pcestateReq.setLspObject(lspObj); |
166 | 166 | ||
167 | - //store path | 167 | + if (cb.readableBytes() > 0) { |
168 | - PcepStateReport.PcepMsgPath msgPath = new PcepStateReportVer1().new PcepMsgPath().read(cb); | 168 | + |
169 | - pcestateReq.setMsgPath(msgPath); | 169 | + //mark the reader index to reset |
170 | + cb.markReaderIndex(); | ||
171 | + tempObjHeader = PcepObjectHeader.read(cb); | ||
172 | + | ||
173 | + yObjectClass = tempObjHeader.getObjClass(); | ||
174 | + yObjectType = tempObjHeader.getObjType(); | ||
175 | + | ||
176 | + //reset reader index | ||
177 | + cb.resetReaderIndex(); | ||
178 | + | ||
179 | + if ((PcepEroObjectVer1.ERO_OBJ_CLASS == yObjectClass) | ||
180 | + && (PcepEroObjectVer1.ERO_OBJ_TYPE == yObjectType)) { | ||
181 | + // store path | ||
182 | + PcepStateReport.PcepMsgPath msgPath = new PcepStateReportVer1().new PcepMsgPath().read(cb); | ||
183 | + pcestateReq.setMsgPath(msgPath); | ||
184 | + } | ||
185 | + } | ||
170 | 186 | ||
171 | llStateReportList.add(pcestateReq); | 187 | llStateReportList.add(pcestateReq); |
172 | } | 188 | } | ... | ... |
... | @@ -251,7 +251,10 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { | ... | @@ -251,7 +251,10 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { |
251 | tlv = PathSetupTypeTlv.of(cb.readInt()); | 251 | tlv = PathSetupTypeTlv.of(cb.readInt()); |
252 | break; | 252 | break; |
253 | default: | 253 | default: |
254 | - throw new PcepParseException("Unsupported TLV received in SRP Object."); | 254 | + // Skip the unknown TLV. |
255 | + cb.skipBytes(hLength); | ||
256 | + tlv = null; | ||
257 | + log.info("Received unsupported TLV type :" + hType + " in SRP object."); | ||
255 | } | 258 | } |
256 | 259 | ||
257 | // Check for the padding | 260 | // Check for the padding |
... | @@ -262,7 +265,10 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { | ... | @@ -262,7 +265,10 @@ public class PcepSrpObjectVer1 implements PcepSrpObject { |
262 | cb.skipBytes(pad); | 265 | cb.skipBytes(pad); |
263 | } | 266 | } |
264 | } | 267 | } |
265 | - llOutOptionalTlv.add(tlv); | 268 | + |
269 | + if (tlv != null) { | ||
270 | + llOutOptionalTlv.add(tlv); | ||
271 | + } | ||
266 | } | 272 | } |
267 | 273 | ||
268 | return llOutOptionalTlv; | 274 | return llOutOptionalTlv; | ... | ... |
-
Please register or login to post a comment