use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class DhcpManager method setupTableMissForDhcpTable.
private void setupTableMissForDhcpTable(BigInteger dpId) {
List<MatchInfo> matches = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE, "DHCPTableMissFlow", 0, "DHCP Table Miss Flow", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
DhcpServiceCounters.install_dhcp_table_miss_flow.inc();
mdsalUtil.installFlow(flowEntity);
setupTableMissForHandlingExternalTunnel(dpId);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity 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.FlowEntity 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.FlowEntity in project netvirt by opendaylight.
the class ElanInterfaceManager method setExternalTunnelTable.
/**
* Installs a flow in the External Tunnel table consisting in translating
* the VNI retrieved from the packet that came over a tunnel with a TOR into
* elanTag that will be used later in the ELANs pipeline.
*
* @param dpnId
* the dpn id
* @param elanInfo
* the elan info
*/
public void setExternalTunnelTable(BigInteger dpnId, ElanInstance elanInfo) {
long elanTag = elanInfo.getElanTag();
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.EXTERNAL_TUNNEL_TABLE, // prio
getFlowRef(NwConstants.EXTERNAL_TUNNEL_TABLE, elanTag), // prio
5, // flowName
elanInfo.getElanInstanceName(), // idleTimeout
0, // hardTimeout
0, ITMConstants.COOKIE_ITM_EXTERNAL.add(BigInteger.valueOf(elanTag)), buildMatchesForVni(ElanUtils.getVxlanSegmentationId(elanInfo)), getInstructionsIntOrExtTunnelTable(elanTag));
mdsalManager.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity 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);
}
Aggregations