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);
}
}
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;
}
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));
}
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);
}
Aggregations