Exemplo n.º 1
0
 @Override
 @LogMessageDoc(
     level = "ERROR",
     message = "Failed to clear all flows on switch {switch}",
     explanation = "An I/O error occured while trying to clear " + "flows on the switch.",
     recommendation = LogMessageDoc.CHECK_SWITCH)
 public void clearAllFlowMods() {
   // Delete all pre-existing flows
   OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
   OFMessage fm =
       ((OFFlowMod) floodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD))
           .setMatch(match)
           .setCommand(OFFlowMod.OFPFC_DELETE)
           .setOutPort(OFPort.OFPP_NONE)
           .setLength(U16.t(OFFlowMod.MINIMUM_LENGTH));
   fm.setXid(getNextTransactionId());
   OFMessage barrierMsg =
       (OFBarrierRequest)
           floodlightProvider.getOFMessageFactory().getMessage(OFType.BARRIER_REQUEST);
   barrierMsg.setXid(getNextTransactionId());
   try {
     List<OFMessage> msglist = new ArrayList<OFMessage>(1);
     msglist.add(fm);
     write(msglist);
     msglist = new ArrayList<OFMessage>(1);
     msglist.add(barrierMsg);
     write(msglist);
   } catch (Exception e) {
     log.error("Failed to clear all flows on switch " + this, e);
   }
 }
Exemplo n.º 2
0
 @Override
 public Future<OFFeaturesReply> querySwitchFeaturesReply() throws IOException {
   OFMessage request =
       floodlightProvider.getOFMessageFactory().getMessage(OFType.FEATURES_REQUEST);
   request.setXid(getNextTransactionId());
   OFFeaturesReplyFuture future = new OFFeaturesReplyFuture(threadPool, this, request.getXid());
   this.featuresFutureMap.put(request.getXid(), future);
   List<OFMessage> msglist = new ArrayList<OFMessage>(1);
   msglist.add(request);
   this.write(msglist);
   return future;
 }