import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.next.table.related.table.feature.property.NextTableIds;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Translates MultipartReply messages.
// TODO: experimenterBody does not have get methods
}
- private void writeFlags(final MultipartRequestFlags flags, final ByteBuf outBuffer) {
+ private static void writeFlags(final MultipartRequestFlags flags, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, flags.isOFPMPFREQMORE());
+ map.put(0, flags.getOFPMPFREQMORE());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeShort(bitmap);
}
for (TableFeatures tableFeature : tableFeatures.getTableFeatures()) {
ByteBuf tableFeatureBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
tableFeatureBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
- tableFeatureBuff.writeByte(tableFeature.getTableId());
+ tableFeatureBuff.writeByte(tableFeature.getTableId().toJava());
tableFeatureBuff.writeZero(TABLE_FEATURES_PADDING);
write32String(tableFeature.getName(), tableFeatureBuff);
tableFeatureBuff.writeBytes(tableFeature.getMetadataMatch());
}
private void writeExperimenterRelatedTableProperty(final ByteBuf output, final TableFeatureProperties property) {
- long expId = property.augmentation(ExperimenterIdTableFeatureProperty.class).getExperimenter().getValue();
+ Uint32 expId = property.augmentation(ExperimenterIdTableFeatureProperty.class).getExperimenter().getValue();
OFSerializer<TableFeatureProperties> serializer = registry.getSerializer(ExperimenterSerializerKeyFactory
- .createMultipartRequestTFSerializerKey(EncodeConstants.OF13_VERSION_ID, expId));
+ .createMultipartRequestTFSerializerKey(EncodeConstants.OF_VERSION_1_3, expId));
serializer.serialize(property, output);
}
List<MatchEntry> entries = property.augmentation(OxmRelatedTableFeatureProperty.class).getMatchEntry();
if (entries != null) {
TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory
- .createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ .createMatchEntriesKeyMaker(EncodeConstants.OF_VERSION_1_3);
ListSerializer.serializeHeaderList(entries, keyMaker, registry, output);
}
int length = output.writerIndex() - startIndex;
output.writeShort(EncodeConstants.EMPTY_LENGTH);
List<Action> actions = property.augmentation(ActionRelatedTableFeatureProperty.class).getAction();
if (actions != null) {
- TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF_VERSION_1_3);
ListSerializer.serializeHeaderList(actions, keyMaker, registry, output);
}
int length = output.writerIndex() - startIndex;
.getNextTableIds();
if (nextTableIds != null) {
for (NextTableIds next : nextTableIds) {
- output.writeByte(next.getTableId());
+ output.writeByte(next.getTableId().toJava());
}
}
int length = output.writerIndex() - startIndex;
.getInstruction();
if (instructions != null) {
TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory
- .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ .createInstructionKeyMaker(EncodeConstants.OF_VERSION_1_3);
ListSerializer.serializeHeaderList(instructions, keyMaker, registry, output);
}
int length = output.writerIndex() - startIndex;
return result;
}
- private void writeTableConfig(final TableConfig tableConfig, final ByteBuf outBuffer) {
+ private static void writeTableConfig(final TableConfig tableConfig, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, tableConfig.isOFPTCDEPRECATEDMASK());
+ map.put(0, tableConfig.getOFPTCDEPRECATEDMASK());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void serializeMeterFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static 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.writeByte(meterFeatures.getMaxBands().toJava());
+ outBuffer.writeByte(meterFeatures.getMaxColor().toJava());
outBuffer.writeZero(METER_FEATURES_PADDING);
}
- private void writeBandTypes(final MeterBandTypeBitmap bandTypes, final ByteBuf outBuffer) {
+ private static void writeBandTypes(final MeterBandTypeBitmap bandTypes, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, bandTypes.isOFPMBTDROP());
- map.put(1, bandTypes.isOFPMBTDSCPREMARK());
+ map.put(0, bandTypes.getOFPMBTDROP());
+ map.put(1, bandTypes.getOFPMBTDSCPREMARK());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void serializeMeterConfigBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeMeterConfigBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterConfigCase meterConfigCase = (MultipartReplyMeterConfigCase) body;
MultipartReplyMeterConfig meter = meterConfigCase.getMultipartReplyMeterConfig();
for (MeterConfig meterConfig : meter.getMeterConfig()) {
outBuffer.writeInt(meterBand.getBurstSize().intValue());
}
- private void writeMeterFlags(final MeterFlags flags, final ByteBuf outBuffer) {
+ private static void writeMeterFlags(final MeterFlags flags, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, flags.isOFPMFKBPS());
- map.put(1, flags.isOFPMFPKTPS());
- map.put(2, flags.isOFPMFBURST());
- map.put(3, flags.isOFPMFSTATS());
+ map.put(0, flags.getOFPMFKBPS());
+ map.put(1, flags.getOFPMFPKTPS());
+ map.put(2, flags.getOFPMFBURST());
+ map.put(3, flags.getOFPMFSTATS());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeShort(bitmap);
}
- private void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterCase meterCase = (MultipartReplyMeterCase) body;
MultipartReplyMeter meter = meterCase.getMultipartReplyMeter();
for (MeterStats meterStats : meter.getMeterStats()) {
}
}
- private void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyGroupFeaturesCase groupFeaturesCase = (MultipartReplyGroupFeaturesCase) body;
MultipartReplyGroupFeatures groupFeatures = groupFeaturesCase.getMultipartReplyGroupFeatures();
writeGroupTypes(groupFeatures.getTypes(), outBuffer);
writeGroupCapabilities(groupFeatures.getCapabilities(), outBuffer);
- for (Long maxGroups : groupFeatures.getMaxGroups()) {
+ for (Uint32 maxGroups : groupFeatures.getMaxGroups()) {
outBuffer.writeInt(maxGroups.intValue());
}
for (ActionType action : groupFeatures.getActionsBitmap()) {
}
}
- private void writeActionType(final ActionType action, final ByteBuf outBuffer) {
+ private static void writeActionType(final ActionType action, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, action.isOFPATOUTPUT());
- map.put(1, action.isOFPATCOPYTTLOUT());
- map.put(2, action.isOFPATCOPYTTLIN());
- map.put(3, action.isOFPATSETMPLSTTL());
- map.put(4, action.isOFPATDECMPLSTTL());
- map.put(5, action.isOFPATPUSHVLAN());
- map.put(6, action.isOFPATPOPVLAN());
- map.put(7, action.isOFPATPUSHMPLS());
- map.put(8, action.isOFPATPOPMPLS());
- map.put(9, action.isOFPATSETQUEUE());
- map.put(10, action.isOFPATGROUP());
- map.put(11, action.isOFPATSETNWTTL());
- map.put(12, action.isOFPATDECNWTTL());
- map.put(13, action.isOFPATSETFIELD());
- map.put(14, action.isOFPATPUSHPBB());
- map.put(15, action.isOFPATPOPPBB());
- map.put(16, action.isOFPATEXPERIMENTER());
+ map.put(0, action.getOFPATOUTPUT());
+ map.put(1, action.getOFPATCOPYTTLOUT());
+ map.put(2, action.getOFPATCOPYTTLIN());
+ map.put(3, action.getOFPATSETMPLSTTL());
+ map.put(4, action.getOFPATDECMPLSTTL());
+ map.put(5, action.getOFPATPUSHVLAN());
+ map.put(6, action.getOFPATPOPVLAN());
+ map.put(7, action.getOFPATPUSHMPLS());
+ map.put(8, action.getOFPATPOPMPLS());
+ map.put(9, action.getOFPATSETQUEUE());
+ map.put(10, action.getOFPATGROUP());
+ map.put(11, action.getOFPATSETNWTTL());
+ map.put(12, action.getOFPATDECNWTTL());
+ map.put(13, action.getOFPATSETFIELD());
+ map.put(14, action.getOFPATPUSHPBB());
+ map.put(15, action.getOFPATPOPPBB());
+ map.put(16, action.getOFPATEXPERIMENTER());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void writeGroupCapabilities(final GroupCapabilities capabilities, final ByteBuf outBuffer) {
+ private static void writeGroupCapabilities(final GroupCapabilities capabilities, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, capabilities.isOFPGFCSELECTWEIGHT());
- map.put(1, capabilities.isOFPGFCSELECTLIVENESS());
- map.put(2, capabilities.isOFPGFCCHAINING());
- map.put(3, capabilities.isOFPGFCCHAININGCHECKS());
+ map.put(0, capabilities.getOFPGFCSELECTWEIGHT());
+ map.put(1, capabilities.getOFPGFCSELECTLIVENESS());
+ map.put(2, capabilities.getOFPGFCCHAINING());
+ map.put(3, capabilities.getOFPGFCCHAININGCHECKS());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void writeGroupTypes(final GroupTypes types, final ByteBuf outBuffer) {
+ private static void writeGroupTypes(final GroupTypes types, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, types.isOFPGTALL());
- map.put(1, types.isOFPGTSELECT());
- map.put(2, types.isOFPGTINDIRECT());
- map.put(3, types.isOFPGTFF());
+ map.put(0, types.getOFPGTALL());
+ map.put(1, types.getOFPGTSELECT());
+ map.put(2, types.getOFPGTINDIRECT());
+ map.put(3, types.getOFPGTFF());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
for (BucketsList bucket : groupDesc.getBucketsList()) {
ByteBuf bucketBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
bucketBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
- bucketBuff.writeShort(bucket.getWeight());
+ bucketBuff.writeShort(bucket.getWeight().toJava());
bucketBuff.writeInt(bucket.getWatchPort().getValue().intValue());
bucketBuff.writeInt(bucket.getWatchGroup().intValue());
bucketBuff.writeZero(BUCKET_PADDING);
}
}
- private void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyGroupCase groupCase = (MultipartReplyGroupCase) body;
MultipartReplyGroup group = groupCase.getMultipartReplyGroup();
for (GroupStats groupStats : group.getGroupStats()) {
}
}
- private void serializeQueueBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeQueueBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyQueueCase queueCase = (MultipartReplyQueueCase) body;
MultipartReplyQueue queue = queueCase.getMultipartReplyQueue();
for (QueueStats queueStats : queue.getQueueStats()) {
}
}
- private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
for (PortStats portStat : portStats.getPortStats()) {
}
}
- private void serializeTableBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeTableBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyTableCase tableCase = (MultipartReplyTableCase) body;
MultipartReplyTable table = tableCase.getMultipartReplyTable();
for (TableStats tableStats : table.getTableStats()) {
- outBuffer.writeByte(tableStats.getTableId());
+ outBuffer.writeByte(tableStats.getTableId().toJava());
outBuffer.writeZero(TABLE_PADDING);
outBuffer.writeInt(tableStats.getActiveCount().intValue());
outBuffer.writeLong(tableStats.getLookupCount().longValue());
}
}
- private void serializeAggregateBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeAggregateBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyAggregateCase aggregateCase = (MultipartReplyAggregateCase) body;
MultipartReplyAggregate aggregate = aggregateCase.getMultipartReplyAggregate();
outBuffer.writeLong(aggregate.getPacketCount().longValue());
flowStatsBuff.writeZero(FLOW_STATS_PADDING_1);
flowStatsBuff.writeInt(flowStats.getDurationSec().intValue());
flowStatsBuff.writeInt(flowStats.getDurationNsec().intValue());
- flowStatsBuff.writeShort(flowStats.getPriority());
- flowStatsBuff.writeShort(flowStats.getIdleTimeout());
- flowStatsBuff.writeShort(flowStats.getHardTimeout());
+ flowStatsBuff.writeShort(flowStats.getPriority().toJava());
+ flowStatsBuff.writeShort(flowStats.getIdleTimeout().toJava());
+ flowStatsBuff.writeShort(flowStats.getHardTimeout().toJava());
flowStatsBuff.writeZero(FLOW_STATS_PADDING_2);
flowStatsBuff.writeLong(flowStats.getCookie().longValue());
flowStatsBuff.writeLong(flowStats.getPacketCount().longValue());
new MessageTypeKey<>(message.getVersion(), Match.class));
matchSerializer.serialize(flowStats.getMatch(), flowStatsBuff);
ListSerializer.serializeList(flowStats.getInstruction(),
- TypeKeyMakerFactory.createInstructionKeyMaker(message.getVersion()), registry, flowStatsBuff);
+ TypeKeyMakerFactory.createInstructionKeyMaker(message.getVersion()), registry,
+ flowStatsBuff);
flowStatsBuff.setShort(FLOW_STATS_LENGTH_INDEX, flowStatsBuff.readableBytes());
outBuffer.writeBytes(flowStatsBuff);
}
}
- private void serializeDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyDescCase descCase = (MultipartReplyDescCase) body;
MultipartReplyDesc desc = descCase.getMultipartReplyDesc();
write256String(desc.getMfrDesc(), outBuffer);
write256String(desc.getDpDesc(), outBuffer);
}
- private void write256String(final String toWrite, final ByteBuf outBuffer) {
+ private static void write256String(final String toWrite, final ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 256) {
byte[] nameBytesPadding = new byte[256];
}
}
- private void write32String(final String toWrite, final ByteBuf outBuffer) {
+ private static void write32String(final String toWrite, final ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 32) {
byte[] nameBytesPadding = new byte[32];
}
}
- private void serializePortDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializePortDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortDescCase portCase = (MultipartReplyPortDescCase) body;
MultipartReplyPortDesc portDesc = portCase.getMultipartReplyPortDesc();
for (Ports port : portDesc.getPorts()) {
outBuffer.writeInt(port.getPortNo().intValue()); // Assuming PortNo
// = PortId
outBuffer.writeZero(PORT_DESC_PADDING_1);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(port.getHwAddr()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(port.getHwAddr()));
outBuffer.writeZero(PORT_DESC_PADDING_2);
writeName(port.getName(), outBuffer);
writePortConfig(port.getConfig(), outBuffer);
}
}
- private void writeName(final String name, final ByteBuf outBuffer) {
+ private static void writeName(final String name, final ByteBuf outBuffer) {
byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
} else {
outBuffer.writeBytes(nameBytes);
}
-
}
- private void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
+ private static void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, config.isPortDown());
- map.put(2, config.isNoRecv());
- map.put(5, config.isNoFwd());
- map.put(6, config.isNoPacketIn());
+ map.put(0, config.getPortDown());
+ map.put(2, config.getNoRecv());
+ map.put(5, config.getNoFwd());
+ map.put(6, config.getNoPacketIn());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void writePortState(final PortState state, final ByteBuf outBuffer) {
+ private static void writePortState(final PortState state, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, state.isLinkDown());
- map.put(1, state.isBlocked());
- map.put(2, state.isLive());
+ map.put(0, state.getLinkDown());
+ map.put(1, state.getBlocked());
+ map.put(2, state.getLive());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
+ private static void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
- map.put(0, features.is_10mbHd());
- map.put(1, features.is_10mbFd());
- map.put(2, features.is_100mbHd());
- map.put(3, features.is_100mbFd());
- map.put(4, features.is_1gbHd());
- map.put(5, features.is_1gbFd());
- map.put(6, features.is_10gbFd());
- map.put(7, features.is_40gbFd());
- map.put(8, features.is_100gbFd());
- map.put(9, features.is_1tbFd());
- map.put(10, features.isOther());
- map.put(11, features.isCopper());
- map.put(12, features.isFiber());
- map.put(13, features.isAutoneg());
- map.put(14, features.isPause());
- map.put(15, features.isPauseAsym());
+ map.put(0, features.get_10mbHd());
+ map.put(1, features.get_10mbFd());
+ map.put(2, features.get_100mbHd());
+ map.put(3, features.get_100mbFd());
+ map.put(4, features.get_1gbHd());
+ map.put(5, features.get_1gbFd());
+ map.put(6, features.get_10gbFd());
+ map.put(7, features.get_40gbFd());
+ map.put(8, features.get_100gbFd());
+ map.put(9, features.get_1tbFd());
+ map.put(10, features.getOther());
+ map.put(11, features.getCopper());
+ map.put(12, features.getFiber());
+ map.put(13, features.getAutoneg());
+ map.put(14, features.getPause());
+ map.put(15, features.getPauseAsym());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}