@Override void processOFError(OFErrorMsg m) { /* * HP ProCurve switches do not support * the ofpt_barrier_request message. * * Look for an error from a bad ofpt_barrier_request, * log a warning, but proceed. */ if (m.getErrType() == OFErrorType.BAD_REQUEST && ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE && ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) { log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve."); } else { logErrorDisconnect(m); } }
/** * Send the configuration requests to tell the switch we want full * packets * @throws IOException */ private void sendHandshakeSetConfig() { // Ensure we receive the full packet via PacketIn // FIXME: We don't set the reassembly flags. OFSetConfig configSet = factory.buildSetConfig() .setXid(handshakeTransactionIds--) .setMissSendLen(0xffff) .build(); // Barrier OFBarrierRequest barrier = factory.buildBarrierRequest() .setXid(handshakeTransactionIds--) .build(); // Verify (need barrier?) OFGetConfigRequest configReq = factory.buildGetConfigRequest() .setXid(handshakeTransactionIds--) .build(); List<OFMessage> msgList = ImmutableList.<OFMessage>of(configSet, barrier, configReq); mainConnection.write(msgList); }
@Override public void startDriverHandshake() { if (startDriverHandshakeCalled) { throw new SwitchDriverSubHandshakeAlreadyStarted(); } startDriverHandshakeCalled = true; OFFlowMod fm = factory().buildFlowDelete() .setTableId(TableId.ALL) .setOutGroup(OFGroup.ANY) .build(); channel.write(Collections.singletonList(fm)); barrierXid = getNextTransactionId(); OFBarrierRequest barrier = factory().buildBarrierRequest() .setXid(barrierXid).build(); channel.write(Collections.singletonList(barrier)); }
@Override public void startDriverHandshake() { if (startDriverHandshakeCalled) { throw new SwitchDriverSubHandshakeAlreadyStarted(); } startDriverHandshakeCalled = true; OFFlowMod fm = factory().buildFlowDelete() .setTableId(TableId.ALL) .setOutGroup(OFGroup.ANY) .build(); sendMsg(Collections.singletonList(fm)); OFGroupMod gm = factory().buildGroupDelete() .setGroup(OFGroup.ALL) .setGroupType(OFGroupType.ALL) .build(); sendMsg(Collections.singletonList(gm)); OFMeterMod mm = factory().buildMeterMod() .setMeterId(MeterId.ALL.id()) .build(); sendMsg(Collections.singletonList(mm)); barrierXid = getNextTransactionId(); OFBarrierRequest barrier = factory().buildBarrierRequest() .setXid(barrierXid).build(); sendHandshakeMessage(barrier); }
/** * Send the configuration requests to tell the switch we want full * packets. * @throws IOException */ private void sendHandshakeSetConfig() throws IOException { OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10; //log.debug("Sending CONFIG_REQUEST to {}", channel.getRemoteAddress()); List<OFMessage> msglist = new ArrayList<OFMessage>(3); // Ensure we receive the full packet via PacketIn // FIXME: We don't set the reassembly flags. // Only send config to switches to send full packets, if they have a buffer. // Saves a packet & OFSetConfig can't be handled by certain switches. if(this.featuresReply.getNBuffers() > 0) { OFSetConfig sc = factory .buildSetConfig() .setMissSendLen((short) 0xffff) .setXid(this.handshakeTransactionIds--) .build(); msglist.add(sc); } // Barrier OFBarrierRequest br = factory .buildBarrierRequest() .setXid(this.handshakeTransactionIds--) .build(); msglist.add(br); // Verify (need barrier?) OFGetConfigRequest gcr = factory .buildGetConfigRequest() .setXid(this.handshakeTransactionIds--) .build(); msglist.add(gcr); channel.write(msglist); }
private long sendBarrier() { long xid = handshakeTransactionIds--; OFBarrierRequest barrier = factory.buildBarrierRequest() .setXid(xid) .build(); sw.write(barrier); /* don't use ListenableFuture here; we receive via barrier reply OR error (barrier unsupported) */ return xid; }
private void sendBarrier(IOFSwitch sw) { OFBarrierRequest barrierRequest = sw.getOFFactory().buildBarrierRequest() .build(); ListenableFuture<OFBarrierReply> future = sw.writeRequest(barrierRequest); try { future.get(10, TimeUnit.SECONDS); /* If successful, we can discard the reply. */ } catch (InterruptedException | ExecutionException | TimeoutException e) { log.error("Switch {} doesn't support barrier messages? OVS should.", sw.toString()); } }
private void sendBarrier(boolean finalBarrier) { int xid = getNextTransactionId(); if (finalBarrier) { barrierXidToWaitFor = xid; } OFBarrierRequest br = factory .buildBarrierRequest() .setXid(xid) .build(); write(br); }
/** * Send the configuration requests to tell the switch we want full * packets. * @throws IOException */ private void sendHandshakeSetConfig() throws IOException { OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10; //log.debug("Sending CONFIG_REQUEST to {}", channel.getRemoteAddress()); List<OFMessage> msglist = new ArrayList<OFMessage>(3); // Ensure we receive the full packet via PacketIn // FIXME: We don't set the reassembly flags. OFSetConfig sc = factory .buildSetConfig() .setMissSendLen((short) 0xffff) .setXid(this.handshakeTransactionIds--) .build(); msglist.add(sc); // Barrier OFBarrierRequest br = factory .buildBarrierRequest() .setXid(this.handshakeTransactionIds--) .build(); msglist.add(br); // Verify (need barrier?) OFGetConfigRequest gcr = factory .buildGetConfigRequest() .setXid(this.handshakeTransactionIds--) .build(); msglist.add(gcr); channel.write(msglist); }
private void sendBarrier(boolean finalBarrier) throws IOException { int xid = getNextTransactionId(); if (finalBarrier) { barrierXidToWaitFor = xid; } OFBarrierRequest br = getFactory() .buildBarrierRequest() .setXid(xid) .build(); write(br, null); }
private void sendHandshakeBarrier() throws IOException { long xid = getNextTransactionId(); barrierXidToWaitFor = xid; OFBarrierRequest br = getFactory() .buildBarrierRequest() .setXid(xid) .build(); write(br, null); }
@Override public OFMessageFuture<OFBarrierReply> barrierAsync(Dpid dpid) { // TODO creation of message and future should be moved to OFSwitchImpl IOFSwitch sw = floodlightProvider.getMasterSwitch(dpid.value()); if (sw == null) { return null; } OFBarrierRequest msg = createBarrierRequest(sw); OFBarrierReplyFuture future = new OFBarrierReplyFuture(threadPool, sw, (int) msg.getXid()); barrierFutures.put(BarrierInfo.create(dpid.value(), msg), future); addMessageImpl(dpid, msg, MsgPriority.NORMAL); return future; }
protected OFBarrierRequest createBarrierRequest(IOFSwitch sw) { OFFactory factory = sw.getFactory(); if (factory == null) { log.error("No OF Message Factory for switch {} with OFVersion {}", sw, sw.getOFVersion()); return null; } return factory.buildBarrierRequest() .setXid(sw.getNextTransactionId()) .build(); }