本文整理汇总了Java中org.onosproject.net.flow.TypedStoredFlowEntry.bytes方法的典型用法代码示例。如果您正苦于以下问题:Java TypedStoredFlowEntry.bytes方法的具体用法?Java TypedStoredFlowEntry.bytes怎么用?Java TypedStoredFlowEntry.bytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flow.TypedStoredFlowEntry
的用法示例。
在下文中一共展示了TypedStoredFlowEntry.bytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例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);
}
}
示例3: TypedFlowEntryWithLoad
import org.onosproject.net.flow.TypedStoredFlowEntry; //导入方法依赖的package包/类
/**
* Creates a new typed flow entry with load.
*
* @param cp connect point
* @param tfe typed flow entry
*/
public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe) {
this.cp = cp;
this.tfe = tfe;
this.load = new DefaultLoad(tfe.bytes(), 0, typedPollInterval(tfe));
}