[ONOS-4722] cherry-picked GoldenEye:Fix exception on learning unknown PCE-initiated LSP from PCC
Change-Id: I8abc003aeb187f18e51de533f0c51e265dfd8661
Showing
14 changed files
with
92 additions
and
73 deletions
| ... | @@ -150,7 +150,7 @@ public final class BasicPceccHandler { | ... | @@ -150,7 +150,7 @@ public final class BasicPceccHandler { |
| 150 | 150 | ||
| 151 | // Push into destination device | 151 | // Push into destination device |
| 152 | // Destination device IN port is link.dst().port() | 152 | // Destination device IN port is link.dst().port() |
| 153 | - installLocalLabelRule(dstDeviceId, labelId, dstPort, tunnel.tunnelId(), isLastLabelToPush, | 153 | + installLocalLabelRule(dstDeviceId, labelId, dstPort, tunnel.tunnelId(), false, |
| 154 | Long.valueOf(LabelType.IN_LABEL.value), Objective.Operation.ADD); | 154 | Long.valueOf(LabelType.IN_LABEL.value), Objective.Operation.ADD); |
| 155 | 155 | ||
| 156 | // Push into source device | 156 | // Push into source device | ... | ... |
| ... | @@ -116,6 +116,7 @@ import static org.onosproject.incubator.net.tunnel.Tunnel.Type.MPLS; | ... | @@ -116,6 +116,7 @@ import static org.onosproject.incubator.net.tunnel.Tunnel.Type.MPLS; |
| 116 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; | 116 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; |
| 117 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.ESTABLISHED; | 117 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.ESTABLISHED; |
| 118 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; | 118 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; |
| 119 | +import static org.onosproject.incubator.net.tunnel.Tunnel.State.FAILED; | ||
| 119 | import static org.onosproject.pce.pceservice.LspType.WITH_SIGNALLING; | 120 | import static org.onosproject.pce.pceservice.LspType.WITH_SIGNALLING; |
| 120 | import static org.onosproject.pce.pceservice.LspType.SR_WITHOUT_SIGNALLING; | 121 | import static org.onosproject.pce.pceservice.LspType.SR_WITHOUT_SIGNALLING; |
| 121 | import static org.onosproject.pce.pceservice.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 122 | import static org.onosproject.pce.pceservice.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
| ... | @@ -603,6 +604,18 @@ public class PceManager implements PceService { | ... | @@ -603,6 +604,18 @@ public class PceManager implements PceService { |
| 603 | PceccTunnelInfo pceccTunnelInfo = new PceccTunnelInfo(null, consumerId); | 604 | PceccTunnelInfo pceccTunnelInfo = new PceccTunnelInfo(null, consumerId); |
| 604 | pceStore.addTunnelInfo(updatedTunnelId, pceccTunnelInfo); | 605 | pceStore.addTunnelInfo(updatedTunnelId, pceccTunnelInfo); |
| 605 | } | 606 | } |
| 607 | + | ||
| 608 | + // For CR cases, download labels and send update message. | ||
| 609 | + if (lspType == WITHOUT_SIGNALLING_AND_WITHOUT_SR) { | ||
| 610 | + Tunnel tunnelForlabelDownload = new DefaultTunnel(null, tunnel.src(), tunnel.dst(), MPLS, INIT, null, | ||
| 611 | + updatedTunnelId, tunnel.tunnelName(), computedPath, | ||
| 612 | + labelStack, annotationBuilder.build()); | ||
| 613 | + | ||
| 614 | + if (!crHandler.allocateLabel(tunnelForlabelDownload)) { | ||
| 615 | + log.error("Unable to allocate labels for the tunnel {}.", tunnel.toString()); | ||
| 616 | + } | ||
| 617 | + } | ||
| 618 | + | ||
| 606 | return true; | 619 | return true; |
| 607 | } | 620 | } |
| 608 | 621 | ||
| ... | @@ -1154,6 +1167,11 @@ public class PceManager implements PceService { | ... | @@ -1154,6 +1167,11 @@ public class PceManager implements PceService { |
| 1154 | links.get(links.size() - 1).dst().deviceId(), | 1167 | links.get(links.size() - 1).dst().deviceId(), |
| 1155 | tunnel.tunnelName().value(), constraints, lspType)); | 1168 | tunnel.tunnelName().value(), constraints, lspType)); |
| 1156 | } | 1169 | } |
| 1170 | + | ||
| 1171 | + if (tunnel.state() == FAILED) { | ||
| 1172 | + // Check whether this ONOS instance is master, if yes, recompute and send update. | ||
| 1173 | + checkForMasterAndUpdateTunnel(tunnel.path().src().deviceId(), tunnel); | ||
| 1174 | + } | ||
| 1157 | break; | 1175 | break; |
| 1158 | 1176 | ||
| 1159 | case TUNNEL_REMOVED: | 1177 | case TUNNEL_REMOVED: | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.provider.pcep.tunnel.impl; | 17 | +package org.onosproject.pcep.controller; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * Representation of LSP type. | 20 | * Representation of LSP type. | ... | ... |
| ... | @@ -37,13 +37,4 @@ public interface PcepEventListener { | ... | @@ -37,13 +37,4 @@ public interface PcepEventListener { |
| 37 | * @param endOfSyncAction the action that needs to be taken for the tunnel | 37 | * @param endOfSyncAction the action that needs to be taken for the tunnel |
| 38 | */ | 38 | */ |
| 39 | void handleEndOfSyncAction(Tunnel tunnel, PcepLspSyncAction endOfSyncAction); | 39 | void handleEndOfSyncAction(Tunnel tunnel, PcepLspSyncAction endOfSyncAction); |
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * Handles sending PCEP message to client on end of LSPDB sync. | ||
| 43 | - * | ||
| 44 | - * @param pccId id of the pcc | ||
| 45 | - * @param msg the message to be sent | ||
| 46 | - * @param endOfSyncAction the action that needs to be taken in the message | ||
| 47 | - */ | ||
| 48 | - void handleEndOfSyncAction(PccId pccId, PcepMessage msg, PcepLspSyncAction endOfSyncAction); | ||
| 49 | } | 40 | } | ... | ... |
| ... | @@ -49,6 +49,7 @@ import org.onosproject.pcep.controller.PcepLspStatus; | ... | @@ -49,6 +49,7 @@ import org.onosproject.pcep.controller.PcepLspStatus; |
| 49 | import org.onosproject.pcep.controller.PcepNodeListener; | 49 | import org.onosproject.pcep.controller.PcepNodeListener; |
| 50 | import org.onosproject.pcep.controller.PcepPacketListener; | 50 | import org.onosproject.pcep.controller.PcepPacketListener; |
| 51 | import org.onosproject.pcep.controller.PcepSyncStatus; | 51 | import org.onosproject.pcep.controller.PcepSyncStatus; |
| 52 | +import org.onosproject.pcep.controller.SrpIdGenerators; | ||
| 52 | import org.onosproject.pcep.controller.driver.PcepAgent; | 53 | import org.onosproject.pcep.controller.driver.PcepAgent; |
| 53 | import org.onosproject.pcepio.exceptions.PcepParseException; | 54 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 54 | import org.onosproject.pcepio.protocol.PcInitiatedLspRequest; | 55 | import org.onosproject.pcepio.protocol.PcInitiatedLspRequest; |
| ... | @@ -61,6 +62,7 @@ import org.onosproject.pcepio.protocol.PcepInitiateMsg; | ... | @@ -61,6 +62,7 @@ import org.onosproject.pcepio.protocol.PcepInitiateMsg; |
| 61 | import org.onosproject.pcepio.protocol.PcepLspObject; | 62 | import org.onosproject.pcepio.protocol.PcepLspObject; |
| 62 | import org.onosproject.pcepio.protocol.PcepMessage; | 63 | import org.onosproject.pcepio.protocol.PcepMessage; |
| 63 | import org.onosproject.pcepio.protocol.PcepReportMsg; | 64 | import org.onosproject.pcepio.protocol.PcepReportMsg; |
| 65 | +import org.onosproject.pcepio.protocol.PcepSrpObject; | ||
| 64 | import org.onosproject.pcepio.protocol.PcepStateReport; | 66 | import org.onosproject.pcepio.protocol.PcepStateReport; |
| 65 | import org.onosproject.pcepio.types.PcepValueType; | 67 | import org.onosproject.pcepio.types.PcepValueType; |
| 66 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 68 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
| ... | @@ -74,7 +76,6 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -74,7 +76,6 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 74 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; | 76 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; |
| 75 | import static org.onosproject.pcep.controller.PcepLspSyncAction.REMOVE; | 77 | import static org.onosproject.pcep.controller.PcepLspSyncAction.REMOVE; |
| 76 | import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_UPDATE; | 78 | import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_UPDATE; |
| 77 | -import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_DELETE; | ||
| 78 | import static org.onosproject.pcep.controller.PcepLspSyncAction.UNSTABLE; | 79 | import static org.onosproject.pcep.controller.PcepLspSyncAction.UNSTABLE; |
| 79 | import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_TYPE_19; | 80 | import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_TYPE_19; |
| 80 | import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_VALUE_5; | 81 | import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_VALUE_5; |
| ... | @@ -487,8 +488,10 @@ public class PcepClientControllerImpl implements PcepClientController { | ... | @@ -487,8 +488,10 @@ public class PcepClientControllerImpl implements PcepClientController { |
| 487 | if (lspObj.getCFlag() && !lspObj.getRFlag()) { | 488 | if (lspObj.getCFlag() && !lspObj.getRFlag()) { |
| 488 | // For initiated LSP, need to send PCInit delete msg. | 489 | // For initiated LSP, need to send PCInit delete msg. |
| 489 | try { | 490 | try { |
| 491 | + PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(SrpIdGenerators.create()) | ||
| 492 | + .setRFlag(true).build(); | ||
| 490 | PcInitiatedLspRequest releaseLspRequest = pc.factory().buildPcInitiatedLspRequest() | 493 | PcInitiatedLspRequest releaseLspRequest = pc.factory().buildPcInitiatedLspRequest() |
| 491 | - .setLspObject(lspObj).build(); | 494 | + .setLspObject(lspObj).setSrpObject(srpobj).build(); |
| 492 | LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList | 495 | LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList |
| 493 | = new LinkedList<PcInitiatedLspRequest>(); | 496 | = new LinkedList<PcInitiatedLspRequest>(); |
| 494 | llPcInitiatedLspRequestList.add(releaseLspRequest); | 497 | llPcInitiatedLspRequestList.add(releaseLspRequest); |
| ... | @@ -496,10 +499,7 @@ public class PcepClientControllerImpl implements PcepClientController { | ... | @@ -496,10 +499,7 @@ public class PcepClientControllerImpl implements PcepClientController { |
| 496 | PcepInitiateMsg pcInitiateMsg = pc.factory().buildPcepInitiateMsg() | 499 | PcepInitiateMsg pcInitiateMsg = pc.factory().buildPcepInitiateMsg() |
| 497 | .setPcInitiatedLspRequestList(llPcInitiatedLspRequestList).build(); | 500 | .setPcInitiatedLspRequestList(llPcInitiatedLspRequestList).build(); |
| 498 | 501 | ||
| 499 | - for (PcepEventListener l : pcepEventListener) { | 502 | + pc.sendMessage(Collections.singletonList(pcInitiateMsg)); |
| 500 | - l.handleEndOfSyncAction(pccId, pcInitiateMsg, SEND_DELETE); | ||
| 501 | - } | ||
| 502 | - | ||
| 503 | } catch (PcepParseException e) { | 503 | } catch (PcepParseException e) { |
| 504 | log.error("Exception occured while sending initiate delete message {}", e.getMessage()); | 504 | log.error("Exception occured while sending initiate delete message {}", e.getMessage()); |
| 505 | } | 505 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -36,7 +36,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { | ... | @@ -36,7 +36,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { |
| 36 | 0 1 2 3 | 36 | 0 1 2 3 |
| 37 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 37 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 38 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 39 | - | Type=TBD | Length = 8 | | 39 | + | Type=TBD | Length = 4 | |
| 40 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 41 | | nexthop IPv4 address | | 41 | | nexthop IPv4 address | |
| 42 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 42 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| ... | @@ -46,7 +46,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { | ... | @@ -46,7 +46,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { |
| 46 | */ | 46 | */ |
| 47 | protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class); | 47 | protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class); |
| 48 | 48 | ||
| 49 | - public static final short TYPE = 2; //to be defined | 49 | + public static final short TYPE = (short) 65289; //to be defined |
| 50 | //Length is header + value | 50 | //Length is header + value |
| 51 | public static final short LENGTH = 8; | 51 | public static final short LENGTH = 8; |
| 52 | public static final short VALUE_LENGTH = 4; | 52 | public static final short VALUE_LENGTH = 4; |
| ... | @@ -93,7 +93,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { | ... | @@ -93,7 +93,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { |
| 93 | 93 | ||
| 94 | @Override | 94 | @Override |
| 95 | public short getLength() { | 95 | public short getLength() { |
| 96 | - return LENGTH; | 96 | + return VALUE_LENGTH; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | @Override | 99 | @Override |
| ... | @@ -117,7 +117,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { | ... | @@ -117,7 +117,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { |
| 117 | public int write(ChannelBuffer c) { | 117 | public int write(ChannelBuffer c) { |
| 118 | int iStartIndex = c.writerIndex(); | 118 | int iStartIndex = c.writerIndex(); |
| 119 | c.writeShort(TYPE); | 119 | c.writeShort(TYPE); |
| 120 | - c.writeShort(LENGTH); | 120 | + c.writeShort(VALUE_LENGTH); |
| 121 | c.writeInt(rawValue); | 121 | c.writeInt(rawValue); |
| 122 | return c.writerIndex() - iStartIndex; | 122 | return c.writerIndex() - iStartIndex; |
| 123 | } | 123 | } |
| ... | @@ -136,7 +136,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { | ... | @@ -136,7 +136,7 @@ public class NexthopIPv4addressTlv implements PcepValueType { |
| 136 | public String toString() { | 136 | public String toString() { |
| 137 | return MoreObjects.toStringHelper(getClass()) | 137 | return MoreObjects.toStringHelper(getClass()) |
| 138 | .add("Type", TYPE) | 138 | .add("Type", TYPE) |
| 139 | - .add("Length", LENGTH) | 139 | + .add("Length", VALUE_LENGTH) |
| 140 | .add("Ipv4Address ", rawValue) | 140 | .add("Ipv4Address ", rawValue) |
| 141 | .toString(); | 141 | .toString(); |
| 142 | } | 142 | } | ... | ... |
| ... | @@ -82,15 +82,21 @@ import org.onosproject.pcepio.protocol.PcepUpdateMsg; | ... | @@ -82,15 +82,21 @@ import org.onosproject.pcepio.protocol.PcepUpdateMsg; |
| 82 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; | 82 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; |
| 83 | import org.onosproject.pcepio.types.IPv4SubObject; | 83 | import org.onosproject.pcepio.types.IPv4SubObject; |
| 84 | import org.onosproject.pcepio.types.NexthopIPv4addressTlv; | 84 | import org.onosproject.pcepio.types.NexthopIPv4addressTlv; |
| 85 | +import org.onosproject.pcepio.types.PathSetupTypeTlv; | ||
| 85 | import org.onosproject.pcepio.types.PcepLabelDownload; | 86 | import org.onosproject.pcepio.types.PcepLabelDownload; |
| 86 | import org.onosproject.pcepio.types.PcepLabelMap; | 87 | import org.onosproject.pcepio.types.PcepLabelMap; |
| 87 | import org.onosproject.pcepio.types.PcepValueType; | 88 | import org.onosproject.pcepio.types.PcepValueType; |
| 88 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 89 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
| 90 | +import org.onosproject.pcepio.types.SymbolicPathNameTlv; | ||
| 91 | +import org.onosproject.pcep.controller.LspType; | ||
| 89 | import org.onosproject.pcep.controller.SrpIdGenerators; | 92 | import org.onosproject.pcep.controller.SrpIdGenerators; |
| 90 | import org.onosproject.pcep.controller.PcepAnnotationKeys; | 93 | import org.onosproject.pcep.controller.PcepAnnotationKeys; |
| 91 | import org.osgi.service.component.ComponentContext; | 94 | import org.osgi.service.component.ComponentContext; |
| 92 | import org.slf4j.Logger; | 95 | import org.slf4j.Logger; |
| 93 | 96 | ||
| 97 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE; | ||
| 98 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | ||
| 99 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCE_INIT; | ||
| 94 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; | 100 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; |
| 95 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; | 101 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; |
| 96 | import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION; | 102 | import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION; |
| ... | @@ -447,20 +453,34 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -447,20 +453,34 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
| 447 | 453 | ||
| 448 | srpObj = getSrpObject(pc, type, false); | 454 | srpObj = getSrpObject(pc, type, false); |
| 449 | 455 | ||
| 450 | - String lspId = tunnel.annotations().value(PcepAnnotationKeys.PLSP_ID); | 456 | + String lspId = tunnel.annotations().value(PcepAnnotationKeys.LOCAL_LSP_ID); |
| 451 | - String plspId = tunnel.annotations().value(PcepAnnotationKeys.LOCAL_LSP_ID); | 457 | + String plspId = tunnel.annotations().value(PcepAnnotationKeys.PLSP_ID); |
| 452 | String tunnelIdentifier = tunnel.annotations().value(PcepAnnotationKeys.PCC_TUNNEL_ID); | 458 | String tunnelIdentifier = tunnel.annotations().value(PcepAnnotationKeys.PCC_TUNNEL_ID); |
| 453 | 459 | ||
| 454 | LinkedList<PcepValueType> tlvs = new LinkedList<>(); | 460 | LinkedList<PcepValueType> tlvs = new LinkedList<>(); |
| 455 | StatefulIPv4LspIdentifiersTlv lspIdTlv = new StatefulIPv4LspIdentifiersTlv(((IpTunnelEndPoint) tunnel.src()) | 461 | StatefulIPv4LspIdentifiersTlv lspIdTlv = new StatefulIPv4LspIdentifiersTlv(((IpTunnelEndPoint) tunnel.src()) |
| 456 | - .ip().getIp4Address().toInt(), Short.valueOf(lspId), Short.valueOf(tunnelIdentifier), 0, | 462 | + .ip().getIp4Address().toInt(), Short.valueOf(lspId), Short.valueOf(tunnelIdentifier), |
| 463 | + ((IpTunnelEndPoint) tunnel.src()).ip().getIp4Address().toInt(), | ||
| 457 | ((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt()); | 464 | ((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt()); |
| 458 | tlvs.add(lspIdTlv); | 465 | tlvs.add(lspIdTlv); |
| 459 | 466 | ||
| 467 | + if (tunnel.tunnelName().value() != null) { | ||
| 468 | + SymbolicPathNameTlv pathNameTlv = new SymbolicPathNameTlv(tunnel.tunnelName().value().getBytes()); | ||
| 469 | + tlvs.add(pathNameTlv); | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + boolean delegated = (tunnel.annotations().value(DELEGATE) == null) ? false | ||
| 473 | + : Boolean.valueOf(tunnel.annotations() | ||
| 474 | + .value(DELEGATE)); | ||
| 475 | + boolean initiated = (tunnel.annotations().value(PCE_INIT) == null) ? false | ||
| 476 | + : Boolean.valueOf(tunnel.annotations() | ||
| 477 | + .value(PCE_INIT)); | ||
| 478 | + | ||
| 460 | lspObj = pc.factory().buildLspObject() | 479 | lspObj = pc.factory().buildLspObject() |
| 461 | .setRFlag(false) | 480 | .setRFlag(false) |
| 462 | .setAFlag(true) | 481 | .setAFlag(true) |
| 463 | - .setDFlag(true) | 482 | + .setDFlag(delegated) |
| 483 | + .setCFlag(initiated) | ||
| 464 | .setPlspId(Integer.valueOf(plspId)) | 484 | .setPlspId(Integer.valueOf(plspId)) |
| 465 | .setOptionalTlv(tlvs) | 485 | .setOptionalTlv(tlvs) |
| 466 | .build(); | 486 | .build(); |
| ... | @@ -495,9 +515,15 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -495,9 +515,15 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
| 495 | return; | 515 | return; |
| 496 | } | 516 | } |
| 497 | 517 | ||
| 518 | + // set PathSetupTypeTlv of SRP object | ||
| 519 | + LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>(); | ||
| 520 | + LspType lspSigType = LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE)); | ||
| 521 | + llOptionalTlv.add(new PathSetupTypeTlv(lspSigType.type())); | ||
| 522 | + | ||
| 498 | PcepSrpObject srpObj = pc.factory().buildSrpObject() | 523 | PcepSrpObject srpObj = pc.factory().buildSrpObject() |
| 499 | .setRFlag(false) | 524 | .setRFlag(false) |
| 500 | .setSrpID(SrpIdGenerators.create()) | 525 | .setSrpID(SrpIdGenerators.create()) |
| 526 | + .setOptionalTlv(llOptionalTlv) | ||
| 501 | .build(); | 527 | .build(); |
| 502 | 528 | ||
| 503 | PcepEroObject eroObj = pc.factory().buildEroObject() | 529 | PcepEroObject eroObj = pc.factory().buildEroObject() | ... | ... |
| ... | @@ -78,6 +78,7 @@ import org.onosproject.pcep.api.PcepTunnel.PathType; | ... | @@ -78,6 +78,7 @@ import org.onosproject.pcep.api.PcepTunnel.PathType; |
| 78 | import org.onosproject.pcep.api.PcepTunnelListener; | 78 | import org.onosproject.pcep.api.PcepTunnelListener; |
| 79 | import org.onosproject.pcep.api.PcepTunnelStatistics; | 79 | import org.onosproject.pcep.api.PcepTunnelStatistics; |
| 80 | import org.onosproject.pcep.controller.LspKey; | 80 | import org.onosproject.pcep.controller.LspKey; |
| 81 | +import org.onosproject.pcep.controller.LspType; | ||
| 81 | import org.onosproject.pcep.controller.PccId; | 82 | import org.onosproject.pcep.controller.PccId; |
| 82 | import org.onosproject.pcep.controller.PcepClient; | 83 | import org.onosproject.pcep.controller.PcepClient; |
| 83 | import org.onosproject.pcep.controller.PcepClientController; | 84 | import org.onosproject.pcep.controller.PcepClientController; |
| ... | @@ -140,8 +141,9 @@ import static org.onosproject.net.DefaultAnnotations.EMPTY; | ... | @@ -140,8 +141,9 @@ import static org.onosproject.net.DefaultAnnotations.EMPTY; |
| 140 | import static org.onosproject.net.DeviceId.deviceId; | 141 | import static org.onosproject.net.DeviceId.deviceId; |
| 141 | import static org.onosproject.net.PortNumber.portNumber; | 142 | import static org.onosproject.net.PortNumber.portNumber; |
| 142 | import static org.onosproject.pcep.api.PcepDpid.uri; | 143 | import static org.onosproject.pcep.api.PcepDpid.uri; |
| 143 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 144 | +import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING; |
| 144 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 145 | +import static org.onosproject.pcep.controller.LspType.SR_WITHOUT_SIGNALLING; |
| 146 | +import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | ||
| 145 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH; | 147 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH; |
| 146 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID; | 148 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID; |
| 147 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | 149 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
| ... | @@ -157,7 +159,6 @@ import static org.onosproject.provider.pcep.tunnel.impl.RequestType.UPDATE; | ... | @@ -157,7 +159,6 @@ import static org.onosproject.provider.pcep.tunnel.impl.RequestType.UPDATE; |
| 157 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; | 159 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; |
| 158 | import static org.onosproject.pcep.controller.PcepLspSyncAction.REMOVE; | 160 | import static org.onosproject.pcep.controller.PcepLspSyncAction.REMOVE; |
| 159 | import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_UPDATE; | 161 | import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_UPDATE; |
| 160 | -import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_DELETE; | ||
| 161 | import static org.onosproject.pcepio.protocol.ver1.PcepMetricObjectVer1.IGP_METRIC; | 162 | import static org.onosproject.pcepio.protocol.ver1.PcepMetricObjectVer1.IGP_METRIC; |
| 162 | import static org.onosproject.pcepio.protocol.ver1.PcepMetricObjectVer1.TE_METRIC; | 163 | import static org.onosproject.pcepio.protocol.ver1.PcepMetricObjectVer1.TE_METRIC; |
| 163 | import static org.slf4j.LoggerFactory.getLogger; | 164 | import static org.slf4j.LoggerFactory.getLogger; |
| ... | @@ -311,7 +312,10 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -311,7 +312,10 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
| 311 | 312 | ||
| 312 | //TODO: tunnel which is passed doesn't have tunnelID | 313 | //TODO: tunnel which is passed doesn't have tunnelID |
| 313 | if (tunnel.annotations().value(PLSP_ID) != null) { | 314 | if (tunnel.annotations().value(PLSP_ID) != null) { |
| 314 | - updateTunnel(tunnel, path); | 315 | + if (LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE)) != WITHOUT_SIGNALLING_AND_WITHOUT_SR) { |
| 316 | + // For CR LSPs, BGP flow provider will send update message after pushing labels. | ||
| 317 | + updateTunnel(tunnel, path); | ||
| 318 | + } | ||
| 315 | return; | 319 | return; |
| 316 | } | 320 | } |
| 317 | 321 | ||
| ... | @@ -1219,8 +1223,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -1219,8 +1223,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
| 1219 | 1223 | ||
| 1220 | tlv = new StatefulIPv4LspIdentifiersTlv((((IpTunnelEndPoint) tunnel.src()) | 1224 | tlv = new StatefulIPv4LspIdentifiersTlv((((IpTunnelEndPoint) tunnel.src()) |
| 1221 | .ip().getIp4Address().toInt()), | 1225 | .ip().getIp4Address().toInt()), |
| 1222 | - localLspId, pccTunnelId, 0, (((IpTunnelEndPoint) tunnel.dst()).ip() | 1226 | + localLspId, pccTunnelId, |
| 1223 | - .getIp4Address().toInt())); | 1227 | + ((IpTunnelEndPoint) tunnel.src()).ip().getIp4Address().toInt(), |
| 1228 | + (((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt())); | ||
| 1224 | llOptionalTlv.add(tlv); | 1229 | llOptionalTlv.add(tlv); |
| 1225 | } | 1230 | } |
| 1226 | 1231 | ||
| ... | @@ -1229,9 +1234,18 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -1229,9 +1234,18 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
| 1229 | llOptionalTlv.add(tlv); | 1234 | llOptionalTlv.add(tlv); |
| 1230 | } | 1235 | } |
| 1231 | 1236 | ||
| 1237 | + boolean delegated = (tunnel.annotations().value(DELEGATE) == null) ? false | ||
| 1238 | + : Boolean.valueOf(tunnel.annotations() | ||
| 1239 | + .value(DELEGATE)); | ||
| 1240 | + boolean initiated = (tunnel.annotations().value(PCE_INIT) == null) ? false | ||
| 1241 | + : Boolean.valueOf(tunnel.annotations() | ||
| 1242 | + .value(PCE_INIT)); | ||
| 1243 | + | ||
| 1232 | // build lsp object | 1244 | // build lsp object |
| 1233 | PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true) | 1245 | PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true) |
| 1234 | .setPlspId(Integer.valueOf(tunnel.annotations().value(PLSP_ID))) | 1246 | .setPlspId(Integer.valueOf(tunnel.annotations().value(PLSP_ID))) |
| 1247 | + .setDFlag(delegated) | ||
| 1248 | + .setCFlag(initiated) | ||
| 1235 | .setOptionalTlv(llOptionalTlv).build(); | 1249 | .setOptionalTlv(llOptionalTlv).build(); |
| 1236 | // build ero object | 1250 | // build ero object |
| 1237 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); | 1251 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); |
| ... | @@ -1818,36 +1832,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -1818,36 +1832,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
| 1818 | tunnelRemoved(td); | 1832 | tunnelRemoved(td); |
| 1819 | } | 1833 | } |
| 1820 | } | 1834 | } |
| 1821 | - | ||
| 1822 | - @Override | ||
| 1823 | - public void handleEndOfSyncAction(PccId pccId, PcepMessage msg, PcepLspSyncAction endOfSyncAction) { | ||
| 1824 | - try { | ||
| 1825 | - if ((msg instanceof PcepInitiateMsg) && (endOfSyncAction == SEND_DELETE)) { | ||
| 1826 | - PcepClient pc = pcepClientController.getClient(pccId); | ||
| 1827 | - LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = ((PcepInitiateMsg) msg) | ||
| 1828 | - .getPcInitiatedLspRequestList(); | ||
| 1829 | - PcInitiatedLspRequest pcInitMsg = llPcInitiatedLspRequestList.iterator().next(); | ||
| 1830 | - | ||
| 1831 | - if (pcInitMsg != null) { | ||
| 1832 | - PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(SrpIdGenerators.create()) | ||
| 1833 | - .setRFlag(true).build(); | ||
| 1834 | - | ||
| 1835 | - PcInitiatedLspRequest releaseLspRequest = pc.factory().buildPcInitiatedLspRequest() | ||
| 1836 | - .setLspObject(pcInitMsg.getLspObject()).setSrpObject(srpobj).build(); | ||
| 1837 | - | ||
| 1838 | - llPcInitiatedLspRequestList.remove(pcInitMsg); | ||
| 1839 | - llPcInitiatedLspRequestList.add(releaseLspRequest); | ||
| 1840 | - | ||
| 1841 | - PcepInitiateMsg pcInitiateMsg = pc.factory().buildPcepInitiateMsg() | ||
| 1842 | - .setPcInitiatedLspRequestList(llPcInitiatedLspRequestList).build(); | ||
| 1843 | - | ||
| 1844 | - pc.sendMessage(Collections.singletonList(pcInitiateMsg)); | ||
| 1845 | - } | ||
| 1846 | - } | ||
| 1847 | - } catch (PcepParseException e) { | ||
| 1848 | - log.error("Exception occured while sending initiate delete message {}", e.getMessage()); | ||
| 1849 | - } | ||
| 1850 | - } | ||
| 1851 | } | 1835 | } |
| 1852 | @Override | 1836 | @Override |
| 1853 | public Tunnel tunnelQueryById(TunnelId tunnelId) { | 1837 | public Tunnel tunnelQueryById(TunnelId tunnelId) { | ... | ... |
| ... | @@ -20,9 +20,9 @@ import static org.hamcrest.Matchers.nullValue; | ... | @@ -20,9 +20,9 @@ import static org.hamcrest.Matchers.nullValue; |
| 20 | import static org.hamcrest.core.Is.is; | 20 | import static org.hamcrest.core.Is.is; |
| 21 | import static org.hamcrest.core.IsNot.not; | 21 | import static org.hamcrest.core.IsNot.not; |
| 22 | import static org.onosproject.net.DefaultAnnotations.EMPTY; | 22 | import static org.onosproject.net.DefaultAnnotations.EMPTY; |
| 23 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 23 | +import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING; |
| 24 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 24 | +import static org.onosproject.pcep.controller.LspType.SR_WITHOUT_SIGNALLING; |
| 25 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 25 | +import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
| 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
| 27 | 27 | ||
| 28 | import java.io.IOException; | 28 | import java.io.IOException; | ... | ... |
| ... | @@ -20,9 +20,9 @@ import static org.hamcrest.MatcherAssert.assertThat; | ... | @@ -20,9 +20,9 @@ import static org.hamcrest.MatcherAssert.assertThat; |
| 20 | import static org.hamcrest.core.Is.is; | 20 | import static org.hamcrest.core.Is.is; |
| 21 | import static org.hamcrest.core.IsNot.not; | 21 | import static org.hamcrest.core.IsNot.not; |
| 22 | import static org.hamcrest.Matchers.nullValue; | 22 | import static org.hamcrest.Matchers.nullValue; |
| 23 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 23 | +import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING; |
| 24 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 24 | +import static org.onosproject.pcep.controller.LspType.SR_WITHOUT_SIGNALLING; |
| 25 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 25 | +import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
| 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
| 27 | 27 | ||
| 28 | import java.io.IOException; | 28 | import java.io.IOException; | ... | ... |
| ... | @@ -25,7 +25,7 @@ import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | ... | @@ -25,7 +25,7 @@ import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
| 25 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID; | 25 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID; |
| 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID; | 26 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID; |
| 27 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE; | 27 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE; |
| 28 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 28 | +import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
| 29 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; | 29 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; |
| 30 | import static org.onosproject.net.Device.Type.ROUTER; | 30 | import static org.onosproject.net.Device.Type.ROUTER; |
| 31 | import static org.onosproject.net.MastershipRole.MASTER; | 31 | import static org.onosproject.net.MastershipRole.MASTER; | ... | ... |
| ... | @@ -19,7 +19,7 @@ import static org.hamcrest.MatcherAssert.assertThat; | ... | @@ -19,7 +19,7 @@ import static org.hamcrest.MatcherAssert.assertThat; |
| 19 | import static org.hamcrest.Matchers.nullValue; | 19 | import static org.hamcrest.Matchers.nullValue; |
| 20 | import static org.hamcrest.core.IsNot.not; | 20 | import static org.hamcrest.core.IsNot.not; |
| 21 | import static org.onosproject.net.DefaultAnnotations.EMPTY; | 21 | import static org.onosproject.net.DefaultAnnotations.EMPTY; |
| 22 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 22 | +import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING; |
| 23 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; | 23 | import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
| 24 | 24 | ||
| 25 | import java.io.IOException; | 25 | import java.io.IOException; | ... | ... |
| ... | @@ -55,9 +55,9 @@ import org.onosproject.pcep.controller.PccId; | ... | @@ -55,9 +55,9 @@ import org.onosproject.pcep.controller.PccId; |
| 55 | import org.onosproject.pcepio.protocol.PcepVersion; | 55 | import org.onosproject.pcepio.protocol.PcepVersion; |
| 56 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 56 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
| 57 | 57 | ||
| 58 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 58 | +import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING; |
| 59 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 59 | +import static org.onosproject.pcep.controller.LspType.SR_WITHOUT_SIGNALLING; |
| 60 | -import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 60 | +import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
| 61 | /** | 61 | /** |
| 62 | * Test for PCEP update tunnel. | 62 | * Test for PCEP update tunnel. |
| 63 | */ | 63 | */ | ... | ... |
-
Please register or login to post a comment