X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=elanmanager%2Fimpl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetvirt%2Felan%2Fevpn%2Futils%2FElanEvpnFlowUtils.java;h=fbd56638a606ef60b0294b64dd110823f04f9f61;hb=5d126f11acaab8c6808239f6dff94ab321ac7b58;hp=ce51c4b6b6effe569c1f9f205939cb9dfc970412;hpb=2f0569ed75ef8a1fb60f992d19c8bbdf92ff45bf;p=netvirt.git diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/evpn/utils/ElanEvpnFlowUtils.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/evpn/utils/ElanEvpnFlowUtils.java index ce51c4b6b6..fbd56638a6 100644 --- a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/evpn/utils/ElanEvpnFlowUtils.java +++ b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/evpn/utils/ElanEvpnFlowUtils.java @@ -12,18 +12,20 @@ import com.google.common.util.concurrent.ListenableFuture; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.inject.Inject; import javax.inject.Singleton; -import org.opendaylight.genius.infra.Datastore; -import org.opendaylight.genius.infra.ManagedNewTransactionRunner; -import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl; import org.opendaylight.genius.mdsalutil.MDSALUtil; import org.opendaylight.genius.mdsalutil.MatchInfo; import org.opendaylight.genius.mdsalutil.NwConstants; import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager; import org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired; import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.util.Datastore; +import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner; +import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl; import org.opendaylight.netvirt.elan.utils.ElanConstants; import org.opendaylight.netvirt.elan.utils.ElanEtreeUtils; import org.opendaylight.netvirt.elan.utils.ElanItmUtils; @@ -33,10 +35,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName; import org.opendaylight.yangtools.yang.common.Uint64; - @Singleton public class ElanEvpnFlowUtils { private final IMdsalApiManager mdsalManager; @@ -56,23 +58,23 @@ public class ElanEvpnFlowUtils { public Flow evpnBuildDmacFlowForExternalRemoteMac(EvpnDmacFlow evpnDmacFlow) { List mkMatches = ElanUtils.buildMatchesForElanTagShFlagAndDstMac(evpnDmacFlow.getElanTag(), false, evpnDmacFlow.getDstMacAddress()); - List mkInstructions = new ArrayList<>(); + Map mkInstructionsMap = new HashMap<>(); List actions = elanItmUtils.getExternalTunnelItmEgressAction(evpnDmacFlow.getDpId(), evpnDmacFlow.getNexthopIP(), evpnDmacFlow.getVni()); - mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions)); + mkInstructionsMap.put(new InstructionKey(0), MDSALUtil.buildApplyActionsInstruction(actions)); Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, ElanUtils.getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, evpnDmacFlow.getDpId(), evpnDmacFlow.getNexthopIP(), evpnDmacFlow.getDstMacAddress(), evpnDmacFlow.getElanTag(), false), 20, evpnDmacFlow.getElanName(), 0, 0, Uint64.valueOf(ElanConstants.COOKIE_ELAN_KNOWN_DMAC.toJava() .add(BigInteger.valueOf(evpnDmacFlow.getElanTag()))), - mkMatches, mkInstructions); + mkMatches, mkInstructionsMap); return flow; } - public List> evpnDeleteDmacFlowsToExternalMac(EvpnDmacFlow evpnDmacFlow) { - List> futures = new ArrayList<>(); + public List> evpnDeleteDmacFlowsToExternalMac(EvpnDmacFlow evpnDmacFlow) { + List> futures = new ArrayList<>(); try (Acquired lock = ElanUtils.lockElanMacDPN(evpnDmacFlow.getElanTag(), evpnDmacFlow.getDstMacAddress(), evpnDmacFlow.getDpId())) { futures.addAll( @@ -84,9 +86,9 @@ public class ElanEvpnFlowUtils { return futures; } - private List> evpnDeleteEtreeDmacFlowsToExternalMac(long elanTag, Uint64 dpId, + private List> evpnDeleteEtreeDmacFlowsToExternalMac(long elanTag, Uint64 dpId, String nexthopIp, String macToRemove) { - List> futures = new ArrayList<>(); + List> futures = new ArrayList<>(); EtreeLeafTagName etreeLeafTag = elanEtreeUtils.getEtreeLeafTagByElanTag(elanTag); if (etreeLeafTag != null) { futures.addAll( @@ -105,7 +107,7 @@ public class ElanEvpnFlowUtils { return String.valueOf(elanDmacTable) + elanTag + dpId + nexthopIp + dstMacAddress + shFlag; } - private List> evpnRemoveTheDropFlow(long elanTag, Uint64 dpId, String nexthopIp, + private List> evpnRemoveTheDropFlow(long elanTag, Uint64 dpId, String nexthopIp, String macToRemove) { String flowId = ElanEvpnFlowUtils.evpnGetKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, nexthopIp, macToRemove, elanTag, true); @@ -114,7 +116,7 @@ public class ElanEvpnFlowUtils { tx -> mdsalManager.removeFlow(tx, dpId, flowToRemove))); } - private List> evpnRemoveFlowThatSendsThePacketOnAnExternalTunnel(long elanTag, + private List> evpnRemoveFlowThatSendsThePacketOnAnExternalTunnel(long elanTag, Uint64 dpId, String nexthopIp, String macToRemove) { String flowId = ElanEvpnFlowUtils.evpnGetKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, nexthopIp, macToRemove, elanTag, false);