Search in sources :

Example 1 with GetMeterStatisticsInput

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);
}
Also used : GetMeterStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutput) RpcError(org.opendaylight.yangtools.yang.common.RpcError) Test(org.junit.Test)

Example 2 with 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());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestMeterStats(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterStats) GetMeterStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)

Example 3 with 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 MultipartRequestMeterCase body = (MultipartRequestMeterCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
    final MultipartRequestMeter meter = body.getMultipartRequestMeter();
    assertEquals(METER_NO, meter.getMeterId().getValue());
}
Also used : MultipartRequestMeterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCase) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeter) GetMeterStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)

Example 4 with GetMeterStatisticsInput

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();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestMeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder) MultipartRequestMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)

Aggregations

Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)2 GetMeterStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput)2 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)2 Test (org.junit.Test)1 GetMeterStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutput)1 MultipartRequestMeterStats (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterStats)1 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)1 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)1 MultipartRequestMeterCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCase)1 MultipartRequestMeterCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder)1 MultipartRequestMeter (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeter)1 MultipartRequestMeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1