use of org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession 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.absent());
nextSession.sendReport(createPcRtpMessage(createLsp(plspId.getValue(), true, Optional.fromNullable(tlvs), true, false), NO_SRP, tunnel.getLspState()));
tunnel.setDelegationHolder(nextSession.getId());
break;
}
}
}, this.redelegationTimeout, TimeUnit.SECONDS);
tunnel.setRedelegationTimeout(newRedelegationTimeout);
}
use of org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession 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(Lsp1.class, new Lsp1Builder().setCreate(tunnel.getType() == LspType.PCE_LSP).build()).setTlvs(tlvs).build(), Optional.fromNullable(srp), path);
session.sendReport(pcRpt);
}
}
Aggregations