Search in sources :

Example 1 with MultipartRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest in project openflowplugin by opendaylight.

the class GroupDirectStatisticsServiceTest method testBuildRequestBody.

@Override
public void testBuildRequestBody() throws Exception {
    final GetGroupStatisticsInput input = mock(GetGroupStatisticsInput.class);
    when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
    when(input.getGroupId()).thenReturn(new GroupId(GROUP_NO));
    final MultipartRequestGroupStats body = (MultipartRequestGroupStats) ((MultipartRequest) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
    assertEquals(GROUP_NO, body.getGroupId().getValue());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) GetGroupStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput) MultipartRequestGroupStats(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupStats) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)

Example 2 with MultipartRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest in project openflowplugin by opendaylight.

the class NodeConnectorDirectStatisticsServiceTest method testBuildRequestBody.

@Override
public void testBuildRequestBody() throws Exception {
    final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class);
    when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
    when(input.getNodeConnectorId()).thenReturn(nodeConnectorId);
    final MultipartRequestPortStats body = (MultipartRequestPortStats) ((MultipartRequest) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
    assertEquals(nodeConnectorId, body.getNodeConnectorId());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats) GetNodeConnectorStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput)

Example 3 with MultipartRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest 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 4 with MultipartRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest in project openflowplugin by opendaylight.

the class FlowDirectStatisticsServiceTest method testBuildRequestBody.

@Override
public void testBuildRequestBody() throws Exception {
    final GetFlowStatisticsInput input = mock(GetFlowStatisticsInput.class);
    when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
    when(input.getTableId()).thenReturn(TABLE_NO);
    final MultipartRequestFlowStats body = (MultipartRequestFlowStats) ((MultipartRequest) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
    assertEquals(TABLE_NO, body.getTableId());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestFlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats) GetFlowStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput)

Example 5 with MultipartRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest in project openflowplugin by opendaylight.

the class MultipartRequestMessageSerializer method serialize.

@Override
public void serialize(final MultipartRequest message, final ByteBuf outBuffer) {
    final MultipartRequestBody multipartRequestBody = message.getMultipartRequestBody();
    final MultipartType multipartType = getMultipartType(multipartRequestBody);
    final int index = outBuffer.writerIndex();
    super.serialize(message, outBuffer);
    outBuffer.writeShort(multipartType.getIntValue());
    outBuffer.writeShort(ByteBufUtils.fillBitMask(0, message.isRequestMore()));
    outBuffer.writeZero(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
    final OFSerializer<MultipartRequestBody> serializer = Preconditions.checkNotNull(registry).getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, multipartRequestBody.getImplementedInterface()));
    serializer.serialize(multipartRequestBody, outBuffer);
    outBuffer.setShort(index + 2, outBuffer.writerIndex() - index);
}
Also used : MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) MultipartRequestBody(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody)

Aggregations

Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)5 GetFlowStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput)1 GetGroupStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput)1 GetMeterStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput)1 GetNodeConnectorStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput)1 GetQueueStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsInput)1 QueueId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId)1 MultipartRequestFlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats)1 MultipartRequestGroupStats (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupStats)1 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)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.meter.types.rev130918.MeterId)1 MultipartRequestBody (org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody)1 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)1 MultipartRequestPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats)1 MultipartRequestQueueStats (org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.request.multipart.request.body.MultipartRequestQueueStats)1