コード例 #1
0
ファイル: LinearFlowMap.java プロジェクト: fp7-ofelia/VeRTIGO
  /**
   * Step through each FlowEntry in order and match on it. If we get EQUALS or SUBSET, then stop.
   *
   * <p>IF we get SUPERSET or INTERSECT, then keep going and merge the results.
   */
  @Override
  public List<FlowIntersect> intersects(long dpid, OFMatch match) {

    List<FlowIntersect> results = new ArrayList<FlowIntersect>();
    FlowIntersect intersect;
    MatchType matchType;
    boolean needMerge = false;

    for (Iterator<FlowEntry> it = rules.iterator(); it.hasNext(); ) {
      FlowEntry rule = it.next();
      intersect = rule.matches(dpid, match);
      matchType = intersect.getMatchType();

      if (matchType == MatchType.NONE) continue;

      results.add(intersect);
      if ((matchType == MatchType.EQUAL) || (matchType == MatchType.SUBSET)) break;
      if ((matchType == MatchType.INTERSECT) || (matchType == MatchType.SUPERSET)) needMerge = true;
      else
        // else, wtf?
        throw new RuntimeException("Unknown MatchType = " + intersect.getMatchType());
    }

    if (needMerge && (results.size() > 1))
      // BROKEN: needs to virtualize priorities
      // return priorityMerge(results); // expensive, avoid if possible
      return results;
    else return results;
  }
コード例 #2
0
ファイル: LinearFlowMap.java プロジェクト: fp7-ofelia/VeRTIGO
 /** Strip down the flow intersections to just the matching rules */
 @Override
 public List<FlowEntry> matches(long dpid, OFMatch match) {
   List<FlowEntry> results = new LinkedList<FlowEntry>();
   for (FlowEntry rule : this.rules) {
     if (rule.matches(dpid, match).getMatchType() != MatchType.NONE) results.add(rule);
   }
   return results;
 }