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());
}
Aggregations