use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder in project openflowplugin by opendaylight.
the class LearnConvertorUtil method buildExtFlowModSpec.
private static FlowModSpec buildExtFlowModSpec(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec flowModSpec) {
if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromField flowModAdd2 = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase) flowModSpec).getFlowModAddMatchFromField();
FlowModAddMatchFromFieldBuilder flowModAdd = new FlowModAddMatchFromFieldBuilder();
flowModAdd.setDstField(flowModAdd2.getDstField());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setDstOfs(flowModAdd2.getDstOfs());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
FlowModAddMatchFromFieldCaseBuilder caseBuilder = new FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(flowModAdd.build());
return caseBuilder.build();
} else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValue flowModAdd2 = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase) flowModSpec).getFlowModAddMatchFromValue();
FlowModAddMatchFromValueBuilder flowModAdd = new FlowModAddMatchFromValueBuilder();
flowModAdd.setValue(flowModAdd2.getValue());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
FlowModAddMatchFromValueCaseBuilder caseBuilder = new FlowModAddMatchFromValueCaseBuilder();
caseBuilder.setFlowModAddMatchFromValue(flowModAdd.build());
return caseBuilder.build();
} else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoField flowModCopy2 = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase) flowModSpec).getFlowModCopyFieldIntoField();
FlowModCopyFieldIntoFieldBuilder flowModCopy = new FlowModCopyFieldIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setSrcField(flowModCopy2.getSrcField());
flowModCopy.setSrcOfs(flowModCopy2.getSrcOfs());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyFieldIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoField flowModCopy2 = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase) flowModSpec).getFlowModCopyValueIntoField();
FlowModCopyValueIntoFieldBuilder flowModCopy = new FlowModCopyValueIntoFieldBuilder();
flowModCopy.setValue(flowModCopy2.getValue());
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyValueIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPort flowModOut2 = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase) flowModSpec).getFlowModOutputToPort();
FlowModOutputToPortBuilder flowModOut = new FlowModOutputToPortBuilder();
flowModOut.setSrcField(flowModOut2.getSrcField());
flowModOut.setSrcOfs(flowModOut2.getSrcOfs());
flowModOut.setFlowModNumBits(flowModOut2.getFlowModNumBits());
FlowModOutputToPortCaseBuilder caseBuilder = new FlowModOutputToPortCaseBuilder();
caseBuilder.setFlowModOutputToPort(flowModOut.build());
return caseBuilder.build();
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder 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.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder 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