use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class OpendaylightMeterStatisticsServiceImplTest method testGetAllMeterStatistics.
@Test
public void testGetAllMeterStatistics() throws Exception {
GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder().setNode(createNodeRef("unitProt:123"));
rpcResult = buildMeterStatisticsReply();
final Future<RpcResult<GetAllMeterStatisticsOutput>> resultFuture = meterStatisticsService.getAllMeterStatistics(input.build());
Assert.assertTrue(resultFuture.isDone());
final RpcResult<GetAllMeterStatisticsOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPMETER, requestInput.getValue().getType());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class OpendaylightMeterStatisticsServiceImplTest method testGetMeterFeatures.
@Test
public void testGetMeterFeatures() throws Exception {
GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder().setNode(createNodeRef("unitProt:123"));
rpcResult = RpcResultBuilder.<Object>success(Collections.singletonList(new MultipartReplyMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3).setMultipartReplyBody(new MultipartReplyMeterFeaturesCaseBuilder().setMultipartReplyMeterFeatures(new MultipartReplyMeterFeaturesBuilder().setBandTypes(new MeterBandTypeBitmap(true, false)).setCapabilities(new MeterFlags(true, false, false, false)).setMaxBands((short) 71).setMaxColor((short) 72).setMaxMeter(73L).build()).build()).build())).build();
final Future<RpcResult<GetMeterFeaturesOutput>> resultFuture = meterStatisticsService.getMeterFeatures(input.build());
Assert.assertTrue(resultFuture.isDone());
final RpcResult<GetMeterFeaturesOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPMETERFEATURES, requestInput.getValue().getType());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class OpendaylightQueueStatisticsServiceImplTest method testGetAllQueuesStatisticsFromAllPorts.
@Test
public void testGetAllQueuesStatisticsFromAllPorts() throws Exception {
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider).commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
GetAllQueuesStatisticsFromAllPortsInputBuilder input = new GetAllQueuesStatisticsFromAllPortsInputBuilder().setNode(createNodeRef("unitProt:123"));
rpcResult = buildQueueStatsReply();
final Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> resultFuture = queueStatisticsService.getAllQueuesStatisticsFromAllPorts(input.build());
Assert.assertTrue(resultFuture.isDone());
final RpcResult<GetAllQueuesStatisticsFromAllPortsOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPQUEUE, requestInput.getValue().getType());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class AbstractCompatibleStatServiceTest method setUp.
@Override
public void setUp() {
rqContext = new AbstractRequestContext<Object>(42L) {
@Override
public void close() {
// NOOP
}
};
final Answer closeRequestFutureAnswer = invocation -> {
rqContext.setResult(rpcResult);
rqContext.close();
return null;
};
Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID);
Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null);
Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider).commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
Mockito.when(translatorLibrary.lookupTranslator(Matchers.any(TranslatorKey.class))).thenReturn(translator);
service = AggregateFlowsInTableService.createWithOook(rqContextStack, deviceContext, new AtomicLong(20L));
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project openflowplugin by opendaylight.
the class GroupForwarder method update.
@Override
public void update(final InstanceIdentifier<Group> identifier, final Group original, final Group update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
final Group originalGroup = original;
final Group updatedGroup = update;
final UpdateGroupInputBuilder builder = new UpdateGroupInputBuilder();
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setGroupRef(new GroupRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
builder.setUpdatedGroup(new UpdatedGroupBuilder(updatedGroup).build());
builder.setOriginalGroup(new OriginalGroupBuilder(originalGroup).build());
final Future<RpcResult<UpdateGroupOutput>> resultFuture = this.provider.getSalGroupService().updateGroup(builder.build());
JdkFutures.addErrorLogging(resultFuture, LOG, "updateGroup");
}
Aggregations