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 startRedelegationTimer.
private void startRedelegationTimer(final PCCTunnel tunnel, final PlspId plspId, final PCCSession session) {
final Timeout newRedelegationTimeout = this.timer.newTimeout(timeout -> {
// remove delegation
PCCTunnelManagerImpl.this.setDelegation(plspId, null);
// delegate to another PCE
int index = session.getId();
for (int i = 1; i < PCCTunnelManagerImpl.this.sessions.size(); i++) {
index++;
if (index == PCCTunnelManagerImpl.this.sessions.size()) {
index = 0;
}
final PCCSession nextSession = PCCTunnelManagerImpl.this.sessions.get(index);
if (nextSession != null) {
tunnel.cancelTimeouts();
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.empty());
nextSession.sendReport(createPcRtpMessage(createLsp(plspId.getValue(), true, Optional.ofNullable(tlvs), true, false), NO_SRP, tunnel.getLspState()));
tunnel.setDelegationHolder(nextSession.getId());
break;
}
}
}, this.redelegationTimeout, TimeUnit.SECONDS);
tunnel.setRedelegationTimeout(newRedelegationTimeout);
}
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 sendToAll.
private void sendToAll(final PCCTunnel tunnel, final PlspId plspId, final List<Subobject> subobjects, final Srp srp, final Path path, final Lsp lsp) {
for (final PCCSession session : this.sessions.values()) {
final boolean isDelegated = hasDelegation(tunnel, session);
final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.of(subobjects));
final Pcrpt pcRpt = createPcRtpMessage(new LspBuilder(lsp).setPlspId(plspId).setOperational(OperationalStatus.Up).setDelegate(isDelegated).setSync(true).addAugmentation(new Lsp1Builder().setCreate(tunnel.getType() == LspType.PCE_LSP).build()).setTlvs(tlvs).build(), Optional.ofNullable(srp), path);
session.sendReport(pcRpt);
}
}
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 createLspAndSendReport.
private void createLspAndSendReport(final Uint32 plspId, final PCCTunnel tunnel, final PCCSession session, final Optional<Boolean> isSync, final Optional<Srp> srp) {
final boolean delegation = hasDelegation(tunnel, session);
if (delegation) {
tunnel.cancelTimeouts();
}
final String destinationAddress = getDestinationAddress(tunnel.getLspState().getEro().getSubobject(), this.address);
final Tlvs tlvs = createLspTlvs(plspId, true, destinationAddress, this.address, this.address, Optional.of(tunnel.getPathName()), this.syncOptimization.incrementLspDBVersion());
final boolean sync = isSync.isPresent() ? isSync.get() : this.syncOptimization.isSyncNeedIt();
final Lsp lsp = createLsp(plspId, sync, Optional.ofNullable(tlvs), delegation, false);
final Pcrpt pcrtp = createPcRtpMessage(lsp, srp, tunnel.getLspState());
session.sendReport(pcrtp);
}
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 PCCTriggeredLspResyncTest method createTriggerLspResync.
private static Message createTriggerLspResync() {
final SrpBuilder srpBuilder = new SrpBuilder();
srpBuilder.setOperationId(new SrpIdNumber(Uint32.ONE));
srpBuilder.setProcessingRule(Boolean.TRUE);
final Srp srp = srpBuilder.build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(Uint32.TWO)).setSync(Boolean.TRUE).build();
final UpdatesBuilder rb = new UpdatesBuilder();
rb.setSrp(srp);
rb.setLsp(lsp);
final PathBuilder pb = new PathBuilder();
rb.setPath(pb.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 PCEPTopologySessionListener method loadLspData.
/**
* Recover lspData and mark any LSPs in the LSP database that were previously reported by the PCC as stale.
*/
@Override
protected synchronized void loadLspData(final Node node, final Map<String, ReportedLsp> lspData, final Map<PlspId, String> lsps, final boolean incrementalSynchro) {
// load node's lsps from DS
final PathComputationClient pcc = node.augmentation(Node1.class).getPathComputationClient();
for (final ReportedLsp reportedLsp : pcc.nonnullReportedLsp().values()) {
final String lspName = reportedLsp.getName();
lspData.put(lspName, reportedLsp);
if (!reportedLsp.getPath().isEmpty()) {
final Path1 path1 = reportedLsp.getPath().values().iterator().next().augmentation(Path1.class);
if (path1 != null) {
final PlspId plspId = path1.getLsp().getPlspId();
if (!incrementalSynchro) {
staleLsps.add(plspId);
}
lsps.put(plspId, lspName);
}
}
}
}
Aggregations