use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder in project netvirt by opendaylight.
the class OpenFlow13Utils method wrapActionsIntoApplyActionsInstruction.
public static InstructionsBuilder wrapActionsIntoApplyActionsInstruction(List<Action> theActions) {
// Create an Apply Action
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(theActions);
// Wrap our Apply Action in an Instruction
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
List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
return new InstructionsBuilder().setInstruction(instructions);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder in project openflowplugin by opendaylight.
the class TableFeaturesConvertorTest method setupTest.
@Before
public void setupTest() {
setupInstructionsList();
setupActions();
setupFieldTableFeatures();
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
for (int i = 0; i < INSTRUCTIONS_LIST.size(); i++) {
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstruction(INSTRUCTIONS_LIST.get(i));
instructions.add(instructionBuilder.build());
}
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder instructionsBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder();
instructionsBuilder1.setInstruction(instructions);
instructionsBuilder.setInstructions(instructionsBuilder1.build());
AUGMENTATIONS_MAP.put(Instructions.class, instructionsBuilder.build());
InstructionsMissBuilder instructionsMissBuilder = new InstructionsMissBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder instructionsMissBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder();
instructionsMissBuilder1.setInstruction(instructions);
instructionsMissBuilder.setInstructionsMiss(instructionsMissBuilder1.build());
AUGMENTATIONS_MAP.put(InstructionsMiss.class, instructionsMissBuilder.build());
NextTableBuilder nextTableBuilder = new NextTableBuilder();
AUGMENTATIONS_MAP.put(NextTable.class, nextTableBuilder.build());
NextTableMissBuilder nextTableMissBuilder = new NextTableMissBuilder();
AUGMENTATIONS_MAP.put(NextTableMiss.class, nextTableMissBuilder.build());
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
AUGMENTATIONS_MAP.put(WriteActions.class, writeActionsBuilder.build());
WriteActionsMissBuilder writeActionsMissBuilder = new WriteActionsMissBuilder();
AUGMENTATIONS_MAP.put(WriteActionsMiss.class, writeActionsMissBuilder.build());
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
AUGMENTATIONS_MAP.put(ApplyActions.class, applyActionsBuilder.build());
ApplyActionsMissBuilder applyActionsMissBuilder = new ApplyActionsMissBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder applyActionsMissBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder();
applyActionsMissBuilder1.setAction(ACTIONS);
applyActionsMissBuilder.setApplyActionsMiss(applyActionsMissBuilder1.build());
AUGMENTATIONS_MAP.put(ApplyActionsMiss.class, applyActionsMissBuilder.build());
MatchBuilder matchBuilder = new MatchBuilder();
AUGMENTATIONS_MAP.put(Match.class, matchBuilder.build());
WildcardsBuilder wildcardsBuilder = new WildcardsBuilder();
AUGMENTATIONS_MAP.put(Wildcards.class, wildcardsBuilder.build());
WriteSetfieldBuilder writeSetfieldBuilder = new WriteSetfieldBuilder();
AUGMENTATIONS_MAP.put(WriteSetfield.class, writeSetfieldBuilder.build());
WriteSetfieldMissBuilder writeSetfieldMissBuilder = new WriteSetfieldMissBuilder();
AUGMENTATIONS_MAP.put(WriteSetfieldMiss.class, writeSetfieldMissBuilder.build());
ApplySetfieldBuilder applySetfieldBuilder = new ApplySetfieldBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
applySetfieldBuilder1.setSetFieldMatch(FIELD_TABLE_FEATURES);
applySetfieldBuilder.setApplySetfield(applySetfieldBuilder1.build());
AUGMENTATIONS_MAP.put(ApplySetfield.class, applySetfieldBuilder.build());
ApplySetfieldMissBuilder applySetfieldMissBuilder = new ApplySetfieldMissBuilder();
AUGMENTATIONS_MAP.put(ApplySetfieldMiss.class, applySetfieldMissBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder in project openflowplugin by opendaylight.
the class FlowStatsResponseConvertorTest method testToSALInstruction.
/**
* Test method for {@link FlowInstructionResponseConvertor#convert(List, VersionConvertorData)} }.
*/
@Test
public void testToSALInstruction() {
List<Instruction> instructionsList = new ArrayList<>();
InstructionBuilder instructionBuilder = new InstructionBuilder();
for (int i = 0; i < PRESET_COUNT; i++) {
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
ActionBuilder actionBuilder = new ActionBuilder();
List<Action> actions = new ArrayList<>();
for (int j = 0; j < PRESET_COUNT; j++) {
actions.add(actionBuilder.build());
}
applyActionsBuilder.setAction(actions);
applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
instructionBuilder.setInstructionChoice(applyActionsCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
Instructions instructions;
VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
instructions = convert(instructionsList, data);
assertNotNull(instructions);
assertEquals(PRESET_COUNT, instructions.getInstruction().size());
instructionsList = new ArrayList<>();
for (int i = 0; i < PRESET_COUNT; i++) {
GotoTableCaseBuilder gotoTableCaseBuilder = new GotoTableCaseBuilder();
GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
gotoTableBuilder.setTableId((short) i);
gotoTableCaseBuilder.setGotoTable(gotoTableBuilder.build());
instructionBuilder.setInstructionChoice(gotoTableCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
instructions = convert(instructionsList, data);
assertNotNull(instructions);
assertEquals(PRESET_COUNT, instructions.getInstruction().size());
instructionsList = new ArrayList<>();
for (int i = 0; i < PRESET_COUNT; i++) {
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
meterBuilder.setMeterId((long) i);
meterCaseBuilder.setMeter(meterBuilder.build());
instructionBuilder.setInstructionChoice(meterCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
instructions = convert(instructionsList, data);
assertNotNull(instructions);
assertEquals(PRESET_COUNT, instructions.getInstruction().size());
instructionsList = new ArrayList<>();
for (int i = 0; i < PRESET_COUNT; i++) {
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
ActionBuilder actionBuilder = new ActionBuilder();
List<Action> actions = new ArrayList<>();
for (int j = 0; j < PRESET_COUNT; j++) {
actions.add(actionBuilder.build());
}
writeActionsBuilder.setAction(actions);
writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
instructionBuilder.setInstructionChoice(writeActionsCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
instructions = convert(instructionsList, data);
assertNotNull(instructions);
assertEquals(PRESET_COUNT, instructions.getInstruction().size());
instructionsList = new ArrayList<>();
for (int i = 0; i < PRESET_COUNT; i++) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
instructionBuilder.setInstructionChoice(clearActionsCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
instructions = convert(instructionsList, data);
assertNotNull(instructions);
int instructionSize = instructions.getInstruction().size();
assertEquals(PRESET_COUNT, instructionSize);
instructionsList = new ArrayList<>();
for (int i = 0; i < PRESET_COUNT; i++) {
WriteMetadataCaseBuilder metadataCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
metadataBuilder.setMetadata(BigInteger.TEN.setBit(i).toByteArray());
metadataBuilder.setMetadataMask(BigInteger.ONE.setBit(i).toByteArray());
metadataCaseBuilder.setWriteMetadata(metadataBuilder.build());
instructionBuilder.setInstructionChoice(metadataCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
}
instructions = convert(instructionsList, data);
assertNotNull(instructions);
assertEquals(PRESET_COUNT, instructions.getInstruction().size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction13.
private static InstructionsBuilder createAppyActionInstruction13() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final DropActionBuilder drop = new DropActionBuilder();
ab.setAction(new DropActionCaseBuilder().setDropAction(drop.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.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction32.
private static InstructionsBuilder createAppyActionInstruction32() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
setTpSrcActionBuilder.setPort(new PortNumber(109));
ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.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;
}
Aggregations