use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class ProgrammingServiceImplTest method testCleanInstructions.
@Test
public void testCleanInstructions() throws Exception {
final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2", "mockedSubmit1");
this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
final CleanInstructionsInputBuilder cleanInstructionsInputBuilder = new CleanInstructionsInputBuilder();
final CleanInstructionsInput cleanInstructionsInput = cleanInstructionsInputBuilder.setId(Lists.newArrayList(mockedSubmit1.getId(), mockedSubmit2.getId())).build();
ListenableFuture<RpcResult<CleanInstructionsOutput>> cleanedInstructionOutput = this.testedProgrammingService.cleanInstructions(cleanInstructionsInput);
assertCleanInstructionOutput(cleanedInstructionOutput, 2);
this.testedProgrammingService.cancelInstruction(getCancelInstruction("mockedSubmit1"));
cleanedInstructionOutput = this.testedProgrammingService.cleanInstructions(cleanInstructionsInput);
assertCleanInstructionOutput(cleanedInstructionOutput, 0);
checkNotPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit1.getId()));
checkNotPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit2.getId()));
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class FlowForwarderTest method removeTest.
@Test
public void removeTest() throws Exception {
Mockito.when(salFlowService.removeFlow(removeFlowInputCpt.capture())).thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().setTransactionId(new TransactionId(BigInteger.ONE)).build()).buildFuture());
final Flow removeFlow = new FlowBuilder(flow).build();
final Future<RpcResult<RemoveFlowOutput>> removeResult = flowForwarder.remove(flowPath, removeFlow, flowCapableNodePath);
Mockito.verify(salFlowService).removeFlow(Matchers.<RemoveFlowInput>any());
final RemoveFlowInput flowInput = removeFlowInputCpt.getValue();
Assert.assertEquals(2, flowInput.getTableId().shortValue());
Assert.assertEquals(emptyMatch, flowInput.getMatch());
Assert.assertEquals(null, flowInput.getInstructions());
Assert.assertEquals(true, flowInput.isStrict());
final RpcResult<RemoveFlowOutput> removeFlowOutputRpcResult = removeResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(removeFlowOutputRpcResult.isSuccessful());
final RemoveFlowOutput resultValue = removeFlowOutputRpcResult.getResult();
Assert.assertEquals(1, resultValue.getTransactionId().getValue().intValue());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class GroupForwarderTest method testUpdate.
@Test
public void testUpdate() throws Exception {
Mockito.when(salGroupService.updateGroup(updateGroupInputCpt.capture())).thenReturn(RpcResultBuilder.success(new UpdateGroupOutputBuilder().setTransactionId(txId).build()).buildFuture());
Group groupOriginal = new GroupBuilder(group).build();
Group groupUpdate = new GroupBuilder(group).setGroupName("another-test").build();
final Future<RpcResult<UpdateGroupOutput>> addResult = groupForwarder.update(groupPath, groupOriginal, groupUpdate, flowCapableNodePath);
Mockito.verify(salGroupService).updateGroup(Matchers.<UpdateGroupInput>any());
Assert.assertTrue(addResult.isDone());
final RpcResult<UpdateGroupOutput> result = addResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(result.isSuccessful());
Assert.assertEquals(1, result.getResult().getTransactionId().getValue().intValue());
final UpdateGroupInput updateGroupInput = updateGroupInputCpt.getValue();
Assert.assertEquals(groupPath, updateGroupInput.getGroupRef().getValue());
Assert.assertEquals(nodePath, updateGroupInput.getNode().getValue());
Assert.assertNotNull(updateGroupInput.getOriginalGroup().getBuckets());
Assert.assertNotNull(updateGroupInput.getUpdatedGroup().getBuckets());
Assert.assertEquals("test-group", updateGroupInput.getOriginalGroup().getGroupName());
Assert.assertEquals("another-test", updateGroupInput.getUpdatedGroup().getGroupName());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class MeterForwarderTest method testUpdate.
@Test
public void testUpdate() throws Exception {
Mockito.when(salMeterService.updateMeter(updateMeterInputCpt.capture())).thenReturn(RpcResultBuilder.success(new UpdateMeterOutputBuilder().setTransactionId(txId).build()).buildFuture());
Meter meterOriginal = new MeterBuilder(meter).build();
Meter meterUpdate = new MeterBuilder(meter).setMeterName("another-test").build();
final Future<RpcResult<UpdateMeterOutput>> updateResult = meterForwarder.update(meterPath, meterOriginal, meterUpdate, flowCapableNodePath);
Mockito.verify(salMeterService).updateMeter(Matchers.<UpdateMeterInput>any());
Assert.assertTrue(updateResult.isDone());
final RpcResult<UpdateMeterOutput> meterResult = updateResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(meterResult.isSuccessful());
Assert.assertEquals(1, meterResult.getResult().getTransactionId().getValue().intValue());
final UpdateMeterInput updateMeterInput = updateMeterInputCpt.getValue();
Assert.assertEquals(meterPath, updateMeterInput.getMeterRef().getValue());
Assert.assertEquals(nodePath, updateMeterInput.getNode().getValue());
Assert.assertEquals("test-meter", updateMeterInput.getOriginalMeter().getMeterName());
Assert.assertEquals("another-test", updateMeterInput.getUpdatedMeter().getMeterName());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class MeterForwarderTest method testRemove.
@Test
public void testRemove() throws Exception {
Mockito.when(salMeterService.removeMeter(removeMeterInputCpt.capture())).thenReturn(RpcResultBuilder.success(new RemoveMeterOutputBuilder().setTransactionId(txId).build()).buildFuture());
Meter removeMeter = new MeterBuilder(meter).build();
final Future<RpcResult<RemoveMeterOutput>> removeResult = meterForwarder.remove(meterPath, removeMeter, flowCapableNodePath);
Mockito.verify(salMeterService).removeMeter(Matchers.<RemoveMeterInput>any());
Assert.assertTrue(removeResult.isDone());
final RpcResult<RemoveMeterOutput> meterResult = removeResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(meterResult.isSuccessful());
Assert.assertEquals(1, meterResult.getResult().getTransactionId().getValue().intValue());
final RemoveMeterInput removeMeterInput = removeMeterInputCpt.getValue();
Assert.assertEquals(meterPath, removeMeterInput.getMeterRef().getValue());
Assert.assertEquals(nodePath, removeMeterInput.getNode().getValue());
Assert.assertEquals("test-meter", removeMeterInput.getMeterName());
}
Aggregations