private Collection<FlowRule> processForward(ForwardingObjective forwardingObjective) { switch (forwardingObjective.flag()) { case SPECIFIC: return processSpecific(forwardingObjective); case VERSATILE: return processVersatile(forwardingObjective); default: fail(forwardingObjective, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", forwardingObjective.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
public static int forwardingObjectiveHash(ForwardingObjective forwardingObjective) { return Objects.hash(forwardingObjective.selector(), forwardingObjective.flag(), forwardingObjective.permanent(), forwardingObjective.timeout(), forwardingObjective.appId(), forwardingObjective.priority(), forwardingObjective.nextId(), forwardingObjective.treatment()); } }
@Override public ObjectNode encode(ForwardingObjective forwardingObjective, CodecContext context) { checkNotNull(forwardingObjective, NOT_NULL_MESSAGE); final JsonCodec<TrafficTreatment> trafficTreatmentCodec = context.codec(TrafficTreatment.class); final JsonCodec<TrafficSelector> trafficSelectorCodec = context.codec(TrafficSelector.class); // encode common properties ObjectiveCodecHelper och = new ObjectiveCodecHelper(); ObjectNode result = och.encode(forwardingObjective, context); // encode id result.put(ID, forwardingObjective.id()); // encode flag result.put(FLAG, forwardingObjective.flag().toString()); // encode op result.put(OPERATION, forwardingObjective.op().toString()); // encode selector ObjectNode trafficSelectorNode = trafficSelectorCodec.encode(forwardingObjective.selector(), context); result.set(SELECTOR, trafficSelectorNode); // encode nextId if (forwardingObjective.nextId() != null) { result.put(NEXT_ID, forwardingObjective.nextId()); } // encode treatment if (forwardingObjective.treatment() != null) { ObjectNode trafficTreatmentNode = trafficTreatmentCodec.encode(forwardingObjective.treatment(), context); result.set(TREATMENT, trafficTreatmentNode); } return result; }
public List<ForwardingObjective> getGeneratedParentForwardingObjectiveForRemove(ForwardingObjective child) { List<ForwardingObjective> fos = this.generatedParentForwardingObjectiveMap.get(forwardingObjectiveHash(child)); List<ForwardingObjective> removeFos = new ArrayList<>(); for (ForwardingObjective fo : fos) { removeFos.add(DefaultForwardingObjective.builder() .fromApp(fo.appId()) .makePermanent() .withFlag(fo.flag()) .withPriority(fo.priority()) .withSelector(fo.selector()) .withTreatment(fo.treatment()) .remove()); } return removeFos; }
public static ForwardingObjective composeOverride(ForwardingObjective fo, int priorityAddend) { return DefaultForwardingObjective.builder() .fromApp(fo.appId()) .makePermanent() .withFlag(fo.flag()) .withPriority(fo.priority() + priorityAddend) .withSelector(fo.selector()) .withTreatment(fo.treatment()) .add(); }