Search in sources :

Example 41 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo 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 42 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project netvirt by opendaylight.

the class VpnNodeListener method createTableMissForVpnGwFlow.

private void createTableMissForVpnGwFlow(WriteTransaction writeFlowTx, BigInteger dpId) {
    List<MatchInfo> matches = new ArrayList<>();
    List<ActionInfo> actionsInfos = Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
    List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
    FlowEntity flowEntityMissforGw = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, getTableMissFlowRef(dpId, NwConstants.L3_GW_MAC_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "L3 Gw Mac Table Miss", 0, 0, new BigInteger("1080000", 16), matches, instructions);
    LOG.trace("Invoking MDSAL to install L3 Gw Mac Table Miss Entry");
    mdsalManager.addFlowToTx(flowEntityMissforGw, writeFlowTx);
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) BigInteger(java.math.BigInteger) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 43 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project netvirt by opendaylight.

the class InterVpnLinkUtil method buildLPortDispatcherFlow.

/**
 * Builds a Flow to be installed into LPortDispatcher table, that matches on
 * SI=2 + vpnLinkEndpointPseudoPortTag and sends to FIB.
 *
 * @param interVpnLinkName The name of the InterVpnLink
 * @param vpnId Dataplane identifier of the VPN, the Vrf Tag.
 * @param lportTag DataPlane identifier of the LogicalPort.
 * @return the Flow ready to be installed
 */
public static Flow buildLPortDispatcherFlow(String interVpnLinkName, long vpnId, int lportTag) {
    LOG.info("Inter-vpn-link : buildLPortDispatcherFlow. vpnId {}   lportTag {} ", vpnId, lportTag);
    List<MatchInfo> matches = Collections.singletonList(new MatchMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)), MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
    String flowRef = getLportDispatcherFlowRef(interVpnLinkName, lportTag);
    return MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef, VpnConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY, flowRef, 0, 0, VpnUtil.getCookieL3((int) vpnId), matches, buildLportDispatcherTableInstructions(vpnId));
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo)

Example 44 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo 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 45 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project netvirt by opendaylight.

the class DhcpManager method setupDhcpAllocationPoolFlow.

private void setupDhcpAllocationPoolFlow(BigInteger dpId) {
    List<MatchInfo> matches = DhcpServiceUtils.getDhcpMatch();
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionPuntToController());
    instructions.add(new InstructionApplyActions(actionsInfos));
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE, "DhcpAllocationPoolFlow", DhcpMConstants.DEFAULT_DHCP_ALLOCATION_POOL_FLOW_PRIORITY, "Dhcp Allocation Pool Flow", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
    LOG.trace("Installing DHCP Allocation Pool Flow DpId {}", dpId);
    DhcpServiceCounters.install_dhcp_flow.inc();
    mdsalUtil.installFlow(flowEntity);
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Aggregations

MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)117 ArrayList (java.util.ArrayList)107 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)63 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)52 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)51 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)50 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)49 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)35 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)24 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)23 BigInteger (java.math.BigInteger)22 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)18 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)15 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)15 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)11 MatchIpv4Destination (org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination)11 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)10 MatchEthernetDestination (org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination)10 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)10 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)9