use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action 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.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class LLDPDataTreeChangeListenerTest method evaluateAction.
private static void evaluateAction(final Action action) {
if (action.getAction() instanceof OutputActionCase) {
OutputActionCase outputActionCase = (OutputActionCase) action.getAction();
assertEquals("CONTROLLER", outputActionCase.getOutputAction().getOutputNodeConnector().getValue());
assertEquals(new Integer(0xffff).intValue(), outputActionCase.getOutputAction().getMaxLength().intValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesDeserializer method readActions.
@SuppressWarnings("checkstyle:LineLength")
private List<Action> readActions(ByteBuf message, int length) {
final List<Action> actions = new ArrayList<>();
final int startIndex = message.readerIndex();
int offset = 0;
while (message.readerIndex() - startIndex < length) {
try {
actions.add(new ActionBuilder().setKey(new ActionKey(offset)).setOrder(offset).setAction(ActionUtil.readActionHeader(EncodeConstants.OF13_VERSION_ID, message, registry, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS)).build());
offset++;
} catch (ClassCastException | IllegalStateException e) {
message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
}
}
return actions;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project openflowplugin by opendaylight.
the class ActionUtil method readAction.
/**
* Deserialize OpenFlow action, using extension converter if available.
* TODO: Remove also extension converters
*
* @param version OpenFlow version
* @param message OpenFlow buffered message
* @param registry deserializer registry
* @param path Action path
*/
public static Action readAction(short version, ByteBuf message, DeserializerRegistry registry, ActionPath path) {
int type = message.getUnsignedShort(message.readerIndex());
Long expId = null;
if (type == EncodeConstants.EXPERIMENTER_VALUE) {
expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
}
try {
final MessageCodeExperimenterKey key = new MessageCodeExperimenterKey(version, type, Action.class, expId);
final OFDeserializer<Action> deserializer = registry.getDeserializer(key);
return deserializer.deserialize(message);
} catch (ClassCastException | IllegalStateException e) {
final MessageCodeKey key = Objects.nonNull(expId) ? new ExperimenterActionDeserializerKey(version, expId) : new ActionDeserializerKey(version, type, expId);
final OFDeserializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> deserializer = registry.getDeserializer(key);
return ActionExtensionHelper.processAlienAction(deserializer.deserialize(message), OpenflowVersion.get(version), path);
}
}
Aggregations