当前位置: 首页>>代码示例>>Java>>正文


Java TypedStoredFlowEntry类代码示例

本文整理汇总了Java中org.onosproject.net.flow.TypedStoredFlowEntry的典型用法代码示例。如果您正苦于以下问题:Java TypedStoredFlowEntry类的具体用法?Java TypedStoredFlowEntry怎么用?Java TypedStoredFlowEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TypedStoredFlowEntry类属于org.onosproject.net.flow包,在下文中一共展示了TypedStoredFlowEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addWithCalAndSetFlowLiveType

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Adds the typed flow entry into table, and calculates and set the flow live type,
 * and then add it into a corresponding typed flow table.
 *
 * @param rule the flow rule
 */
public synchronized void addWithCalAndSetFlowLiveType(TypedStoredFlowEntry rule) {
    checkNotNull(rule);

    //rule have to be new DefaultTypedFlowEntry
    boolean result = getFlowEntriesInternal(rule.id()).add(rule);
    if (result) {
        calAndSetFlowLiveTypeInternal(rule);
        addWithSetFlowLiveTypeCount++;
    } else {
        if (log.isDebugEnabled()) {
            log.debug("FlowId {} ADD failed, it may already exist in table - {}",
                    rule.id(), sw.getStringId());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:NewAdaptiveFlowStatsCollector.java

示例2: removeLiveFlowsInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
private void removeLiveFlowsInternal(TypedStoredFlowEntry fe) {
    switch (fe.flowLiveType()) {
    case IMMEDIATE_FLOW:
        // do nothing
        break;
    case SHORT_FLOW:
        shortFlows.remove(fe);
        break;
    case MID_FLOW:
        midFlows.remove(fe);
        break;
    case LONG_FLOW:
        longFlows.remove(fe);
        break;
    default: // error in Flow Live Type
        log.error("removeLiveFlowsInternal: unknown live type error");
        break;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:NewAdaptiveFlowStatsCollector.java

示例3: getFlowLiveType

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * converts string of flow live type to FloeLiveType enum.
 *
 * @param liveType string representing the flow live type
 * @return TypedStoredFlowEntry.FlowLiveType
 */
private TypedStoredFlowEntry.FlowLiveType getFlowLiveType(String liveType) {
    String liveTypeUC = liveType.toUpperCase();

    if (liveTypeUC.equals("IMMEDIATE")) {
        return TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW;
    } else if (liveTypeUC.equals("SHORT")) {
        return TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW;
    } else if (liveTypeUC.equals("MID")) {
        return TypedStoredFlowEntry.FlowLiveType.MID_FLOW;
    } else if (liveTypeUC.equals("LONG")) {
        return TypedStoredFlowEntry.FlowLiveType.LONG_FLOW;
    } else if (liveTypeUC.equals("UNKNOWN")) {
        return TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW;
    } else {
        return null; // flow live type error
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:GetFlowStatistics.java

示例4: newTypedStoredFlowEntry

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Creates a new typed flow entry with the given flow entry fe.
 *
 * @param fe flow entry
 * @return new typed flow entry
 */
public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) {
    if (fe == null) {
        return null;
    }

    long life = fe.life();

    if (life >= LONG_POLL_INTERVAL) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.LONG_FLOW);
    } else if (life >= MID_POLL_INTERVAL) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.MID_FLOW);
    } else if (life >= CAL_AND_POLL_INTERVAL) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW);
    } else if (life >= 0) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW);
    } else { // life < 0
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:TypedFlowEntryWithLoad.java

示例5: loadAllByType

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
@Override
public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
                                                              TypedStoredFlowEntry.FlowLiveType liveType,
                                                              Instruction.Type instType) {
    checkPermission(STATISTIC_READ);

    Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(CONNECT_POINT_COMPARATOR);

    if (device == null) {
        return allLoad;
    }

    List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id()));

    for (Port port : ports) {
        ConnectPoint cp = new ConnectPoint(device.id(), port.number());
        List<TypedFlowEntryWithLoad> tfel = loadAllPortInternal(cp, liveType, instType);
        allLoad.put(cp, tfel);
    }

    return allLoad;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:FlowStatisticManager.java

