Search in sources :

Example 1 with ActionMultipathBuilder

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());
}
Also used : NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder) ActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder) NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder) Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst) NxActionMultipathGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionMultipathGrouping)

Example 2 with ActionMultipathBuilder

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();
}
Also used : NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder) ActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)

Example 3 with ActionMultipathBuilder

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();
}
Also used : ActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder) NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) NxActionMultipathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder)

Aggregations

ActionMultipathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder)3 NxActionMultipathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder)3 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)2 ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)1 NxActionMultipathGrouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionMultipathGrouping)1 Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst)1