Search in sources :

Example 11 with OperationResult

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());
}
Also used : PcinitiateMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.PcinitiateMessageBuilder) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) PcinitiateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateBuilder) Optional(com.google.common.base.Optional) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp) Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)

Example 12 with OperationResult

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);
}
Also used : SubmitRemoveLspOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitRemoveLspOutput) OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult) AbstractInstructionExecutor(org.opendaylight.bgpcep.pcep.topology.spi.AbstractInstructionExecutor) SubmitRemoveLspOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitRemoveLspOutputBuilder)

Example 13 with OperationResult

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);
}
Also used : SubmitTriggerSyncOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitTriggerSyncOutput) SubmitTriggerSyncOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitTriggerSyncOutputBuilder) OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult) AbstractInstructionExecutor(org.opendaylight.bgpcep.pcep.topology.spi.AbstractInstructionExecutor)

Example 14 with OperationResult

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);
}
Also used : SubmitUpdateLspOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitUpdateLspOutput) OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult) SubmitUpdateLspOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.programming.rev171025.SubmitUpdateLspOutputBuilder) AbstractInstructionExecutor(org.opendaylight.bgpcep.pcep.topology.spi.AbstractInstructionExecutor)

Example 15 with OperationResult

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);
}
Also used : OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult)

Aggregations

OperationResult (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult)8 AbstractInstructionExecutor (org.opendaylight.bgpcep.pcep.topology.spi.AbstractInstructionExecutor)5 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)3 PcrptMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcrptMessage)3 PcupdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcupdBuilder)3 PcupdMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.PcupdMessageBuilder)3 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)3 PcerrMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcerrMessage)3 RemoveLspInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInputBuilder)3 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)3 Optional (com.google.common.base.Optional)2 Test (org.junit.Test)2 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 NetworkTopologyRef (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef)2 PcinitiateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateBuilder)2 PcinitiateMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.PcinitiateMessageBuilder)2 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)2 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)2 Link (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link)2