示例6: loadTopnByType

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
@Override
public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device,
                                                               TypedStoredFlowEntry.FlowLiveType liveType,
                                                               Instruction.Type instType,
                                                               int topn) {
    checkPermission(STATISTIC_READ);

    Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(CONNECT_POINT_COMPARATOR);

    if (device == null) {
        return allLoad;
    }

    List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id()));

    for (Port port : ports) {
        ConnectPoint cp = new ConnectPoint(device.id(), port.number());
        List<TypedFlowEntryWithLoad> tfel = loadTopnPortInternal(cp, liveType, instType, topn);
        allLoad.put(cp, tfel);
    }

    return allLoad;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:FlowStatisticManager.java

示例7: typedFlowEntryLoadByInstInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
private List<TypedFlowEntryWithLoad> typedFlowEntryLoadByInstInternal(ConnectPoint cp,
                                                                  Map<FlowRule, TypedStoredFlowEntry> currentMap,
                                                                  Map<FlowRule, TypedStoredFlowEntry> previousMap,
                                                                  boolean isAllInstType,
                                                                  Instruction.Type instType,
                                                                  int liveTypePollInterval) {
    List<TypedFlowEntryWithLoad> fel = new ArrayList<>();

    for (TypedStoredFlowEntry tfe : currentMap.values()) {
        if (isAllInstType ||
                tfe.treatment().allInstructions().stream().
                        filter(i -> i.type() == instType).
                        findAny().isPresent()) {
            long currentBytes = tfe.bytes();
            long previousBytes = previousMap.getOrDefault(tfe, new DefaultTypedFlowEntry((FlowRule) tfe)).bytes();
            Load fLoad = new DefaultLoad(currentBytes, previousBytes, liveTypePollInterval);
            fel.add(new TypedFlowEntryWithLoad(cp, tfe, fLoad));
        }
    }

    return fel;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:FlowStatisticManager.java

示例8: typedPollInterval

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Returns current typed flow entry's polling interval.
 *
 * @param tfe typed flow entry
 * @return typed poll interval
 */
public static long typedPollInterval(TypedStoredFlowEntry tfe) {
    checkNotNull(tfe, "TypedStoredFlowEntry cannot be null");

    PollInterval pollIntervalInstance = PollInterval.getInstance();

    switch (tfe.flowLiveType()) {
        case LONG_FLOW:
            return pollIntervalInstance.getLongPollInterval();
        case MID_FLOW:
            return pollIntervalInstance.getMidPollInterval();
        case SHORT_FLOW:
        case IMMEDIATE_FLOW:
        default:
            return pollIntervalInstance.getPollInterval();
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:TypedFlowEntryWithLoad.java

示例9: newTypedStoredFlowEntry

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Creates a new typed flow entry with the given flow entry fe.
 *
 * @param fe flow entry
 * @return new typed flow entry
 */
public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) {
    if (fe == null) {
        return null;
    }

    long life = fe.life();
    PollInterval pollIntervalInstance = PollInterval.getInstance();

    if (life < 0) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW);
    } else if (life < pollIntervalInstance.getPollInterval()) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW);
    } else if (life < pollIntervalInstance.getMidPollInterval()) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW);
    } else if (life < pollIntervalInstance.getLongPollInterval()) {
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.MID_FLOW);
    } else { // >= longPollInterval
        return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.LONG_FLOW);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:TypedFlowEntryWithLoad.java

