use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLspBuilder 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.rev200120.pcep.client.attributes.path.computation.client.ReportedLspBuilder in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method isSolicited.
private boolean isSolicited(final Srp srp, final Lsp lsp, final MessageContext ctx, final ReportedLspBuilder rlb) {
if (srp == null) {
return false;
}
final SrpIdNumber id = srp.getOperationId();
if (id.getValue() == 0) {
return false;
}
switch(lsp.getOperational()) {
case Active:
case Down:
case Up:
if (!isTriggeredSyncInProcess()) {
final PCEPRequest req = removeRequest(id);
if (req != null) {
LOG.debug("Request {} resulted in LSP operational state {}", id, lsp.getOperational());
rlb.setMetadata(req.getMetadata());
ctx.resolveRequest(req);
} else {
LOG.warn("Request ID {} not found in outstanding DB", id);
}
}
break;
case GoingDown:
case GoingUp:
// up...
break;
default:
break;
}
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLspBuilder in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method isSolicited.
private boolean isSolicited(final Srp srp, final Lsp lsp, final MessageContext ctx, final ReportedLspBuilder rlb) {
if (srp == null) {
return false;
}
final SrpIdNumber id = srp.getOperationId();
if (id.getValue().toJava() == 0) {
return false;
}
switch(lsp.getOperational()) {
case Active:
case Down:
case Up:
if (!isTriggeredSyncInProcess()) {
final PCEPRequest req = removeRequest(id);
if (req != null) {
LOG.debug("Request {} resulted in LSP operational state {}", id, lsp.getOperational());
rlb.setMetadata(req.getMetadata());
ctx.resolveRequest(req);
} else {
LOG.warn("Request ID {} not found in outstanding DB", id);
}
}
break;
case GoingDown:
case GoingUp:
// up...
break;
default:
break;
}
return true;
}
Aggregations