public FlowEntryBuilder(DeviceId deviceId, OFFlowRemoved removed, DriverService driverService) { this.match = removed.getMatch(); this.removed = removed; this.deviceId = deviceId; this.instructions = null; this.stat = null; this.flowMod = null; this.type = FlowType.REMOVED; this.driverService = driverService; }
public SwitchDriverSubHandshakeCompleted(OFMessage m) { super("Sub-Handshake is already complete but received message " + m.getType()); } }
private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) { this.sw = s; this.pktin = pkt; this.isBuffered = pktin.getBufferId() != OFBufferId.NO_BUFFER; }
@Override public void startDriverHandshake() { if (factory().getVersion() == OFVersion.OF_10) { OFFlowAdd.Builder fmBuilder = factory().buildFlowAdd(); fmBuilder.setPriority(LOWEST_PRIORITY); sendHandshakeMessage(fmBuilder.build()); } }
private void sendHandshakeOFPortDescRequest() throws IOException { // Get port description for 1.3 switch OFPortDescStatsRequest preq = factory13 .buildPortDescStatsRequest() .setXid(handshakeTransactionIds--) .build(); channel.write(Collections.singletonList(preq)); }
/** * Send featuresRequest msg to the switch using the handshake transactions ids. * @throws IOException */ private void sendHandshakeFeaturesRequestMessage() throws IOException { OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10; OFMessage m = factory.buildFeaturesRequest() .setXid(this.handshakeTransactionIds--) .build(); channel.write(Collections.singletonList(m)); }
@Override public void run() { if (sw.getRole() == RoleState.MASTER) { log.trace("Collecting stats for {}", sw.getStringId()); OFFlowStatsRequest request = sw.factory().buildFlowStatsRequest() .setMatch(sw.factory().matchWildcardAll()) .setTableId(TableId.ALL) .setOutPort(OFPort.NO_MASK) .build(); sw.sendMsg(request); } } }
@Override void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m) { if (m.getStatsType().equals(OFStatsType.PORT_DESC)) { h.sw.setPortDescReply((OFPortDescStatsReply) m); } h.dispatchMessage(m); }
/** * Builds the GroupDel OF message. * * @return GroupDel OF message */ public OFGroupDelete buildGroupDel() { OFGroupDelete groupMsg = factory.buildGroupDelete() .setGroup(OFGroup.of(groupId.id())) .setGroupType(OFGroupType.SELECT) .setXid(xid) .build(); return groupMsg; }
private long portSpeed(OFPortDesc port) { if (port.getVersion() == OFVersion.OF_13) { // Note: getCurrSpeed() returns a value in kbps (this also applies to OF_11 and OF_12) return port.getCurrSpeed() / KBPS; } PortSpeed portSpeed = PortSpeed.SPEED_NONE; for (OFPortFeatures feat : port.getCurr()) { portSpeed = PortSpeed.max(portSpeed, feat.getPortSpeed()); } return portSpeed.getSpeedBps() / MBPS; }
/** * send a description state request. * @throws IOException */ private void sendHandshakeDescriptionStatsRequest() throws IOException { // Get Description to set switch-specific flags OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10; OFDescStatsRequest dreq = factory .buildDescStatsRequest() .setXid(handshakeTransactionIds--) .build(); channel.write(Collections.singletonList(dreq)); }
@Override public String manufacturerDescription() { return this.desc.getMfrDesc(); }
@Override public String softwareDescription() { return this.desc.getSwDesc(); }
@Override public OFFactory factory() { return OFFactories.getFactory(ofVersion); }
@Override public String hardwareDescription() { return this.desc.getHwDesc(); }
@Override public void run() { if (sw.getRole() == RoleState.MASTER) { log.trace("Collecting stats for {}", sw.getStringId()); OFTableStatsRequest request = sw.factory().buildTableStatsRequest() .build(); sw.sendMsg(request); } } }
@Override public String serialNumber() { return this.desc.getSerialNum(); }
@Override public String datapathDescription() { return this.desc.getDpDesc(); }
private RoleState(OFControllerRole nxRole) { nxRole.ordinal(); }
public FlowEntryBuilder(DeviceId deviceId, OFFlowMod fm, DriverService driverService) { this.match = fm.getMatch(); this.deviceId = deviceId; this.instructions = getInstructions(fm); this.type = FlowType.MOD; this.flowMod = fm; this.stat = null; this.removed = null; this.driverService = driverService; }