use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method onSessionUp.
@Override
protected void onSessionUp(final PCEPSession session, final PathComputationClientBuilder pccBuilder) {
final InetAddress peerAddress = session.getRemoteAddress();
final Tlvs tlvs = session.getRemoteTlvs();
if (tlvs != null && tlvs.getAugmentation(Tlvs1.class) != null) {
final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
if (stateful != null) {
setStatefulCapabilities(stateful);
pccBuilder.setReportedLsp(Collections.emptyList());
if (isSynchronized()) {
pccBuilder.setStateSync(PccSyncState.Synchronized);
} else if (isTriggeredInitialSynchro()) {
pccBuilder.setStateSync(PccSyncState.TriggeredInitialSync);
} else if (isIncrementalSynchro()) {
pccBuilder.setStateSync(PccSyncState.IncrementalSync);
} else {
pccBuilder.setStateSync(PccSyncState.InitialResync);
}
pccBuilder.setStatefulTlv(new StatefulTlvBuilder().addAugmentation(StatefulTlv1.class, new StatefulTlv1Builder(tlvs.getAugmentation(Tlvs1.class)).build()).build());
} else {
LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
}
} else {
LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method manageNextReport.
private boolean manageNextReport(final Reports report, final MessageContext ctx) {
final Lsp lsp = report.getLsp();
final PlspId plspid = lsp.getPlspId();
final Srp srp = report.getSrp();
if (!lsp.isSync() && (plspid == null || plspid.getValue() == 0)) {
purgeStaleLsps(ctx);
if (isTriggeredSyncInProcess()) {
if (srp == null) {
return false;
}
final SrpIdNumber id = srp.getOperationId();
if (id.getValue() == 0) {
return false;
}
final PCEPRequest req = removeRequest(id);
ctx.resolveRequest(req);
}
stateSynchronizationAchieved(ctx);
return true;
}
final ReportedLspBuilder rlb = new ReportedLspBuilder();
boolean solicited = false;
solicited = isSolicited(srp, lsp, ctx, rlb);
// if remove flag is set in SRP object, remove the tunnel immediately
if (solicited && srp.getAugmentation(Srp1.class) != null) {
final Srp1 initiatedSrp = srp.getAugmentation(Srp1.class);
if (initiatedSrp.isRemove()) {
super.removeLsp(ctx, plspid);
return false;
}
}
rlb.setPath(Collections.singletonList(buildPath(report, srp, lsp)));
String name = lookupLspName(plspid);
if (lsp.getTlvs() != null && lsp.getTlvs().getSymbolicPathName() != null) {
name = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(lsp.getTlvs().getSymbolicPathName().getPathName().getValue())).toString();
}
// get LspDB from LSP and write it to pcc's node
final LspDbVersion lspDbVersion = geLspDbVersionTlv(lsp);
if (lspDbVersion != null) {
updatePccNode(ctx, new PathComputationClientBuilder().addAugmentation(PathComputationClient1.class, new PathComputationClient1Builder().setLspDbVersion(lspDbVersion).build()).build());
}
updateLsp(ctx, plspid, name, rlb, solicited, lsp.isRemove());
unmarkStaleLsp(plspid);
LOG.debug("LSP {} updated", lsp);
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.PathComputationClientBuilder in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method stateSynchronizationAchieved.
/**
* Indicate that the peer has completed state synchronization.
*
* @param ctx Message context
*/
protected final synchronized void stateSynchronizationAchieved(final MessageContext ctx) {
if (this.synced.getAndSet(true)) {
LOG.debug("State synchronization achieved while synchronizing, not updating state");
return;
}
if (this.triggeredResyncInProcess) {
this.triggeredResyncInProcess = false;
}
updatePccNode(ctx, new PathComputationClientBuilder().setStateSync(PccSyncState.Synchronized).build());
// The node has completed synchronization, cleanup metadata no longer reported back
this.nodeState.cleanupExcept(this.lsps.values());
LOG.debug("Session {} achieved synchronized state", this.session);
}
Aggregations