use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder in project netvirt by opendaylight.
the class OpenFlow13Utils method createActionOutPort.
public static Action createActionOutPort(final String portUri, final int order) {
OutputActionBuilder output = new OutputActionBuilder();
Uri value = new Uri(portUri);
output.setOutputNodeConnector(value);
ActionBuilder ab = createActionBuilder(order);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
return ab.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createOutputInstructions.
private static InstructionsBuilder createOutputInstructions(final String outputType, final int outputValue) {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final OutputActionBuilder output = new OutputActionBuilder();
output.setMaxLength(outputValue);
final Uri value = new Uri(outputType);
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
ab.setOrder(0);
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
// Create an Apply Action
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
// Wrap our Apply Action in an Instruction
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction1.
private static InstructionsBuilder createAppyActionInstruction1() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final OutputActionBuilder output = new OutputActionBuilder();
output.setMaxLength(56);
final Uri value = new Uri("PCEP");
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
// Create an Apply Action
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
// Wrap our Apply Action in an Instruction
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
ib.setKey(new InstructionKey(0));
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createSentToControllerInstructions.
private static InstructionsBuilder createSentToControllerInstructions() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final OutputActionBuilder output = new OutputActionBuilder();
output.setMaxLength(Integer.valueOf(0xffff));
final Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
ab.setOrder(0);
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
// Create an Apply Action
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
// Wrap our Apply Action in an Instruction
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder in project openflowplugin by opendaylight.
the class PacketOutConvertor method convert.
@Override
public PacketOutInput convert(TransmitPacketInput source, PacketOutConvertorData data) {
LOG.trace("toPacketOutInput for datapathId:{}, xid:{}", data.getDatapathId(), data.getXid());
// Build Port ID from TransmitPacketInput.Ingress
PortNumber inPortNr;
Long bufferId = OFConstants.OFP_NO_BUFFER;
Iterable<PathArgument> inArgs = null;
if (source.getIngress() != null) {
inArgs = source.getIngress().getValue().getPathArguments();
}
if (inArgs != null && Iterables.size(inArgs) >= 3) {
inPortNr = getPortNumber(Iterables.get(inArgs, 2), data.getVersion());
} else {
// The packetOut originated from the controller
inPortNr = new PortNumber(0xfffffffdL);
}
// Build Buffer ID to be NO_OFP_NO_BUFFER
if (source.getBufferId() != null) {
bufferId = source.getBufferId();
}
PortNumber outPort = null;
NodeConnectorRef outRef = source.getEgress();
Iterable<PathArgument> outArgs = outRef.getValue().getPathArguments();
if (Iterables.size(outArgs) >= 3) {
outPort = getPortNumber(Iterables.get(outArgs, 2), data.getVersion());
} else {
// TODO : P4 search for some normal exception
// new Exception("PORT NR not exist in Egress");
LOG.error("PORT NR not exist in Egress");
}
List<Action> actions = new ArrayList<>();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> inputActions = source.getAction();
if (inputActions != null) {
final ActionConvertorData actionConvertorData = new ActionConvertorData(data.getVersion());
actionConvertorData.setDatapathId(data.getDatapathId());
final Optional<List<Action>> convertedActions = getConvertorExecutor().convert(inputActions, actionConvertorData);
actions = convertedActions.orElse(Collections.emptyList());
} else {
// TODO VD P! wait for way to move Actions (e.g. augmentation)
OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
outputActionBuilder.setPort(outPort);
outputActionBuilder.setMaxLength(OFConstants.OFPCML_NO_BUFFER);
outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
ActionBuilder actionBuild = new ActionBuilder();
actionBuild.setActionChoice(outputActionCaseBuilder.build());
actions.add(actionBuild.build());
}
PacketOutInputBuilder builder = new PacketOutInputBuilder();
builder.setAction(actions);
builder.setData(source.getPayload());
builder.setVersion(data.getVersion());
builder.setXid(data.getXid());
builder.setInPort(inPortNr);
builder.setBufferId(bufferId);
return builder.build();
}
Aggregations