use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoadBuilder in project openflowplugin by opendaylight.
the class RegLoadConvertor method convert.
@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();
nxActionRegLoadBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
nxActionRegLoadBuilder.setOfsNbits(dst.getStart() << 6 | dst.getEnd() - dst.getStart());
nxActionRegLoadBuilder.setValue(nxAction.getNxRegLoad().getValue());
actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
return ActionUtil.createAction(actionRegLoadBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoadBuilder in project openflowplugin by opendaylight.
the class RegLoadCodecTest method createAction.
private Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
nxActionRegLoadBuilder.setOfsNbits(1);
nxActionRegLoadBuilder.setDst((long) 2);
nxActionRegLoadBuilder.setValue(BigInteger.valueOf(3));
actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
actionBuilder.setActionChoice(actionRegLoadBuilder.build());
return actionBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoadBuilder in project openflowplugin by opendaylight.
the class RegLoadCodec method deserialize.
@Override
public Action deserialize(final ByteBuf message) {
final ActionBuilder actionBuilder = deserializeHeader(message);
NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
nxActionRegLoadBuilder.setOfsNbits(message.readUnsignedShort());
nxActionRegLoadBuilder.setDst(message.readUnsignedInt());
nxActionRegLoadBuilder.setValue(BigInteger.valueOf(message.readLong()));
actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
actionBuilder.setActionChoice(actionRegLoadBuilder.build());
return actionBuilder.build();
}
Aggregations