use of org.opendaylight.genius.mdsalutil.ActionInfo 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.ActionInfo 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);
}
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class ElanNodeListener method setupExternalL2vniTableMissFlow.
private void setupExternalL2vniTableMissFlow(BigInteger dpnId) {
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 flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, getTableMissFlowRef(NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE), 0, "External L2VNI Table Miss Flow", 0, 0, ElanConstants.COOKIE_L2VNI_DEMUX, matches, instructions);
mdsalManager.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class EgressCountersServiceImpl method syncCounterFlows.
@Override
public void syncCounterFlows(ElementCountersRequest ecr, int operation) {
int lportTag = ecr.getLportTag();
List<MatchInfoBase> flowMatches = CountersServiceUtils.getCounterFlowMatch(ecr, lportTag, ElementCountersDirection.EGRESS);
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = CountersServiceUtils.getDispatcherTableResubmitInstructions(actionsInfos, ElementCountersDirection.EGRESS);
BigInteger dpn = ecr.getDpn();
String flowName = createFlowName(ecr, lportTag, dpn);
syncFlow(dpn, NwConstants.EGRESS_COUNTERS_TABLE, flowName, CountersServiceUtils.COUNTER_TABLE_COUNTER_FLOW_PRIORITY, CountersServiceUtils.COUNTER_FLOW_NAME, 0, 0, CountersServiceUtils.COOKIE_COUNTERS_BASE, flowMatches, instructions, operation);
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class EgressCountersServiceImpl method installDefaultCounterRules.
@Override
public void installDefaultCounterRules(String interfaceId) {
BigInteger dpn = interfaceManager.getDpnForInterface(interfaceId);
String defaultFlowName = CountersServiceUtils.DEFAULT_EGRESS_COUNTER_FLOW_PREFIX + dpn + interfaceId;
List<MatchInfoBase> defaultFlowMatches = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = CountersServiceUtils.getDispatcherTableResubmitInstructions(actionsInfos, ElementCountersDirection.EGRESS);
syncFlow(dpn, NwConstants.EGRESS_COUNTERS_TABLE, defaultFlowName, CountersServiceUtils.COUNTER_TABLE_DEFAULT_FLOW_PRIORITY, CountersServiceUtils.COUNTER_FLOW_NAME, 0, 0, CountersServiceUtils.COOKIE_COUNTERS_BASE, defaultFlowMatches, instructions, NwConstants.ADD_FLOW);
}
Aggregations