return this.lsps.get(id);
}
+ /**
+ * Reads operational data on this node. Doesn't attempt to read the data,
+ * if the node does not exist. In this case returns null.
+ *
+ * @param id InstanceIdentifier of the node
+ * @return null if the node does not exists, or operational data
+ */
protected final synchronized <T extends DataObject> ListenableFuture<Optional<T>> readOperationalData(final InstanceIdentifier<T> id) {
+ if (this.nodeState == null) {
+ return null;
+ }
return this.nodeState.readOperationalData(id);
}
// Make sure there is no such LSP
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
+ if (f == null) {
+ return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
+ }
return Futures.transform(f, new AsyncFunction<Optional<ReportedLsp>, OperationResult>() {
@Override
// Make sure the LSP exists, we need it for PLSP-ID
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
+ if (f == null) {
+ return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
+ }
return Futures.transform(f, new AsyncFunction<Optional<ReportedLsp>, OperationResult>() {
@Override
// Make sure the LSP exists
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
+ if (f == null) {
+ return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
+ }
return Futures.transform(f, new AsyncFunction<Optional<ReportedLsp>, OperationResult>() {
@Override
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
+ if (f == null) {
+ return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
+ }
return Futures.transform(f, new Function<Optional<ReportedLsp>, OperationResult>() {
@Override