コード例 #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 void funnel(OFPortDescVer12 message, PrimitiveSink sink) {
   message.portNo.putTo(sink);
   // skip pad (4 bytes)
   message.hwAddr.putTo(sink);
   // skip pad (2 bytes)
   sink.putUnencodedChars(message.name);
   OFPortConfigSerializerVer12.putTo(message.config, sink);
   OFPortStateSerializerVer12.putTo(message.state, sink);
   OFPortFeaturesSerializerVer12.putTo(message.curr, sink);
   OFPortFeaturesSerializerVer12.putTo(message.advertised, sink);
   OFPortFeaturesSerializerVer12.putTo(message.supported, sink);
   OFPortFeaturesSerializerVer12.putTo(message.peer, sink);
   sink.putLong(message.currSpeed);
   sink.putLong(message.maxSpeed);
 }
コード例 #3
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));
 }