use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetMeterStatisticsFail.
@Test
public void testGetMeterStatisticsFail() throws Exception {
RpcResult<GetMeterStatisticsOutput> result = emptyService.getMeterStatistics(getMeterStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractMeterDirectStatisticsService.class.getSimpleName()));
}
verify(meterDirectStatisticsService, times(0)).handleAndReply(getMeterStatisticsInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput in project openflowplugin by opendaylight.
the class MeterDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetMeterStatisticsInput input = mock(GetMeterStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getMeterId()).thenReturn(new MeterId(METER_NO));
final MultipartRequestMeterStats body = (MultipartRequestMeterStats) ((MultipartRequest) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
assertEquals(METER_NO, body.getMeterId().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput in project openflowplugin by opendaylight.
the class MeterDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetMeterStatisticsInput input = mock(GetMeterStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getMeterId()).thenReturn(new MeterId(METER_NO));
final MultipartRequestMeterCase body = (MultipartRequestMeterCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestMeter meter = body.getMultipartRequestMeter();
assertEquals(METER_NO, meter.getMeterId().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput in project openflowplugin by opendaylight.
the class MeterStatsService method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final GetMeterStatisticsInput input) throws ServiceException {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
return mprInput.build();
}
Aggregations