use of org.onosproject.net.flow.DefaultTypedFlowEntry in project onos by opennetworkinglab.
the class FlowStatisticManager method toFlowEntryWithLoad.
private List<TypedFlowEntryWithLoad> toFlowEntryWithLoad(List<FlowEntryWithLoad> loadList) {
// convert FlowEntryWithLoad list to TypedFlowEntryWithLoad list
List<TypedFlowEntryWithLoad> tfelList = new ArrayList<>();
loadList.forEach(fel -> {
StoredFlowEntry sfe = fel.storedFlowEntry();
TypedStoredFlowEntry.FlowLiveType liveType = toTypedStoredFlowEntryLiveType(sfe.liveType());
TypedStoredFlowEntry tfe = new DefaultTypedFlowEntry(sfe, liveType);
TypedFlowEntryWithLoad tfel = new TypedFlowEntryWithLoad(fel.connectPoint(), tfe, fel.load());
tfelList.add(tfel);
});
return tfelList;
}
use of org.onosproject.net.flow.DefaultTypedFlowEntry in project onos by opennetworkinglab.
the class TypedFlowEntryWithLoad method newTypedStoredFlowEntry.
/**
* 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);
}
}
Aggregations