use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId in project bgpcep by opendaylight.
the class PCCTriggeredSyncTest method createTriggerMsg.
private static Message createTriggerMsg() {
final UpdatesBuilder rb = new UpdatesBuilder().setSrp(new SrpBuilder().setIgnore(false).setProcessingRule(false).setOperationId(new SrpIdNumber(Uint32.ONE)).build()).setLsp(new LspBuilder().setPlspId(new PlspId(Uint32.ZERO)).setSync(Boolean.TRUE).build()).setPath(new PathBuilder().build());
final PcupdMessageBuilder ub = new PcupdMessageBuilder();
ub.setUpdates(Collections.singletonList(rb.build()));
return new PcupdBuilder().setPcupdMessage(ub.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method returnDelegation.
private void returnDelegation(final Updates update, final PCCSession session) {
final PlspId plspId = update.getLsp().getPlspId();
final PCCTunnel tunnel = this.tunnels.get(plspId);
final Uint32 srpId = update.getSrp().getOperationId().getValue();
if (tunnel != null) {
// check if session really has a delegation
if (hasDelegation(tunnel, session)) {
// send report D=0
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.empty());
final Pcrpt pcrtp = createPcRtpMessage(new LspBuilder(update.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(false).setTlvs(tlvs).build(), Optional.of(createSrp(srpId)), tunnel.getLspState());
session.sendReport(pcrtp);
// start state timer
startStateTimeout(tunnel, plspId);
// if PCC's LSP, start re-delegation timer
if (tunnel.getType() == LspType.PCC_LSP) {
startRedelegationTimer(tunnel, plspId, session);
} else {
// if PCE-initiated LSP, revoke delegation instantly
setDelegation(plspId, null);
}
} else {
session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, srpId));
}
} else {
session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method onSessionUp.
@Override
public synchronized void onSessionUp(final PCCSession session) {
this.syncOptimization = new PCCSyncOptimization(session);
lazyTunnelInicialization();
// first session - delegate all PCC's LSPs only when reporting at startup
if (!this.sessions.containsKey(session.getId()) && session.getId() == 0) {
for (final PlspId plspId : this.tunnels.keySet()) {
setDelegation(plspId, session);
}
}
this.sessions.put(session.getId(), session);
if (!this.syncOptimization.isTriggeredInitSyncEnabled()) {
lspReport(session);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method removeTunnel.
protected void removeTunnel(final Requests request, final PCCSession session) {
final PlspId plspId = request.getLsp().getPlspId();
final PCCTunnel tunnel = this.tunnels.get(plspId);
final Uint32 srpId = request.getSrp().getOperationId().getValue();
if (tunnel != null) {
if (tunnel.getType() == LspType.PCE_LSP) {
if (hasDelegation(tunnel, session)) {
this.tunnels.remove(plspId);
sendToAll(tunnel, plspId, tunnel.getLspState().getEro().getSubobject(), new SrpBuilder(request.getSrp()).addAugmentation(new Srp1Builder().setRemove(true).build()).build(), reqToRptPath(request), request.getLsp());
} else {
session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, srpId));
}
} else {
session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.LSP_NOT_PCE_INITIATED, srpId));
}
} else {
session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportLsp.
private void reportLsp(final PlspId plspId, final SrpIdNumber operationId, final PCCSession session) {
final PCCTunnel tunnel = this.tunnels.get(plspId);
if (tunnel == null) {
return;
}
final Srp srp = new SrpBuilder().setOperationId(operationId).build();
createLspAndSendReport(plspId.getValue(), tunnel, session, Optional.of(Boolean.TRUE), Optional.of(srp));
}
Aggregations