use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method ensureLspOperational.
@Override
public synchronized ListenableFuture<OperationResult> ensureLspOperational(final EnsureLspOperationalInput input) {
checkArgument(input != null && input.getName() != null && input.getNode() != null, MISSING_XML_TAG);
final Arguments args = input.getArguments();
checkArgument(args != null, MISSING_XML_TAG);
final OperationalStatus op;
final Arguments1 aa = args.augmentation(Arguments1.class);
if (aa != null) {
op = aa.getOperational();
} else {
op = null;
}
// Make sure the LSP exists
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
return f == null ? OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future() : listenableFuture(f, input, op);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method validateReportedLsp.
@Override
protected Lsp validateReportedLsp(final Optional<ReportedLsp> rep, final LspId input) {
if (!rep.isPresent()) {
LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
return null;
}
// it doesn't matter how many lsps there are in the path list, we only need data that is the same in each path
final Path1 ra = rep.get().getPath().values().iterator().next().augmentation(Path1.class);
checkState(ra != null, "Reported LSP reported null from data-store.");
final Lsp reportedLsp = ra.getLsp();
checkState(reportedLsp != null, "Reported LSP does not contain LSP object.");
return reportedLsp;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp 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