Search in sources :

Example 1 with NxActionLearnBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder in project openflowplugin by opendaylight.

the class LearnCodecUtil method buildFlowModSpecs.

static synchronized void buildFlowModSpecs(NxActionLearnBuilder nxActionLearnBuilder, ByteBuf message, short messageLength) {
    LearnCodecUtil.length = messageLength;
    List<FlowMods> flowModeList = new ArrayList<>();
    while (LearnCodecUtil.length > 0) {
        FlowMods flowMod = readFlowMod(message);
        if (flowMod != null) {
            flowModeList.add(flowMod);
        } else {
            LOG.trace("skipping padding bytes");
        }
    }
    if (LearnCodecUtil.length != 0) {
        LOG.error("Learn Codec read " + Math.abs(messageLength) + " bytes more than needed from stream. Packet might be corrupted");
    }
    nxActionLearnBuilder.setFlowMods(flowModeList);
}
Also used : FlowMods(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods) ArrayList(java.util.ArrayList)

Example 2 with NxActionLearnBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder in project openflowplugin by opendaylight.

the class LearnCodec method deserialize.

@Override
public Action deserialize(final ByteBuf message) {
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setExperimenterId(new ExperimenterId(NiciraConstants.NX_VENDOR_ID));
    short length = LearnCodecUtil.deserializeHeader(message);
    final ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
    NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
    LearnCodecUtil.deserializeLearnHeader(message, nxActionLearnBuilder);
    length -= LearnCodecUtil.HEADER_LENGTH;
    LearnCodecUtil.buildFlowModSpecs(nxActionLearnBuilder, message, length);
    actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
    actionBuilder.setActionChoice(actionLearnBuilder.build());
    return actionBuilder.build();
}
Also used : NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder) ActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearnBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder)

Example 3 with NxActionLearnBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder in project openflowplugin by opendaylight.

the class LearnCodecTest method createAction.

private Action createAction() {
    ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setExperimenterId(experimenterId);
    final ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
    NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
    nxActionLearnBuilder.setIdleTimeout(1);
    nxActionLearnBuilder.setHardTimeout(2);
    nxActionLearnBuilder.setPriority(3);
    nxActionLearnBuilder.setCookie(BigInteger.valueOf(4));
    nxActionLearnBuilder.setFlags(5);
    nxActionLearnBuilder.setTableId((short) 6);
    nxActionLearnBuilder.setFinIdleTimeout(7);
    nxActionLearnBuilder.setFinHardTimeout(8);
    nxActionLearnBuilder.setFlowMods(createFlowMods());
    actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
    actionBuilder.setActionChoice(actionLearnBuilder.build());
    return actionBuilder.build();
}
Also used : NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder) ActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearnBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder)

Example 4 with NxActionLearnBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder in project openflowplugin by opendaylight.

the class LearnConvertor method convert.

@Override
public Action convert(final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
    Preconditions.checkArgument(nxActionArg instanceof NxActionLearnGrouping);
    NxActionLearnGrouping nxAction = (NxActionLearnGrouping) nxActionArg;
    NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
    LearnConvertorUtil.convertDown(nxAction, nxActionLearnBuilder);
    ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
    actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
    return ActionUtil.createAction(actionLearnBuilder.build());
}
Also used : NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder) ActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearnBuilder) NxActionLearnGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionLearnGrouping) NxActionLearnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder)

Aggregations

ActionLearnBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearnBuilder)3 NxActionLearnBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder)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)2 ArrayList (java.util.ArrayList)1 FlowMods (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods)1 NxActionLearnGrouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionLearnGrouping)1