use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method onSessionDown.
@Override
public synchronized void onSessionDown(final PCCSession session) {
for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
final PCCTunnel tunnel = entry.getValue();
final PlspId plspId = entry.getKey();
// deal with delegations
if (hasDelegation(tunnel, session)) {
startStateTimeout(tunnel, entry.getKey());
startRedelegationTimer(tunnel, plspId, session);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportToAll.
protected void reportToAll(final Updates update, final PCCSession session) {
final PlspId plspId = update.getLsp().getPlspId();
final PCCTunnel tunnel = this.tunnels.get(plspId);
final long srpId = update.getSrp().getOperationId().getValue();
if (tunnel != null) {
if (hasDelegation(tunnel, session)) {
final Srp srp = createSrp(update.getSrp().getOperationId().getValue());
final Path path = updToRptPath(update.getPath());
final List<Subobject> subobjects = update.getPath().getEro().getSubobject();
final Lsp lsp = update.getLsp();
sendToAll(tunnel, plspId, subobjects, srp, path, lsp);
// update tunnel state
tunnel.setLspState(path);
} 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.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportMissedLsp.
/**
* Reports Missed Lsp when DbVersion doesnt match.
*/
private void reportMissedLsp(final PCCSession session) {
for (long missedLsp = this.syncOptimization.getRemoteLspDbVersionValue().longValue() + 1; missedLsp <= this.syncOptimization.getLocalLspDbVersionValue().longValue(); missedLsp++) {
final PlspId plspId = new PlspId(missedLsp);
final PCCTunnel tunnel = this.tunnels.get(plspId);
createLspAndSendReport(missedLsp, tunnel, session, Optional.absent(), NO_SRP);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method takeDelegation.
protected void takeDelegation(final Requests request, final PCCSession session) {
final PlspId plspId = request.getLsp().getPlspId();
final PCCTunnel tunnel = this.tunnels.get(plspId);
final long srpId = request.getSrp().getOperationId().getValue();
if (tunnel != null) {
// check if tunnel has no delegation
if ((tunnel.getType() == LspType.PCE_LSP) && ((tunnel.getDelegationHolder() == -1) || (tunnel.getDelegationHolder() == session.getId()))) {
// set delegation
tunnel.cancelTimeouts();
setDelegation(plspId, session);
// send report
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
session.sendReport(createPcRtpMessage(new LspBuilder(request.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(true).setTlvs(tlvs).build(), Optional.of(createSrp(srpId)), tunnel.getLspState()));
} 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.model.match.types.rev131026.match.Tunnel in project bgpcep by opendaylight.
the class PCCTunnelManagerImpl method reportAllKnownLsp.
private void reportAllKnownLsp(final Optional<SrpIdNumber> operationId, final PCCSession session) {
Srp srp = null;
if (operationId.isPresent()) {
srp = new SrpBuilder().setOperationId(operationId.get()).build();
}
for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
final PCCTunnel tunnel = entry.getValue();
final long plspId = entry.getKey().getValue();
createLspAndSendReport(plspId, tunnel, session, Optional.absent(), Optional.fromNullable(srp));
}
}
Aggregations