Search in sources :

Example 1 with MatchTunnelId

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

the class EvpnSnatFlowProgrammer method removeTunnelTableEntry.

public void removeTunnelTableEntry(BigInteger dpnId, long l3Vni, WriteTransaction removeFlowInvTx) {
    LOG.debug("removeTunnelTableEntry : Remove terminating service table {} --> table {} flow on NAPT DpnId {} " + "with l3Vni {} as matching parameter", NwConstants.INTERNAL_TUNNEL_TABLE, NwConstants.INBOUND_NAPT_TABLE, dpnId, l3Vni);
    List<MatchInfo> mkMatches = new ArrayList<>();
    // Matching metadata
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
    Flow flowEntity = 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, null);
    mdsalManager.removeFlowToTx(dpnId, flowEntity, removeFlowInvTx);
    LOG.debug("removeTunnelTableEntry : Successfully removed terminating service table flow {} on DpnId {}", flowEntity, 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 2 with MatchTunnelId

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

the class ExternalRoutersListener method buildTsFlowEntityWithUpdatedVpnId.

private FlowEntity buildTsFlowEntityWithUpdatedVpnId(BigInteger dpId, String routerName, long routerIdLongVal, long changedVpnId, ProviderTypes extNwProvType) {
    LOG.debug("buildTsFlowEntityWithUpdatedVpnId : called for switch {}, routerName {}, BGP VPN ID {}", dpId, routerName, changedVpnId);
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    BigInteger tunnelId = BigInteger.valueOf(changedVpnId);
    if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanManager, extNwProvType)) {
        tunnelId = NatOverVxlanUtil.getRouterVni(idManager, routerName, changedVpnId);
    }
    matches.add(new MatchTunnelId(tunnelId));
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
    instructions.add(new InstructionGotoTable(NwConstants.OUTBOUND_NAPT_TABLE));
    BigInteger routerId = BigInteger.valueOf(routerIdLongVal);
    String flowRef = getFlowRefTs(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId.longValue());
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef, NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_TS_TABLE, matches, instructions);
    return flowEntity;
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 3 with MatchTunnelId

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

the class VpnFloatingIpHandler method makeTunnelTableEntry.

private void makeTunnelTableEntry(String vpnName, BigInteger dpnId, long serviceId, List<Instruction> customInstructions, WriteTransaction writeFlowInvTx, ProviderTypes provType) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    LOG.info("makeTunnelTableEntry on DpnId = {} and serviceId = {}", dpnId, serviceId);
    int flowPriority = 5;
    // then handled back to using using flow 25->44(which will be installed as part of SNAT)
    if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanService, provType)) {
        mkMatches.add(new MatchTunnelId(NatOverVxlanUtil.getInternetVpnVni(idManager, vpnName, serviceId)));
        flowPriority = 6;
    } else {
        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
    }
    Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), flowPriority, 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)

Example 4 with MatchTunnelId

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

the class EvpnDnatFlowProgrammer method makeTunnelTableEntry.

private void makeTunnelTableEntry(BigInteger dpnId, long l3Vni, List<Instruction> customInstructions, WriteTransaction writeFlowInvTx) {
    LOG.debug("makeTunnelTableEntry : Create terminating service table {} --> table {} flow on DpnId {} " + "with l3Vni {} as matching parameter", NwConstants.INTERNAL_TUNNEL_TABLE, NwConstants.PDNAT_TABLE, 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.DNAT_FLOW_NAME), 6, String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, customInstructions);
    mdsalManager.addFlowToTx(dpnId, terminatingServiceTableFlowEntity, writeFlowInvTx);
    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 5 with MatchTunnelId

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

the class ElanUtils method getTunnelIdMatchForFilterEqualsLPortTag.

/**
 * Constructs the Matches that checks that the tunnel_id field contains a
 * specific lportTag.
 *
 * @param lportTag
 *            lportTag that must be checked against the tunnel_id field
 * @return the list of match Info
 */
public static List<MatchInfo> getTunnelIdMatchForFilterEqualsLPortTag(int lportTag) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    // Matching metadata
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(lportTag)));
    return mkMatches;
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList)

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