* @param header the OXM/NXM header.
* @return the destination choice.
*/
- static DstChoice resolveDstChoice(Uint32 header) {
+ static DstChoice resolveDstChoice(final Uint32 header) {
return NXMHEADER_TO_DST_CHOICE.get(header.toJava());
}
- static DstChoice resolveDstChoice(Long header) {
+ static DstChoice resolveDstChoice(final Long header) {
return NXMHEADER_TO_DST_CHOICE.get(header);
}
* @param header the OXM/NXM header.
* @return the destination choice.
*/
- static DstChoice resolveDstChoice(Uint64 header) {
+ static DstChoice resolveDstChoice(final Uint64 header) {
return NXMHEADER_TO_DST_CHOICE.get(header);
}
* @param header the OXM/NXM header.
* @return the source choice.
*/
- static SrcChoice resolveSrcChoice(Long header) {
+ static SrcChoice resolveSrcChoice(final Long header) {
return NXMHEADER_TO_SRC_CHOICE.get(header);
}
- static SrcChoice resolveSrcChoice(Uint32 header) {
+ static SrcChoice resolveSrcChoice(final Uint32 header) {
return NXMHEADER_TO_SRC_CHOICE.get(header.toJava());
}
* @param header the OXM/NXM header.
* @return the destination choice.
*/
- static SrcChoice resolveSrcChoice(Uint64 header) {
+ static SrcChoice resolveSrcChoice(final Uint64 header) {
return NXMHEADER_TO_SRC_CHOICE.get(header);
}
* @return the OXM/NXM header as uint32 {@code Long}.
* @throws IllegalArgumentException if the field is experimenter.
*/
- static Long resolveDstHeaderUint32(DstChoice dstChoice) {
+ static Uint32 resolveDstHeaderUint32(final DstChoice dstChoice) {
NxmHeader nxmHeader = dstChoice instanceof DstNxRegCase
? REG_DST_CHOICE_TO_NXMHEADER.get(dstChoice)
: DST_CHOICE_TYPE_TO_NXMHEADER.get(dstChoice.implementedInterface());
if (nxmHeader.isExperimenter()) {
throw new IllegalArgumentException("Cannot fit experimenter destination choice on a uint32 header");
}
- return nxmHeader.toLong();
+ return Uint32.valueOf(nxmHeader.toLong());
}
/**
* @param dstChoice the destination choice field.
* @return the OXM/NXM header as uint64 {@code BigInteger}.
*/
- static Uint64 resolveDstHeaderUint64(DstChoice dstChoice) {
+ static Uint64 resolveDstHeaderUint64(final DstChoice dstChoice) {
return dstChoice instanceof DstNxRegCase
? REG_DST_CHOICE_TO_NXMHEADER.get(dstChoice).toUint64()
: DST_CHOICE_TYPE_TO_NXMHEADER.get(dstChoice.implementedInterface()).toUint64();
* @return the OXM/NXM header as uint32 {@code Long}.
* @throws IllegalArgumentException if the field is experimenter.
*/
- static Long resolveSrcHeaderUint32(SrcChoice srcChoice) {
+ static Uint32 resolveSrcHeaderUint32(final SrcChoice srcChoice) {
NxmHeader nxmHeader = srcChoice instanceof SrcNxRegCase
? REG_SRC_CHOICE_TO_NXMHEADER.get(srcChoice)
: SRC_CHOICE_TYPE_TO_NXMHEADER.get(srcChoice.implementedInterface());
if (nxmHeader.isExperimenter()) {
throw new IllegalArgumentException("Cannot fit experimenter source choice on a uint32 header");
}
- return nxmHeader.toLong();
+ return Uint32.valueOf(nxmHeader.toLong());
}
/**
* @param srcChoice the destination choice field.
* @return the OXM/NXM header as uint64 {@code BigInteger}.
*/
- static Uint64 resolveSrcHeaderUint64(SrcChoice srcChoice) {
+ static Uint64 resolveSrcHeaderUint64(final SrcChoice srcChoice) {
return srcChoice instanceof SrcNxRegCase
? REG_SRC_CHOICE_TO_NXMHEADER.get(srcChoice).toUint64()
: SRC_CHOICE_TYPE_TO_NXMHEADER.get(srcChoice.implementedInterface()).toUint64();
* @param srcChoice the source choice field.
* @return true if experimenter.
*/
- static boolean isExperimenter(SrcChoice srcChoice) {
+ static boolean isExperimenter(final SrcChoice srcChoice) {
return srcChoice instanceof SrcNxRegCase
? REG_SRC_CHOICE_TO_NXMHEADER.get(srcChoice).isExperimenter()
: SRC_CHOICE_TYPE_TO_NXMHEADER.get(srcChoice.implementedInterface()).isExperimenter();
* @param dstChoice the destination choice field.
* @return true if experimenter.
*/
- static boolean isExperimenter(DstChoice dstChoice) {
+ static boolean isExperimenter(final DstChoice dstChoice) {
return dstChoice instanceof DstNxRegCase
? REG_DST_CHOICE_TO_NXMHEADER.get(dstChoice).isExperimenter()
: DST_CHOICE_TYPE_TO_NXMHEADER.get(dstChoice.implementedInterface()).isExperimenter();
Dst dst = nxAction.getNxMultipath().getDst();
final int start = dst.getStart().toJava();
- nxActionMultipathBuilder.setOfsNbits(start << 6 | dst.getEnd().toJava() - start);
+ nxActionMultipathBuilder.setOfsNbits(Uint16.valueOf(start << 6 | dst.getEnd().toJava() - start));
// We resolve the destination as a uint32 header, multipath action
// does not support 8-byte experimenter headers.
nxActionMultipathBuilder.setDst(FieldChoiceResolver.resolveDstHeaderUint32(dst.getDstChoice()));
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputRegBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputRegBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionOutputRegGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegNodesNodeTableFlowWriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputReg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputRegBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.Src;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.SrcBuilder;
/**
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
final Action input, final ActionPath path) {
- NxActionOutputReg action = ((ActionOutputReg) input.getActionChoice()).getNxActionOutputReg();
- SrcBuilder srcBuilder = new SrcBuilder();
- srcBuilder.setSrcChoice(FieldChoiceResolver.resolveSrcChoice(action.getSrc()));
- srcBuilder.setOfsNbits(action.getNBits());
- NxOutputRegBuilder builder = new NxOutputRegBuilder();
- builder.setSrc(srcBuilder.build());
- builder.setMaxLen(action.getMaxLen());
- return resolveAction(builder.build(), path);
+ final var action = ((ActionOutputReg) input.getActionChoice()).getNxActionOutputReg();
+ return resolveAction(new NxOutputRegBuilder()
+ .setSrc(new SrcBuilder()
+ .setSrcChoice(FieldChoiceResolver.resolveSrcChoice(action.getSrc()))
+ .setOfsNbits(action.getNBits())
+ .build())
+ .setMaxLen(action.getMaxLen())
+ .build(), path);
}
@Override
public Action convert(
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionOutputRegGrouping);
- NxActionOutputRegGrouping nxAction = (NxActionOutputRegGrouping) nxActionArg;
- Src src = nxAction.getNxOutputReg().getSrc();
- final ActionOutputRegBuilder builder = new ActionOutputRegBuilder();
- NxActionOutputRegBuilder nxActionOutputRegBuilder = new NxActionOutputRegBuilder();
- nxActionOutputRegBuilder.setSrc(FieldChoiceResolver.resolveSrcHeaderUint32(src.getSrcChoice()));
- nxActionOutputRegBuilder.setNBits(src.getOfsNbits());
- nxActionOutputRegBuilder.setMaxLen(nxAction.getNxOutputReg().getMaxLen());
- builder.setNxActionOutputReg(nxActionOutputRegBuilder.build());
- return ActionUtil.createAction(builder.build());
+ checkArgument(nxActionArg instanceof NxActionOutputRegGrouping);
+ final var nxAction = (NxActionOutputRegGrouping) nxActionArg;
+ final var src = nxAction.getNxOutputReg().getSrc();
+ return ActionUtil.createAction(new ActionOutputRegBuilder()
+ .setNxActionOutputReg(new NxActionOutputRegBuilder()
+ .setSrc(FieldChoiceResolver.resolveSrcHeaderUint32(src.getSrcChoice()))
+ .setNBits(src.getOfsNbits())
+ .setMaxLen(nxAction.getNxOutputReg().getMaxLen())
+ .build())
+ .build());
}
static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
ConvertorActionFromOFJava<Action, ActionPath> {
@Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input,
- ActionPath path) {
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
+ final Action input, final ActionPath path) {
NxActionRegLoad2 actionRegLoad2 = ((ActionRegLoad2) input.getActionChoice()).getNxActionRegLoad2();
MatchEntry matchEntry = actionRegLoad2.getMatchEntry().get(0);
NxRegLoad nxRegLoad = resolveRegLoad(matchEntry);
@Override
public Action convert(
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionCase) {
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionCase) {
Preconditions.checkArgument(actionCase instanceof NxActionRegLoadGrouping);
NxActionRegLoadGrouping nxAction = (NxActionRegLoadGrouping) actionCase;
return ActionUtil.createAction(actionRegLoad2);
}
- private static MatchEntry resolveMatchEntry(NxRegLoad nxRegLoad) {
+ private static MatchEntry resolveMatchEntry(final NxRegLoad nxRegLoad) {
Dst dst = nxRegLoad.getDst();
Uint64 value = nxRegLoad.getValue();
Uint16 start = dst.getStart();
return resolveMatchEntry(dstChoice, value, mask);
}
- private static MatchEntry resolveMatchEntry(DstChoice dstChoice, Uint64 value, Uint64 mask) {
+ private static MatchEntry resolveMatchEntry(final DstChoice dstChoice, final Uint64 value, final Uint64 mask) {
try {
if (dstChoice instanceof DstNxNshFlagsCase) {
return NshFlagsConvertor.buildMatchEntry(Uint8.valueOf(value), Uint8.valueOf(mask));
throw new CodecPreconditionException("Missing implementation of a case in dst-choice? " + dstChoice.getClass());
}
- private static NxRegLoad resolveRegLoad(MatchEntry matchEntry) {
+ private static NxRegLoad resolveRegLoad(final MatchEntry matchEntry) {
Class<? extends MatchField> oxmMatchField = matchEntry.getOxmMatchField();
ExperimenterIdCase experimenterIdCase = (ExperimenterIdCase) matchEntry.getMatchEntryValue();
OfjAugNxExpMatch ofjAugNxExpMatch = experimenterIdCase.augmentation(OfjAugNxExpMatch.class);
}
private static NxRegLoad resolveRegLoad(
- Class<? extends MatchField> oxmMatchField,
- NxExpMatchEntryValue value,
- DstBuilder dstBuilder) {
+ final Class<? extends MatchField> oxmMatchField,
+ final NxExpMatchEntryValue value,
+ final DstBuilder dstBuilder) {
if (NxmNxNshFlags.class.equals(oxmMatchField)) {
int valueLength = NiciraMatchCodecs.NSH_FLAGS_CODEC.getValueLength();
throw new CodecPreconditionException("Missing codec for " + value.implementedInterface());
}
- private static NxRegLoad resolveRegLoad(Uint8 value, @Nullable Uint8 mask, int valueLength, DstBuilder dstBuilder) {
- return resolveRegLoad(
- Uint64.valueOf(value),
- mask == null ? null : Uint64.valueOf(mask),
- valueLength,
- dstBuilder);
+ private static NxRegLoad resolveRegLoad(final Uint8 value, final @Nullable Uint8 mask, final int valueLength,
+ final DstBuilder dstBuilder) {
+ return resolveRegLoad(value.toUint64(), mask == null ? null : mask.toUint64(), valueLength, dstBuilder);
}
- private static NxRegLoad resolveRegLoad(Uint32 value, @Nullable Uint32 mask, int valueLength,
- DstBuilder dstBuilder) {
- return resolveRegLoad(
- Uint64.valueOf(value),
- mask == null ? null : Uint64.valueOf(mask),
- valueLength,
- dstBuilder);
+ private static NxRegLoad resolveRegLoad(final Uint32 value, final @Nullable Uint32 mask, final int valueLength,
+ final DstBuilder dstBuilder) {
+ return resolveRegLoad(value.toUint64(), mask == null ? null : mask.toUint64(), valueLength, dstBuilder);
}
// Convert the value/mask pair of the openflowjava reg_load2 action to the
// value/bit range pair of the openfloplugin reg_load action.
- private static NxRegLoad resolveRegLoad(Uint64 value,
- @Nullable Uint64 mask,
- int length,
- DstBuilder dstBuilder) {
+ private static NxRegLoad resolveRegLoad(Uint64 value, final @Nullable Uint64 mask, final int length,
+ final DstBuilder dstBuilder) {
final int start;
final int end;
if (mask == null) {
value = Uint64.fromLongBits(newValueBits);
}
- dstBuilder.setStart(start);
- dstBuilder.setEnd(end - 1);
- NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
- nxRegLoadBuilder.setDst(dstBuilder.build());
- nxRegLoadBuilder.setValue(value);
- return nxRegLoadBuilder.build();
+ return new NxRegLoadBuilder()
+ .setDst(dstBuilder.setStart(Uint16.valueOf(start)).setEnd(Uint16.valueOf(end - 1)).build())
+ .setValue(value)
+ .build();
}
private static int lowestSetBit(final long value) {
// Convert value/bit range pair of the openfloplugin reg_load action to the
// value/mask pair of the openflowjava reg_load2 action.
- private static Uint64[] resolveValueMask(Uint64 value, Uint16 start, Uint16 end) {
+ private static Uint64[] resolveValueMask(final Uint64 value, final Uint16 start, final Uint16 end) {
final int startInt = start.toJava();
final int bits = end.toJava() - startInt + 1;
final long valueBits = value.longValue();
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoadBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoadBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionRegLoadGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadNodesNodeTableFlowWriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.Dst;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
@Override
public Action convert(
final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionRegLoadGrouping);
-
- NxActionRegLoadGrouping nxAction = (NxActionRegLoadGrouping) nxActionArg;
- Dst dst = nxAction.getNxRegLoad().getDst();
-
-
- final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
- NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
- // We resolve the destination as a uint32 header, reg load action
- // does not support 8-byte experimenter headers.
- nxActionRegLoadBuilder.setDst(FieldChoiceResolver.resolveDstHeaderUint32(dst.getDstChoice()));
-
+ checkArgument(nxActionArg instanceof NxActionRegLoadGrouping);
+ final var nxAction = (NxActionRegLoadGrouping) nxActionArg;
+ final var dst = nxAction.getNxRegLoad().getDst();
final int start = dst.getStart().toJava();
- nxActionRegLoadBuilder.setOfsNbits(Uint16.valueOf(start << 6 | dst.getEnd().toJava() - start));
- nxActionRegLoadBuilder.setValue(nxAction.getNxRegLoad().getValue());
- actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
- return ActionUtil.createAction(actionRegLoadBuilder.build());
+
+ return ActionUtil.createAction(new ActionRegLoadBuilder()
+ .setNxActionRegLoad(new NxActionRegLoadBuilder()
+ // We resolve the destination as a uint32 header, reg load action
+ // does not support 8-byte experimenter headers.
+ .setDst(FieldChoiceResolver.resolveDstHeaderUint32(dst.getDstChoice()))
+ .setOfsNbits(Uint16.valueOf(start << 6 | dst.getEnd().toJava() - start))
+ .setValue(nxAction.getNxRegLoad().getValue())
+ .build())
+ .build());
}
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
final Action input, final ActionPath path) {
- NxActionRegLoad actionRegLoad = ((ActionRegLoad) input.getActionChoice()).getNxActionRegLoad();
- DstBuilder dstBuilder = new DstBuilder();
- dstBuilder.setDstChoice(FieldChoiceResolver.resolveDstChoice(actionRegLoad.getDst()));
- dstBuilder.setStart(resolveStart(actionRegLoad.getOfsNbits()));
- dstBuilder.setEnd(resolveEnd(actionRegLoad.getOfsNbits()));
- NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
- nxRegLoadBuilder.setDst(dstBuilder.build());
- nxRegLoadBuilder.setValue(actionRegLoad.getValue());
- return resolveAction(nxRegLoadBuilder.build(), path);
+ final var actionRegLoad = ((ActionRegLoad) input.getActionChoice()).getNxActionRegLoad();
+ return resolveAction(new NxRegLoadBuilder()
+ .setDst(new DstBuilder()
+ .setDstChoice(FieldChoiceResolver.resolveDstChoice(actionRegLoad.getDst()))
+ .setStart(resolveStart(actionRegLoad.getOfsNbits()))
+ .setEnd(resolveEnd(actionRegLoad.getOfsNbits()))
+ .build())
+ .setValue(actionRegLoad.getValue())
+ .build(), path);
}
private static Uint16 resolveStart(final Uint16 ofsNBints) {
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMoveBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionRegMoveGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.DstBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.SrcBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
/**
* Convert to/from SAL flow model to openflowjava model for NxActionRegMove action.
@Override
public Action convert(
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
- Preconditions.checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
- NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
-
- Dst dst = nxAction.getNxRegMove().getDst();
- Src src = nxAction.getNxRegMove().getSrc();
- final ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
- NxActionRegMoveBuilder nxActionRegMove = new NxActionRegMoveBuilder();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
+ checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
+ final NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
+ final Dst dst = nxAction.getNxRegMove().getDst();
+ final Src src = nxAction.getNxRegMove().getSrc();
- nxActionRegMove.setDst(FieldChoiceResolver.resolveDstHeaderUint64(dst.getDstChoice()));
- nxActionRegMove.setDstOfs(dst.getStart());
- nxActionRegMove.setSrc(FieldChoiceResolver.resolveSrcHeaderUint64(src.getSrcChoice()));
- nxActionRegMove.setSrcOfs(src.getStart());
- nxActionRegMove.setNBits(dst.getEnd().toJava() - dst.getStart().toJava() + 1);
- actionRegMoveBuilder.setNxActionRegMove(nxActionRegMove.build());
- return ActionUtil.createAction(actionRegMoveBuilder.build());
+ return ActionUtil.createAction(new ActionRegMoveBuilder()
+ .setNxActionRegMove(new NxActionRegMoveBuilder()
+ .setDst(FieldChoiceResolver.resolveDstHeaderUint64(dst.getDstChoice()))
+ .setDstOfs(dst.getStart())
+ .setSrc(FieldChoiceResolver.resolveSrcHeaderUint64(src.getSrcChoice()))
+ .setSrcOfs(src.getStart())
+ .setNBits(Uint16.valueOf(dst.getEnd().toJava() - dst.getStart().toJava() + 1))
+ .build())
+ .build());
}
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(
- Action input, ActionPath path) {
- NxActionRegMove actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
- DstBuilder dstBuilder = new DstBuilder();
- dstBuilder.setDstChoice(FieldChoiceResolver.resolveDstChoice(actionRegMove.getDst()));
- dstBuilder.setStart(actionRegMove.getDstOfs());
- dstBuilder.setEnd(actionRegMove.getDstOfs().toJava() + actionRegMove.getNBits().toJava() - 1);
- SrcBuilder srcBuilder = new SrcBuilder();
- srcBuilder.setSrcChoice(FieldChoiceResolver.resolveSrcChoice(actionRegMove.getSrc()));
- srcBuilder.setStart(actionRegMove.getSrcOfs());
- srcBuilder.setEnd(actionRegMove.getSrcOfs().toJava() + actionRegMove.getNBits().toJava() - 1);
- NxRegMoveBuilder nxRegMoveBuilder = new NxRegMoveBuilder();
- nxRegMoveBuilder.setDst(dstBuilder.build());
- nxRegMoveBuilder.setSrc(srcBuilder.build());
- return resolveAction(nxRegMoveBuilder.build(), path);
+ final Action input, final ActionPath path) {
+ final var actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
+ final int delta = actionRegMove.getNBits().toJava() - 1;
+
+ return resolveAction(new NxRegMoveBuilder()
+ .setDst(new DstBuilder()
+ .setDstChoice(FieldChoiceResolver.resolveDstChoice(actionRegMove.getDst()))
+ .setStart(actionRegMove.getDstOfs())
+ .setEnd(Uint16.valueOf(actionRegMove.getDstOfs().toJava() + delta))
+ .build())
+ .setSrc(new SrcBuilder()
+ .setSrcChoice(FieldChoiceResolver.resolveSrcChoice(actionRegMove.getSrc()))
+ .setStart(actionRegMove.getSrcOfs())
+ .setEnd(Uint16.valueOf(actionRegMove.getSrcOfs().toJava() + delta))
+ .build())
+ .build(), path);
}
private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
- NxRegMove value, ActionPath path) {
+ final NxRegMove value, final ActionPath path) {
switch (path) {
case INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS:
return new NxActionRegMoveNodesNodeTableFlowWriteActionsCaseBuilder().setNxRegMove(value).build();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.spa.grouping.NxmOfArpSpa;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.spa.grouping.NxmOfArpSpaBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Convert to/from SAL flow model to openflowjava model for ArpSpaCase.
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
- Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpSpa().getIpv4Address());
- ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder();
- arpSpaCaseValueBuilder.setArpSpaValues(new ArpSpaValuesBuilder()
- .setValue(value).build());
- return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx
- .match.rev140421.NxmOfArpSpa.class, Nxm0Class.class, arpSpaCaseValueBuilder.build()).build();
+ return MatchUtil.createDefaultMatchEntryBuilder(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpSpa.class,
+ Nxm0Class.class, new ArpSpaCaseValueBuilder()
+ .setArpSpaValues(new ArpSpaValuesBuilder()
+ .setValue(Uint32.valueOf(IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpSpa()
+ .getIpv4Address())))
+ .build())
+ .build())
+ .build();
}
private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmOfArpSpa value,
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.tpa.grouping.NxmOfArpTpa;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.tpa.grouping.NxmOfArpTpaBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Convert to/from SAL flow model to openflowjava model for ArpTpaCase.
public class ArpTpaConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
@Override
- public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ public ExtensionAugment<? extends Augmentation<Extension>> convert(final MatchEntry input, final MatchPath path) {
ArpTpaCaseValue arpTpaCaseValue = (ArpTpaCaseValue) input.getMatchEntryValue();
Ipv4Address ipv4Address = IpConverter.longToIpv4Address(arpTpaCaseValue.getArpTpaValues().getValue());
return resolveAugmentation(new NxmOfArpTpaBuilder().setIpv4Address(ipv4Address).build(), path,
}
@Override
- public MatchEntry convert(Extension extension) {
+ public MatchEntry convert(final Extension extension) {
Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.ARP_TPA_RESOLVER.findExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
- Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpTpa().getIpv4Address());
- ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder();
- arpTpaCaseValueBuilder.setArpTpaValues(new ArpTpaValuesBuilder()
- .setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa.class,
- Nxm0Class.class, arpTpaCaseValueBuilder.build()).build();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa.class,
+ Nxm0Class.class, new ArpTpaCaseValueBuilder()
+ .setArpTpaValues(new ArpTpaValuesBuilder()
+ .setValue(Uint32.valueOf(
+ IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpTpa().getIpv4Address()))).build())
+ .build())
+ .build();
}
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfArpTpa value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmOfArpTpa value,
+ final MatchPath path, final Class<? extends ExtensionKey> key) {
switch (path) {
case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
-import com.google.common.primitives.Longs;
-import com.google.common.primitives.UnsignedBytes;
-import java.util.Iterator;
import org.opendaylight.openflowplugin.extension.api.AugmentationGroupingResolver;
import org.opendaylight.openflowplugin.extension.api.AugmentationGroupingResolver.Factory;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
* @author msunal
*/
public final class MatchUtil {
- private static final Splitter SPLITTER = Splitter.on('.');
- private static final Joiner JOINER = Joiner.on('.');
-
public static final AugmentationGroupingResolver<NxmNxRegGrouping, Extension> REG_RESOLVER;
public static final AugmentationGroupingResolver<NxmNxTunIdGrouping, Extension> TUN_ID_RESOLVER;
public static final AugmentationGroupingResolver<NxmNxArpShaGrouping, Extension> ARP_SHA_RESOLVER;
}
private MatchUtil() {
+ // Hidden on purpose
}
public static MatchEntryBuilder createDefaultMatchEntryBuilder(final Class<? extends MatchField> matchField,
final Class<? extends OxmClassBase> oxmClass,
final MatchEntryValue matchEntryValue) {
- MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
- matchEntryBuilder.setHasMask(false);
- matchEntryBuilder.setOxmMatchField(matchField);
- matchEntryBuilder.setOxmClass(oxmClass);
- matchEntryBuilder.setMatchEntryValue(matchEntryValue);
- return matchEntryBuilder;
+ return new MatchEntryBuilder()
+ .setHasMask(false)
+ .setOxmMatchField(matchField)
+ .setOxmClass(oxmClass)
+ .setMatchEntryValue(matchEntryValue);
}
public static <V extends Augmentation<ExperimenterIdCase>> MatchEntryBuilder createExperimenterMatchEntryBuilder(
.build());
}
- public static Long ipv4ToLong(final Ipv4Address ipv4) {
- Iterator<String> iterator = SPLITTER.split(ipv4.getValue()).iterator();
- byte[] bytes = new byte[8];
- for (int i = 0; i < bytes.length; i++) {
- if (i < 4) {
- bytes[i] = 0;
- } else {
- bytes[i] = UnsignedBytes.parseUnsignedByte(iterator.next());
- }
- }
- Long result = Longs.fromByteArray(bytes);
- return result;
- }
-
- public static Ipv4Address longToIpv4Address(final Uint32 value) {
- return longToIpv4Address(value.toJava());
- }
-
- public static Ipv4Address longToIpv4Address(final Long value) {
- return longToIpv4Address(value.longValue());
+ public static Uint32 ipv4ToUint32(final Ipv4Address ipv4) {
+ return Uint32.fromIntBits(IetfInetUtil.INSTANCE.ipv4AddressBits(ipv4));
}
- public static Ipv4Address longToIpv4Address(final long value) {
- byte[] bytes = Longs.toByteArray(value);
- String[] strArray = new String[4];
- for (int i = 4; i < bytes.length; i++) {
- strArray[i - 4] = UnsignedBytes.toString(bytes[i]);
- }
- String str = JOINER.join(strArray);
- Ipv4Address result = new Ipv4Address(str);
- return result;
+ public static Ipv4Address uint32ToIpv4Address(final Uint32 value) {
+ return IetfInetUtil.INSTANCE.ipv4AddressFor(value.intValue());
}
}
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
-import java.util.Optional;
import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchPacketInMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStatsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4DstGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4DstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.dst.grouping.NxmNxTunIpv4Dst;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.dst.grouping.NxmNxTunIpv4DstBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
public class TunIPv4DstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxTunIpv4Dst value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmNxTunIpv4Dst value,
+ final MatchPath path, final Class<? extends ExtensionKey> key) {
switch (path) {
case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(
- MatchEntry input, MatchPath path) {
+ final MatchEntry input, final MatchPath path) {
TunIpv4DstCaseValue tunIpv4DstCaseValue = (TunIpv4DstCaseValue) input.getMatchEntryValue();
return resolveAugmentation(new NxmNxTunIpv4DstBuilder()
- .setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4DstCaseValue.getTunIpv4DstValues().getValue()))
+ .setIpv4Address(MatchUtil.uint32ToIpv4Address(tunIpv4DstCaseValue.getTunIpv4DstValues().getValue()))
.build(), path, NxmNxTunIpv4DstKey.class);
}
@Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.TUN_IPV4_DST_RESOLVER.findExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Ipv4Address value = matchGrouping.get().getNxmNxTunIpv4Dst().getIpv4Address();
+ public MatchEntry convert(final Extension extension) {
+ final Ipv4Address value = MatchUtil.TUN_IPV4_DST_RESOLVER.findExtension(extension)
+ .orElseThrow(() -> new CodecPreconditionException(extension))
+ .getNxmNxTunIpv4Dst().getIpv4Address();
- TunIpv4DstCaseValueBuilder tunIpv4DstCaseValueBuilder = new TunIpv4DstCaseValueBuilder();
- tunIpv4DstCaseValueBuilder.setTunIpv4DstValues(new TunIpv4DstValuesBuilder()
- .setValue(MatchUtil.ipv4ToLong(value)).build());
return MatchUtil.createDefaultMatchEntryBuilder(
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst.class,
- Nxm1Class.class, tunIpv4DstCaseValueBuilder.build()).build();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst.class,
+ Nxm1Class.class, new TunIpv4DstCaseValueBuilder()
+ .setTunIpv4DstValues(new TunIpv4DstValuesBuilder()
+ .setValue(MatchUtil.ipv4ToUint32(value))
+ .build())
+ .build())
+ .build();
}
}
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
-import java.util.Optional;
import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchPacketInMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStatsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4SrcGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIpv4SrcKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.src.grouping.NxmNxTunIpv4Src;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.ipv4.src.grouping.NxmNxTunIpv4SrcBuilder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
public class TunIPv4SrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxTunIpv4Src value,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmNxTunIpv4Src value,
+ final MatchPath path, final Class<? extends ExtensionKey> key) {
switch (path) {
case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(
- MatchEntry input, MatchPath path) {
+ final MatchEntry input, final MatchPath path) {
TunIpv4SrcCaseValue tunIpv4SrcCaseValue = (TunIpv4SrcCaseValue) input.getMatchEntryValue();
return resolveAugmentation(new NxmNxTunIpv4SrcBuilder()
- .setIpv4Address(MatchUtil.longToIpv4Address(tunIpv4SrcCaseValue.getTunIpv4SrcValues().getValue()))
+ .setIpv4Address(MatchUtil.uint32ToIpv4Address(tunIpv4SrcCaseValue.getTunIpv4SrcValues().getValue()))
.build(), path, NxmNxTunIpv4SrcKey.class);
}
@Override
- public MatchEntry convert(Extension extension) {
- Optional<NxmNxTunIpv4SrcGrouping> matchGrouping = MatchUtil.TUN_IPV4_SRC_RESOLVER.findExtension(extension);
- if (!matchGrouping.isPresent()) {
- throw new CodecPreconditionException(extension);
- }
- Ipv4Address value = matchGrouping.get().getNxmNxTunIpv4Src().getIpv4Address();
+ public MatchEntry convert(final Extension extension) {
+ final Ipv4Address value = MatchUtil.TUN_IPV4_SRC_RESOLVER.findExtension(extension)
+ .orElseThrow(() -> new CodecPreconditionException(extension))
+ .getNxmNxTunIpv4Src().getIpv4Address();
- TunIpv4SrcCaseValueBuilder tunIpv4SrcCaseValueBuilder = new TunIpv4SrcCaseValueBuilder();
- tunIpv4SrcCaseValueBuilder.setTunIpv4SrcValues(new TunIpv4SrcValuesBuilder()
- .setValue(MatchUtil.ipv4ToLong(value)).build());
return MatchUtil.createDefaultMatchEntryBuilder(
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Src.class,
- Nxm1Class.class, tunIpv4SrcCaseValueBuilder.build()).build();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Src.class,
+ Nxm1Class.class, new TunIpv4SrcCaseValueBuilder()
+ .setTunIpv4SrcValues(new TunIpv4SrcValuesBuilder()
+ .setValue(MatchUtil.ipv4ToUint32(value))
+ .build())
+ .build())
+ .build();
}
}
import org.junit.Test;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class MatchUtilTest {
-
private static final Ipv4Address IPV4_ADDRESS = new Ipv4Address("1.2.3.4");
- private static final Long IPV4_LONG = 16909060L;
+ private static final Uint32 IPV4_LONG = Uint32.valueOf(16909060);
@Test
public void testIpv4toLong() {
- final Long result = MatchUtil.ipv4ToLong(IPV4_ADDRESS);
- assertEquals("Does not match",IPV4_LONG,result);
+ assertEquals(IPV4_LONG, MatchUtil.ipv4ToUint32(IPV4_ADDRESS));
}
@Test
public void testLongtoIpv4() {
- Ipv4Address result = MatchUtil.longToIpv4Address(16909060L);
- assertEquals("Does not match",IPV4_ADDRESS,result);
+ assertEquals(IPV4_ADDRESS, MatchUtil.uint32ToIpv4Address(IPV4_LONG));
}
-
}