Avantika-Huawei
Committed by Gerrit Code Review

[ONOS-4722] GoldenEye:Fix exception on learning unknown PCE-initiated LSP from PCC

Change-Id: I967a952e9fe014a88b73abadb3003b5f8b6e45b9
...@@ -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 }
......
...@@ -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 }
......
...@@ -138,10 +138,13 @@ import org.onosproject.pcepio.protocol.PcepUpdateMsg; ...@@ -138,10 +138,13 @@ import org.onosproject.pcepio.protocol.PcepUpdateMsg;
138 import org.onosproject.pcepio.protocol.PcepUpdateRequest; 138 import org.onosproject.pcepio.protocol.PcepUpdateRequest;
139 import org.onosproject.pcepio.types.IPv4SubObject; 139 import org.onosproject.pcepio.types.IPv4SubObject;
140 import org.onosproject.pcepio.types.NexthopIPv4addressTlv; 140 import org.onosproject.pcepio.types.NexthopIPv4addressTlv;
141 +import org.onosproject.pcepio.types.PathSetupTypeTlv;
141 import org.onosproject.pcepio.types.PcepLabelDownload; 142 import org.onosproject.pcepio.types.PcepLabelDownload;
142 import org.onosproject.pcepio.types.PcepLabelMap; 143 import org.onosproject.pcepio.types.PcepLabelMap;
143 import org.onosproject.pcepio.types.PcepValueType; 144 import org.onosproject.pcepio.types.PcepValueType;
144 import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; 145 import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
146 +import org.onosproject.pcepio.types.SymbolicPathNameTlv;
147 +import org.onosproject.pcep.controller.LspType;
145 import org.onosproject.pcepio.protocol.PcepAttribute; 148 import org.onosproject.pcepio.protocol.PcepAttribute;
146 import org.onosproject.pcepio.protocol.PcepBandwidthObject; 149 import org.onosproject.pcepio.protocol.PcepBandwidthObject;
147 import org.onosproject.pcep.controller.SrpIdGenerators; 150 import org.onosproject.pcep.controller.SrpIdGenerators;
...@@ -150,6 +153,9 @@ import org.osgi.service.component.ComponentContext; ...@@ -150,6 +153,9 @@ import org.osgi.service.component.ComponentContext;
150 import org.slf4j.Logger; 153 import org.slf4j.Logger;
151 154
152 import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH; 155 import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH;
156 +import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE;
157 +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
158 +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCE_INIT;
153 import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; 159 import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC;
154 import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; 160 import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED;
155 import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION; 161 import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION;
...@@ -507,20 +513,34 @@ public class BgpcepFlowRuleProvider extends AbstractProvider ...@@ -507,20 +513,34 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
507 513
508 srpObj = getSrpObject(pc, type, false); 514 srpObj = getSrpObject(pc, type, false);
509 515
510 - String lspId = tunnel.annotations().value(PcepAnnotationKeys.PLSP_ID); 516 + String lspId = tunnel.annotations().value(PcepAnnotationKeys.LOCAL_LSP_ID);
511 - String plspId = tunnel.annotations().value(PcepAnnotationKeys.LOCAL_LSP_ID); 517 + String plspId = tunnel.annotations().value(PcepAnnotationKeys.PLSP_ID);
512 String tunnelIdentifier = tunnel.annotations().value(PcepAnnotationKeys.PCC_TUNNEL_ID); 518 String tunnelIdentifier = tunnel.annotations().value(PcepAnnotationKeys.PCC_TUNNEL_ID);
513 519
514 LinkedList<PcepValueType> tlvs = new LinkedList<>(); 520 LinkedList<PcepValueType> tlvs = new LinkedList<>();
515 StatefulIPv4LspIdentifiersTlv lspIdTlv = new StatefulIPv4LspIdentifiersTlv(((IpTunnelEndPoint) tunnel.src()) 521 StatefulIPv4LspIdentifiersTlv lspIdTlv = new StatefulIPv4LspIdentifiersTlv(((IpTunnelEndPoint) tunnel.src())
516 - .ip().getIp4Address().toInt(), Short.valueOf(lspId), Short.valueOf(tunnelIdentifier), 0, 522 + .ip().getIp4Address().toInt(), Short.valueOf(lspId), Short.valueOf(tunnelIdentifier),
523 + ((IpTunnelEndPoint) tunnel.src()).ip().getIp4Address().toInt(),
517 ((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt()); 524 ((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt());
518 tlvs.add(lspIdTlv); 525 tlvs.add(lspIdTlv);
519 526
527 + if (tunnel.tunnelName().value() != null) {
528 + SymbolicPathNameTlv pathNameTlv = new SymbolicPathNameTlv(tunnel.tunnelName().value().getBytes());
529 + tlvs.add(pathNameTlv);
530 + }
531 +
532 + boolean delegated = (tunnel.annotations().value(DELEGATE) == null) ? false
533 + : Boolean.valueOf(tunnel.annotations()
534 + .value(DELEGATE));
535 + boolean initiated = (tunnel.annotations().value(PCE_INIT) == null) ? false
536 + : Boolean.valueOf(tunnel.annotations()
537 + .value(PCE_INIT));
538 +
520 lspObj = pc.factory().buildLspObject() 539 lspObj = pc.factory().buildLspObject()
521 .setRFlag(false) 540 .setRFlag(false)
522 .setAFlag(true) 541 .setAFlag(true)
523 - .setDFlag(true) 542 + .setDFlag(delegated)
543 + .setCFlag(initiated)
524 .setPlspId(Integer.valueOf(plspId)) 544 .setPlspId(Integer.valueOf(plspId))
525 .setOptionalTlv(tlvs) 545 .setOptionalTlv(tlvs)
526 .build(); 546 .build();
...@@ -555,9 +575,15 @@ public class BgpcepFlowRuleProvider extends AbstractProvider ...@@ -555,9 +575,15 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
555 return; 575 return;
556 } 576 }
557 577
578 + // set PathSetupTypeTlv of SRP object
579 + LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
580 + LspType lspSigType = LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE));
581 + llOptionalTlv.add(new PathSetupTypeTlv(lspSigType.type()));
582 +
558 PcepSrpObject srpObj = pc.factory().buildSrpObject() 583 PcepSrpObject srpObj = pc.factory().buildSrpObject()
559 .setRFlag(false) 584 .setRFlag(false)
560 .setSrpID(SrpIdGenerators.create()) 585 .setSrpID(SrpIdGenerators.create())
586 + .setOptionalTlv(llOptionalTlv)
561 .build(); 587 .build();
562 588
563 PcepEroObject eroObj = pc.factory().buildEroObject() 589 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) {
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.
314 updateTunnel(tunnel, path); 317 updateTunnel(tunnel, path);
318 + }
315 return; 319 return;
316 } 320 }
317 321
...@@ -1221,8 +1225,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1221,8 +1225,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1221 1225
1222 tlv = new StatefulIPv4LspIdentifiersTlv((((IpTunnelEndPoint) tunnel.src()) 1226 tlv = new StatefulIPv4LspIdentifiersTlv((((IpTunnelEndPoint) tunnel.src())
1223 .ip().getIp4Address().toInt()), 1227 .ip().getIp4Address().toInt()),
1224 - localLspId, pccTunnelId, 0, (((IpTunnelEndPoint) tunnel.dst()).ip() 1228 + localLspId, pccTunnelId,
1225 - .getIp4Address().toInt())); 1229 + ((IpTunnelEndPoint) tunnel.src()).ip().getIp4Address().toInt(),
1230 + (((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt()));
1226 llOptionalTlv.add(tlv); 1231 llOptionalTlv.add(tlv);
1227 } 1232 }
1228 1233
...@@ -1231,9 +1236,18 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1231,9 +1236,18 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1231 llOptionalTlv.add(tlv); 1236 llOptionalTlv.add(tlv);
1232 } 1237 }
1233 1238
1239 + boolean delegated = (tunnel.annotations().value(DELEGATE) == null) ? false
1240 + : Boolean.valueOf(tunnel.annotations()
1241 + .value(DELEGATE));
1242 + boolean initiated = (tunnel.annotations().value(PCE_INIT) == null) ? false
1243 + : Boolean.valueOf(tunnel.annotations()
1244 + .value(PCE_INIT));
1245 +
1234 // build lsp object 1246 // build lsp object
1235 PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true) 1247 PcepLspObject lspobj = pc.factory().buildLspObject().setAFlag(true)
1236 .setPlspId(Integer.valueOf(tunnel.annotations().value(PLSP_ID))) 1248 .setPlspId(Integer.valueOf(tunnel.annotations().value(PLSP_ID)))
1249 + .setDFlag(delegated)
1250 + .setCFlag(initiated)
1237 .setOptionalTlv(llOptionalTlv).build(); 1251 .setOptionalTlv(llOptionalTlv).build();
1238 // build ero object 1252 // build ero object
1239 PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); 1253 PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build();
...@@ -1820,36 +1834,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1820,36 +1834,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1820 tunnelRemoved(td); 1834 tunnelRemoved(td);
1821 } 1835 }
1822 } 1836 }
1823 -
1824 - @Override
1825 - public void handleEndOfSyncAction(PccId pccId, PcepMessage msg, PcepLspSyncAction endOfSyncAction) {
1826 - try {
1827 - if ((msg instanceof PcepInitiateMsg) && (endOfSyncAction == SEND_DELETE)) {
1828 - PcepClient pc = pcepClientController.getClient(pccId);
1829 - LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = ((PcepInitiateMsg) msg)
1830 - .getPcInitiatedLspRequestList();
1831 - PcInitiatedLspRequest pcInitMsg = llPcInitiatedLspRequestList.iterator().next();
1832 -
1833 - if (pcInitMsg != null) {
1834 - PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(SrpIdGenerators.create())
1835 - .setRFlag(true).build();
1836 -
1837 - PcInitiatedLspRequest releaseLspRequest = pc.factory().buildPcInitiatedLspRequest()
1838 - .setLspObject(pcInitMsg.getLspObject()).setSrpObject(srpobj).build();
1839 -
1840 - llPcInitiatedLspRequestList.remove(pcInitMsg);
1841 - llPcInitiatedLspRequestList.add(releaseLspRequest);
1842 -
1843 - PcepInitiateMsg pcInitiateMsg = pc.factory().buildPcepInitiateMsg()
1844 - .setPcInitiatedLspRequestList(llPcInitiatedLspRequestList).build();
1845 -
1846 - pc.sendMessage(Collections.singletonList(pcInitiateMsg));
1847 - }
1848 - }
1849 - } catch (PcepParseException e) {
1850 - log.error("Exception occured while sending initiate delete message {}", e.getMessage());
1851 - }
1852 - }
1853 } 1837 }
1854 @Override 1838 @Override
1855 public Tunnel tunnelQueryById(TunnelId tunnelId) { 1839 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 */
......