Search in sources :

Example 1 with CancelInstructionInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInput in project bgpcep by opendaylight.

the class ProgrammingServiceImplTest method testCancelInstruction.

@Test
public void testCancelInstruction() throws Exception {
    final SubmitInstructionInput mockedSubmit = getMockedSubmitInstructionInput("mockedSubmit");
    this.testedProgrammingService.scheduleInstruction(mockedSubmit);
    checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit.getId()));
    final CancelInstructionInput mockedCancel = getCancelInstruction("mockedSubmit");
    this.testedProgrammingService.cancelInstruction(mockedCancel);
    checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit.getId()));
    this.mockedExecutorWrapper.assertSubmittedTasksSize(2);
    this.mockedNotificationServiceWrapper.assertNotificationsCount(2);
    this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit.getId(), InstructionStatus.Cancelled);
}
Also used : CancelInstructionInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInput) SubmitInstructionInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput) Test(org.junit.Test)

Example 2 with CancelInstructionInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInput in project bgpcep by opendaylight.

the class ProgrammingServiceImplTest method getCancelInstruction.

private static CancelInstructionInput getCancelInstruction(final String instructionId) {
    final CancelInstructionInputBuilder builder = new CancelInstructionInputBuilder();
    builder.setId(new InstructionId(instructionId));
    return builder.build();
}
Also used : InstructionId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.InstructionId) CancelInstructionInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInputBuilder)

Example 3 with CancelInstructionInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInput in project bgpcep by opendaylight.

the class ProgrammingServiceImpl method realCancelInstruction.

private synchronized RpcResult<CancelInstructionOutput> realCancelInstruction(final CancelInstructionInput input) {
    final InstructionImpl instruction = this.insns.get(input.getId());
    if (instruction == null) {
        LOG.debug("Instruction {} not present in the graph", input.getId());
        final CancelInstructionOutput out = new CancelInstructionOutputBuilder().setFailure(UnknownInstruction.class).build();
        return SuccessfulRpcResult.create(out);
    }
    return SuccessfulRpcResult.create(new CancelInstructionOutputBuilder().setFailure(instruction.tryCancel(null)).build());
}
Also used : CancelInstructionOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionOutputBuilder) UnknownInstruction(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.UnknownInstruction) CancelInstructionOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionOutput)

Aggregations

Test (org.junit.Test)1 CancelInstructionInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInput)1 CancelInstructionInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionInputBuilder)1 CancelInstructionOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionOutput)1 CancelInstructionOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.CancelInstructionOutputBuilder)1 InstructionId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.InstructionId)1 SubmitInstructionInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput)1 UnknownInstruction (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.UnknownInstruction)1