use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method removeLsp.
@Override
public synchronized ListenableFuture<OperationResult> removeLsp(@Nonnull final RemoveLspArgs input) {
Preconditions.checkArgument(input != null && input.getName() != null && input.getNode() != null, MISSING_XML_TAG);
LOG.trace("RemoveLspArgs {}", input);
// 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.transformAsync(f, rep -> {
final Lsp reportedLsp = validateReportedLsp(rep, input);
if (reportedLsp == null) {
return OperationResults.createUnsent(PCEPErrors.UNKNOWN_PLSP_ID).future();
}
final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
final Requests rb = buildRequest(rep, reportedLsp);
ib.setRequests(Collections.singletonList(rb));
return sendMessage(new PcinitiateBuilder().setPcinitiateMessage(ib.build()).build(), rb.getSrp().getOperationId(), null);
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult in project bgpcep by opendaylight.
the class TopologyProgramming method submitRemoveLsp.
@Override
public ListenableFuture<RpcResult<SubmitRemoveLspOutput>> submitRemoveLsp(final SubmitRemoveLspInput input) {
Preconditions.checkArgument(input.getNode() != null);
Preconditions.checkArgument(input.getName() != null);
final SubmitRemoveLspOutputBuilder b = new SubmitRemoveLspOutputBuilder();
b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.removeLsp(input);
}
}));
final RpcResult<SubmitRemoveLspOutput> res = SuccessfulRpcResult.create(b.build());
return Futures.immediateFuture(res);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult in project bgpcep by opendaylight.
the class TopologyProgramming method submitTriggerSync.
@Override
public ListenableFuture<RpcResult<SubmitTriggerSyncOutput>> submitTriggerSync(final SubmitTriggerSyncInput input) {
Preconditions.checkArgument(input.getNode() != null);
final SubmitTriggerSyncOutputBuilder b = new SubmitTriggerSyncOutputBuilder();
b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.triggerSync(input);
}
}));
final RpcResult<SubmitTriggerSyncOutput> res = SuccessfulRpcResult.create(b.build());
return Futures.immediateFuture(res);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult in project bgpcep by opendaylight.
the class TopologyProgramming method submitUpdateLsp.
@Override
public ListenableFuture<RpcResult<SubmitUpdateLspOutput>> submitUpdateLsp(final SubmitUpdateLspInput input) {
Preconditions.checkArgument(input.getNode() != null);
Preconditions.checkArgument(input.getName() != null);
final SubmitUpdateLspOutputBuilder b = new SubmitUpdateLspOutputBuilder();
b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.updateLsp(input);
}
}));
final RpcResult<SubmitUpdateLspOutput> res = SuccessfulRpcResult.create(b.build());
return Futures.immediateFuture(res);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult in project bgpcep by opendaylight.
the class PCEPRequest method done.
synchronized void done() {
OperationResult result;
switch(this.state) {
case UNSENT:
result = OperationResults.UNSENT;
break;
case UNACKED:
result = OperationResults.NOACK;
break;
case DONE:
return;
default:
return;
}
done(result);
}
Aggregations