Search in sources :

Example 11 with MatchTunnelId

use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.

the class EvpnUtils method programEvpnL2vniFlow.

private void programEvpnL2vniFlow(ElanInstance elanInfo, BiConsumer<BigInteger, FlowEntity> flowHandler) {
    long elanTag = elanInfo.getElanTag();
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(elanUtils.getVxlanSegmentationId(elanInfo))));
    NWUtil.getOperativeDPNs(broker).forEach(dpnId -> {
        LOG.debug("Updating tunnel flow to dpnid {}", dpnId);
        List<InstructionInfo> instructions = getInstructionsForExtTunnelTable(elanTag);
        String flowRef = getFlowRef(NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, elanTag, dpnId);
        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, flowRef, // prio
        5, // flowName
        elanInfo.getElanInstanceName(), // idleTimeout
        0, // hardTimeout
        0, ITMConstants.COOKIE_ITM_EXTERNAL.add(BigInteger.valueOf(elanTag)), mkMatches, instructions);
        flowHandler.accept(dpnId, flowEntity);
    });
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 12 with MatchTunnelId

use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.

the class ElanInterfaceManager method buildMatchesForVni.

private List<MatchInfo> buildMatchesForVni(Long vni) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    MatchInfo match = new MatchTunnelId(BigInteger.valueOf(vni));
    mkMatches.add(match);
    return mkMatches;
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList)

Example 13 with MatchTunnelId

use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.

the class ElanServiceChainUtils method programExternalTunnelTable.

/**
 * This flow is in charge of receiving packets from the TOR and sending
 * them to the SCF Pipeline by setting the LportTag of ElanPseudoPort.
 * Note that ELAN already has a flow in this table that redirects packets
 * to the ELAN Pipeline. However, the flow for the SCF Pipeline will have
 * higher priority, and will only be present when there is a ServiceChain
 * using this ElanPseudoPort.
 * <ul>
 *  <li> Matches on the VNI
 *  <li> Sets SI=1 and ElanPseudoPort tag in the Metadata and sends to
 *    LPortDispatcher via table 80.
 * </ul>
 * @param dpnId Dpn Id where the flow must be installed
 * @param elanLportTag the Elan Pseudo Lport Id to be used in the Dataplane
 * @param vni the VNI to which the Elan is related
 * @param elanTag the Elan Id to be used in the Dataplane
 * @param addOrRemove States if the flow must be added or removed
 */
public static void programExternalTunnelTable(IMdsalApiManager mdsalManager, BigInteger dpnId, int elanLportTag, long vni, int elanTag, int addOrRemove) {
    LOG.info("L2-ServiceChaining: programExternalTunnelTable dpId={} vni={} elanLportTag={} addOrRemove={} ", dpnId, vni, elanLportTag, addOrRemove);
    String flowRef = buildExtTunnelTblToLportDispFlowRef(vni, elanLportTag);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        List<MatchInfo> matches = Collections.singletonList(new MatchTunnelId(BigInteger.valueOf(vni)));
        List<Instruction> instructions = buildSetLportTagAndGotoLportDispInstructions(elanLportTag);
        Flow flow = MDSALUtil.buildFlowNew(NwConstants.EXTERNAL_TUNNEL_TABLE, flowRef, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.TUNNEL_TABLE_COOKIE.add(BigInteger.valueOf(elanTag)), matches, instructions);
        mdsalManager.installFlow(dpnId, flow);
    } else {
        Flow flow = new FlowBuilder().setTableId(NwConstants.EXTERNAL_TUNNEL_TABLE).setId(new FlowId(flowRef)).build();
        mdsalManager.removeFlow(dpnId, flow);
    }
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 14 with MatchTunnelId

use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.

the class EvpnSnatFlowProgrammer method makeTunnelTableEntry.

public void makeTunnelTableEntry(BigInteger dpnId, long l3Vni, List<Instruction> customInstructions, short tableId, WriteTransaction writeFlowTx) {
    LOG.debug("makeTunnelTableEntry : Create terminating service table {} --> table {} flow on NAPT DpnId {} " + "with l3Vni {} as matching parameter", NwConstants.INTERNAL_TUNNEL_TABLE, tableId, dpnId, l3Vni);
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
    Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.SNAT_FLOW_NAME), 5, String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, customInstructions);
    mdsalManager.addFlowToTx(dpnId, terminatingServiceTableFlowEntity, writeFlowTx);
    LOG.debug("makeTunnelTableEntry : Successfully installed terminating service table flow {} on DpnId {}", terminatingServiceTableFlowEntity, dpnId);
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 15 with MatchTunnelId

use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.

the class ExternalRoutersListener method makeTunnelTableEntry.

private void makeTunnelTableEntry(BigInteger dpnId, long serviceId, long l3Vni, List<Instruction> customInstructions, WriteTransaction writeFlowInvTx, ProviderTypes extNwProvType) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    LOG.debug("makeTunnelTableEntry : DpnId = {} and serviceId = {} and actions = {}", dpnId, serviceId, customInstructions);
    if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanManager, extNwProvType)) {
        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
    } else {
        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
    }
    Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, customInstructions);
    mdsalManager.addFlowToTx(dpnId, terminatingServiceTableFlowEntity, writeFlowInvTx);
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Aggregations

MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)24 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)24 ArrayList (java.util.ArrayList)23 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)11 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)9 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)7 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)5 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)5 BigInteger (java.math.BigInteger)3 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 ActionNxConntrack (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack)2 NxCtAction (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction)2 ActionNxLoadMetadata (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata)2 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)2 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)2 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)2 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)2 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)2 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)2