Search in sources :

Example 1 with NxLearn

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearn in project openflowplugin by opendaylight.

the class LearnConvertorUtil method getFlowMods.

private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods> getFlowMods(NxLearn nxLearn) {
    if (nxLearn.getFlowMods() == null) {
        return null;
    }
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods> flowMods = new ArrayList<>();
    for (FlowMods flowMod : nxLearn.getFlowMods()) {
        org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder flowModBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder();
        org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.FlowModSpec flowModSpec = buildFlowModSpec(flowMod.getFlowModSpec());
        flowModBuilder.setFlowModSpec(flowModSpec);
        flowMods.add(flowModBuilder.build());
    }
    return flowMods;
}
Also used : ArrayList(java.util.ArrayList) FlowModsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowModsBuilder) FlowMods(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowMods)

Example 2 with NxLearn

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearn 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);
}
Also used : FlowModOutputToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPort) FlowModCopyFieldIntoFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase) FlowModAddMatchFromValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValue) NxActionLearnNodesNodeTableFlowApplyActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionLearnNodesNodeTableFlowApplyActionsCase) FlowModAddMatchFromFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase) FlowModAddMatchFromField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromField) FlowMods(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowMods) FlowModOutputToPortCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase) NxLearn(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearn) FlowModAddMatchFromValueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase) FlowModCopyValueIntoField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoField) FlowModCopyFieldIntoField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoField) FlowModCopyValueIntoFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase)

Aggregations

FlowMods (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowMods)2 ArrayList (java.util.ArrayList)1 FlowModAddMatchFromFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase)1 FlowModAddMatchFromValueCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromValueCase)1 FlowModCopyFieldIntoFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModCopyFieldIntoFieldCase)1 FlowModCopyValueIntoFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModCopyValueIntoFieldCase)1 FlowModOutputToPortCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.FlowModOutputToPortCase)1 FlowModAddMatchFromField (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.field._case.FlowModAddMatchFromField)1 FlowModAddMatchFromValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.add.match.from.value._case.FlowModAddMatchFromValue)1 FlowModCopyFieldIntoField (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.copy.field.into.field._case.FlowModCopyFieldIntoField)1 FlowModCopyValueIntoField (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.copy.value.into.field._case.FlowModCopyValueIntoField)1 FlowModOutputToPort (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flow.mod.spec.flow.mod.spec.flow.mod.output.to.port._case.FlowModOutputToPort)1 NxActionLearnNodesNodeTableFlowApplyActionsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionLearnNodesNodeTableFlowApplyActionsCase)1 NxLearn (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.NxLearn)1 FlowModsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.learn.grouping.nx.learn.FlowModsBuilder)1