use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder in project genius by opendaylight.
the class ActionSetTunnelSourceIp method buildAction.
@Override
public Action buildAction(int newActionKey) {
NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
Dst dst = new DstBuilder().setDstChoice(new DstNxTunIpv4SrcCaseBuilder().setNxTunIpv4Src(Boolean.TRUE).build()).setStart(0).setEnd(31).build();
nxRegLoadBuilder.setDst(dst);
nxRegLoadBuilder.setValue(sourceIp);
ActionBuilder ab = new ActionBuilder();
if (groupBucket) {
ab.setAction(new NxActionRegLoadNodesNodeGroupBucketsBucketActionsCaseBuilder().setNxRegLoad(nxRegLoadBuilder.build()).build());
} else {
ab.setAction(new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder().setNxRegLoad(nxRegLoadBuilder.build()).build());
}
ab.setKey(new ActionKey(newActionKey));
return ab.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder in project genius by opendaylight.
the class ActionDrop method buildAction.
@Override
public Action buildAction(int newActionKey) {
DropActionBuilder dab = new DropActionBuilder();
DropAction dropAction = dab.build();
ActionBuilder ab = new ActionBuilder();
ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
ab.setKey(new ActionKey(newActionKey)).build();
return ab.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder in project genius by opendaylight.
the class ActionLearn method buildAction.
@Override
public Action buildAction(int newActionKey) {
NxLearnBuilder learnBuilder = new NxLearnBuilder();
learnBuilder.setIdleTimeout(idleTimeout).setHardTimeout(hardTimeout).setPriority(priority).setCookie(cookie).setFlags(flags).setTableId(tableId).setFinIdleTimeout(finIdleTimeout).setFinHardTimeout(finHardTimeout);
learnBuilder.setFlowMods(this.flowMods.stream().map(FlowMod::buildFlowMod).collect(Collectors.toList()));
return new ActionBuilder().setKey(new ActionKey(newActionKey)).setAction(new NxActionLearnNodesNodeTableFlowApplyActionsCaseBuilder().setNxLearn(learnBuilder.build()).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder in project openflowplugin by opendaylight.
the class MultipartReplyGroupDescDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyGroupDescBuilder builder = new MultipartReplyGroupDescBuilder();
final List<GroupDescStats> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final int itemLength = message.readUnsignedShort();
final GroupDescStatsBuilder itemBuilder = new GroupDescStatsBuilder().setGroupType(GroupTypes.forValue(message.readUnsignedByte()));
message.skipBytes(PADDING_IN_GROUP_DESC_HEADER);
itemBuilder.setGroupId(new GroupId(message.readUnsignedInt()));
itemBuilder.setKey(new GroupDescStatsKey(itemBuilder.getGroupId()));
final List<Bucket> subItems = new ArrayList<>();
int actualLength = GROUP_DESC_HEADER_LENGTH;
long bucketKey = 0;
while (actualLength < itemLength) {
final int bucketsLength = message.readUnsignedShort();
final BucketBuilder bucketBuilder = new BucketBuilder().setBucketId(new BucketId(bucketKey)).setKey(new BucketKey(new BucketId(bucketKey))).setWeight(message.readUnsignedShort()).setWatchPort(message.readUnsignedInt()).setWatchGroup(message.readUnsignedInt());
message.skipBytes(PADDING_IN_BUCKETS_HEADER);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions = new ArrayList<>();
final int startIndex = message.readerIndex();
final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH;
int offset = 0;
while (message.readerIndex() - startIndex < bucketLength) {
actions.add(new ActionBuilder().setKey(new ActionKey(offset)).setOrder(offset).setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION)).build());
offset++;
}
bucketBuilder.setAction(actions);
subItems.add(bucketBuilder.build());
bucketKey++;
actualLength += bucketsLength;
}
items.add(itemBuilder.setBuckets(new BucketsBuilder().setBucket(subItems).build()).build());
}
return builder.setGroupDescStats(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder 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;
}
Aggregations