use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder in project openflowplugin by opendaylight.
the class MultipathConvertor method convert.
@Override
public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
Preconditions.checkArgument(nxActionArg instanceof NxActionMultipathGrouping);
NxActionMultipathGrouping nxAction = (NxActionMultipathGrouping) nxActionArg;
NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
nxActionMultipathBuilder.setFields(nxAction.getNxMultipath().getFields());
nxActionMultipathBuilder.setBasis(nxAction.getNxMultipath().getBasis());
nxActionMultipathBuilder.setAlgorithm(nxAction.getNxMultipath().getAlgorithm());
nxActionMultipathBuilder.setMaxLink(nxAction.getNxMultipath().getMaxLink());
nxActionMultipathBuilder.setArg(nxAction.getNxMultipath().getArg());
Dst dst = nxAction.getNxMultipath().getDst();
nxActionMultipathBuilder.setOfsNbits(dst.getStart() << 6 | dst.getEnd() - dst.getStart());
nxActionMultipathBuilder.setDst(RegMoveConvertor.resolveDst(dst.getDstChoice()));
ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();
actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
return ActionUtil.createAction(actionMultipathBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder in project openflowplugin by opendaylight.
the class MultipathCodecTest method createAction.
private Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
final ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();
NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
nxActionMultipathBuilder.setFields(OfjNxHashFields.NXHASHFIELDSETHSRC);
nxActionMultipathBuilder.setBasis(2);
nxActionMultipathBuilder.setAlgorithm(OfjNxMpAlgorithm.NXMPALGMODULON);
nxActionMultipathBuilder.setMaxLink(4);
nxActionMultipathBuilder.setArg((long) 5);
nxActionMultipathBuilder.setOfsNbits(6);
nxActionMultipathBuilder.setDst((long) 7);
actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
actionBuilder.setActionChoice(actionMultipathBuilder.build());
return actionBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder in project openflowplugin by opendaylight.
the class MultipathCodec method deserialize.
@Override
public Action deserialize(final ByteBuf message) {
final ActionBuilder actionBuilder = deserializeHeader(message);
final ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();
NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
nxActionMultipathBuilder.setFields(OfjNxHashFields.forValue(message.readUnsignedShort()));
nxActionMultipathBuilder.setBasis(message.readUnsignedShort());
// two bytes
message.skipBytes(2);
nxActionMultipathBuilder.setAlgorithm(OfjNxMpAlgorithm.forValue(message.readUnsignedShort()));
nxActionMultipathBuilder.setMaxLink(message.readUnsignedShort());
nxActionMultipathBuilder.setArg(message.readUnsignedInt());
// two bytes
message.skipBytes(2);
nxActionMultipathBuilder.setOfsNbits(message.readUnsignedShort());
nxActionMultipathBuilder.setDst(message.readUnsignedInt());
actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
actionBuilder.setActionChoice(actionMultipathBuilder.build());
return actionBuilder.build();
}
Aggregations