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


Java TypedStoredFlowEntry.life方法代码示例

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


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

示例1: 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

示例2: addOrUpdateFlows

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入方法依赖的package包/类
/**
 * Adds or updates typed flow entry from flow entry into the internal flow table.
 *
 * @param flowEntries the flow entries
 */
public synchronized void addOrUpdateFlows(FlowEntry... flowEntries) {
    for (FlowEntry fe : flowEntries) {
        // check if this new rule is an update to an existing entry
        TypedStoredFlowEntry stored = deviceFlowTable.getFlowEntry(fe);

        if (stored != null) {
            // duplicated flow entry is collected!, just skip
            if (fe.bytes() == stored.bytes() && fe.packets() == stored.packets()
                    && fe.life() == stored.life()) {
                if (log.isTraceEnabled()) {
                    log.trace("addOrUpdateFlows({}): flowId={},is DUPLICATED stats collection, just skip.",
                            sw.getStringId(), fe.id());
                }

                //FIXME modification of "stored" flow entry outside of store
                stored.setLastSeen();
                continue;
            } else if (fe.life() < stored.life()) {
                // Invalid updates the stats values, i.e., bytes, packets, durations ...
                if (log.isDebugEnabled()) {
                    log.debug(ADD_INVALID_LOG, fe.id(), stored.id(), fe.bytes(),
                            stored.bytes(), fe.life(), stored.life(),
                            fe.lastSeen(), stored.lastSeen());
                }
                // go next
                //FIXME modification of "stored" flow entry outside of store
                stored.setLastSeen();
                continue;
            }

            // update now
            //FIXME modification of "stored" flow entry outside of store
            stored.setLife(fe.life());
            stored.setPackets(fe.packets());
            stored.setBytes(fe.bytes());
            stored.setLastSeen();
            if (stored.state() == FlowEntry.FlowEntryState.PENDING_ADD) {
                // flow is really RULE_ADDED
                stored.setState(FlowEntry.FlowEntryState.ADDED);
            }
            // flow is RULE_UPDATED, skip adding and just updating flow live table
            //deviceFlowTable.calAndSetFlowLiveType(stored);
            continue;
        }

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

示例3: checkAndMoveLiveFlowInternal

import org.onosproject.net.flow.TypedStoredFlowEntry; //导入方法依赖的package包/类
private boolean checkAndMoveLiveFlowInternal(TypedStoredFlowEntry fe, long cTime) {
    long curTime = (cTime > 0 ? cTime : System.currentTimeMillis());
    // For latency adjustment(default=500 millisecond) between FlowStatsRequest and Reply
    long fromLastSeen = ((curTime - fe.lastSeen() + latencyFlowStatsRequestAndReplyMillis) / 1000);
    // fe.life() unit is SECOND!
    long liveTime = fe.life() + fromLastSeen;


    switch (fe.flowLiveType()) {
    case IMMEDIATE_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            longFlows.add(fe);
        } else if (liveTime >= midPollInterval) {
            fe.setFlowLiveType(FlowLiveType.MID_FLOW);
            midFlows.add(fe);
        } else if (liveTime >= calAndPollInterval) {
            fe.setFlowLiveType(FlowLiveType.SHORT_FLOW);
            shortFlows.add(fe);
        }
        break;
    case SHORT_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            shortFlows.remove(fe);
            longFlows.add(fe);
        } else if (liveTime >= midPollInterval) {
            fe.setFlowLiveType(FlowLiveType.MID_FLOW);
            shortFlows.remove(fe);
            midFlows.add(fe);
        }
        break;
    case MID_FLOW:
        if (liveTime >= longPollInterval) {
            fe.setFlowLiveType(FlowLiveType.LONG_FLOW);
            midFlows.remove(fe);
            longFlows.add(fe);
        }
        break;
    case LONG_FLOW:
        if (fromLastSeen > entirePollInterval) {
            log.trace("checkAndMoveLiveFlowInternal: flow is already removed at switch.");
            return false;
        }
        break;
    case UNKNOWN_FLOW: // Unknown flow is an internal error flow type, just fall through
    default:
        log.error("Unknown live type error for {}", sw.getStringId());
        return false;
    }

    if (log.isTraceEnabled()) {
        log.trace(CHECK_AND_MOVE_LOG, fe.id(), fe.state(), fe.flowLiveType(),
                liveTime, fe.life(), fe.bytes(), fe.packets(), fromLastSeen,
                fe.priority(), fe.selector().criteria(), fe.treatment(),
                sw.getStringId());
    }

    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:61,代码来源:NewAdaptiveFlowStatsCollector.java


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