コード例 #1
0
    @Override
    public OFPortDesc readFrom(ByteBuf bb) throws OFParseError {
      OFPort portNo = OFPort.read4Bytes(bb);
      // pad: 4 bytes
      bb.skipBytes(4);
      MacAddress hwAddr = MacAddress.read6Bytes(bb);
      // pad: 2 bytes
      bb.skipBytes(2);
      String name = ChannelUtils.readFixedLengthString(bb, 16);
      Set<OFPortConfig> config = OFPortConfigSerializerVer12.readFrom(bb);
      Set<OFPortState> state = OFPortStateSerializerVer12.readFrom(bb);
      Set<OFPortFeatures> curr = OFPortFeaturesSerializerVer12.readFrom(bb);
      Set<OFPortFeatures> advertised = OFPortFeaturesSerializerVer12.readFrom(bb);
      Set<OFPortFeatures> supported = OFPortFeaturesSerializerVer12.readFrom(bb);
      Set<OFPortFeatures> peer = OFPortFeaturesSerializerVer12.readFrom(bb);
      long currSpeed = U32.f(bb.readInt());
      long maxSpeed = U32.f(bb.readInt());

      OFPortDescVer12 portDescVer12 =
          new OFPortDescVer12(
              portNo,
              hwAddr,
              name,
              config,
              state,
              curr,
              advertised,
              supported,
              peer,
              currSpeed,
              maxSpeed);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", portDescVer12);
      return portDescVer12;
    }
コード例 #2
0
    @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;
    }
コード例 #3
0
    @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;
    }
コード例 #4
0
    @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;
    }
コード例 #5
0
    @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;
    }
コード例 #6
0
    @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;
    }
コード例 #7
0
    @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;
    }
コード例 #8
0
    @Override
    public OFBsnSetLacpReply 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 == 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 != 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 experimenter == 0x5c16c7L
      int experimenter = bb.readInt();
      if (experimenter != 0x5c16c7)
        throw new OFParseError(
            "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter);
      // fixed value property subtype == 0x2aL
      int subtype = bb.readInt();
      if (subtype != 0x2a)
        throw new OFParseError("Wrong subtype: Expected=0x2aL(0x2aL), got=" + subtype);
      long status = U32.f(bb.readInt());
      OFPort portNo = OFPort.read4Bytes(bb);

      OFBsnSetLacpReplyVer14 bsnSetLacpReplyVer14 = new OFBsnSetLacpReplyVer14(xid, status, portNo);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnSetLacpReplyVer14);
      return bsnSetLacpReplyVer14;
    }
コード例 #9
0
    @Override
    public OFBsnBwEnableSetRequest readFrom(ByteBuf bb) throws OFParseError {
      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 == 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 == 0x12L
      int subtype = bb.readInt();
      if (subtype != 0x12)
        throw new OFParseError("Wrong subtype: Expected=0x12L(0x12L), got=" + subtype);
      long enable = U32.f(bb.readInt());

      OFBsnBwEnableSetRequestVer11 bsnBwEnableSetRequestVer11 =
          new OFBsnBwEnableSetRequestVer11(xid, enable);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnBwEnableSetRequestVer11);
      return bsnBwEnableSetRequestVer11;
    }
コード例 #10
0
    @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 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;
    }
コード例 #12
0
    @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;
    }
コード例 #13
0
    @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;
    }
コード例 #14
0
    @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;
    }
コード例 #15
0
 @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);
   }
 }
コード例 #16
0
    @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;
    }
コード例 #17
0
 @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);
   }
 }
コード例 #18
0
    @Override
    public OFFlowModFailedErrorMsg readFrom(ByteBuf 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 == 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 == 3
      short errType = bb.readShort();
      if (errType != (short) 0x3)
        throw new OFParseError(
            "Wrong errType: Expected=OFErrorType.FLOW_MOD_FAILED(3), got=" + errType);
      OFFlowModFailedCode code = OFFlowModFailedCodeSerializerVer10.readFrom(bb);
      OFErrorCauseData data =
          OFErrorCauseData.read(bb, length - (bb.readerIndex() - start), OFVersion.OF_10);

      OFFlowModFailedErrorMsgVer10 flowModFailedErrorMsgVer10 =
          new OFFlowModFailedErrorMsgVer10(xid, code, data);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", flowModFailedErrorMsgVer10);
      return flowModFailedErrorMsgVer10;
    }
コード例 #19
0
    @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;
    }
コード例 #20
0
    @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;
    }
コード例 #21
0
    @Override
    public OFPortStatsRequest readFrom(ByteBuf 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 == 4
      short statsType = bb.readShort();
      if (statsType != (short) 0x4)
        throw new OFParseError("Wrong statsType: Expected=OFStatsType.PORT(4), got=" + statsType);
      Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb);
      // pad: 4 bytes
      bb.skipBytes(4);
      OFPort portNo = OFPort.read4Bytes(bb);
      // pad: 4 bytes
      bb.skipBytes(4);

      OFPortStatsRequestVer13 portStatsRequestVer13 =
          new OFPortStatsRequestVer13(xid, flags, portNo);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", portStatsRequestVer13);
      return portStatsRequestVer13;
    }
コード例 #22
0
 @Override
 public OFStatsRequest<?> readFrom(ChannelBuffer bb) throws OFParseError {
   if (bb.readableBytes() < MINIMUM_LENGTH) return null;
   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 < MINIMUM_LENGTH)
     throw new OFParseError(
         "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length);
   U32.f(bb.readInt());
   short statsType = bb.readShort();
   bb.readerIndex(start);
   switch (statsType) {
     case (short) 0x2:
       // discriminator value OFStatsType.AGGREGATE=2 for class OFAggregateStatsRequestVer13
       return OFAggregateStatsRequestVer13.READER.readFrom(bb);
     case (short) 0xffff:
       // discriminator value OFStatsType.EXPERIMENTER=65535 for class
       // OFExperimenterStatsRequestVer13
       return OFExperimenterStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x0:
       // discriminator value OFStatsType.DESC=0 for class OFDescStatsRequestVer13
       return OFDescStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x1:
       // discriminator value OFStatsType.FLOW=1 for class OFFlowStatsRequestVer13
       return OFFlowStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x4:
       // discriminator value OFStatsType.PORT=4 for class OFPortStatsRequestVer13
       return OFPortStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x5:
       // discriminator value OFStatsType.QUEUE=5 for class OFQueueStatsRequestVer13
       return OFQueueStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x3:
       // discriminator value OFStatsType.TABLE=3 for class OFTableStatsRequestVer13
       return OFTableStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x7:
       // discriminator value OFStatsType.GROUP_DESC=7 for class OFGroupDescStatsRequestVer13
       return OFGroupDescStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x6:
       // discriminator value OFStatsType.GROUP=6 for class OFGroupStatsRequestVer13
       return OFGroupStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x8:
       // discriminator value OFStatsType.GROUP_FEATURES=8 for class
       // OFGroupFeaturesStatsRequestVer13
       return OFGroupFeaturesStatsRequestVer13.READER.readFrom(bb);
     case (short) 0xa:
       // discriminator value OFStatsType.METER_CONFIG=10 for class
       // OFMeterConfigStatsRequestVer13
       return OFMeterConfigStatsRequestVer13.READER.readFrom(bb);
     case (short) 0xb:
       // discriminator value OFStatsType.METER_FEATURES=11 for class
       // OFMeterFeaturesStatsRequestVer13
       return OFMeterFeaturesStatsRequestVer13.READER.readFrom(bb);
     case (short) 0x9:
       // discriminator value OFStatsType.METER=9 for class OFMeterStatsRequestVer13
       return OFMeterStatsRequestVer13.READER.readFrom(bb);
     case (short) 0xd:
       // discriminator value OFStatsType.PORT_DESC=13 for class OFPortDescStatsRequestVer13
       return OFPortDescStatsRequestVer13.READER.readFrom(bb);
     case (short) 0xc:
       // discriminator value OFStatsType.TABLE_FEATURES=12 for class
       // OFTableFeaturesStatsRequestVer13
       return OFTableFeaturesStatsRequestVer13.READER.readFrom(bb);
     default:
       throw new OFParseError(
           "Unknown value for discriminator statsType of class OFStatsRequestVer13: "
               + statsType);
   }
 }
コード例 #23
0
 @Override
 public OFBsnStatsReply readFrom(ChannelBuffer bb) throws OFParseError {
   if (bb.readableBytes() < MINIMUM_LENGTH) return null;
   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);
   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);
   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);
   int subtype = bb.readInt();
   bb.readerIndex(start);
   switch (subtype) {
     case 0xd:
       // discriminator value 0xdL=0xdL for class OFBsnDebugCounterDescStatsReplyVer13
       return OFBsnDebugCounterDescStatsReplyVer13.READER.readFrom(bb);
     case 0xc:
       // discriminator value 0xcL=0xcL for class OFBsnDebugCounterStatsReplyVer13
       return OFBsnDebugCounterStatsReplyVer13.READER.readFrom(bb);
     case 0xa:
       // discriminator value 0xaL=0xaL for class OFBsnFlowChecksumBucketStatsReplyVer13
       return OFBsnFlowChecksumBucketStatsReplyVer13.READER.readFrom(bb);
     case 0x5:
       // discriminator value 0x5L=0x5L for class OFBsnGentableBucketStatsReplyVer13
       return OFBsnGentableBucketStatsReplyVer13.READER.readFrom(bb);
     case 0x4:
       // discriminator value 0x4L=0x4L for class OFBsnGentableDescStatsReplyVer13
       return OFBsnGentableDescStatsReplyVer13.READER.readFrom(bb);
     case 0x2:
       // discriminator value 0x2L=0x2L for class OFBsnGentableEntryDescStatsReplyVer13
       return OFBsnGentableEntryDescStatsReplyVer13.READER.readFrom(bb);
     case 0x3:
       // discriminator value 0x3L=0x3L for class OFBsnGentableEntryStatsReplyVer13
       return OFBsnGentableEntryStatsReplyVer13.READER.readFrom(bb);
     case 0x7:
       // discriminator value 0x7L=0x7L for class OFBsnGentableStatsReplyVer13
       return OFBsnGentableStatsReplyVer13.READER.readFrom(bb);
     case 0xe:
       // discriminator value 0xeL=0xeL for class OFBsnImageDescStatsReplyVer13
       return OFBsnImageDescStatsReplyVer13.READER.readFrom(bb);
     case 0x1:
       // discriminator value 0x1L=0x1L for class OFBsnLacpStatsReplyVer13
       return OFBsnLacpStatsReplyVer13.READER.readFrom(bb);
     case 0x8:
       // discriminator value 0x8L=0x8L for class OFBsnPortCounterStatsReplyVer13
       return OFBsnPortCounterStatsReplyVer13.READER.readFrom(bb);
     case 0x6:
       // discriminator value 0x6L=0x6L for class OFBsnSwitchPipelineStatsReplyVer13
       return OFBsnSwitchPipelineStatsReplyVer13.READER.readFrom(bb);
     case 0xb:
       // discriminator value 0xbL=0xbL for class OFBsnTableChecksumStatsReplyVer13
       return OFBsnTableChecksumStatsReplyVer13.READER.readFrom(bb);
     case 0x9:
       // discriminator value 0x9L=0x9L for class OFBsnVlanCounterStatsReplyVer13
       return OFBsnVlanCounterStatsReplyVer13.READER.readFrom(bb);
     case 0xf:
       // discriminator value 0xfL=0xfL for class OFBsnVrfCounterStatsReplyVer13
       return OFBsnVrfCounterStatsReplyVer13.READER.readFrom(bb);
     default:
       throw new OFParseError(
           "Unknown value for discriminator subtype of class OFBsnStatsReplyVer13: " + subtype);
   }
 }
コード例 #24
0
    @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;
    }
