Search in sources :

Example 1 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class ElanInterfaceManager method getInstructionsIntOrExtTunnelTable.

/**
 * Builds the list of instructions to be installed in the INTERNAL_TUNNEL_TABLE (36) / EXTERNAL_TUNNEL_TABLE (38)
 * which so far consists of writing the elanTag in metadata and send the packet to ELAN_DMAC_TABLE.
 *
 * @param elanTag
 *            elanTag to be written in metadata when flow is selected
 * @return the instructions ready to be installed in a flow
 */
private List<InstructionInfo> getInstructionsIntOrExtTunnelTable(Long elanTag) {
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionWriteMetadata(ElanHelper.getElanMetadataLabel(elanTag), ElanHelper.getElanMetadataMask()));
    /* applicable for EXTERNAL_TUNNEL_TABLE only
        * TODO: We should point to SMAC or DMAC depending on a configuration property to enable mac learning
        */
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
    return mkInstructions;
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)

Example 2 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class ElanNodeListener method setupTableMissDmacFlow.

private void setupTableMissDmacFlow(BigInteger dpId) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_UNKNOWN_DMAC_TABLE));
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, getTableMissFlowRef(NwConstants.ELAN_DMAC_TABLE), 0, "ELAN dMac Table Miss Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC, mkMatches, mkInstructions);
    mdsalManager.installFlow(flowEntity);
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 3 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable 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 4 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class ElanNodeListener method addSmacLearnedTableFlow.

private void addSmacLearnedTableFlow(BigInteger dpId) {
    // T50 - match on Reg4 and goto T51
    List<MatchInfoBase> mkMatches = new ArrayList<>();
    mkMatches.add(new NxMatchRegister(NxmNxReg4.class, LEARN_MATCH_REG4_VALUE));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
    String flowRef = new StringBuffer().append(NwConstants.ELAN_SMAC_TABLE).append(NwConstants.FLOWID_SEPARATOR).append(LEARN_MATCH_REG4_VALUE).toString();
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_SMAC_TABLE, flowRef, 10, "ELAN sMac Table Reg4 Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(LEARN_MATCH_REG4_VALUE)), mkMatches, mkInstructions);
    mdsalManager.installFlow(flowEntity);
}
Also used : NxmNxReg4(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) NxMatchRegister(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 5 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class AclServiceUtils method createCtMarkInstructionForNewState.

/**
 * This method creates and returns the ct_mark instruction when a ACL rule removed from the
 * instance. This instruction will reset the ct_mark value and stops the existing traffics.
 *
 * @param filterTable the filterTable
 * @param elanId the Elan id
 * @return list of instruction
 */
public static List<InstructionInfo> createCtMarkInstructionForNewState(Short filterTable, Long elanId) {
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    List<NxCtAction> ctActionsList = new ArrayList<>();
    NxCtAction nxCtMarkClearAction = new ActionNxConntrack.NxCtMark(AclConstants.CT_MARK_NEW_STATE);
    ctActionsList.add(nxCtMarkClearAction);
    ActionNxConntrack actionNxConntrack = new ActionNxConntrack(2, 1, 0, elanId.intValue(), (short) 255, ctActionsList);
    actionsInfos.add(actionNxConntrack);
    instructions.add(new InstructionApplyActions(actionsInfos));
    instructions.add(new InstructionGotoTable(filterTable));
    return instructions;
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) NxCtAction(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction) ActionNxConntrack(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)44 ArrayList (java.util.ArrayList)43 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)33 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)25 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)17 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)15 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)14 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)14 BigInteger (java.math.BigInteger)13 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)12 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)10 ActionPopMpls (org.opendaylight.genius.mdsalutil.actions.ActionPopMpls)7 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)6 CreateFibEntryInput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fib.rpc.rev160121.CreateFibEntryInput)6 CreateFibEntryInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fib.rpc.rev160121.CreateFibEntryInputBuilder)6 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)5 MatchMplsLabel (org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel)5 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)5