Exemple #1
0
  private void lookupByFlowSpace(FVClassifier fvClassifier) {
    SliceAction sliceAction;
    int perms;
    // grab single matching rule: only one because it's a point in flowspace
    FlowEntry flowEntry =
        fvClassifier
            .getSwitchFlowMap()
            .matches(
                fvClassifier.getSwitchInfo().getDatapathId(),
                this.getInPort(),
                this.getPacketData());
    if (flowEntry == null) {
      FVLog.log(
          LogLevel.DEBUG, fvClassifier, "dropping unclassifiable msg: " + this.toVerboseString());
      return;
    }

    boolean foundHome = false;
    // foreach slice in that rule
    for (OFAction ofAction : flowEntry.getActionsList()) {
      sliceAction = (SliceAction) ofAction;
      perms = sliceAction.getSlicePerms();
      if ((perms & (SliceAction.READ | SliceAction.WRITE)) != 0) {
        // lookup slice and send msg to them
        // TODO record buffer id for later validation
        FVSlicer fvSlicer = fvClassifier.getSlicerByName(sliceAction.getSliceName());
        if (fvSlicer == null) {
          FVLog.log(
              LogLevel.WARN,
              fvClassifier,
              "tried to send msg to non-existant slice: "
                  + sliceAction.getSliceName()
                  + " corrupted flowspace?:: "
                  + this.toVerboseString());
          continue;
        }
        if (fvSlicer.isConnected()) {
          if ((perms & SliceAction.WRITE) != 0) fvSlicer.setBufferIDAllowed(this.getBufferId());
          fvSlicer.sendMsg(this, fvClassifier);
          /**
           * TODO : come back and decide if we should uncomment this i.e., should a rule get
           * squashed if it's only recipient is read only
           *
           * <p>if yes, then tests-readonly.py needs to be changed
           */

          // if ((perms & SliceAction.WRITE) != 0)
          foundHome = true;
        } else {
          sendDropRule(fvClassifier, flowEntry, fvSlicer.getSliceName(), (short) 0, (short) 1);
        }
        foundHome = true;
      }
      /*
       * ash: not sure if this is the intended behavior, but I am guessing
       * that if this packet hasn't gotten handled anywhere we should at least
       * default to adding a drop rule for unless we want to be flooded.
       */
      if (!foundHome) sendDropRule(fvClassifier, flowEntry, "exact", (short) 0, (short) 1);
    }
  }