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);
}
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();
}
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());
}
Aggregations