Search in sources :

Example 1 with MatchInPort

use of org.opendaylight.genius.mdsalutil.matches.MatchInPort in project genius by opendaylight.

the class FlowBasedServicesUtils method getMatchInfoForTunnelPortAtIngressTable.

@Nonnull
public static List<MatchInfo> getMatchInfoForTunnelPortAtIngressTable(BigInteger dpId, long portNo) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchInPort(dpId, portNo));
    return matches;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort) Nonnull(javax.annotation.Nonnull)

Example 2 with MatchInPort

use of org.opendaylight.genius.mdsalutil.matches.MatchInPort in project genius by opendaylight.

the class FlowBasedServicesUtils method getMatchInfoForVlanPortAtIngressTable.

public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchInPort(dpId, portNo));
    int vlanId = 0;
    IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
    if (l2vlan != null) {
        vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
    }
    if (vlanId >= 0 && l2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Transparent) {
        matches.add(new MatchVlanVid(vlanId));
    }
    return matches;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchVlanVid(org.opendaylight.genius.mdsalutil.matches.MatchVlanVid) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 3 with MatchInPort

use of org.opendaylight.genius.mdsalutil.matches.MatchInPort 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)

Example 4 with MatchInPort

use of org.opendaylight.genius.mdsalutil.matches.MatchInPort in project genius by opendaylight.

the class InterfaceServiceUtil method getMatchInfoForVlanLPort.

public static List<MatchInfo> getMatchInfoForVlanLPort(BigInteger dpId, long portNo, long vlanId, boolean isVlanTransparent) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchInPort(dpId, portNo));
    if (vlanId != 0 && !isVlanTransparent) {
        matches.add(new MatchVlanVid((int) vlanId));
    }
    return matches;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchVlanVid(org.opendaylight.genius.mdsalutil.matches.MatchVlanVid) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort)

Aggregations

ArrayList (java.util.ArrayList)4 MatchInPort (org.opendaylight.genius.mdsalutil.matches.MatchInPort)4 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)3 MatchVlanVid (org.opendaylight.genius.mdsalutil.matches.MatchVlanVid)2 Nonnull (javax.annotation.Nonnull)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 NxMatchTunnelDestinationIp (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelDestinationIp)1 NxMatchTunnelSourceIp (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchTunnelSourceIp)1 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)1 TunnelTypeMplsOverGre (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre)1