本文整理汇总了Java中org.onosproject.net.flow.TypedStoredFlowEntry.flowLiveType方法的典型用法代码示例。如果您正苦于以下问题:Java TypedStoredFlowEntry.flowLiveType方法的具体用法?Java TypedStoredFlowEntry.flowLiveType怎么用?Java TypedStoredFlowEntry.flowLiveType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flow.TypedStoredFlowEntry
的用法示例。
在下文中一共展示了TypedStoredFlowEntry.flowLiveType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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();
}
}
示例3: 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;
}
}
}
示例4: 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");
switch (tfe.flowLiveType()) {
case LONG_FLOW:
return LONG_POLL_INTERVAL;
case MID_FLOW:
return MID_POLL_INTERVAL;
case SHORT_FLOW:
case IMMEDIATE_FLOW:
default:
return CAL_AND_POLL_INTERVAL;
}
}
示例5: 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;
}