use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.
the class BaseVrfEntryHandler method buildL3vpnGatewayFlow.
public FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
String flowId = FibUtil.getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, flowId, 20, flowId, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, mkMatches, mkInstructions);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.
the class VpnNodeListener method makeTableMissFlow.
private void makeTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
// Instruction to goto L3 InterfaceTable
List<InstructionInfo> instructions = Collections.singletonList(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
List<MatchInfo> matches = new ArrayList<>();
FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_LFIB_TABLE, getTableMissFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "Table Miss", 0, 0, cookieTableMiss, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install Table Miss Entry");
mdsalManager.addFlowToTx(flowEntityLfib, writeFlowTx);
} else {
mdsalManager.removeFlowToTx(flowEntityLfib, writeFlowTx);
}
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.
the class DhcpManager method setupTableMissForHandlingExternalTunnel.
private void setupTableMissForHandlingExternalTunnel(BigInteger dpId) {
List<MatchInfo> matches = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionGotoTable(NwConstants.EXTERNAL_TUNNEL_TABLE));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL, "DHCPTableMissFlowForExternalTunnel", 0, "DHCP Table Miss Flow For External Tunnel", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
DhcpServiceCounters.install_dhcp_table_miss_flow_for_external_table.inc();
mdsalUtil.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.
the class VpnServiceChainUtils method buildLFibVpnPseudoPortFlow.
/**
* Builds a Flow for the LFIB table that sets the LPortTag of the
* VpnPseudoPort and sends to LPortDispatcher table.
* <ul>
* <li>Matching: eth_type = MPLS, mpls_label = VPN MPLS label
* <li>Actions: setMetadata LportTag and SI=2, pop MPLS, Go to
* LPortDispacherTable
* </ul>
*
* @param dpId DpnId
* @param label MPLS label
* @param nextHop Next Hop IP
* @param lportTag Pseudo Logical Port tag
* @return the FlowEntity
*/
public static FlowEntity buildLFibVpnPseudoPortFlow(BigInteger dpId, Long label, String nextHop, int lportTag) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.MPLS_UNICAST);
matches.add(new MatchMplsLabel(label));
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionPopMpls());
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionWriteMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)), MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
String flowRef = getLFibVpnPseudoPortFlowRef(lportTag, label, nextHop);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable in project netvirt by opendaylight.
the class ArpResponderUtil method getExtInterfaceInstructions.
/**
* Get instruction list for ARP responder flows originated from ext-net e.g.
* router-gw/fip.<br>
* The split-horizon bit should be reset in order to allow traffic from
* provider network to be routed back to flat/VLAN network and override the
* egress table drop flow.<br>
* In order to allow write-metadata in the ARP responder table the resubmit
* action needs to be replaced with goto instruction.
*/
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String extInterfaceName, String ipAddress, String macAddress) {
AtomicInteger tableId = new AtomicInteger(-1);
List<Instruction> instructions = new ArrayList<>();
List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
actions.removeIf(v -> {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v.getAction();
if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
return true;
} else {
return false;
}
});
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, 0));
if (tableId.get() != -1) {
// write-metadata
if ((short) tableId.get() > NwConstants.ARP_RESPONDER_TABLE) {
instructions.add(new InstructionGotoTable((short) tableId.get()).buildInstruction(2));
} else {
LOG.warn("Failed to insall responder flow for interface {}. Resubmit to {} can't be replaced with goto", extInterfaceName, tableId);
}
}
return instructions;
}
Aggregations