Search in sources :

Example 21 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class PolicyServiceFlowUtil method getPolicyClassifierInstructions.

public List<InstructionInfo> getPolicyClassifierInstructions(long policyClassifierId) {
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionWriteMetadata(MetaDataUtil.getPolicyClassifierMetaData(policyClassifierId), MetaDataUtil.METADATA_MASK_POLICY_CLASSIFER_ID));
    instructions.add(new InstructionGotoTable(NwConstants.EGRESS_POLICY_ROUTING_TABLE));
    return instructions;
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)

Example 22 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable 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 23 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class ElanUtils method buildKnownSmacFlow.

public FlowEntity buildKnownSmacFlow(ElanInstance elanInfo, InterfaceInfo interfaceInfo, long macTimeout, String macAddress) {
    int lportTag = interfaceInfo.getInterfaceTag();
    // Matching metadata and eth_src fields
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanInfo.getElanTag(), lportTag), ElanHelper.getElanMetadataMask()));
    mkMatches.add(new MatchEthernetSource(new MacAddress(macAddress)));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
    BigInteger dpId = interfaceInfo.getDpId();
    long elanTag = getElanTag(elanInfo, interfaceInfo);
    return new FlowEntityBuilder().setDpnId(dpId).setTableId(NwConstants.ELAN_SMAC_TABLE).setFlowId(getKnownDynamicmacFlowRef(NwConstants.ELAN_SMAC_TABLE, dpId, lportTag, macAddress, elanTag)).setPriority(20).setFlowName(elanInfo.getDescription()).setIdleTimeOut((int) macTimeout).setHardTimeOut(0).setCookie(ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(elanTag))).setMatchInfoList(mkMatches).setInstructionInfoList(mkInstructions).setStrictFlag(true).setSendFlowRemFlag(macTimeout != 0).build();
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) FlowEntityBuilder(org.opendaylight.genius.mdsalutil.FlowEntityBuilder) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MatchEthernetSource(org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource) ArrayList(java.util.ArrayList) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) BigInteger(java.math.BigInteger)

Example 24 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class VpnUtil method buildL3vpnGatewayFlow.

public static FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId, long subnetVpnId) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
    if (subnetVpnId != VpnConstants.INVALID_ID) {
        BigInteger subnetIdMetaData = MetaDataUtil.getVpnIdMetadata(subnetVpnId);
        mkInstructions.add(new InstructionWriteMetadata(subnetIdMetaData, MetaDataUtil.METADATA_MASK_VRFID));
    }
    String flowId = getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
    return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, flowId, 20, flowId, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, mkMatches, mkInstructions);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) 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) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Example 25 with InstructionGotoTable

use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.

the class EvpnUtils method getInstructionsForExtTunnelTable.

private List<InstructionInfo> getInstructionsForExtTunnelTable(Long elanTag) {
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionWriteMetadata(ElanUtils.getElanMetadataLabel(elanTag, false), ElanHelper.getElanMetadataMask()));
    mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
    return mkInstructions;
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)

Aggregations

InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)44 ArrayList (java.util.ArrayList)43 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)33 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)25 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)17 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)15 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)14 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)14 BigInteger (java.math.BigInteger)13 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)12 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)10 ActionPopMpls (org.opendaylight.genius.mdsalutil.actions.ActionPopMpls)7 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)6 CreateFibEntryInput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fib.rpc.rev160121.CreateFibEntryInput)6 CreateFibEntryInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fib.rpc.rev160121.CreateFibEntryInputBuilder)6 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)5 MatchMplsLabel (org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel)5 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)5