use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action in project openflowplugin by opendaylight.
the class Activator method createBuckets.
private static BucketsBuilder createBuckets() {
List<Action> actionList = new ArrayList<>();
actionList.add(new ActionBuilder().setOrder(0).setAction(new PopVlanActionCaseBuilder().setPopVlanAction(new PopVlanActionBuilder().build()).build()).build());
BucketBuilder bucketBuilder = new BucketBuilder();
bucketBuilder.setBucketId(new BucketId(12L));
bucketBuilder.setAction(actionList);
List<Bucket> bucketList = new ArrayList<>();
bucketList.add(bucketBuilder.build());
actionList = new ArrayList<>();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetField(new SetFieldBuilder().setLayer3Match(new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix("10.0.1.0/32")).build()).build());
actionList.add(new ActionBuilder().setAction(setFieldCaseBuilder.build()).setOrder(0).build());
setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetField(new SetFieldBuilder().setLayer3Match(new Ipv4MatchBuilder().setIpv4Destination(new Ipv4Prefix("10.0.10.0/32")).build()).build());
actionList.add(new ActionBuilder().setAction(setFieldCaseBuilder.build()).setOrder(0).build());
bucketBuilder = new BucketBuilder();
bucketBuilder.setBucketId(new BucketId(13L));
bucketBuilder.setAction(actionList);
bucketList.add(bucketBuilder.build());
BucketsBuilder bucketsBuilder = new BucketsBuilder();
bucketsBuilder.setBucket(bucketList);
return bucketsBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action in project openflowplugin by opendaylight.
the class Activator method createGroupInstructions.
private static InstructionsBuilder createGroupInstructions(long groupId) {
ActionBuilder actionBuilder = new ActionBuilder();
GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
groupActionBuilder.setGroupId(groupId);
actionBuilder.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionBuilder.build()).build());
actionBuilder.setOrder(1);
actionBuilder.setKey(new ActionKey(0));
List<Action> actionList = new ArrayList<>();
actionList.add(actionBuilder.build());
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
applyActionsBuilder.setAction(actionList);
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActionsBuilder.build()).build());
instructionBuilder.setOrder(0);
instructionBuilder.setKey(new InstructionKey(0));
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
instructions.add(instructionBuilder.build());
instructionsBuilder.setInstruction(instructions);
return instructionsBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action in project openflowplugin by opendaylight.
the class SalToOfSetNwSrcActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final ActionBuilder builder = new ActionBuilder();
final Address address = source.getSetNwSrcAction().getAddress();
if (address instanceof Ipv4) {
Iterable<String> addressParts = PREFIX_SPLITTER.split(((Ipv4) address).getIpv4Address().getValue());
Ipv4Address result = new Ipv4Address(addressParts.iterator().next());
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv4Src.class);
Ipv4SrcCaseBuilder ipv4SrcCaseBuilder = new Ipv4SrcCaseBuilder();
Ipv4SrcBuilder ipv4SrcBuilder = new Ipv4SrcBuilder();
ipv4SrcBuilder.setIpv4Address(result);
Integer prefix = IpConversionUtil.extractPrefix(result);
ipv4SrcBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
ipv4SrcCaseBuilder.setIpv4Src(ipv4SrcBuilder.build());
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setMatchEntryValue(ipv4SrcCaseBuilder.build());
List<MatchEntry> entries = new ArrayList<>();
entries.add(matchEntryBuilder.build());
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
setFieldBuilder.setMatchEntry(entries);
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
builder.setActionChoice(setFieldCaseBuilder.build());
} else if (address instanceof Ipv6) {
Iterable<String> addressParts = PREFIX_SPLITTER.split(((Ipv6) address).getIpv6Address().getValue());
Ipv6Address result = new Ipv6Address(addressParts.iterator().next());
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6Src.class);
Ipv6SrcCaseBuilder ipv6SrcCaseBuilder = new Ipv6SrcCaseBuilder();
Ipv6SrcBuilder ipv6SrcBuilder = new Ipv6SrcBuilder();
ipv6SrcBuilder.setIpv6Address(result);
Integer prefix = IpConversionUtil.extractPrefix(result);
ipv6SrcBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
ipv6SrcCaseBuilder.setIpv6Src(ipv6SrcBuilder.build());
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setMatchEntryValue(ipv6SrcCaseBuilder.build());
List<MatchEntry> matchEntriesList = new ArrayList<>();
matchEntriesList.add(matchEntryBuilder.build());
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldActionBuilder = new SetFieldActionBuilder();
setFieldActionBuilder.setMatchEntry(matchEntriesList);
setFieldCaseBuilder.setSetFieldAction(setFieldActionBuilder.build());
builder.setActionChoice(setFieldCaseBuilder.build());
} else {
throw new IllegalArgumentException("Address is not supported: " + address.getClass().getName());
}
return Optional.of(builder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action in project openflowplugin by opendaylight.
the class SalToOfSetNwTtlActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
nwTtlBuilder.setNwTtl(source.getSetNwTtlAction().getNwTtl());
nwTtlCaseBuilder.setSetNwTtlAction(nwTtlBuilder.build());
return Optional.of(new ActionBuilder().setActionChoice(nwTtlCaseBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action in project openflowplugin by opendaylight.
the class SalToOfSetVlanIdActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setOxmMatchField(VlanVid.class);
matchBuilder.setHasMask(false);
VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
vlanVidBuilder.setCfiBit(true);
SetVlanIdAction setvlanidaction = source.getSetVlanIdAction();
vlanVidBuilder.setVlanVid(setvlanidaction.getVlanId().getValue());
vlanVidCaseBuilder.setVlanVid(vlanVidBuilder.build());
matchBuilder.setMatchEntryValue(vlanVidCaseBuilder.build());
List<MatchEntry> entries = new ArrayList<>();
entries.add(matchBuilder.build());
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
setFieldBuilder.setMatchEntry(entries);
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
return Optional.of(new ActionBuilder().setActionChoice(setFieldCaseBuilder.build()).build());
}
Aggregations