use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializePortDescBody.
private void serializePortDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortDescCase portCase = (MultipartReplyPortDescCase) body;
MultipartReplyPortDesc portDesc = portCase.getMultipartReplyPortDesc();
for (Ports port : portDesc.getPorts()) {
// Assuming PortNo
outBuffer.writeInt(port.getPortNo().intValue());
// = PortId
outBuffer.writeZero(PORT_DESC_PADDING_1);
outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(port.getHwAddr()));
outBuffer.writeZero(PORT_DESC_PADDING_2);
writeName(port.getName(), outBuffer);
writePortConfig(port.getConfig(), outBuffer);
writePortState(port.getState(), outBuffer);
writePortFeatures(port.getCurrentFeatures(), outBuffer);
writePortFeatures(port.getAdvertisedFeatures(), outBuffer);
writePortFeatures(port.getSupportedFeatures(), outBuffer);
writePortFeatures(port.getPeerFeatures(), outBuffer);
outBuffer.writeInt(port.getCurrSpeed().intValue());
outBuffer.writeInt(port.getMaxSpeed().intValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializeMeterFeaturesBody.
private void serializeMeterFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterFeaturesCase meterFeaturesCase = (MultipartReplyMeterFeaturesCase) body;
MultipartReplyMeterFeatures meterFeatures = meterFeaturesCase.getMultipartReplyMeterFeatures();
outBuffer.writeInt(meterFeatures.getMaxMeter().intValue());
writeBandTypes(meterFeatures.getBandTypes(), outBuffer);
writeMeterFlags(meterFeatures.getCapabilities(), outBuffer);
outBuffer.writeByte(meterFeatures.getMaxBands());
outBuffer.writeByte(meterFeatures.getMaxColor());
outBuffer.writeZero(METER_FEATURES_PADDING);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializeMeterConfigBody.
private void serializeMeterConfigBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterConfigCase meterConfigCase = (MultipartReplyMeterConfigCase) body;
MultipartReplyMeterConfig meter = meterConfigCase.getMultipartReplyMeterConfig();
for (MeterConfig meterConfig : meter.getMeterConfig()) {
ByteBuf meterConfigBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
meterConfigBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
writeMeterFlags(meterConfig.getFlags(), meterConfigBuff);
meterConfigBuff.writeInt(meterConfig.getMeterId().getValue().intValue());
for (Bands currentBand : meterConfig.getBands()) {
MeterBand meterBand = currentBand.getMeterBand();
if (meterBand instanceof MeterBandDropCase) {
MeterBandDropCase dropBandCase = (MeterBandDropCase) meterBand;
MeterBandDrop dropBand = dropBandCase.getMeterBandDrop();
writeBandCommonFields(dropBand, meterConfigBuff);
} else if (meterBand instanceof MeterBandDscpRemarkCase) {
MeterBandDscpRemarkCase dscpRemarkBandCase = (MeterBandDscpRemarkCase) meterBand;
MeterBandDscpRemark dscpRemarkBand = dscpRemarkBandCase.getMeterBandDscpRemark();
writeBandCommonFields(dscpRemarkBand, meterConfigBuff);
} else if (meterBand instanceof MeterBandExperimenterCase) {
MeterBandExperimenterCase experimenterBandCase = (MeterBandExperimenterCase) meterBand;
MeterBandExperimenter experimenterBand = experimenterBandCase.getMeterBandExperimenter();
writeBandCommonFields(experimenterBand, meterConfigBuff);
}
}
meterConfigBuff.setShort(METER_CONFIG_LENGTH_INDEX, meterConfigBuff.readableBytes());
outBuffer.writeBytes(meterConfigBuff);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializePortStatsBody.
private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
for (PortStats portStat : portStats.getPortStats()) {
outBuffer.writeInt(portStat.getPortNo().intValue());
outBuffer.writeZero(PORT_STATS_PADDING);
outBuffer.writeLong(portStat.getRxPackets().longValue());
outBuffer.writeLong(portStat.getTxPackets().longValue());
outBuffer.writeLong(portStat.getRxBytes().longValue());
outBuffer.writeLong(portStat.getTxBytes().longValue());
outBuffer.writeLong(portStat.getRxDropped().longValue());
outBuffer.writeLong(portStat.getTxDropped().longValue());
outBuffer.writeLong(portStat.getRxErrors().longValue());
outBuffer.writeLong(portStat.getTxErrors().longValue());
outBuffer.writeLong(portStat.getRxFrameErr().longValue());
outBuffer.writeLong(portStat.getRxOverErr().longValue());
outBuffer.writeLong(portStat.getRxCrcErr().longValue());
outBuffer.writeLong(portStat.getCollisions().longValue());
outBuffer.writeInt(portStat.getDurationSec().intValue());
outBuffer.writeInt(portStat.getDurationNsec().intValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializeMeterBody.
private void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterCase meterCase = (MultipartReplyMeterCase) body;
MultipartReplyMeter meter = meterCase.getMultipartReplyMeter();
for (MeterStats meterStats : meter.getMeterStats()) {
ByteBuf meterStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
meterStatsBuff.writeInt(meterStats.getMeterId().getValue().intValue());
meterStatsBuff.writeInt(EncodeConstants.EMPTY_LENGTH);
meterStatsBuff.writeZero(METER_PADDING);
meterStatsBuff.writeInt(meterStats.getFlowCount().intValue());
meterStatsBuff.writeLong(meterStats.getPacketInCount().longValue());
meterStatsBuff.writeLong(meterStats.getByteInCount().longValue());
meterStatsBuff.writeInt(meterStats.getDurationSec().intValue());
meterStatsBuff.writeInt(meterStats.getDurationNsec().intValue());
for (MeterBandStats meterBandStats : meterStats.getMeterBandStats()) {
meterStatsBuff.writeLong(meterBandStats.getPacketBandCount().longValue());
meterStatsBuff.writeLong(meterBandStats.getByteBandCount().longValue());
}
meterStatsBuff.setInt(METER_LENGTH_INDEX, meterStatsBuff.readableBytes());
outBuffer.writeBytes(meterStatsBuff);
}
}
Aggregations