.append(", Treatments: ") .append(((NextObjective) pn.flowObjective()) .next());
/** * Next Objectives are stored as dummy groups for retrieval later * when Forwarding Objectives reference the next objective id. At that point * the dummy group is fetched from the distributed store and the enclosed * treatment is applied as a flow rule action. * * @param nextObj the next objective of type simple */ private void processSimpleNextObjective(NextObjective nextObj) { // Simple next objective has a single treatment (not a collection) log.debug("Received nextObj {}", nextObj.id()); // delay processing to emulate group creation delay(50); TrafficTreatment treatment = nextObj.next().iterator().next(); flowObjectiveStore.putNextGroup(nextObj.id(), new DummyGroup(treatment)); }
@Override public void next(NextObjective nextObjective) { switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() != 1) { log.error("Next Objectives of type Simple should only have a " + "single Traffic Treatment. Next Objective Id:{}", nextObjective.id()); fail(nextObjective, ObjectiveError.BADPARAMS); return; } processSimpleNextObjective(nextObjective); break; case HASHED: case BROADCAST: case FAILOVER: fail(nextObjective, ObjectiveError.UNSUPPORTED); log.warn("Unsupported next objective type {}", nextObjective.type()); break; default: fail(nextObjective, ObjectiveError.UNKNOWN); log.warn("Unknown next objective type {}", nextObjective.type()); } }
@Override public ObjectNode encode(NextObjective nextObjective, CodecContext context) { checkNotNull(nextObjective, 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(nextObjective, context); // encode id result.put(ID, nextObjective.id()); // encode type result.put(TYPE, nextObjective.type().toString()); // encode operation result.put(OPERATION, nextObjective.op().toString()); // encode treatments ArrayNode treatments = context.mapper().createArrayNode(); nextObjective.next().forEach(t -> { ObjectNode treatmentJson = trafficTreatmentCodec.encode(t, context); treatments.add(treatmentJson); }); result.set(TREATMENTS, treatments); // encode meta if (nextObjective.meta() != null) { ObjectNode trafficSelectorNode = trafficSelectorCodec.encode(nextObjective.meta(), context); result.set(META, trafficSelectorNode); } return result; }
protected void addGroup(NextObjective nextObjective) { switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() != 1) { log.error("Next Objectives of type Simple should only have a " + "single Traffic Treatment. Next Objective Id:{}", nextObjective.id()); Ofdpa2Pipeline.fail(nextObjective, ObjectiveError.BADPARAMS); return; } processSimpleNextObjective(nextObjective); break; case BROADCAST: processBroadcastNextObjective(nextObjective); break; case HASHED: processHashedNextObjective(nextObjective); break; case FAILOVER: Ofdpa2Pipeline.fail(nextObjective, ObjectiveError.UNSUPPORTED); log.warn("Unsupported next objective type {}", nextObjective.type()); break; default: Ofdpa2Pipeline.fail(nextObjective, ObjectiveError.UNKNOWN); log.warn("Unknown next objective type {}", nextObjective.type()); } }
private void addBucketToGroup(NextObjective nextObjective) { log.debug("addBucketToGroup in {}: for next objective id {}", deviceId, nextObjective.id()); Collection<TrafficTreatment> treatments = nextObjective.next(); TrafficTreatment treatment = treatments.iterator().next(); final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective .id())); Group group = groupService.getGroup(deviceId, key); if (group == null) { log.warn("Group is not found in {} for {}", deviceId, key); return; } GroupBucket bucket; if (group.type() == GroupDescription.Type.INDIRECT) { bucket = DefaultGroupBucket.createIndirectGroupBucket(treatment); } else if (group.type() == GroupDescription.Type.SELECT) { bucket = DefaultGroupBucket.createSelectGroupBucket(treatment); } else if (group.type() == GroupDescription.Type.ALL) { bucket = DefaultGroupBucket.createAllGroupBucket(treatment); } else { log.warn("Unsupported Group type {}", group.type()); return; } GroupBuckets bucketsToAdd = new GroupBuckets(Collections.singletonList(bucket)); log.debug("Adding buckets to group id {} of next objective id {} in device {}", group.id(), nextObjective.id(), deviceId); groupService.addBucketsToGroup(deviceId, key, bucketsToAdd, key, appId); }
switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() == 1) { TrafficTreatment treatment = nextObjective.next().iterator().next(); log.debug("Converting SIMPLE group for next objective id {} " + "to {} flow-actions in device:{}", nextObjective.id(), "to flow-actions in device:{}", nextObjective.id(), deviceId); TrafficTreatment treatment = nextObjective.next().iterator().next(); flowObjectiveStore.putNextGroup(nextObjective.id(), new SpringOpenGroup(null, treatment)); .next() .stream() .map((treatment) -> DefaultGroupBucket case BROADCAST: buckets = nextObjective .next() .stream() .map((treatment) -> DefaultGroupBucket
NextGroup nextGroup = flowObjectiveStore.getNextGroup(nextObjective.id()); if (nextGroup != null) { Collection<TrafficTreatment> treatments = nextObjective.next(); TrafficTreatment treatment = treatments.iterator().next(); final GroupKey key = new DefaultGroupKey(
TrafficTreatment treatment = nextObj.next().iterator().next();
return; if (nextObjective.next().size() > 1) { log.warn("Only one bucket can be added at a time"); return;
return; Collection<TrafficTreatment> treatments = nextObjective.next(); TrafficTreatment treatment = treatments.iterator().next();
List<GroupInfo> unsentGroups) { Collection<TrafficTreatment> buckets = nextObj.next();
switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() == 1) { TrafficTreatment treatment = treatments.iterator().next();
switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() != 1) { log.error("Next Objectives of type Simple should only have a "
Collection<TrafficTreatment> buckets = nextObj.next();
if (nextObjective != null) { pendingNext.invalidate(fwd.nextId()); nextObjective.next().forEach(treat -> { FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .forDevice(deviceId)