use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder in project openflowplugin by opendaylight.
the class OF13SetFieldActionDeserializer method deserialize.
@Override
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public Action deserialize(ByteBuf input) {
Objects.requireNonNull(registry);
final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder builder = new ActionBuilder();
final int startIndex = input.readerIndex();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
final SetFieldCaseBuilder caseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder actionBuilder = new SetFieldActionBuilder();
int oxmClass = input.getUnsignedShort(input.readerIndex());
// get oxm_field & hasMask byte and extract the field value
int oxmField = input.getUnsignedByte(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
key.setExperimenterId(expId);
}
OFDeserializer<MatchEntry> matchDeserializer = registry.getDeserializer(key);
List<MatchEntry> entry = new ArrayList<>();
entry.add(matchDeserializer.deserialize(input));
actionBuilder.setMatchEntry(entry);
caseBuilder.setSetFieldAction(actionBuilder.build());
builder.setActionChoice(caseBuilder.build());
int paddingRemainder = (input.readerIndex() - startIndex) % EncodeConstants.PADDING;
if (paddingRemainder != 0) {
input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder in project openflowplugin by opendaylight.
the class SalToOfSetDlDstActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlDstAction setdldstaction = source.getSetDlDstAction();
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setOxmMatchField(EthDst.class);
EthDstCaseBuilder ethDstCaseBuilder = new EthDstCaseBuilder();
EthDstBuilder ethDstBuilder = new EthDstBuilder();
ethDstBuilder.setMacAddress(setdldstaction.getAddress());
matchBuilder.setHasMask(false);
ethDstCaseBuilder.setEthDst(ethDstBuilder.build());
matchBuilder.setMatchEntryValue(ethDstCaseBuilder.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder in project openflowplugin by opendaylight.
the class SalToOfSetDlSrcActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlSrcAction setdlsrcaction = source.getSetDlSrcAction();
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setOxmMatchField(EthSrc.class);
EthSrcCaseBuilder ethSrcCaseBuilder = new EthSrcCaseBuilder();
EthSrcBuilder ethSrcBuilder = new EthSrcBuilder();
ethSrcBuilder.setMacAddress(setdlsrcaction.getAddress());
matchBuilder.setHasMask(false);
ethSrcCaseBuilder.setEthSrc(ethSrcBuilder.build());
matchBuilder.setMatchEntryValue(ethSrcCaseBuilder.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