@Override public void writeTo(final ChannelBuffer data) { super.writeTo(data); data.writeShort(this.statisticType.getTypeValue()); data.writeShort(this.flags); if (this.statistics != null) { for (final OFStatistics statistic : this.statistics) { statistic.writeTo(data); } } }
@Override void processOFStatisticsReply(final SwitchChannelHandler h, final OFStatisticsReply m) { // Read description, if it has been updated final OVXDescriptionStatistics description = new OVXDescriptionStatistics(); final ChannelBuffer data = ChannelBuffers.buffer(description .getLength()); final OFStatistics f = m.getFirstStatistics(); f.writeTo(data); description.readFrom(data); OFFlowMod fm = new OFFlowMod(); fm.setCommand(OFFlowMod.OFPFC_DELETE); fm.setMatch(new OFMatch()); h.channel.write(Collections.singletonList(fm)); h.sw = new PhysicalSwitch(h.featuresReply.getDatapathId()); // set switch information // set features reply and channel first so we have a DPID and // channel info. h.sw.setFeaturesReply(h.featuresReply); h.sw.setDescriptionStats(description); h.sw.setConnected(true); h.sw.setChannel(h.channel); for (final OFPortStatus ps : h.pendingPortStatusMsg) { this.handlePortStatusMessage(h, ps); } h.pendingPortStatusMsg.clear(); h.sw.boot(); h.setState(ACTIVE); }