Search in sources :

Example 1 with DefaultFlowRule

use of org.onosproject.net.flow.DefaultFlowRule in project onos by opennetworkinglab.

the class ECFlowRuleStore method updateStoreInternal.

private Set<FlowRuleBatchEntry> updateStoreInternal(FlowRuleBatchOperation operation) {
    return operation.getOperations().stream().map(op -> {
        StoredFlowEntry entry;
        switch(op.operator()) {
            case ADD:
                entry = new DefaultFlowEntry(op.target());
                log.debug("Adding flow rule: {}", entry);
                flowTable.add(entry);
                return op;
            case MODIFY:
                entry = new DefaultFlowEntry(op.target());
                log.debug("Updating flow rule: {}", entry);
                flowTable.update(entry);
                return op;
            case REMOVE:
                return flowTable.update(op.target(), stored -> {
                    stored.setState(FlowEntryState.PENDING_REMOVE);
                    log.debug("Setting state of rule to pending remove: {}", stored);
                    // of flows that do not specify actions or have empty treatment
                    return new FlowRuleBatchEntry(op.operator(), new DefaultFlowRule(stored));
                });
            default:
                log.warn("Unknown flow operation operator: {}", op.operator());
        }
        return null;
    }).filter(Objects::nonNull).collect(Collectors.toSet());
}
Also used : StoredFlowEntry(org.onosproject.net.flow.StoredFlowEntry) DefaultFlowEntry(org.onosproject.net.flow.DefaultFlowEntry) FlowRuleBatchEntry(org.onosproject.net.flow.oldbatch.FlowRuleBatchEntry) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule)

Aggregations

DefaultFlowEntry (org.onosproject.net.flow.DefaultFlowEntry)1 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)1 StoredFlowEntry (org.onosproject.net.flow.StoredFlowEntry)1 FlowRuleBatchEntry (org.onosproject.net.flow.oldbatch.FlowRuleBatchEntry)1