Search in sources :

Example 1 with NxMatchTunnelDestinationIp

use of org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelDestinationIp 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));
}
Also used : NxMatchTunnelDestinationIp(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelDestinationIp) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) NxMatchTunnelSourceIp(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelSourceIp) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) TunnelTypeMplsOverGre(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre)

Aggregations

ArrayList (java.util.ArrayList)1 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)1 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)1 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)1 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)1 MatchInPort (org.opendaylight.genius.mdsalutil.matches.MatchInPort)1 NxMatchTunnelDestinationIp (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelDestinationIp)1 NxMatchTunnelSourceIp (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelSourceIp)1 TunnelTypeMplsOverGre (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre)1