Search in sources :

Example 16 with InstructionGotoTable

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

the class BaseVrfEntryHandler method buildL3vpnGatewayFlow.

public FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId) {
    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));
    String flowId = FibUtil.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) 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 17 with InstructionGotoTable

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

the class VpnNodeListener method makeTableMissFlow.

private void makeTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
    final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
    // Instruction to goto L3 InterfaceTable
    List<InstructionInfo> instructions = Collections.singletonList(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
    List<MatchInfo> matches = new ArrayList<>();
    FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_LFIB_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "Table Miss", 0, 0, cookieTableMiss, matches, instructions);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        LOG.debug("Invoking MDSAL to install Table Miss Entry");
        mdsalManager.addFlowToTx(flowEntityLfib, writeFlowTx);
    } else {
        mdsalManager.removeFlowToTx(flowEntityLfib, writeFlowTx);
    }
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) BigInteger(java.math.BigInteger) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 18 with InstructionGotoTable

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

the class DhcpManager method setupTableMissForHandlingExternalTunnel.

private void setupTableMissForHandlingExternalTunnel(BigInteger dpId) {
    List<MatchInfo> matches = new ArrayList<>();
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionGotoTable(NwConstants.EXTERNAL_TUNNEL_TABLE));
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL, "DHCPTableMissFlowForExternalTunnel", 0, "DHCP Table Miss Flow For External Tunnel", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
    DhcpServiceCounters.install_dhcp_table_miss_flow_for_external_table.inc();
    mdsalUtil.installFlow(flowEntity);
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 19 with InstructionGotoTable

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

the class VpnServiceChainUtils method buildLFibVpnPseudoPortFlow.

/**
 * Builds a Flow for the LFIB table that sets the LPortTag of the
 * VpnPseudoPort and sends to LPortDispatcher table.
 * <ul>
 * <li>Matching: eth_type = MPLS, mpls_label = VPN MPLS label
 * <li>Actions: setMetadata LportTag and SI=2, pop MPLS, Go to
 *              LPortDispacherTable
 * </ul>
 *
 * @param dpId  DpnId
 * @param label MPLS label
 * @param nextHop Next Hop IP
 * @param lportTag Pseudo Logical Port tag
 * @return the FlowEntity
 */
public static FlowEntity buildLFibVpnPseudoPortFlow(BigInteger dpId, Long label, String nextHop, int lportTag) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.MPLS_UNICAST);
    matches.add(new MatchMplsLabel(label));
    List<ActionInfo> actionsInfos = Collections.singletonList(new ActionPopMpls());
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionWriteMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)), MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
    instructions.add(new InstructionApplyActions(actionsInfos));
    instructions.add(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
    String flowRef = getLFibVpnPseudoPortFlowRef(lportTag, label, nextHop);
    return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) MatchMplsLabel(org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ActionPopMpls(org.opendaylight.genius.mdsalutil.actions.ActionPopMpls) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 20 with InstructionGotoTable

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

the class ArpResponderUtil method getExtInterfaceInstructions.

/**
 * Get instruction list for ARP responder flows originated from ext-net e.g.
 * router-gw/fip.<br>
 * The split-horizon bit should be reset in order to allow traffic from
 * provider network to be routed back to flat/VLAN network and override the
 * egress table drop flow.<br>
 * In order to allow write-metadata in the ARP responder table the resubmit
 * action needs to be replaced with goto instruction.
 */
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String extInterfaceName, String ipAddress, String macAddress) {
    AtomicInteger tableId = new AtomicInteger(-1);
    List<Instruction> instructions = new ArrayList<>();
    List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
    actions.removeIf(v -> {
        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v.getAction();
        if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
            tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
            return true;
        } else {
            return false;
        }
    });
    instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, 0));
    if (tableId.get() != -1) {
        // write-metadata
        if ((short) tableId.get() > NwConstants.ARP_RESPONDER_TABLE) {
            instructions.add(new InstructionGotoTable((short) tableId.get()).buildInstruction(2));
        } else {
            LOG.warn("Failed to insall responder flow for interface {}. Resubmit to {} can't be replaced with goto", extInterfaceName, tableId);
        }
    }
    return instructions;
}
Also used : NxActionResubmitRpcAddGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) ArrayList(java.util.ArrayList) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

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