use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class QosNodeListener method createTableMissEntry.
public void createTableMissEntry(BigInteger dpnId) {
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(dpnId, NwConstants.QOS_DSCP_TABLE, "QoSTableMissFlow", 0, "QoS Table Miss Flow", 0, 0, NwConstants.COOKIE_QOS_TABLE, matches, instructions);
mdsalUtils.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class PolicyRouteFlowProgrammer method programPolicyClassifierFlows.
public void programPolicyClassifierFlows(String policyClassifierName, List<BigInteger> localDpIds, List<BigInteger> remoteDpIds, int addOrRemove) {
long policyClassifierId = policyIdManager.getPolicyClassifierId(policyClassifierName);
if (policyClassifierId == PolicyServiceConstants.INVALID_ID) {
LOG.error("Failed to get policy classifier id for classifier {}", policyClassifierName);
return;
}
coordinator.enqueueJob(policyClassifierName, () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
remoteDpIds.forEach(remoteDpId -> {
long groupId = policyIdManager.getPolicyClassifierGroupId(policyClassifierName, remoteDpId);
if (groupId != PolicyServiceConstants.INVALID_ID) {
List<InstructionInfo> instructions = policyFlowUtil.getPolicyRouteInstructions(groupId);
localDpIds.forEach(localDpId -> {
if (!remoteDpId.equals(localDpId)) {
programPolicyClassifierFlow(policyClassifierName, policyClassifierId, instructions, localDpId, remoteDpId, tx, addOrRemove);
}
});
} else {
LOG.error("Failed to get group id for policy classifier {} DPN {}", policyClassifierName, remoteDpId);
}
});
return Collections.singletonList(tx.submit());
});
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo 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.InstructionInfo in project netvirt by opendaylight.
the class ElanUtils method buildDmacRedirectToDispatcherFlow.
public static FlowEntity buildDmacRedirectToDispatcherFlow(BigInteger dpId, String dstMacAddress, String displayName, long elanTag) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
matches.add(new MatchEthernetDestination(new MacAddress(dstMacAddress)));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actions = new ArrayList<>();
actions.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actions));
String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, dstMacAddress, elanTag);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 20, displayName, 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), matches, instructions);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class ElanUtils method buildKnownSmacFlow.
public FlowEntity buildKnownSmacFlow(ElanInstance elanInfo, InterfaceInfo interfaceInfo, long macTimeout, String macAddress) {
int lportTag = interfaceInfo.getInterfaceTag();
// Matching metadata and eth_src fields
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanInfo.getElanTag(), lportTag), ElanHelper.getElanMetadataMask()));
mkMatches.add(new MatchEthernetSource(new MacAddress(macAddress)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
BigInteger dpId = interfaceInfo.getDpId();
long elanTag = getElanTag(elanInfo, interfaceInfo);
return new FlowEntityBuilder().setDpnId(dpId).setTableId(NwConstants.ELAN_SMAC_TABLE).setFlowId(getKnownDynamicmacFlowRef(NwConstants.ELAN_SMAC_TABLE, dpId, lportTag, macAddress, elanTag)).setPriority(20).setFlowName(elanInfo.getDescription()).setIdleTimeOut((int) macTimeout).setHardTimeOut(0).setCookie(ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(elanTag))).setMatchInfoList(mkMatches).setInstructionInfoList(mkInstructions).setStrictFlag(true).setSendFlowRemFlag(macTimeout != 0).build();
}
Aggregations