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);
}
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();
}
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();
}
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());
}
Aggregations