use of org.onosproject.net.flowobjective.DefaultForwardingObjective in project onos by opennetworkinglab.
the class IntentFilter method getFlowEntries.
/**
* Finds all flow entries created by FlowObjectiveIntent.
*
* @param intent FlowObjectiveIntent Object
* @return set of flow entries created by FlowObjectiveIntent
*/
private List<FlowEntry> getFlowEntries(FlowObjectiveIntent intent) {
List<FlowEntry> flowEntries = new ArrayList<>();
Iterator<Objective> objectives = intent.objectives().iterator();
Iterator<DeviceId> devices = intent.devices().iterator();
DefaultNextObjective nextObjective = null;
DefaultForwardingObjective forwardObjective;
Objective objective;
DeviceId deviceId;
FlowEntry flowEntry;
while (objectives.hasNext()) {
objective = objectives.next();
deviceId = devices.next();
if (objective instanceof NextObjective) {
nextObjective = (DefaultNextObjective) objective;
} else if (objective instanceof ForwardingObjective) {
forwardObjective = (DefaultForwardingObjective) objective;
FlowRule.Builder builder = DefaultFlowRule.builder().forDevice(deviceId).withSelector(forwardObjective.selector()).withPriority(intent.priority()).fromApp(intent.appId()).makePermanent();
if (nextObjective != null) {
builder.withTreatment(nextObjective.next().iterator().next());
}
FlowRule flowRule = builder.build();
flowEntry = getFlowEntry(flowRule);
if (flowEntry != null) {
flowEntries.add(flowEntry);
}
}
}
return flowEntries;
}
Aggregations