Search in sources :

Example 6 with ActionDrop

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

the class DhcpServiceUtils method setupDhcpDropAction.

public static void setupDhcpDropAction(BigInteger dpId, short tableId, 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<ActionInfo> actionsInfos = new ArrayList<>();
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfos));
    // Drop Action
    actionsInfos.add(new ActionDrop());
    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 Drop Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
        DhcpServiceCounters.remove_dhcp_drop_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 Drop Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
        DhcpServiceCounters.install_dhcp_drop_flow.inc();
        mdsalUtil.addFlowToTx(flowEntity, tx);
    }
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity)

Example 7 with ActionDrop

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

the class AclServiceOFFlowBuilder method getDropInstructionInfo.

/**
 * Returns drop instruction info.
 * @return drop list of InstructionInfo objects
 */
public static List<InstructionInfo> getDropInstructionInfo() {
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop());
    instructions.add(new InstructionApplyActions(actionsInfos));
    return instructions;
}
Also used : InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop)

Example 8 with ActionDrop

use of org.opendaylight.genius.mdsalutil.actions.ActionDrop in project genius by opendaylight.

the class ActionInfoBuilderTest method noActionValues.

@Test
public void noActionValues() {
    ActionInfo actionInfo = new ActionDrop();
    assertEquals("new ActionDrop", generator.getExpression(actionInfo));
}
Also used : ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) Test(org.junit.Test)

Example 9 with ActionDrop

use of org.opendaylight.genius.mdsalutil.actions.ActionDrop in project genius by opendaylight.

the class FlowBasedServicesUtils method installEgressDispatcherSplitHorizonFlow.

public static void installEgressDispatcherSplitHorizonFlow(BigInteger dpId, BoundServices boundService, String interfaceName, WriteTransaction writeTransaction, int interfaceTag, short currentServiceIndex, Interface iface) {
    // only install split horizon drop flows for external interfaces
    if (!isExternal(iface)) {
        return;
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("Installing split horizon drop flow for external interface {} on dpId {}", interfaceName, dpId);
    }
    // BigInteger.ONE is used for
    BigInteger shFlagSet = BigInteger.ONE;
    // checking the Split-Horizon
    // flag
    List<MatchInfoBase> shMatches = FlowBasedServicesUtils.getMatchInfoForEgressDispatcherTable(interfaceTag, currentServiceIndex);
    shMatches.add(new MatchMetadata(shFlagSet, MetaDataUtil.METADATA_MASK_SH_FLAG));
    List<InstructionInfo> shInstructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop());
    shInstructions.add(new InstructionApplyActions(actionsInfos));
    String flowRef = getSplitHorizonFlowRef(dpId, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, interfaceName, shFlagSet);
    String serviceRef = boundService.getServiceName();
    // This must be higher priority than the egress flow
    int splitHorizonFlowPriority = boundService.getServicePriority() + 1;
    StypeOpenflow stypeOpenFlow = boundService.getAugmentation(StypeOpenflow.class);
    Flow egressSplitHorizonFlow = MDSALUtil.buildFlow(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, flowRef, splitHorizonFlowPriority, serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(), shMatches, shInstructions);
    installFlow(dpId, egressSplitHorizonFlow, writeTransaction);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) StypeOpenflow(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) BigInteger(java.math.BigInteger) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Aggregations

ActionDrop (org.opendaylight.genius.mdsalutil.actions.ActionDrop)9 ArrayList (java.util.ArrayList)7 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)7 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)5 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)5 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)3 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)3 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)2 BigInteger (java.math.BigInteger)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Test (org.junit.Test)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 DpnTepInterfaceInfo (org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo)1 BucketInfo (org.opendaylight.genius.mdsalutil.BucketInfo)1 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)1 ActionSetFieldEthernetDestination (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetDestination)1