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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations