コード例 #1
0
    @Override
    public void write(ChannelBuffer bb, OFBsnPduTxRequestVer10 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 1
      bb.writeByte((byte) 0x1);
      // fixed value property type = 4
      bb.writeByte((byte) 0x4);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property experimenter = 0x5c16c7L
      bb.writeInt(0x5c16c7);
      // fixed value property subtype = 0x1fL
      bb.writeInt(0x1f);
      bb.writeInt(U32.t(message.txIntervalMs));
      message.portNo.write2Bytes(bb);
      bb.writeByte(U8.t(message.slotNum));
      // pad: 3 bytes
      bb.writeZero(3);
      bb.writeBytes(message.data);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #2
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;
    }
コード例 #3
0
    @Override
    public void write(ByteBuf bb, OFFlowStatsEntryVer10 message) {
      int startIndex = bb.writerIndex();
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      message.tableId.writeByte(bb);
      // pad: 1 bytes
      bb.writeZero(1);
      message.match.writeTo(bb);
      bb.writeInt(U32.t(message.durationSec));
      bb.writeInt(U32.t(message.durationNsec));
      bb.writeShort(U16.t(message.priority));
      bb.writeShort(U16.t(message.idleTimeout));
      bb.writeShort(U16.t(message.hardTimeout));
      // pad: 6 bytes
      bb.writeZero(6);
      bb.writeLong(message.cookie.getValue());
      bb.writeLong(message.packetCount.getValue());
      bb.writeLong(message.byteCount.getValue());
      ChannelUtils.writeList(bb, message.actions);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #4
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;
    }
コード例 #5
0
 @Override
 public void write(ByteBuf bb, OFBsnBwEnableSetRequestVer11 message) {
   // fixed value property version = 2
   bb.writeByte((byte) 0x2);
   // fixed value property type = 4
   bb.writeByte((byte) 0x4);
   // fixed value property length = 20
   bb.writeShort((short) 0x14);
   bb.writeInt(U32.t(message.xid));
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0x12L
   bb.writeInt(0x12);
   bb.writeInt(U32.t(message.enable));
 }
コード例 #6
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;
    }
コード例 #7
0
    @Override
    public void write(ChannelBuffer bb, OFBsnGentableEntryAddVer13 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 4
      bb.writeByte((byte) 0x4);
      // fixed value property type = 4
      bb.writeByte((byte) 0x4);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property experimenter = 0x5c16c7L
      bb.writeInt(0x5c16c7);
      // fixed value property subtype = 0x2eL
      bb.writeInt(0x2e);
      message.tableId.write2Bytes(bb);
      // keyLength is length indicator for key, will be
      // udpated when key has been written
      int keyLengthIndex = bb.writerIndex();
      bb.writeShort(0);
      message.checksum.write16Bytes(bb);
      int keyStartIndex = bb.writerIndex();
      ChannelUtils.writeList(bb, message.key);
      // update field length member keyLength
      int keyLength = bb.writerIndex() - keyStartIndex;
      bb.setShort(keyLengthIndex, keyLength);
      ChannelUtils.writeList(bb, message.value);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #8
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;
    }
コード例 #9
0
    @Override
    public void write(ChannelBuffer bb, OFBsnGentableBucketStatsReplyVer13 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 4
      bb.writeByte((byte) 0x4);
      // fixed value property type = 19
      bb.writeByte((byte) 0x13);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property statsType = 65535
      bb.writeShort((short) 0xffff);
      OFStatsReplyFlagsSerializerVer13.writeTo(bb, message.flags);
      // pad: 4 bytes
      bb.writeZero(4);
      // fixed value property experimenter = 0x5c16c7L
      bb.writeInt(0x5c16c7);
      // fixed value property subtype = 0x5L
      bb.writeInt(0x5);
      ChannelUtils.writeList(bb, message.entries);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #10
0
 @Override
 public void write(ChannelBuffer bb, OFBsnSetLacpReplyVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 4
   bb.writeByte((byte) 0x4);
   // fixed value property length = 24
   bb.writeShort((short) 0x18);
   bb.writeInt(U32.t(message.xid));
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0x2aL
   bb.writeInt(0x2a);
   bb.writeInt(U32.t(message.status));
   message.portNo.write4Bytes(bb);
 }
コード例 #11
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;
    }
コード例 #12
0
 @Override
 public void write(ChannelBuffer bb, OFBsnTlvQueueWeightVer13 message) {
   // fixed value property type = 0x15
   bb.writeShort((short) 0x15);
   // fixed value property length = 8
   bb.writeShort((short) 0x8);
   bb.writeInt(U32.t(message.value));
 }
コード例 #13
0
 @Override
 public void write(ByteBuf bb, OFPortDescVer12 message) {
   message.portNo.write4Bytes(bb);
   // pad: 4 bytes
   bb.writeZero(4);
   message.hwAddr.write6Bytes(bb);
   // pad: 2 bytes
   bb.writeZero(2);
   ChannelUtils.writeFixedLengthString(bb, message.name, 16);
   OFPortConfigSerializerVer12.writeTo(bb, message.config);
   OFPortStateSerializerVer12.writeTo(bb, message.state);
   OFPortFeaturesSerializerVer12.writeTo(bb, message.curr);
   OFPortFeaturesSerializerVer12.writeTo(bb, message.advertised);
   OFPortFeaturesSerializerVer12.writeTo(bb, message.supported);
   OFPortFeaturesSerializerVer12.writeTo(bb, message.peer);
   bb.writeInt(U32.t(message.currSpeed));
   bb.writeInt(U32.t(message.maxSpeed));
 }
コード例 #14
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;
    }
コード例 #15
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;
    }
コード例 #16
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;
    }
コード例 #17
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;
    }
コード例 #18
0
 @Override
 public void write(ByteBuf bb, OFMeterFeaturesStatsReplyVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 19
   bb.writeByte((byte) 0x13);
   // fixed value property length = 32
   bb.writeShort((short) 0x20);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 11
   bb.writeShort((short) 0xb);
   OFStatsReplyFlagsSerializerVer14.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   message.features.writeTo(bb);
 }
コード例 #19
0
 @Override
 public void write(ByteBuf bb, OFBsnSetMirroringVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 4
   bb.writeByte((byte) 0x4);
   // fixed value property length = 20
   bb.writeShort((short) 0x14);
   bb.writeInt(U32.t(message.xid));
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0x3L
   bb.writeInt(0x3);
   bb.writeByte(U8.t(message.reportMirrorPorts));
   // pad: 3 bytes
   bb.writeZero(3);
 }
コード例 #20
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;
    }
コード例 #21
0
    @Override
    public void write(ChannelBuffer bb, OFEchoRequestVer10 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 1
      bb.writeByte((byte) 0x1);
      // fixed value property type = 2
      bb.writeByte((byte) 0x2);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      bb.writeBytes(message.data);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #22
0
 @Override
 public void write(ByteBuf bb, OFPortStatsRequestVer13 message) {
   // fixed value property version = 4
   bb.writeByte((byte) 0x4);
   // fixed value property type = 18
   bb.writeByte((byte) 0x12);
   // fixed value property length = 24
   bb.writeShort((short) 0x18);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 4
   bb.writeShort((short) 0x4);
   OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   message.portNo.write4Bytes(bb);
   // pad: 4 bytes
   bb.writeZero(4);
 }
    @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;
    }
コード例 #24
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;
    }
コード例 #25
0
 @Override
 public void write(ChannelBuffer bb, OFBsnGentableDescStatsRequestVer13 message) {
   // fixed value property version = 4
   bb.writeByte((byte) 0x4);
   // fixed value property type = 18
   bb.writeByte((byte) 0x12);
   // fixed value property length = 24
   bb.writeShort((short) 0x18);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 65535
   bb.writeShort((short) 0xffff);
   OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0x4L
   bb.writeInt(0x4);
 }
コード例 #26
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;
    }
コード例 #27
0
    @Override
    public void write(ByteBuf bb, OFFlowModFailedErrorMsgVer10 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 1
      bb.writeByte((byte) 0x1);
      // fixed value property type = 1
      bb.writeByte((byte) 0x1);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property errType = 3
      bb.writeShort((short) 0x3);
      OFFlowModFailedCodeSerializerVer10.writeTo(bb, message.code);
      message.data.writeTo(bb);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #28
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;
    }
コード例 #29
0
 @Override
 public void write(ChannelBuffer bb, OFBsnImageDescStatsReplyVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 19
   bb.writeByte((byte) 0x13);
   // fixed value property length = 536
   bb.writeShort((short) 0x218);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 65535
   bb.writeShort((short) 0xffff);
   OFStatsReplyFlagsSerializerVer14.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0xeL
   bb.writeInt(0xe);
   ChannelUtils.writeFixedLengthString(bb, message.imageChecksum, 256);
   ChannelUtils.writeFixedLengthString(bb, message.startupConfigChecksum, 256);
 }
コード例 #30
0
    @Override
    public void write(ChannelBuffer bb, OFBadPropertyErrorMsgVer14 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 5
      bb.writeByte((byte) 0x5);
      // fixed value property type = 1
      bb.writeByte((byte) 0x1);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property errType = 14
      bb.writeShort((short) 0xe);
      OFBadPropertyCodeSerializerVer14.writeTo(bb, message.code);
      message.data.writeTo(bb);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }