use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase in project openflowplugin by opendaylight.
the class LearnConvertorUtil method buildFlowModSpec.
private static org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec buildFlowModSpec(FlowModSpec flowModSpec) {
if (flowModSpec instanceof FlowModAddMatchFromFieldCase) {
FlowModAddMatchFromField flowModAdd2 = ((FlowModAddMatchFromFieldCase) flowModSpec).getFlowModAddMatchFromField();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder flowModAdd = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromFieldBuilder();
flowModAdd.setDstField(flowModAdd2.getDstField());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setDstOfs(flowModAdd2.getDstOfs());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(flowModAdd.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModAddMatchFromValueCase) {
FlowModAddMatchFromValue flowModAdd2 = ((FlowModAddMatchFromValueCase) flowModSpec).getFlowModAddMatchFromValue();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder flowModAdd = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValueBuilder();
flowModAdd.setValue(flowModAdd2.getValue());
flowModAdd.setSrcField(flowModAdd2.getSrcField());
flowModAdd.setSrcOfs(flowModAdd2.getSrcOfs());
flowModAdd.setFlowModNumBits(flowModAdd2.getFlowModNumBits());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCaseBuilder();
caseBuilder.setFlowModAddMatchFromValue(flowModAdd.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModCopyFieldIntoFieldCase) {
FlowModCopyFieldIntoField flowModCopy2 = ((FlowModCopyFieldIntoFieldCase) flowModSpec).getFlowModCopyFieldIntoField();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder flowModCopy = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setSrcField(flowModCopy2.getSrcField());
flowModCopy.setSrcOfs(flowModCopy2.getSrcOfs());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyFieldIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModCopyValueIntoFieldCase) {
FlowModCopyValueIntoField flowModCopy2 = ((FlowModCopyValueIntoFieldCase) flowModSpec).getFlowModCopyValueIntoField();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder flowModCopy = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoFieldBuilder();
flowModCopy.setDstField(flowModCopy2.getDstField());
flowModCopy.setDstOfs(flowModCopy2.getDstOfs());
flowModCopy.setValue(flowModCopy2.getValue());
flowModCopy.setFlowModNumBits(flowModCopy2.getFlowModNumBits());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder.setFlowModCopyValueIntoField(flowModCopy.build());
return caseBuilder.build();
} else if (flowModSpec instanceof FlowModOutputToPortCase) {
FlowModOutputToPort flowModOut2 = ((FlowModOutputToPortCase) flowModSpec).getFlowModOutputToPort();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPortBuilder flowModOut = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPortBuilder();
flowModOut.setSrcField(flowModOut2.getSrcField());
flowModOut.setSrcOfs(flowModOut2.getSrcOfs());
flowModOut.setFlowModNumBits(flowModOut2.getFlowModNumBits());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCaseBuilder caseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCaseBuilder();
caseBuilder.setFlowModOutputToPort(flowModOut.build());
return caseBuilder.build();
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase in project openflowplugin by opendaylight.
the class LearnCodecUtil method serializeFlowMods.
static void serializeFlowMods(final ByteBuf outBuffer, ActionLearn action) {
if (action.getNxActionLearn().getFlowMods() != null) {
for (FlowMods flowMod : action.getNxActionLearn().getFlowMods()) {
if (flowMod.getFlowModSpec() instanceof FlowModAddMatchFromFieldCase) {
FlowModAddMatchFromField flowModSpecFromField = ((FlowModAddMatchFromFieldCase) flowMod.getFlowModSpec()).getFlowModAddMatchFromField();
toFlowModSpecHeader(flowModSpecFromField, outBuffer);
outBuffer.writeInt(flowModSpecFromField.getSrcField().intValue());
outBuffer.writeShort(flowModSpecFromField.getSrcOfs().shortValue());
outBuffer.writeInt(flowModSpecFromField.getDstField().intValue());
outBuffer.writeShort(flowModSpecFromField.getDstOfs().shortValue());
} else if (flowMod.getFlowModSpec() instanceof FlowModAddMatchFromValueCase) {
FlowModAddMatchFromValue flowModSpec = ((FlowModAddMatchFromValueCase) flowMod.getFlowModSpec()).getFlowModAddMatchFromValue();
toFlowModSpecHeader(flowModSpec, outBuffer);
outBuffer.writeShort(flowModSpec.getValue().shortValue());
outBuffer.writeInt(flowModSpec.getSrcField().intValue());
outBuffer.writeShort(flowModSpec.getSrcOfs().shortValue());
} else if (flowMod.getFlowModSpec() instanceof FlowModCopyFieldIntoFieldCase) {
FlowModCopyFieldIntoField flowModSpec = ((FlowModCopyFieldIntoFieldCase) flowMod.getFlowModSpec()).getFlowModCopyFieldIntoField();
toFlowModSpecHeader(flowModSpec, outBuffer);
outBuffer.writeInt(flowModSpec.getSrcField().intValue());
outBuffer.writeShort(flowModSpec.getSrcOfs().shortValue());
outBuffer.writeInt(flowModSpec.getDstField().intValue());
outBuffer.writeShort(flowModSpec.getDstOfs().shortValue());
} else if (flowMod.getFlowModSpec() instanceof FlowModCopyValueIntoFieldCase) {
FlowModCopyValueIntoField flowModSpec = ((FlowModCopyValueIntoFieldCase) flowMod.getFlowModSpec()).getFlowModCopyValueIntoField();
toFlowModSpecHeader(flowModSpec, outBuffer);
outBuffer.writeShort(flowModSpec.getValue().shortValue());
outBuffer.writeInt(flowModSpec.getDstField().intValue());
outBuffer.writeShort(flowModSpec.getDstOfs().shortValue());
} else if (flowMod.getFlowModSpec() instanceof FlowModOutputToPortCase) {
FlowModOutputToPort flowModSpec = ((FlowModOutputToPortCase) flowMod.getFlowModSpec()).getFlowModOutputToPort();
toFlowModSpecHeader(flowModSpec, outBuffer);
outBuffer.writeInt(flowModSpec.getSrcField().intValue());
outBuffer.writeShort(flowModSpec.getSrcOfs().shortValue());
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase in project genius by opendaylight.
the class ActionLearnTest method verifyAction.
private void verifyAction(Action action) {
assertTrue(action.getAction() instanceof NxActionLearnNodesNodeTableFlowApplyActionsCase);
NxActionLearnNodesNodeTableFlowApplyActionsCase nxAction = (NxActionLearnNodesNodeTableFlowApplyActionsCase) action.getAction();
NxLearn nxLearn = nxAction.getNxLearn();
assertEquals(IDLE_TIMEOUT, nxLearn.getIdleTimeout().intValue());
assertEquals(HARD_TIMEOUT, nxLearn.getHardTimeout().intValue());
assertEquals(PRIORITY, nxLearn.getPriority().intValue());
assertEquals(COOKIE, nxLearn.getCookie());
assertEquals(FLAGS, nxLearn.getFlags().intValue());
assertEquals(TABLE_ID, nxLearn.getTableId().shortValue());
assertEquals(FIN_IDLE_TIMEOUT, nxLearn.getFinIdleTimeout().intValue());
assertEquals(FIN_HARD_TIMEOUT, nxLearn.getFinHardTimeout().intValue());
assertEquals(5, nxLearn.getFlowMods().size());
int nbChecked = 0;
for (FlowMods flowMods : nxLearn.getFlowMods()) {
if (flowMods.getFlowModSpec() instanceof FlowModAddMatchFromFieldCase) {
FlowModAddMatchFromFieldCase flowModAddMatchFromFieldCase = (FlowModAddMatchFromFieldCase) flowMods.getFlowModSpec();
FlowModAddMatchFromField flowModAddMatchFromField = flowModAddMatchFromFieldCase.getFlowModAddMatchFromField();
assertEquals(0, flowModAddMatchFromField.getSrcOfs().intValue());
assertEquals(1, flowModAddMatchFromField.getSrcField().longValue());
assertEquals(0, flowModAddMatchFromField.getDstOfs().intValue());
assertEquals(2, flowModAddMatchFromField.getDstField().longValue());
assertEquals(3, flowModAddMatchFromField.getFlowModNumBits().intValue());
nbChecked++;
} else if (flowMods.getFlowModSpec() instanceof FlowModAddMatchFromValueCase) {
FlowModAddMatchFromValueCase flowModAddMatchFromValueCase = (FlowModAddMatchFromValueCase) flowMods.getFlowModSpec();
FlowModAddMatchFromValue flowModAddMatchFromValue = flowModAddMatchFromValueCase.getFlowModAddMatchFromValue();
assertEquals(4, flowModAddMatchFromValue.getValue().intValue());
assertEquals(0, flowModAddMatchFromValue.getSrcOfs().intValue());
assertEquals(5, flowModAddMatchFromValue.getSrcField().longValue());
assertEquals(6, flowModAddMatchFromValue.getFlowModNumBits().intValue());
nbChecked++;
} else if (flowMods.getFlowModSpec() instanceof FlowModCopyFieldIntoFieldCase) {
FlowModCopyFieldIntoFieldCase flowModCopyFieldIntoFieldCase = (FlowModCopyFieldIntoFieldCase) flowMods.getFlowModSpec();
FlowModCopyFieldIntoField flowModCopyFieldIntoField = flowModCopyFieldIntoFieldCase.getFlowModCopyFieldIntoField();
assertEquals(0, flowModCopyFieldIntoField.getSrcOfs().intValue());
assertEquals(7, flowModCopyFieldIntoField.getSrcField().longValue());
assertEquals(0, flowModCopyFieldIntoField.getDstOfs().intValue());
assertEquals(8, flowModCopyFieldIntoField.getDstField().longValue());
assertEquals(9, flowModCopyFieldIntoField.getFlowModNumBits().intValue());
nbChecked++;
} else if (flowMods.getFlowModSpec() instanceof FlowModCopyValueIntoFieldCase) {
FlowModCopyValueIntoFieldCase flowModCopyValueIntoFieldCase = (FlowModCopyValueIntoFieldCase) flowMods.getFlowModSpec();
FlowModCopyValueIntoField flowModCopyValueIntoField = flowModCopyValueIntoFieldCase.getFlowModCopyValueIntoField();
assertEquals(10, flowModCopyValueIntoField.getValue().intValue());
assertEquals(0, flowModCopyValueIntoField.getDstOfs().intValue());
assertEquals(11, flowModCopyValueIntoField.getDstField().longValue());
assertEquals(12, flowModCopyValueIntoField.getFlowModNumBits().intValue());
nbChecked++;
} else if (flowMods.getFlowModSpec() instanceof FlowModOutputToPortCase) {
FlowModOutputToPortCase flowModOutputToPortCase = (FlowModOutputToPortCase) flowMods.getFlowModSpec();
FlowModOutputToPort flowModCopyFieldIntoField = flowModOutputToPortCase.getFlowModOutputToPort();
assertEquals(0, flowModCopyFieldIntoField.getSrcOfs().intValue());
assertEquals(13, flowModCopyFieldIntoField.getSrcField().longValue());
assertEquals(14, flowModCopyFieldIntoField.getFlowModNumBits().intValue());
nbChecked++;
}
}
assertEquals(5, nbChecked);
}
Aggregations