Search in sources :

Example 1 with DefaultTypedFlowEntry

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;
}
Also used : TypedStoredFlowEntry(org.onosproject.net.flow.TypedStoredFlowEntry) TypedStoredFlowEntry(org.onosproject.net.flow.TypedStoredFlowEntry) StoredFlowEntry(org.onosproject.net.flow.StoredFlowEntry) TypedFlowEntryWithLoad(org.onosproject.net.statistic.TypedFlowEntryWithLoad) DefaultTypedFlowEntry(org.onosproject.net.flow.DefaultTypedFlowEntry) ArrayList(java.util.ArrayList)

Example 2 with DefaultTypedFlowEntry

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);
    }
}
Also used : DefaultTypedFlowEntry(org.onosproject.net.flow.DefaultTypedFlowEntry)

Aggregations

DefaultTypedFlowEntry (org.onosproject.net.flow.DefaultTypedFlowEntry)2 ArrayList (java.util.ArrayList)1 StoredFlowEntry (org.onosproject.net.flow.StoredFlowEntry)1 TypedStoredFlowEntry (org.onosproject.net.flow.TypedStoredFlowEntry)1 TypedFlowEntryWithLoad (org.onosproject.net.statistic.TypedFlowEntryWithLoad)1