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);
});
}
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;
}
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);
}
}
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);
}
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);
}
Aggregations