コード例 #25
0
 @Override
 public OFBsnHeader readFrom(ChannelBuffer 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 == 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);
   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);
   int subtype = bb.readInt();
   bb.readerIndex(start);
   switch (subtype) {
     case 0x16:
       // discriminator value 0x16L=0x16L for class OFBsnBwClearDataReplyVer12
       return OFBsnBwClearDataReplyVer12.READER.readFrom(bb);
     case 0x15:
       // discriminator value 0x15L=0x15L for class OFBsnBwClearDataRequestVer12
       return OFBsnBwClearDataRequestVer12.READER.readFrom(bb);
     case 0x14:
       // discriminator value 0x14L=0x14L for class OFBsnBwEnableGetReplyVer12
       return OFBsnBwEnableGetReplyVer12.READER.readFrom(bb);
     case 0x13:
       // discriminator value 0x13L=0x13L for class OFBsnBwEnableGetRequestVer12
       return OFBsnBwEnableGetRequestVer12.READER.readFrom(bb);
     case 0x17:
       // discriminator value 0x17L=0x17L for class OFBsnBwEnableSetReplyVer12
       return OFBsnBwEnableSetReplyVer12.READER.readFrom(bb);
     case 0x12:
       // discriminator value 0x12L=0x12L for class OFBsnBwEnableSetRequestVer12
       return OFBsnBwEnableSetRequestVer12.READER.readFrom(bb);
     case 0xa:
       // discriminator value 0xaL=0xaL for class OFBsnGetInterfacesReplyVer12
       return OFBsnGetInterfacesReplyVer12.READER.readFrom(bb);
     case 0x9:
       // discriminator value 0x9L=0x9L for class OFBsnGetInterfacesRequestVer12
       return OFBsnGetInterfacesRequestVer12.READER.readFrom(bb);
     case 0x5:
       // discriminator value 0x5L=0x5L for class OFBsnGetMirroringReplyVer12
       return OFBsnGetMirroringReplyVer12.READER.readFrom(bb);
     case 0x4:
       // discriminator value 0x4L=0x4L for class OFBsnGetMirroringRequestVer12
       return OFBsnGetMirroringRequestVer12.READER.readFrom(bb);
     case 0x22:
       // discriminator value 0x22L=0x22L for class OFBsnPduRxReplyVer12
       return OFBsnPduRxReplyVer12.READER.readFrom(bb);
     case 0x21:
       // discriminator value 0x21L=0x21L for class OFBsnPduRxRequestVer12
       return OFBsnPduRxRequestVer12.READER.readFrom(bb);
     case 0x23:
       // discriminator value 0x23L=0x23L for class OFBsnPduRxTimeoutVer12
       return OFBsnPduRxTimeoutVer12.READER.readFrom(bb);
     case 0x20:
       // discriminator value 0x20L=0x20L for class OFBsnPduTxReplyVer12
       return OFBsnPduTxReplyVer12.READER.readFrom(bb);
     case 0x1f:
       // discriminator value 0x1fL=0x1fL for class OFBsnPduTxRequestVer12
       return OFBsnPduTxRequestVer12.READER.readFrom(bb);
     case 0x3:
       // discriminator value 0x3L=0x3L for class OFBsnSetMirroringVer12
       return OFBsnSetMirroringVer12.READER.readFrom(bb);
     case 0x19:
       // discriminator value 0x19L=0x19L for class OFBsnSetPktinSuppressionReplyVer12
       return OFBsnSetPktinSuppressionReplyVer12.READER.readFrom(bb);
     case 0xb:
       // discriminator value 0xbL=0xbL for class OFBsnSetPktinSuppressionRequestVer12
       return OFBsnSetPktinSuppressionRequestVer12.READER.readFrom(bb);
     case 0x10:
       // discriminator value 0x10L=0x10L for class OFBsnVirtualPortCreateReplyVer12
       return OFBsnVirtualPortCreateReplyVer12.READER.readFrom(bb);
     case 0xf:
       // discriminator value 0xfL=0xfL for class OFBsnVirtualPortCreateRequestVer12
       return OFBsnVirtualPortCreateRequestVer12.READER.readFrom(bb);
     case 0x1a:
       // discriminator value 0x1aL=0x1aL for class OFBsnVirtualPortRemoveReplyVer12
       return OFBsnVirtualPortRemoveReplyVer12.READER.readFrom(bb);
     case 0x11:
       // discriminator value 0x11L=0x11L for class OFBsnVirtualPortRemoveRequestVer12
       return OFBsnVirtualPortRemoveRequestVer12.READER.readFrom(bb);
     default:
       throw new OFParseError(
           "Unknown value for discriminator subtype of class OFBsnHeaderVer12: " + subtype);
   }
 }