use of org.opendaylight.genius.mdsalutil.InstructionInfo 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.InstructionInfo in project netvirt by opendaylight.
the class ElanInterfaceManager method setupTerminateServiceTable.
public void setupTerminateServiceTable(ElanInstance elanInfo, BigInteger dpId, long elanTag, WriteTransaction writeFlowGroupTx) {
List<? extends MatchInfoBase> listMatchInfoBase;
List<InstructionInfo> instructionInfos;
long serviceId;
if (!elanUtils.isOpenstackVniSemanticsEnforced()) {
serviceId = elanTag;
listMatchInfoBase = ElanUtils.getTunnelMatchesForServiceId((int) elanTag);
instructionInfos = getInstructionsForOutGroup(ElanUtils.getElanLocalBCGId(elanTag));
} else {
serviceId = elanUtils.getVxlanSegmentationId(elanInfo);
listMatchInfoBase = buildMatchesForVni(serviceId);
instructionInfos = getInstructionsIntOrExtTunnelTable(elanTag);
}
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, serviceId), 5, String.format("%s:%d", "ITM Flow Entry ", elanTag), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(elanTag)), listMatchInfoBase, instructionInfos);
mdsalManager.addFlowToTx(flowEntity, writeFlowGroupTx);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class EvpnUtils method programEvpnL2vniFlow.
private void programEvpnL2vniFlow(ElanInstance elanInfo, BiConsumer<BigInteger, FlowEntity> flowHandler) {
long elanTag = elanInfo.getElanTag();
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(elanUtils.getVxlanSegmentationId(elanInfo))));
NWUtil.getOperativeDPNs(broker).forEach(dpnId -> {
LOG.debug("Updating tunnel flow to dpnid {}", dpnId);
List<InstructionInfo> instructions = getInstructionsForExtTunnelTable(elanTag);
String flowRef = getFlowRef(NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, elanTag, dpnId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L2VNI_EXTERNAL_TUNNEL_DEMUX_TABLE, flowRef, // prio
5, // flowName
elanInfo.getElanInstanceName(), // idleTimeout
0, // hardTimeout
0, ITMConstants.COOKIE_ITM_EXTERNAL.add(BigInteger.valueOf(elanTag)), mkMatches, instructions);
flowHandler.accept(dpnId, flowEntity);
});
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class EvpnUtils method getInstructionsForExtTunnelTable.
private List<InstructionInfo> getInstructionsForExtTunnelTable(Long elanTag) {
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteMetadata(ElanUtils.getElanMetadataLabel(elanTag, false), ElanHelper.getElanMetadataMask()));
mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
return mkInstructions;
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class ElanInterfaceManager method getInstructionsForOutGroup.
private List<InstructionInfo> getInstructionsForOutGroup(long groupId) {
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteActions(Collections.singletonList(new ActionGroup(groupId))));
return mkInstructions;
}
Aggregations