Search in sources :

Example 6 with MultipartRequestFlowCase

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());
}
Also used : MultipartRequestFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase) MultipartRequestFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlow) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)

Example 7 with MultipartRequestFlowCase

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());
}
Also used : MultipartRequestFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlow) GetFlowStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput)

Example 8 with MultipartRequestFlowCase

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();
}
Also used : MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) BigInteger(java.math.BigInteger) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)

Example 9 with MultipartRequestFlowCase

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();
}
Also used : MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) BigInteger(java.math.BigInteger)

Example 10 with MultipartRequestFlowCase

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();
}
Also used : MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) BigInteger(java.math.BigInteger)

Aggregations

MultipartRequestFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase)5 MultipartRequestFlowCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder)5 MultipartRequestFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlow)5 MultipartRequestFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder)5 BigInteger (java.math.BigInteger)4 Test (org.junit.Test)2 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)2 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)2 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)2 MatchV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)2 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)2 MultipartRequestBody (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody)2 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 GetFlowStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput)1