Search in sources :

Example 1 with MultipartRequestAggregateBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputMessageFactory method setAggregate.

private MultipartRequestAggregateCase setAggregate(ByteBuf input) {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
    aggregateBuilder.setTableId(input.readUnsignedByte());
    input.skipBytes(AGGREGATE_PADDING_1);
    aggregateBuilder.setOutPort(input.readUnsignedInt());
    aggregateBuilder.setOutGroup(input.readUnsignedInt());
    input.skipBytes(AGGREGATE_PADDING_2);
    byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    input.readBytes(cookie);
    aggregateBuilder.setCookie(new BigInteger(1, cookie));
    final byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    input.readBytes(cookieMask);
    aggregateBuilder.setCookieMask(new BigInteger(1, cookieMask));
    OFDeserializer<Match> matchDeserializer = registry.getDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class));
    aggregateBuilder.setMatch(matchDeserializer.deserialize(input));
    caseBuilder.setMultipartRequestAggregate(aggregateBuilder.build());
    return caseBuilder.build();
}
Also used : MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) BigInteger(java.math.BigInteger) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)

Example 2 with MultipartRequestAggregateBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder in project openflowplugin by opendaylight.

the class OF10StatsRequestInputFactory method setAggregate.

private MultipartRequestAggregateCase setAggregate(ByteBuf input) {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
    OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
    aggregateBuilder.setMatchV10(matchDeserializer.deserialize(input));
    aggregateBuilder.setTableId(input.readUnsignedByte());
    input.skipBytes(AGGREGATE_PADDING_1);
    aggregateBuilder.setOutPort((long) input.readUnsignedShort());
    caseBuilder.setMultipartRequestAggregate(aggregateBuilder.build());
    return caseBuilder.build();
}
Also used : MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)

Example 3 with MultipartRequestAggregateBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder in project openflowplugin by opendaylight.

the class OF10StatsRequestInputAggregateFactoryTest method createMultipartRequestBody.

private static MultipartRequestBody createMultipartRequestBody() {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    final MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
    MatchV10Builder matchBuilder = new MatchV10Builder();
    matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false, false, false, false, false, false, false));
    matchBuilder.setNwSrcMask((short) 32);
    matchBuilder.setNwDstMask((short) 32);
    matchBuilder.setInPort(51);
    matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
    matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
    matchBuilder.setDlVlan(52);
    matchBuilder.setDlVlanPcp((short) 53);
    matchBuilder.setDlType(54);
    matchBuilder.setNwTos((short) 55);
    matchBuilder.setNwProto((short) 56);
    matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
    matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
    matchBuilder.setTpSrc(57);
    matchBuilder.setTpDst(58);
    aggregateBuilder.setMatchV10(matchBuilder.build());
    aggregateBuilder.setTableId((short) 42);
    aggregateBuilder.setOutPort(6653L);
    caseBuilder.setMultipartRequestAggregate(aggregateBuilder.build());
    return caseBuilder.build();
}
Also used : FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 4 with MultipartRequestAggregateBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder in project openflowplugin by opendaylight.

the class MatchInjector method addInjectors.

private static void addInjectors(final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping) {
    // OF-1.3|List<MatchEntries> --> FlowModInputBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class), (ResultInjector<List<MatchEntry>, FlowModInputBuilder>) (value, target) -> target.setMatch(wrapMatchV13(value).build()));
    // OF-1.3|List<MatchEntries> --> OxmFieldsActionBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, SetFieldActionBuilder.class), (ResultInjector<List<MatchEntry>, SetFieldActionBuilder>) (value, target) -> target.setMatchEntry(value));
    // OF-1.0|MatchV10Builder --> FlowModInputBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class), (ResultInjector<MatchV10, FlowModInputBuilder>) (value, target) -> target.setMatchV10(value));
    // OF-1.3|List<MatchEntries> --> MultipartRequestFlowBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestFlowBuilder.class), (ResultInjector<List<MatchEntry>, MultipartRequestFlowBuilder>) (value, target) -> target.setMatch(wrapMatchV13(value).build()));
    // OF-1.0|List<MatchEntries> --> MultipartRequestFlowBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestFlowBuilder.class), (ResultInjector<MatchV10, MultipartRequestFlowBuilder>) (value, target) -> target.setMatchV10(value));
    // OF-1.3|List<MatchEntries> --> MultipartRequestAggregateBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestAggregateBuilder.class), (ResultInjector<List<MatchEntry>, MultipartRequestAggregateBuilder>) (value, target) -> target.setMatch(wrapMatchV13(value).build()));
    // OF-1.0|List<MatchEntries> --> MultipartRequestAggregateBuilder
    injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestAggregateBuilder.class), (ResultInjector<MatchV10, MultipartRequestAggregateBuilder>) (value, target) -> target.setMatchV10(value));
}
Also used : MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) ConvertorKey(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey) HashMap(java.util.HashMap) OFConstants(org.opendaylight.openflowplugin.api.OFConstants) List(java.util.List) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) EncodeConstants(org.opendaylight.openflowjava.protocol.api.util.EncodeConstants) Map(java.util.Map) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) Optional(java.util.Optional) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10) ResultInjector(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) FlowModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder) FlowConvertor(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) ConvertorKey(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey) List(java.util.List) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) FlowModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)

Example 5 with MultipartRequestAggregateBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputFactoryTest method decodeRequestAggregate.

private static MultipartRequestAggregateCase decodeRequestAggregate(ByteBuf output) {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
    builder.setTableId(output.readUnsignedByte());
    output.skipBytes(PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_01);
    builder.setOutPort(output.readUnsignedInt());
    builder.setOutGroup(output.readUnsignedInt());
    output.skipBytes(PADDING_IN_MULTIPART_REQUEST_AGGREGATE_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.setMultipartRequestAggregate(builder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) BigInteger(java.math.BigInteger) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)

Aggregations

MultipartRequestAggregateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder)11 MultipartRequestAggregateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)9 BigInteger (java.math.BigInteger)4 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)3 Test (org.junit.Test)2 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)2 MatchV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)2 MatchV10Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder)2 ByteBuf (io.netty.buffer.ByteBuf)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 EncodeConstants (org.opendaylight.openflowjava.protocol.api.util.EncodeConstants)1 OFConstants (org.opendaylight.openflowplugin.api.OFConstants)1 ConvertorKey (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey)1 ResultInjector (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector)1