Search in sources :

Example 6 with ActionPuntToController

use of org.opendaylight.genius.mdsalutil.actions.ActionPuntToController in project netvirt by opendaylight.

the class VpnNodeListener method makeSubnetRouteTableMissFlow.

private void makeSubnetRouteTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
    final BigInteger cookieTableMiss = new BigInteger("8000004", 16);
    List<ActionInfo> actionsInfos = new ArrayList<>();
    List<InstructionInfo> instructions = new ArrayList<>();
    actionsInfos.add(new ActionPuntToController());
    instructions.add(new InstructionApplyActions(actionsInfos));
    List<MatchInfo> matches = new ArrayList<>();
    String flowRef = getTableMissFlowRef(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, NwConstants.TABLE_MISS_FLOW);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, flowRef, NwConstants.TABLE_MISS_PRIORITY, "Subnet Route Table Miss", 0, 0, cookieTableMiss, matches, instructions);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        mdsalManager.addFlowToTx(flowEntity, writeFlowTx);
    } else {
        mdsalManager.removeFlowToTx(flowEntity, writeFlowTx);
    }
}
Also used : InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) BigInteger(java.math.BigInteger) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 7 with ActionPuntToController

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

Example 8 with ActionPuntToController

use of org.opendaylight.genius.mdsalutil.actions.ActionPuntToController in project netvirt by opendaylight.

the class DhcpServiceUtils method setupDhcpFlowEntry.

public static void setupDhcpFlowEntry(@Nullable BigInteger dpId, short tableId, @Nullable String vmMacAddress, int addOrRemove, IMdsalApiManager mdsalUtil, WriteTransaction tx) {
    if (dpId == null || dpId.equals(DhcpMConstants.INVALID_DPID) || vmMacAddress == null) {
        return;
    }
    List<MatchInfo> matches = getDhcpMatch(vmMacAddress);
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    // Punt to controller
    actionsInfos.add(new ActionPuntToController());
    instructions.add(new InstructionApplyActions(actionsInfos));
    if (addOrRemove == NwConstants.DEL_FLOW) {
        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, getDhcpFlowRef(dpId, tableId, vmMacAddress), DhcpMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, null);
        LOG.trace("Removing DHCP Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
        DhcpServiceCounters.remove_dhcp_flow.inc();
        mdsalUtil.removeFlowToTx(flowEntity, tx);
    } else {
        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, getDhcpFlowRef(dpId, tableId, vmMacAddress), DhcpMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
        LOG.trace("Installing DHCP Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
        DhcpServiceCounters.install_dhcp_flow.inc();
        mdsalUtil.addFlowToTx(flowEntity, tx);
    }
}
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)

Example 9 with ActionPuntToController

use of org.opendaylight.genius.mdsalutil.actions.ActionPuntToController in project netvirt by opendaylight.

the class ExternalRoutersListener method buildOutboundFlowEntityWithBgpVpn.

protected FlowEntity buildOutboundFlowEntityWithBgpVpn(BigInteger dpId, long routerId, long changedVpnId) {
    LOG.debug("buildOutboundFlowEntityWithBgpVpn : called for dpId {} and routerId {}, BGP VPN ID {}", dpId, routerId, changedVpnId);
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionPuntToController());
    instructions.add(new InstructionApplyActions(actionsInfos));
    instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
    String flowRef = getFlowRefOutbound(dpId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
    BigInteger cookie = getCookieOutboundFlow(routerId);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, 5, flowRef, 0, 0, cookie, matches, instructions);
    LOG.debug("createOutboundTblEntryWithBgpVpn : returning flowEntity {}", flowEntity);
    return flowEntity;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) BigInteger(java.math.BigInteger) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 10 with ActionPuntToController

use of org.opendaylight.genius.mdsalutil.actions.ActionPuntToController in project netvirt by opendaylight.

the class Ipv6ServiceUtils method installIcmpv6NsPuntFlow.

public void installIcmpv6NsPuntFlow(short tableId, BigInteger dpId, Long elanTag, String ipv6Address, int addOrRemove) {
    List<MatchInfo> neighborSolicitationMatch = getIcmpv6NSMatch(elanTag, ipv6Address);
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionPuntToController());
    instructions.add(new InstructionApplyActions(actionsInfos));
    FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, getIPv6FlowRef(dpId, elanTag, ipv6Address), Ipv6Constants.DEFAULT_FLOW_PRIORITY, "IPv6NS", 0, 0, NwConstants.COOKIE_IPV6_TABLE, neighborSolicitationMatch, instructions);
    if (addOrRemove == Ipv6Constants.DEL_FLOW) {
        LOG.trace("Removing IPv6 Neighbor Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
        mdsalUtil.removeFlow(rsFlowEntity);
    } else {
        LOG.trace("Installing IPv6 Neighbor Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
        mdsalUtil.installFlow(rsFlowEntity);
    }
}
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

FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)12 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)12 ArrayList (java.util.ArrayList)11 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)11 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)11 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)11 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)10 BigInteger (java.math.BigInteger)4 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)2 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)2 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)1 ActionLearn (org.opendaylight.genius.mdsalutil.actions.ActionLearn)1 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)1 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)1 InstructionWriteActions (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions)1 MatchEthernetDestination (org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination)1 MatchEthernetType (org.opendaylight.genius.mdsalutil.matches.MatchEthernetType)1