use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase in project netvirt by opendaylight.
the class OpenFlow13ProviderTest method checkActionResubmit.
//
// Internal util methods to check Flow Actions
//
private void checkActionResubmit(Instruction curInstruction, short nextTableId) {
assertTrue(curInstruction instanceof ApplyActionsCase);
boolean resubmitActionFound = false;
for (Action action : ((ApplyActionsCase) curInstruction).getApplyActions().getAction()) {
if (action.getAction() instanceof NxActionResubmitNodesNodeTableFlowWriteActionsCase) {
NxActionResubmitNodesNodeTableFlowWriteActionsCase resubmitAction = (NxActionResubmitNodesNodeTableFlowWriteActionsCase) action.getAction();
assertEquals(resubmitAction.getNxResubmit().getTable().shortValue(), nextTableId);
resubmitActionFound = true;
}
}
assertTrue(resubmitActionFound);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase in project netvirt by opendaylight.
the class ElanServiceTestBase method sortActions.
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction sortActions(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction input) {
if (input instanceof ApplyActionsCase) {
List<Action> action = new ArrayList<>(((ApplyActionsCase) input).getApplyActions().getAction());
Collections.sort(action, (o1, o2) -> o1.getOrder().compareTo(o2.getOrder()));
ApplyActions actions = new ApplyActionsBuilder().setAction(action).build();
return new ApplyActionsCaseBuilder().setApplyActions(actions).build();
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase in project openflowplugin by opendaylight.
the class FlowConvertor method isSetVlanIdActionCasePresent.
// check if set vlanid action is present in the flow
private static boolean isSetVlanIdActionCasePresent(Flow flow) {
// If yes,then we would need to two flows
if (flow.getInstructions() != null && flow.getInstructions().getInstruction() != null) {
for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : flow.getInstructions().getInstruction()) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction.getInstruction();
if (curInstruction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase applyActionscase = (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) curInstruction;
ApplyActions applyActions = applyActionscase.getApplyActions();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : applyActions.getAction()) {
if (action.getAction() instanceof SetVlanIdActionCase) {
return true;
}
}
}
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase in project openflowplugin by opendaylight.
the class LLDPDataTreeChangeListenerTest method evaluateInstruction.
private static void evaluateInstruction(final Instruction instruction) {
if (instruction.getInstruction() instanceof ApplyActionsCase) {
ApplyActionsCase applyActionsCase = (ApplyActionsCase) instruction.getInstruction();
assertNotNull(applyActionsCase.getApplyActions().getAction());
assertEquals(1, applyActionsCase.getApplyActions().getAction().size());
Action action = applyActionsCase.getApplyActions().getAction().get(0);
evaluateAction(action);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase in project openflowplugin by opendaylight.
the class ApplyActionsInstructionSerializer method serialize.
@Override
public void serialize(final Instruction instruction, final ByteBuf outBuffer) {
int startIndex = outBuffer.writerIndex();
outBuffer.writeShort(getType());
ApplyActionsCase actionsCase = (ApplyActionsCase) instruction.getInstructionChoice();
if (actionsCase != null) {
List<Action> actions = actionsCase.getApplyActions().getAction();
writeActions(actions, outBuffer, startIndex);
} else {
outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
}
}
Aggregations