use of org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelSourceIp in project genius by opendaylight.
the class InterfaceManagerCommonUtils method addTunnelIngressFlow.
public void addTunnelIngressFlow(IfTunnel tunnel, BigInteger dpnId, long portNo, String interfaceName, int ifIndex) {
if (isTunnelWithoutIngressFlow(tunnel)) {
return;
}
LOG.debug("add tunnel ingress flow for {}", interfaceName);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(new MatchInPort(dpnId, portNo));
if (BooleanUtils.isTrue(tunnel.isTunnelRemoteIpFlow())) {
matches.add(new NxMatchTunnelSourceIp(tunnel.getTunnelDestination().getIpv4Address()));
}
if (BooleanUtils.isTrue(tunnel.isTunnelSourceIpFlow())) {
matches.add(new NxMatchTunnelDestinationIp(tunnel.getTunnelSource().getIpv4Address()));
}
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteMetadata(MetaDataUtil.getLportTagMetaData(ifIndex).or(BigInteger.ONE), MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG));
short tableId = tunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeMplsOverGre.class) ? NwConstants.L3_LFIB_TABLE : tunnel.isInternal() ? NwConstants.INTERNAL_TUNNEL_TABLE : NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL;
mkInstructions.add(new InstructionGotoTable(tableId));
mdsalApiManager.batchedAddFlow(dpnId, buildTunnelIngressFlowEntity(dpnId, interfaceName, matches, mkInstructions));
}
Aggregations