use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder in project openflowplugin by opendaylight.
the class MultipartRequestInputFactory method makeDefaultMultiLayerBody.
private static MultipartRequestBody makeDefaultMultiLayerBody(@Nonnull final MultipartType type, final short version) {
switch(type) {
case OFPMPDESC:
return new MultipartRequestDescCaseBuilder().build();
case OFPMPFLOW:
final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder multipartRequestFlowBuilder = new MultipartRequestFlowBuilder();
multipartRequestFlowBuilder.setTableId(OFConstants.OFPTT_ALL);
multipartRequestFlowBuilder.setOutPort(OFConstants.OFPP_ANY);
multipartRequestFlowBuilder.setOutGroup(OFConstants.OFPG_ANY);
multipartRequestFlowBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
multipartRequestFlowBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
switch(version) {
case OFConstants.OFP_VERSION_1_0:
MatchV10Builder matchV10Builder = MatchUtil.createEmptyV10Match();
multipartRequestFlowBuilder.setMatchV10(matchV10Builder.build());
break;
case OFConstants.OFP_VERSION_1_3:
multipartRequestFlowBuilder.setMatch(new MatchBuilder().setType(OxmMatchType.class).build());
break;
default:
throw new IllegalArgumentException("Unknown version " + version);
}
multipartRequestFlowCaseBuilder.setMultipartRequestFlow(multipartRequestFlowBuilder.build());
return multipartRequestFlowCaseBuilder.build();
case OFPMPAGGREGATE:
return new MultipartRequestAggregateCaseBuilder().build();
case OFPMPTABLE:
return new MultipartRequestTableCaseBuilder().build();
case OFPMPPORTSTATS:
MultipartRequestPortStatsCaseBuilder multipartRequestPortStatsCaseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder multipartRequestPortStatsBuilder = new MultipartRequestPortStatsBuilder();
multipartRequestPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
multipartRequestPortStatsCaseBuilder.setMultipartRequestPortStats(multipartRequestPortStatsBuilder.build());
return multipartRequestPortStatsCaseBuilder.build();
case OFPMPQUEUE:
MultipartRequestQueueCaseBuilder multipartRequestQueueCaseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder multipartRequestQueueBuilder = new MultipartRequestQueueBuilder();
multipartRequestQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
multipartRequestQueueBuilder.setQueueId(OFConstants.OFPQ_ALL);
multipartRequestQueueCaseBuilder.setMultipartRequestQueue(multipartRequestQueueBuilder.build());
return multipartRequestQueueCaseBuilder.build();
case OFPMPGROUP:
MultipartRequestGroupCaseBuilder multipartRequestGroupCaseBuilder = new MultipartRequestGroupCaseBuilder();
MultipartRequestGroupBuilder multipartRequestGroupBuilder = new MultipartRequestGroupBuilder();
GroupId groupId = new GroupId(OFConstants.OFPG_ALL);
multipartRequestGroupBuilder.setGroupId(groupId);
multipartRequestGroupCaseBuilder.setMultipartRequestGroup(multipartRequestGroupBuilder.build());
return multipartRequestGroupCaseBuilder.build();
case OFPMPGROUPDESC:
return new MultipartRequestGroupDescCaseBuilder().build();
case OFPMPGROUPFEATURES:
return new MultipartRequestGroupFeaturesCaseBuilder().build();
case OFPMPMETER:
MultipartRequestMeterCaseBuilder multipartRequestMeterCaseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder multipartRequestMeterBuilder = new MultipartRequestMeterBuilder();
MeterId meterId = new MeterId(OFConstants.OFPM_ALL);
multipartRequestMeterBuilder.setMeterId(meterId);
multipartRequestMeterCaseBuilder.setMultipartRequestMeter(multipartRequestMeterBuilder.build());
return multipartRequestMeterCaseBuilder.build();
case OFPMPMETERCONFIG:
MultipartRequestMeterConfigCaseBuilder multipartRequestMeterConfigCaseBuilder = new MultipartRequestMeterConfigCaseBuilder();
MultipartRequestMeterConfigBuilder multipartRequestMeterConfigBuilder = new MultipartRequestMeterConfigBuilder();
MeterId configMeterId = new MeterId(OFConstants.OFPM_ALL);
multipartRequestMeterConfigBuilder.setMeterId(configMeterId);
multipartRequestMeterConfigCaseBuilder.setMultipartRequestMeterConfig(multipartRequestMeterConfigBuilder.build());
return multipartRequestMeterConfigCaseBuilder.build();
case OFPMPMETERFEATURES:
return new MultipartRequestMeterFeaturesCaseBuilder().build();
case OFPMPTABLEFEATURES:
MultipartRequestTableFeaturesCaseBuilder tableFeaturesCaseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
tableFeaturesCaseBuilder.setMultipartRequestTableFeatures(new MultipartRequestTableFeaturesBuilder().build());
return tableFeaturesCaseBuilder.build();
case OFPMPPORTDESC:
return new MultipartRequestPortDescCaseBuilder().build();
case OFPMPEXPERIMENTER:
return new MultipartRequestExperimenterCaseBuilder().build();
default:
throw new IllegalArgumentException("Unknown MultipartType " + type);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder 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();
}
Aggregations