@Override public OFFlowStatsEntry readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); TableId tableId = TableId.readByte(bb); // pad: 1 bytes bb.skipBytes(1); long durationSec = U32.f(bb.readInt()); long durationNsec = U32.f(bb.readInt()); int priority = U16.f(bb.readShort()); int idleTimeout = U16.f(bb.readShort()); int hardTimeout = U16.f(bb.readShort()); Set<OFFlowModFlags> flags = OFFlowModFlagsSerializerVer14.readFrom(bb); int importance = U16.f(bb.readShort()); // pad: 2 bytes bb.skipBytes(2); U64 cookie = U64.ofRaw(bb.readLong()); U64 packetCount = U64.ofRaw(bb.readLong()); U64 byteCount = U64.ofRaw(bb.readLong()); Match match = ChannelUtilsVer14.readOFMatch(bb); List<OFInstruction> instructions = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFInstructionVer14.READER); OFFlowStatsEntryVer14 flowStatsEntryVer14 = new OFFlowStatsEntryVer14( tableId, durationSec, durationNsec, priority, idleTimeout, hardTimeout, flags, importance, cookie, packetCount, byteCount, match, instructions); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", flowStatsEntryVer14); return flowStatsEntryVer14; }
@Override public OFEchoRequest readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 1 byte version = bb.readByte(); if (version != (byte) 0x1) throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got=" + version); // fixed value property type == 2 byte type = bb.readByte(); if (type != (byte) 0x2) throw new OFParseError("Wrong type: Expected=OFType.ECHO_REQUEST(2), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); byte[] data = ChannelUtils.readBytes(bb, length - (bb.readerIndex() - start)); OFEchoRequestVer10 echoRequestVer10 = new OFEchoRequestVer10(xid, data); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", echoRequestVer10); return echoRequestVer10; }
@Override public OFActionSetField readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 25 short type = bb.readShort(); if (type != (short) 0x19) throw new OFParseError("Wrong type: Expected=OFActionType.SET_FIELD(25), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); OFOxm<?> field = OFOxmVer12.READER.readFrom(bb); // align message to 8 bytes (length contains aligned value) bb.skipBytes(length - (bb.readerIndex() - start)); OFActionSetFieldVer12 actionSetFieldVer12 = new OFActionSetFieldVer12(field); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", actionSetFieldVer12); return actionSetFieldVer12; }
@Override public OFActionBsn readFrom(ChannelBuffer bb) throws OFParseError { if (bb.readableBytes() < MINIMUM_LENGTH) return null; int start = bb.readerIndex(); // fixed value property type == 65535 short type = bb.readShort(); if (type != (short) 0xffff) throw new OFParseError( "Wrong type: Expected=OFActionType.EXPERIMENTER(65535), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); int subtype = bb.readInt(); bb.readerIndex(start); switch (subtype) { case 0x4: // discriminator value 0x4L=0x4L for class OFActionBsnChecksumVer10 return OFActionBsnChecksumVer10.READER.readFrom(bb); case 0x1: // discriminator value 0x1L=0x1L for class OFActionBsnMirrorVer10 return OFActionBsnMirrorVer10.READER.readFrom(bb); case 0x2: // discriminator value 0x2L=0x2L for class OFActionBsnSetTunnelDstVer10 return OFActionBsnSetTunnelDstVer10.READER.readFrom(bb); default: throw new OFParseError( "Unknown value for discriminator subtype of class OFActionBsnVer10: " + subtype); } }
@Override public OFInstructionIdBsnRequireVlanXlate readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 65535 short type = bb.readShort(); if (type != (short) 0xffff) throw new OFParseError( "Wrong type: Expected=OFInstructionType.EXPERIMENTER(65535), got=" + type); int length = U16.f(bb.readShort()); if (length != 12) throw new OFParseError("Wrong length: Expected=12(12), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x8L int subtype = bb.readInt(); if (subtype != 0x8) throw new OFParseError("Wrong subtype: Expected=0x8L(0x8L), got=" + subtype); if (logger.isTraceEnabled()) logger.trace("readFrom - returning shared instance={}", INSTANCE); return INSTANCE; }
@Override public OFMeterFeaturesStatsReply readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 5 byte version = bb.readByte(); if (version != (byte) 0x5) throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length != 32) throw new OFParseError("Wrong length: Expected=32(32), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 11 short statsType = bb.readShort(); if (statsType != (short) 0xb) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.METER_FEATURES(11), got=" + statsType); Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); OFMeterFeatures features = OFMeterFeaturesVer14.READER.readFrom(bb); OFMeterFeaturesStatsReplyVer14 meterFeaturesStatsReplyVer14 = new OFMeterFeaturesStatsReplyVer14(xid, flags, features); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", meterFeaturesStatsReplyVer14); return meterFeaturesStatsReplyVer14; }
@Override public OFMatchV3 readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0x1 short type = bb.readShort(); if (type != (short) 0x1) throw new OFParseError("Wrong type: Expected=0x1(0x1), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); OFOxmList oxmList = OFOxmList.readFrom(bb, length - (bb.readerIndex() - start), OFOxmVer14.READER); // align message to 8 bytes (length does not contain alignment) bb.skipBytes(((length + 7) / 8 * 8) - length); OFMatchV3Ver14 matchV3Ver14 = new OFMatchV3Ver14(oxmList); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", matchV3Ver14); return matchV3Ver14; }
@Override public OFQueueOpFailedErrorMsg readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 1 byte type = bb.readByte(); if (type != (byte) 0x1) throw new OFParseError("Wrong type: Expected=OFType.ERROR(1), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property errType == 9 short errType = bb.readShort(); if (errType != (short) 0x9) throw new OFParseError( "Wrong errType: Expected=OFErrorType.QUEUE_OP_FAILED(9), got=" + errType); OFQueueOpFailedCode code = OFQueueOpFailedCodeSerializerVer13.readFrom(bb); byte[] data = ChannelUtils.readBytes(bb, length - (bb.readerIndex() - start)); OFQueueOpFailedErrorMsgVer13 queueOpFailedErrorMsgVer13 = new OFQueueOpFailedErrorMsgVer13(xid, code, data); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", queueOpFailedErrorMsgVer13); return queueOpFailedErrorMsgVer13; }
@Override public OFBsnSetPktinSuppressionRequest readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 3 byte version = bb.readByte(); if (version != (byte) 0x3) throw new OFParseError("Wrong version: Expected=OFVersion.OF_12(3), got=" + version); // fixed value property type == 4 byte type = bb.readByte(); if (type != (byte) 0x4) throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got=" + type); int length = U16.f(bb.readShort()); if (length != 32) throw new OFParseError("Wrong length: Expected=32(32), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0xbL int subtype = bb.readInt(); if (subtype != 0xb) throw new OFParseError("Wrong subtype: Expected=0xbL(0xbL), got=" + subtype); boolean enabled = (bb.readByte() != 0); // pad: 1 bytes bb.skipBytes(1); int idleTimeout = U16.f(bb.readShort()); int hardTimeout = U16.f(bb.readShort()); int priority = U16.f(bb.readShort()); U64 cookie = U64.ofRaw(bb.readLong()); OFBsnSetPktinSuppressionRequestVer12 bsnSetPktinSuppressionRequestVer12 = new OFBsnSetPktinSuppressionRequestVer12( xid, enabled, idleTimeout, hardTimeout, priority, cookie); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnSetPktinSuppressionRequestVer12); return bsnSetPktinSuppressionRequestVer12; }
@Override public OFGroupFeaturesStatsReply readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 3 byte version = bb.readByte(); if (version != (byte) 0x3) throw new OFParseError("Wrong version: Expected=OFVersion.OF_12(3), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length != 56) throw new OFParseError("Wrong length: Expected=56(56), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 8 short statsType = bb.readShort(); if (statsType != (short) 0x8) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.GROUP_FEATURES(8), got=" + statsType); Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer12.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); long types = U32.f(bb.readInt()); long capabilities = U32.f(bb.readInt()); long maxGroupsAll = U32.f(bb.readInt()); long maxGroupsSelect = U32.f(bb.readInt()); long maxGroupsIndirect = U32.f(bb.readInt()); long maxGroupsFf = U32.f(bb.readInt()); long actionsAll = U32.f(bb.readInt()); long actionsSelect = U32.f(bb.readInt()); long actionsIndirect = U32.f(bb.readInt()); long actionsFf = U32.f(bb.readInt()); OFGroupFeaturesStatsReplyVer12 groupFeaturesStatsReplyVer12 = new OFGroupFeaturesStatsReplyVer12( xid, flags, types, capabilities, maxGroupsAll, maxGroupsSelect, maxGroupsIndirect, maxGroupsFf, actionsAll, actionsSelect, actionsIndirect, actionsFf); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", groupFeaturesStatsReplyVer12); return groupFeaturesStatsReplyVer12; }
@Override public OFBsnGentableEntryAdd readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 4 byte type = bb.readByte(); if (type != (byte) 0x4) throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x2eL int subtype = bb.readInt(); if (subtype != 0x2e) throw new OFParseError("Wrong subtype: Expected=0x2eL(0x2eL), got=" + subtype); GenTableId tableId = GenTableId.read2Bytes(bb); int keyLength = U16.f(bb.readShort()); U128 checksum = U128.read16Bytes(bb); List<OFBsnTlv> key = ChannelUtils.readList(bb, keyLength, OFBsnTlvVer13.READER); List<OFBsnTlv> value = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFBsnTlvVer13.READER); OFBsnGentableEntryAddVer13 bsnGentableEntryAddVer13 = new OFBsnGentableEntryAddVer13(xid, tableId, checksum, key, value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnGentableEntryAddVer13); return bsnGentableEntryAddVer13; }
@Override public OFBsnGentableBucketStatsReply readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer13.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x5L int subtype = bb.readInt(); if (subtype != 0x5) throw new OFParseError("Wrong subtype: Expected=0x5L(0x5L), got=" + subtype); List<OFBsnGentableBucketStatsEntry> entries = ChannelUtils.readList( bb, length - (bb.readerIndex() - start), OFBsnGentableBucketStatsEntryVer13.READER); OFBsnGentableBucketStatsReplyVer13 bsnGentableBucketStatsReplyVer13 = new OFBsnGentableBucketStatsReplyVer13(xid, flags, entries); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnGentableBucketStatsReplyVer13); return bsnGentableBucketStatsReplyVer13; }
@Override public OFBsnVlanCounterStatsEntry readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); int vlanVid = U16.f(bb.readShort()); // pad: 4 bytes bb.skipBytes(4); List<U64> values = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), U64.READER); OFBsnVlanCounterStatsEntryVer13 bsnVlanCounterStatsEntryVer13 = new OFBsnVlanCounterStatsEntryVer13(vlanVid, values); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnVlanCounterStatsEntryVer13); return bsnVlanCounterStatsEntryVer13; }
@Override public OFBsnImageDescStatsReply readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 5 byte version = bb.readByte(); if (version != (byte) 0x5) throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length != 536) throw new OFParseError("Wrong length: Expected=536(536), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0xeL int subtype = bb.readInt(); if (subtype != 0xe) throw new OFParseError("Wrong subtype: Expected=0xeL(0xeL), got=" + subtype); String imageChecksum = ChannelUtils.readFixedLengthString(bb, 256); String startupConfigChecksum = ChannelUtils.readFixedLengthString(bb, 256); OFBsnImageDescStatsReplyVer14 bsnImageDescStatsReplyVer14 = new OFBsnImageDescStatsReplyVer14(xid, flags, imageChecksum, startupConfigChecksum); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnImageDescStatsReplyVer14); return bsnImageDescStatsReplyVer14; }
@Override public OFBsnGentableDescStatsRequest readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 18 byte type = bb.readByte(); if (type != (byte) 0x12) throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got=" + type); int length = U16.f(bb.readShort()); if (length != 24) throw new OFParseError("Wrong length: Expected=24(24), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x4L int subtype = bb.readInt(); if (subtype != 0x4) throw new OFParseError("Wrong subtype: Expected=0x4L(0x4L), got=" + subtype); OFBsnGentableDescStatsRequestVer13 bsnGentableDescStatsRequestVer13 = new OFBsnGentableDescStatsRequestVer13(xid, flags); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnGentableDescStatsRequestVer13); return bsnGentableDescStatsRequestVer13; }
@Override public OFBsnPduTxRequest readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 1 byte version = bb.readByte(); if (version != (byte) 0x1) throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got=" + version); // fixed value property type == 4 byte type = bb.readByte(); if (type != (byte) 0x4) throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x1fL int subtype = bb.readInt(); if (subtype != 0x1f) throw new OFParseError("Wrong subtype: Expected=0x1fL(0x1fL), got=" + subtype); long txIntervalMs = U32.f(bb.readInt()); OFPort portNo = OFPort.read2Bytes(bb); short slotNum = U8.f(bb.readByte()); // pad: 3 bytes bb.skipBytes(3); byte[] data = ChannelUtils.readBytes(bb, length - (bb.readerIndex() - start)); OFBsnPduTxRequestVer10 bsnPduTxRequestVer10 = new OFBsnPduTxRequestVer10(xid, txIntervalMs, portNo, slotNum, data); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnPduTxRequestVer10); return bsnPduTxRequestVer10; }
@Override public OFBsnTlvMissPackets readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0xd short type = bb.readShort(); if (type != (short) 0xd) throw new OFParseError("Wrong type: Expected=0xd(0xd), got=" + type); int length = U16.f(bb.readShort()); if (length != 12) throw new OFParseError("Wrong length: Expected=12(12), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); U64 value = U64.ofRaw(bb.readLong()); OFBsnTlvMissPacketsVer13 bsnTlvMissPacketsVer13 = new OFBsnTlvMissPacketsVer13(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvMissPacketsVer13); return bsnTlvMissPacketsVer13; }
@Override public OFActionSetNwDst readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 6 short type = bb.readShort(); if (type != (short) 0x6) throw new OFParseError("Wrong type: Expected=OFActionType.SET_NW_DST(6), got=" + type); int length = U16.f(bb.readShort()); if (length != 8) throw new OFParseError("Wrong length: Expected=8(8), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); IPv4Address nwAddr = IPv4Address.read4Bytes(bb); OFActionSetNwDstVer11 actionSetNwDstVer11 = new OFActionSetNwDstVer11(nwAddr); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", actionSetNwDstVer11); return actionSetNwDstVer11; }
@Override public OFBsnTlvIcmpType readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0x44 short type = bb.readShort(); if (type != (short) 0x44) throw new OFParseError("Wrong type: Expected=0x44(0x44), got=" + type); int length = U16.f(bb.readShort()); if (length != 5) throw new OFParseError("Wrong length: Expected=5(5), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); short value = U8.f(bb.readByte()); OFBsnTlvIcmpTypeVer14 bsnTlvIcmpTypeVer14 = new OFBsnTlvIcmpTypeVer14(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvIcmpTypeVer14); return bsnTlvIcmpTypeVer14; }
@Override public OFBsnTlvQueueWeight readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0x15 short type = bb.readShort(); if (type != (short) 0x15) throw new OFParseError("Wrong type: Expected=0x15(0x15), got=" + type); int length = U16.f(bb.readShort()); if (length != 8) throw new OFParseError("Wrong length: Expected=8(8), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long value = U32.f(bb.readInt()); OFBsnTlvQueueWeightVer13 bsnTlvQueueWeightVer13 = new OFBsnTlvQueueWeightVer13(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvQueueWeightVer13); return bsnTlvQueueWeightVer13; }
@Override public OFBsnTlvStatus readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0x61 short type = bb.readShort(); if (type != (short) 0x61) throw new OFParseError("Wrong type: Expected=0x61(0x61), got=" + type); int length = U16.f(bb.readShort()); if (length != 5) throw new OFParseError("Wrong length: Expected=5(5), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); OFBsnStatus value = OFBsnStatusSerializerVer13.readFrom(bb); OFBsnTlvStatusVer13 bsnTlvStatusVer13 = new OFBsnTlvStatusVer13(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvStatusVer13); return bsnTlvStatusVer13; }
@Override public OFPortStatsPropExperimenter readFrom(ByteBuf bb) throws OFParseError { if (bb.readableBytes() < MINIMUM_LENGTH) return null; int start = bb.readerIndex(); // fixed value property type == 0xffff short type = bb.readShort(); if (type != (short) 0xffff) throw new OFParseError("Wrong type: Expected=0xffff(0xffff), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); int experimenter = bb.readInt(); bb.readerIndex(start); switch (experimenter) { default: throw new OFParseError( "Unknown value for discriminator experimenter of class OFPortStatsPropExperimenterVer14: " + experimenter); } }
@Override public OFActionCopyTtlIn readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 12 short type = bb.readShort(); if (type != (short) 0xc) throw new OFParseError("Wrong type: Expected=OFActionType.COPY_TTL_IN(12), got=" + type); int length = U16.f(bb.readShort()); if (length != 8) throw new OFParseError("Wrong length: Expected=8(8), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); // pad: 4 bytes bb.skipBytes(4); if (logger.isTraceEnabled()) logger.trace("readFrom - returning shared instance={}", INSTANCE); return INSTANCE; }
@Override public OFBsnTlvActorSystemMac readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 0x29 short type = bb.readShort(); if (type != (short) 0x29) throw new OFParseError("Wrong type: Expected=0x29(0x29), got=" + type); int length = U16.f(bb.readShort()); if (length != 10) throw new OFParseError("Wrong length: Expected=10(10), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); MacAddress value = MacAddress.read6Bytes(bb); OFBsnTlvActorSystemMacVer14 bsnTlvActorSystemMacVer14 = new OFBsnTlvActorSystemMacVer14(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvActorSystemMacVer14); return bsnTlvActorSystemMacVer14; }
@Override public OFBsnStatsRequest<?> readFrom(ChannelBuffer bb) throws OFParseError { if (bb.readableBytes() < MINIMUM_LENGTH) return null; int start = bb.readerIndex(); // fixed value property version == 2 byte version = bb.readByte(); if (version != (byte) 0x2) throw new OFParseError("Wrong version: Expected=OFVersion.OF_11(2), got=" + version); // fixed value property type == 18 byte type = bb.readByte(); if (type != (byte) 0x12) throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); OFStatsRequestFlagsSerializerVer11.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); int subtype = bb.readInt(); bb.readerIndex(start); switch (subtype) { default: throw new OFParseError( "Unknown value for discriminator subtype of class OFBsnStatsRequestVer11: " + subtype); } }
@Override public OFBsnSetMirroring readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 5 byte version = bb.readByte(); if (version != (byte) 0x5) throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version); // fixed value property type == 4 byte type = bb.readByte(); if (type != (byte) 0x4) throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got=" + type); int length = U16.f(bb.readShort()); if (length != 20) throw new OFParseError("Wrong length: Expected=20(20), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x3L int subtype = bb.readInt(); if (subtype != 0x3) throw new OFParseError("Wrong subtype: Expected=0x3L(0x3L), got=" + subtype); short reportMirrorPorts = U8.f(bb.readByte()); // pad: 3 bytes bb.skipBytes(3); OFBsnSetMirroringVer14 bsnSetMirroringVer14 = new OFBsnSetMirroringVer14(xid, reportMirrorPorts); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnSetMirroringVer14); return bsnSetMirroringVer14; }
@Override public OFActionSetDlSrc readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property type == 4 short type = bb.readShort(); if (type != (short) 0x4) throw new OFParseError("Wrong type: Expected=OFActionType.SET_DL_SRC(4), got=" + type); int length = U16.f(bb.readShort()); if (length != 16) throw new OFParseError("Wrong length: Expected=16(16), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); MacAddress dlAddr = MacAddress.read6Bytes(bb); // pad: 6 bytes bb.skipBytes(6); OFActionSetDlSrcVer10 actionSetDlSrcVer10 = new OFActionSetDlSrcVer10(dlAddr); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", actionSetDlSrcVer10); return actionSetDlSrcVer10; }
@Override public OFExperimenterStatsReply readFrom(ByteBuf bb) throws OFParseError { if (bb.readableBytes() < MINIMUM_LENGTH) return null; int start = bb.readerIndex(); // fixed value property version == 3 byte version = bb.readByte(); if (version != (byte) 0x3) throw new OFParseError("Wrong version: Expected=OFVersion.OF_12(3), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); OFStatsReplyFlagsSerializerVer12.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); int experimenter = bb.readInt(); bb.readerIndex(start); switch (experimenter) { case 0x5c16c7: // discriminator value 0x5c16c7L=0x5c16c7L for class OFBsnStatsReplyVer12 return OFBsnStatsReplyVer12.READER.readFrom(bb); default: throw new OFParseError( "Unknown value for discriminator experimenter of class OFExperimenterStatsReplyVer12: " + experimenter); } }
@Override public OFBadPropertyErrorMsg readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 5 byte version = bb.readByte(); if (version != (byte) 0x5) throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version); // fixed value property type == 1 byte type = bb.readByte(); if (type != (byte) 0x1) throw new OFParseError("Wrong type: Expected=OFType.ERROR(1), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property errType == 14 short errType = bb.readShort(); if (errType != (short) 0xe) throw new OFParseError( "Wrong errType: Expected=OFErrorType.BAD_PROPERTY(14), got=" + errType); OFBadPropertyCode code = OFBadPropertyCodeSerializerVer14.readFrom(bb); OFErrorCauseData data = OFErrorCauseData.read(bb, length - (bb.readerIndex() - start), OFVersion.OF_14); OFBadPropertyErrorMsgVer14 badPropertyErrorMsgVer14 = new OFBadPropertyErrorMsgVer14(xid, code, data); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", badPropertyErrorMsgVer14); return badPropertyErrorMsgVer14; }
@Override public OFMeterStatsReply readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 5 byte version = bb.readByte(); if (version != (byte) 0x5) throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version); // fixed value property type == 19 byte type = bb.readByte(); if (type != (byte) 0x13) throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type); int length = U16.f(bb.readShort()); if (length < MINIMUM_LENGTH) throw new OFParseError( "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 9 short statsType = bb.readShort(); if (statsType != (short) 0x9) throw new OFParseError("Wrong statsType: Expected=OFStatsType.METER(9), got=" + statsType); Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); List<OFMeterStats> entries = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFMeterStatsVer14.READER); OFMeterStatsReplyVer14 meterStatsReplyVer14 = new OFMeterStatsReplyVer14(xid, flags, entries); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", meterStatsReplyVer14); return meterStatsReplyVer14; }