use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder 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.MultipartRequestMeterCaseBuilder in project openflowplugin by opendaylight.
the class MultipartRequestMeterInputMessageFactoryTest method createRequestMeter.
private static MultipartRequestMeterCase createRequestMeter() {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder builder = new MultipartRequestMeterBuilder();
builder.setMeterId(new MeterId(1121L));
caseBuilder.setMultipartRequestMeter(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method createRequestMeter.
private static MultipartRequestMeterCase createRequestMeter() {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder builder = new MultipartRequestMeterBuilder();
builder.setMeterId(new MeterId(1121L));
caseBuilder.setMultipartRequestMeter(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method setMeter.
private MultipartRequestMeterCase setMeter(ByteBuf input) {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder meterBuilder = new MultipartRequestMeterBuilder();
meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
caseBuilder.setMultipartRequestMeter(meterBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method decodeRequestMeter.
private static MultipartRequestMeterCase decodeRequestMeter(ByteBuf output) {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder builder = new MultipartRequestMeterBuilder();
builder.setMeterId(new MeterId(output.readUnsignedInt()));
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_METER_BODY);
caseBuilder.setMultipartRequestMeter(builder.build());
return caseBuilder.build();
}
Aggregations