use of org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata 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.InstructionWriteMetadata in project netvirt by opendaylight.
the class PolicyServiceFlowUtil method getPolicyClassifierInstructions.
public List<InstructionInfo> getPolicyClassifierInstructions(long policyClassifierId) {
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionWriteMetadata(MetaDataUtil.getPolicyClassifierMetaData(policyClassifierId), MetaDataUtil.METADATA_MASK_POLICY_CLASSIFER_ID));
instructions.add(new InstructionGotoTable(NwConstants.EGRESS_POLICY_ROUTING_TABLE));
return instructions;
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata in project genius by opendaylight.
the class InterfaceManagerCommonUtils method addTunnelIngressFlow.
public void addTunnelIngressFlow(IfTunnel tunnel, BigInteger dpnId, long portNo, String interfaceName, int ifIndex) {
if (isTunnelWithoutIngressFlow(tunnel)) {
return;
}
LOG.debug("add tunnel ingress flow for {}", interfaceName);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(new MatchInPort(dpnId, portNo));
if (BooleanUtils.isTrue(tunnel.isTunnelRemoteIpFlow())) {
matches.add(new NxMatchTunnelSourceIp(tunnel.getTunnelDestination().getIpv4Address()));
}
if (BooleanUtils.isTrue(tunnel.isTunnelSourceIpFlow())) {
matches.add(new NxMatchTunnelDestinationIp(tunnel.getTunnelSource().getIpv4Address()));
}
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteMetadata(MetaDataUtil.getLportTagMetaData(ifIndex).or(BigInteger.ONE), MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG));
short tableId = tunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeMplsOverGre.class) ? NwConstants.L3_LFIB_TABLE : tunnel.isInternal() ? NwConstants.INTERNAL_TUNNEL_TABLE : NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL;
mkInstructions.add(new InstructionGotoTable(tableId));
mdsalApiManager.batchedAddFlow(dpnId, buildTunnelIngressFlowEntity(dpnId, interfaceName, matches, mkInstructions));
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata in project netvirt by opendaylight.
the class VpnUtil method buildL3vpnGatewayFlow.
public static FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId, long subnetVpnId) {
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));
if (subnetVpnId != VpnConstants.INVALID_ID) {
BigInteger subnetIdMetaData = MetaDataUtil.getVpnIdMetadata(subnetVpnId);
mkInstructions.add(new InstructionWriteMetadata(subnetIdMetaData, MetaDataUtil.METADATA_MASK_VRFID));
}
String flowId = 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.InstructionWriteMetadata 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;
}
Aggregations