use of org.onosproject.net.flow.instructions.Instructions.NoActionInstruction in project onos by opennetworkinglab.
the class OvsOfdpaPipeline method versatileTreatmentBuilder.
@Override
protected TrafficTreatment.Builder versatileTreatmentBuilder(ForwardingObjective fwd) {
// XXX driver does not currently do type checking as per Tables 65-67 in
// OFDPA 2.0 spec. The only allowed treatment is a punt to the controller.
TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder();
if (fwd.treatment() != null) {
for (Instruction ins : fwd.treatment().allInstructions()) {
if (ins instanceof OutputInstruction) {
OutputInstruction o = (OutputInstruction) ins;
if (PortNumber.CONTROLLER.equals(o.port())) {
ttBuilder.transition(PUNT_TABLE);
} else {
log.warn("Only allowed treatments in versatile forwarding " + "objectives are punts to the controller");
}
} else if (ins instanceof NoActionInstruction) {
// No action is allowed and nothing needs to be done
} else {
log.warn("Cannot process instruction in versatile fwd {}", ins);
}
}
if (fwd.treatment().clearedDeferred()) {
ttBuilder.wipeDeferred();
}
}
if (fwd.nextId() != null) {
// Override case
NextGroup next = getGroupForNextObjective(fwd.nextId());
if (next == null) {
fail(fwd, ObjectiveError.BADPARAMS);
return null;
}
List<Deque<GroupKey>> gkeys = appKryo.deserialize(next.data());
// we only need the top level group's key to point the flow to it
Group group = groupService.getGroup(deviceId, gkeys.get(0).peekFirst());
if (group == null) {
log.warn("Group with key:{} for next-id:{} not found in dev:{}", gkeys.get(0).peekFirst(), fwd.nextId(), deviceId);
fail(fwd, ObjectiveError.GROUPMISSING);
return null;
}
ttBuilder.deferred().group(group.id());
}
return ttBuilder;
}
use of org.onosproject.net.flow.instructions.Instructions.NoActionInstruction in project onos by opennetworkinglab.
the class Ofdpa2Pipeline method versatileTreatmentBuilder.
/**
* Helper function to create traffic treatment builder for versatile forwarding objectives.
*
* @param fwd original forwarding objective
* @return treatment builder for the flow rule, or null if there is an error.
*/
protected TrafficTreatment.Builder versatileTreatmentBuilder(ForwardingObjective fwd) {
// XXX driver does not currently do type checking as per Tables 65-67 in
// OFDPA 2.0 spec. The only allowed treatment is a punt to the controller.
TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder();
if (fwd.treatment() != null) {
for (Instruction ins : fwd.treatment().allInstructions()) {
if (ins instanceof OutputInstruction) {
OutputInstruction o = (OutputInstruction) ins;
if (PortNumber.CONTROLLER.equals(o.port())) {
ttBuilder.add(o);
} else {
log.warn("Only allowed treatments in versatile forwarding " + "objectives are punts to the controller");
}
} else if (ins instanceof NoActionInstruction) {
// No action is allowed and nothing needs to be done
} else {
log.warn("Cannot process instruction in versatile fwd {}", ins);
}
}
if (fwd.treatment().clearedDeferred()) {
ttBuilder.wipeDeferred();
}
}
if (fwd.nextId() != null) {
// Override case
NextGroup next = getGroupForNextObjective(fwd.nextId());
if (next == null) {
fail(fwd, ObjectiveError.BADPARAMS);
return null;
}
List<Deque<GroupKey>> gkeys = appKryo.deserialize(next.data());
// we only need the top level group's key to point the flow to it
Group group = groupService.getGroup(deviceId, gkeys.get(0).peekFirst());
if (group == null) {
log.warn("Group with key:{} for next-id:{} not found in dev:{}", gkeys.get(0).peekFirst(), fwd.nextId(), deviceId);
fail(fwd, ObjectiveError.GROUPMISSING);
return null;
}
ttBuilder.deferred().group(group.id());
}
return ttBuilder;
}
use of org.onosproject.net.flow.instructions.Instructions.NoActionInstruction in project onos by opennetworkinglab.
the class InstructionJsonMatcher method matchesSafely.
@Override
public boolean matchesSafely(JsonNode jsonInstruction, Description description) {
// check type
final JsonNode jsonTypeNode = jsonInstruction.get("type");
final String jsonType = jsonTypeNode.textValue();
final String type = instruction.type().name();
if (!jsonType.equals(type)) {
description.appendText("type was " + type);
return false;
}
if (instruction instanceof ModMplsHeaderInstruction) {
return matchModMplsHeaderInstruction(jsonInstruction, description);
} else if (instruction instanceof OutputInstruction) {
return matchOutputInstruction(jsonInstruction, description);
} else if (instruction instanceof GroupInstruction) {
return matchGroupInstruction(jsonInstruction, description);
} else if (instruction instanceof MeterInstruction) {
return matchMeterInstruction(jsonInstruction, description);
} else if (instruction instanceof SetQueueInstruction) {
return matchSetQueueInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOchSignalInstruction) {
return matchModOchSingalInstruction(jsonInstruction, description);
} else if (instruction instanceof ModEtherInstruction) {
return matchModEtherInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanIdInstruction) {
return matchModVlanIdInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanPcpInstruction) {
return matchModVlanPcpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPInstruction) {
return matchModIpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPv6FlowLabelInstruction) {
return matchModIPv6FlowLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModMplsLabelInstruction) {
return matchModMplsLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOduSignalIdInstruction) {
return matchModOduSingalIdInstruction(jsonInstruction, description);
} else if (instruction instanceof PiInstruction) {
return matchPiInstruction(jsonInstruction, description);
} else if (instruction instanceof NoActionInstruction) {
return true;
}
return false;
}
Aggregations