Search in sources :

Example 1 with ActionLearn

use of org.opendaylight.genius.mdsalutil.actions.ActionLearn in project netvirt by opendaylight.

the class ElanNodeListener method setupTableMissSmacFlow.

private void setupTableMissSmacFlow(BigInteger dpId) {
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionPuntToController());
    actionsInfos.add(new ActionLearn(0, tempSmacLearnTimeout, 0, ElanConstants.COOKIE_ELAN_LEARNED_SMAC, 0, NwConstants.ELAN_SMAC_LEARNED_TABLE, 0, 0, Arrays.asList(new ActionLearn.MatchFromField(NwConstants.NxmOfFieldType.NXM_OF_ETH_SRC.getType(), NwConstants.NxmOfFieldType.NXM_OF_ETH_SRC.getType(), NwConstants.NxmOfFieldType.NXM_OF_ETH_SRC.getFlowModHeaderLenInt()), new ActionLearn.MatchFromField(NwConstants.NxmOfFieldType.NXM_NX_REG1.getType(), NwConstants.NxmOfFieldType.NXM_NX_REG1.getType(), ElanConstants.INTERFACE_TAG_LENGTH), new ActionLearn.CopyFromValue(LEARN_MATCH_REG4_VALUE, NwConstants.NxmOfFieldType.NXM_NX_REG4.getType(), 8))));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionApplyActions(actionsInfos));
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
    List<MatchInfo> mkMatches = new ArrayList<>();
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_SMAC_TABLE, getTableMissFlowRef(NwConstants.ELAN_SMAC_TABLE), 0, "ELAN sMac Table Miss Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_SMAC, mkMatches, mkInstructions);
    mdsalManager.installFlow(flowEntity);
    addSmacBaseTableFlow(dpId);
    addSmacLearnedTableFlow(dpId);
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 2 with ActionLearn

use of org.opendaylight.genius.mdsalutil.actions.ActionLearn in project genius by opendaylight.

the class ActionInfoBuilderTest method learnActionValuesMatrix.

@Test
@Ignore("Needs to be rewritten")
public void learnActionValuesMatrix() {
    ActionInfo actionInfo = new ActionLearn(1, 2, 3, BigInteger.valueOf(4), 5, (short) 6, 7, 8, Arrays.asList(new ActionLearn.CopyFromValue(2, 3, 4), new ActionLearn.OutputToPort(4, 5)));
    assertEquals("(new ActionInfoBuilder => [" + System.lineSeparator() + "    actionType = ActionType.learn" + System.lineSeparator() + "    actionValues = #[" + System.lineSeparator() + "        \"1\"," + System.lineSeparator() + "        \"2\"," + System.lineSeparator() + "        \"3\"," + System.lineSeparator() + "        \"4\"," + System.lineSeparator() + "        \"5\"," + System.lineSeparator() + "        \"6\"," + System.lineSeparator() + "        \"7\"," + System.lineSeparator() + "        \"8\"" + System.lineSeparator() + "    ]" + System.lineSeparator() + "    actionValuesMatrix = #[" + System.lineSeparator() + "        #[" + System.lineSeparator() + "            \"COPY_FROM_VALUE\"," + System.lineSeparator() + "            \"2\"," + System.lineSeparator() + "            \"3\"," + System.lineSeparator() + "            \"4\"" + System.lineSeparator() + "        ]," + System.lineSeparator() + "        #[" + System.lineSeparator() + "            \"OUTPUT_TO_PORT\"," + System.lineSeparator() + "            \"4\"," + System.lineSeparator() + "            \"5\"" + System.lineSeparator() + "        ]" + System.lineSeparator() + "    ]" + System.lineSeparator() + "]).build()", generator.getExpression(actionInfo));
}
Also used : ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)2 ActionLearn (org.opendaylight.genius.mdsalutil.actions.ActionLearn)2 ArrayList (java.util.ArrayList)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)1 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)1 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)1 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)1 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)1