use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder in project openflowplugin by opendaylight.
the class LearnConvertorUtil method getFlowMods.
private static List<FlowMods> getFlowMods(NxActionLearn action) {
if (action.getFlowMods() == null) {
return null;
}
List<FlowMods> flowMods = new ArrayList<>();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods flowMod : action.getFlowMods()) {
FlowModsBuilder flowModBuilder = new FlowModsBuilder();
FlowModSpec flowModSpec = buildExtFlowModSpec(flowMod.getFlowModSpec());
flowModBuilder.setFlowModSpec(flowModSpec);
flowMods.add(flowModBuilder.build());
}
return flowMods;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder in project openflowplugin by opendaylight.
the class LearnCodecUtil method readFlowModAddMatchFromValue.
private static FlowMods readFlowModAddMatchFromValue(ByteBuf message, short numBits) {
FlowModAddMatchFromValueBuilder builder = new FlowModAddMatchFromValueBuilder();
builder.setValue(message.readUnsignedShort());
builder.setSrcField((long) message.readInt());
builder.setSrcOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModAddMatchFromValueCaseBuilder caseBuilder = new FlowModAddMatchFromValueCaseBuilder();
caseBuilder.setFlowModAddMatchFromValue(builder.build());
flowModsBuilder.setFlowModSpec(caseBuilder.build());
return flowModsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder in project openflowplugin by opendaylight.
the class LearnCodecUtil method readFlowModCopyFromValue.
private static FlowMods readFlowModCopyFromValue(ByteBuf message, short numBits) {
FlowModCopyValueIntoFieldBuilder builder = new FlowModCopyValueIntoFieldBuilder();
builder.setValue(message.readUnsignedShort());
builder.setDstField((long) message.readInt());
builder.setDstOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyValueIntoField(builder.build());
flowModsBuilder.setFlowModSpec(caseBuilder.build());
return flowModsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder in project openflowplugin by opendaylight.
the class LearnCodecUtil method readFlowModCopyFromField.
private static FlowMods readFlowModCopyFromField(ByteBuf message, short numBits) {
FlowModCopyFieldIntoFieldBuilder builder = new FlowModCopyFieldIntoFieldBuilder();
builder.setSrcField((long) message.readInt());
builder.setSrcOfs((int) message.readShort());
builder.setDstField((long) message.readInt());
builder.setDstOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyFieldIntoField(builder.build());
flowModsBuilder.setFlowModSpec(caseBuilder.build());
return flowModsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder in project openflowplugin by opendaylight.
the class LearnCodecTest method createFlowMods.
private List<FlowMods> createFlowMods() {
final List<FlowMods> flowMods = new ArrayList<>();
// length = 14
final FlowModsBuilder flowMod = new FlowModsBuilder();
FlowModAddMatchFromFieldBuilder spec = new FlowModAddMatchFromFieldBuilder();
spec.setFlowModNumBits(48);
spec.setSrcField((long) 9);
spec.setSrcOfs(10);
spec.setDstField((long) 11);
spec.setDstOfs(12);
FlowModAddMatchFromFieldCaseBuilder caseBuilder = new FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(spec.build());
flowMod.setFlowModSpec(caseBuilder.build());
flowMods.add(flowMod.build());
// length = 14
final FlowModsBuilder flowMod2 = new FlowModsBuilder();
FlowModCopyFieldIntoFieldBuilder spec2 = new FlowModCopyFieldIntoFieldBuilder();
spec2.setFlowModNumBits(48);
spec2.setSrcField((long) 9);
spec2.setSrcOfs(10);
spec2.setDstField((long) 11);
spec2.setDstOfs(12);
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder2 = new FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder2.setFlowModCopyFieldIntoField(spec2.build());
flowMod2.setFlowModSpec(caseBuilder2.build());
flowMods.add(flowMod2.build());
// length = 10
final FlowModsBuilder flowMod3 = new FlowModsBuilder();
FlowModCopyValueIntoFieldBuilder spec3 = new FlowModCopyValueIntoFieldBuilder();
spec3.setFlowModNumBits(48);
spec3.setValue(9);
spec3.setDstField((long) 10);
spec3.setDstOfs(11);
FlowModCopyValueIntoFieldCaseBuilder caseBuilder3 = new FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder3.setFlowModCopyValueIntoField(spec3.build());
flowMod3.setFlowModSpec(caseBuilder3.build());
flowMods.add(flowMod3.build());
// length = 10
final FlowModsBuilder flowMod4 = new FlowModsBuilder();
FlowModAddMatchFromValueBuilder spec4 = new FlowModAddMatchFromValueBuilder();
spec4.setFlowModNumBits(48);
spec4.setValue(9);
spec4.setSrcField((long) 10);
spec4.setSrcOfs(11);
FlowModAddMatchFromValueCaseBuilder caseBuilder4 = new FlowModAddMatchFromValueCaseBuilder();
caseBuilder4.setFlowModAddMatchFromValue(spec4.build());
flowMod4.setFlowModSpec(caseBuilder4.build());
flowMods.add(flowMod4.build());
// length = 8
final FlowModsBuilder flowMod5 = new FlowModsBuilder();
FlowModOutputToPortBuilder spec5 = new FlowModOutputToPortBuilder();
spec5.setFlowModNumBits(48);
spec5.setSrcField((long) 9);
spec5.setSrcOfs(10);
FlowModOutputToPortCaseBuilder caseBuilder5 = new FlowModOutputToPortCaseBuilder();
caseBuilder5.setFlowModOutputToPort(spec5.build());
flowMod5.setFlowModSpec(caseBuilder5.build());
flowMods.add(flowMod5.build());
return flowMods;
}
Aggregations