use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method serializeFlowBody.
private void serializeFlowBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
MultipartRequestFlowCase flowCase = (MultipartRequestFlowCase) multipartRequestBody;
MultipartRequestFlow flow = flowCase.getMultipartRequestFlow();
OFSerializer<MatchV10> matchSerializer = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MatchV10.class));
matchSerializer.serialize(flow.getMatchV10(), output);
output.writeByte(flow.getTableId().shortValue());
output.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY);
output.writeShort(flow.getOutPort().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase 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 MultipartRequestFlowCase body = (MultipartRequestFlowCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestFlow flow = body.getMultipartRequestFlow();
assertEquals(TABLE_NO, flow.getTableId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method setFlow.
private MultipartRequestFlowCase setFlow(ByteBuf input) {
final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
flowBuilder.setTableId(input.readUnsignedByte());
input.skipBytes(FLOW_PADDING_1);
flowBuilder.setOutPort(input.readUnsignedInt());
flowBuilder.setOutGroup(input.readUnsignedInt());
input.skipBytes(FLOW_PADDING_2);
byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(cookie);
flowBuilder.setCookie(new BigInteger(1, cookie));
final byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(cookieMask);
flowBuilder.setCookieMask(new BigInteger(1, cookieMask));
OFDeserializer<Match> matchDeserializer = registry.getDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
flowBuilder.setMatch(matchDeserializer.deserialize(input));
caseBuilder.setMultipartRequestFlow(flowBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method createRequestFlow.
private static MultipartRequestFlowCase createRequestFlow() {
final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
builder.setOutGroup(95L);
byte[] cookie = new byte[] { 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
builder.setCookie(new BigInteger(1, cookie));
byte[] cookieMask = new byte[] { 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
// TODO match field
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method decodeRequestFlow.
private static MultipartRequestFlowCase decodeRequestFlow(ByteBuf output) {
final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId(output.readUnsignedByte());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
builder.setOutPort(output.readUnsignedInt());
builder.setOutGroup(output.readUnsignedInt());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookie);
builder.setCookie(new BigInteger(1, cookie));
byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookieMask);
builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
return caseBuilder.build();
}
Aggregations