示例10: toTypedStoredFlowEntryLiveType

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
private TypedStoredFlowEntry.FlowLiveType toTypedStoredFlowEntryLiveType(FlowEntry.FlowLiveType liveType) {
    if (liveType == null) {
        return null;
    }

    // convert TypedStoredFlowEntry flow live type to FlowEntry one
    switch (liveType) {
        case IMMEDIATE:
            return TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW;
        case SHORT:
            return TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW;
        case MID:
            return TypedStoredFlowEntry.FlowLiveType.MID_FLOW;
        case LONG:
            return TypedStoredFlowEntry.FlowLiveType.LONG_FLOW;
        default:
            return TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW;
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:20,代码来源:FlowStatisticManager.java

示例11: addWithFlowRule

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Adds typed flow entry from flow rule into the internal flow table.
 *
 * @param flowRules the flow rules
 */
public synchronized void addWithFlowRule(FlowRule... flowRules) {
    for (FlowRule fr : flowRules) {
        // First remove old entry unconditionally, if exist
        deviceFlowTable.remove(fr);

        // add new flow entry, we suppose IMMEDIATE_FLOW
        TypedStoredFlowEntry newFlowEntry = new DefaultTypedFlowEntry(fr,
                FlowLiveType.IMMEDIATE_FLOW);
        deviceFlowTable.addWithCalAndSetFlowLiveType(newFlowEntry);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:NewAdaptiveFlowStatsCollector.java

示例12: getFlowEntryInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
private TypedStoredFlowEntry getFlowEntryInternal(FlowRule rule) {
    Set<TypedStoredFlowEntry> flowEntries = getFlowEntriesInternal(rule.id());
    return flowEntries.stream()
            .filter(entry -> Objects.equal(entry, rule))
            .findAny()
            .orElse(null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:NewAdaptiveFlowStatsCollector.java

示例13: add

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Add typed flow entry into table only.
 *
 * @param rule the flow rule
 */
public synchronized void add(TypedStoredFlowEntry rule) {
    checkNotNull(rule);

    //rule have to be new DefaultTypedFlowEntry
    boolean result = getFlowEntriesInternal(rule.id()).add(rule);

    if (result) {
        addCount++;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:NewAdaptiveFlowStatsCollector.java

示例14: calAndSetFlowLiveTypeInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
private void calAndSetFlowLiveTypeInternal(TypedStoredFlowEntry rule) {
    long life = rule.life();
    FlowLiveType prevFlowLiveType = rule.flowLiveType();

    if (life >= longPollInterval) {
        rule.setFlowLiveType(FlowLiveType.LONG_FLOW);
        longFlows.add(rule);
    } else if (life >= midPollInterval) {
        rule.setFlowLiveType(FlowLiveType.MID_FLOW);
        midFlows.add(rule);
    } else if (life >= calAndPollInterval) {
        rule.setFlowLiveType(FlowLiveType.SHORT_FLOW);
        shortFlows.add(rule);
    } else if (life >= 0) {
        rule.setFlowLiveType(FlowLiveType.IMMEDIATE_FLOW);
    } else { // life < 0
        rule.setFlowLiveType(FlowLiveType.UNKNOWN_FLOW);
    }

    if (rule.flowLiveType() != prevFlowLiveType) {
        switch (prevFlowLiveType) {
        // delete it from previous flow table
        case SHORT_FLOW:
            shortFlows.remove(rule);
            break;
        case MID_FLOW:
            midFlows.remove(rule);
            break;
        case LONG_FLOW:
            longFlows.remove(rule);
            break;
        default:
            break;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:NewAdaptiveFlowStatsCollector.java

示例15: checkAndMoveLiveFlowAll

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入依赖的package包/类
/**
 * Checks and moves live type for all type flow entries in table at every calAndPollInterval time.
 */
public void checkAndMoveLiveFlowAll() {
    Set<TypedStoredFlowEntry> typedFlowEntries = getFlowEntriesInternal();

    long calCurTime = System.currentTimeMillis();
    typedFlowEntries.forEach(fe -> {
        if (!checkAndMoveLiveFlowInternal(fe, calCurTime)) {
            remove(fe);
        }
    });

    // print table counts for debug
    if (log.isTraceEnabled()) {
        synchronized (this) {
            long totalFlowCount = getFlowCount();
            long shortFlowCount = shortFlows.size();
            long midFlowCount = midFlows.size();
            long longFlowCount = longFlows.size();
            long immediateFlowCount = totalFlowCount - shortFlowCount - midFlowCount - longFlowCount;
            long calTotalCount = addCount + addWithSetFlowLiveTypeCount - removeCount;

            log.trace(CHECK_AND_MOVE_COUNT_LOG, totalFlowCount, calTotalCount,
                    immediateFlowCount, shortFlowCount, midFlowCount, longFlowCount,
                    addCount, addWithSetFlowLiveTypeCount, removeCount, sw.getStringId());

            if (totalFlowCount != calTotalCount) {
                log.error("Real total flow count and calculated total flow count do NOT match");
            }
            if (immediateFlowCount < 0) {
                log.error("Immediate flow count is negative");
            }
        }
    }
    log.trace("checkAndMoveLiveFlowAll: adaptiveStats for {}", sw.getStringId());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:NewAdaptiveFlowStatsCollector.java


注:本文中的org.onosproject.net.flow.TypedStoredFlowEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。