use of org.opendaylight.genius.mdsalutil.MatchInfo in project netvirt by opendaylight.
the class VpnNodeListener method makeL3IntfTblMissFlow.
private void makeL3IntfTblMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
List<InstructionInfo> instructions = new ArrayList<>();
List<MatchInfo> matches = new ArrayList<>();
final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
// Instruction to goto L3 InterfaceTable
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
// instructions.add(new InstructionGotoTable(NwConstants.LPORT_DISPATCHER_TABLE));
FlowEntity flowEntityL3Intf = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_INTERFACE_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_INTERFACE_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "L3 Interface Table Miss", 0, 0, cookieTableMiss, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install L3 interface Table Miss Entries");
mdsalManager.addFlowToTx(flowEntityL3Intf, writeFlowTx);
} else {
mdsalManager.removeFlowToTx(flowEntityL3Intf, writeFlowTx);
}
}
use of org.opendaylight.genius.mdsalutil.MatchInfo 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.MatchInfo in project netvirt by opendaylight.
the class DhcpServiceUtils method getDhcpMatch.
public static List<MatchInfo> getDhcpMatch() {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(MatchIpProtocol.UDP);
matches.add(new MatchUdpSourcePort(DhcpMConstants.DHCP_CLIENT_PORT));
matches.add(new MatchUdpDestinationPort(DhcpMConstants.DHCP_SERVER_PORT));
return matches;
}
use of org.opendaylight.genius.mdsalutil.MatchInfo 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.MatchInfo 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);
}
}
Aggregations