Search in sources :

Example 1 with FailureCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.FailureCase in project bgpcep by opendaylight.

the class PCEPReplyMessageParser method serializeFailure.

private void serializeFailure(final FailureCase failure, final ByteBuf buffer) {
    if (failure == null) {
        return;
    }
    serializeObject(failure.getNoPath(), buffer);
    serializeObject(failure.getLspa(), buffer);
    serializeObject(failure.getBandwidth(), buffer);
    for (final Metrics m : failure.nonnullMetrics()) {
        serializeObject(m.getMetric(), buffer);
    }
    serializeObject(failure.getIro(), buffer);
}
Also used : Metrics(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.lsp.attributes.Metrics)

Example 2 with FailureCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.FailureCase in project bgpcep by opendaylight.

the class PCEPReplyMessageParser method serializeReply.

protected void serializeReply(final Replies reply, final ByteBuf buffer) {
    serializeObject(reply.getRp(), buffer);
    serializeMonitoring(reply, buffer);
    serializeVendorInformationObjects(reply.getVendorInformationObject(), buffer);
    if (reply.getResult() == null) {
        return;
    }
    if (reply.getResult() instanceof FailureCase) {
        final FailureCase f = (FailureCase) reply.getResult();
        serializeFailure(f, buffer);
        return;
    }
    final SuccessCase s = (SuccessCase) reply.getResult();
    serializeSuccess(s, buffer);
    serializeMonitoringMetrics(reply, buffer);
}
Also used : FailureCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.FailureCase) SuccessCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.SuccessCase)

Example 3 with FailureCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.FailureCase in project bgpcep by opendaylight.

the class AbstractInstructionExecutor method schedule.

public static FailureCase schedule(final InstructionScheduler scheduler, final AbstractInstructionExecutor fwd) {
    final SubmitInstructionInput input = fwd.getInput();
    final ListenableFuture<Instruction> listenableFuture;
    try {
        listenableFuture = scheduler.scheduleInstruction(input);
    } catch (final SchedulerException e) {
        LOG.info("Instuction {} failed to schedule", input, e);
        return new FailureCaseBuilder().setFailure(e.getFailure()).build();
    }
    Futures.addCallback(listenableFuture, fwd, MoreExecutors.directExecutor());
    return null;
}
Also used : FailureCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.submit.instruction.output.result.FailureCaseBuilder) SchedulerException(org.opendaylight.bgpcep.programming.spi.SchedulerException) Instruction(org.opendaylight.bgpcep.programming.spi.Instruction) SubmitInstructionInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput)

Aggregations

Instruction (org.opendaylight.bgpcep.programming.spi.Instruction)1 SchedulerException (org.opendaylight.bgpcep.programming.spi.SchedulerException)1 Metrics (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.lsp.attributes.Metrics)1 FailureCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.FailureCase)1 SuccessCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.SuccessCase)1 SubmitInstructionInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput)1 FailureCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.submit.instruction.output.result.FailureCaseBuilder)1