- String elanName = evpnMacVrfUtils.getElanNameByMacvrfiid(instanceIdentifier);
- if (elanName == null) {
- LOG.trace("ADD: Error : elanName is null for iid {}", instanceIdentifier);
- return;
- }
- List<DpnInterfaces> dpnInterfaceLists = elanUtils.getInvolvedDpnsInElan(elanName);
- if (dpnInterfaceLists == null) {
- LOG.error("ADD: Error : dpnInterfaceLists is null for elan {}", elanName);
- return;
- }
-
- if (evpnMacVrfUtils.checkEvpnAttachedToNet(elanName)) {
- //TODO(Riyaz) : Check if accessing first nexthop address is right solution
- String nexthopIP = macVrfEntry.getRoutePaths().get(0).getNexthopAddress();
- Long elanTag = evpnMacVrfUtils.getElanTagByMacvrfiid(instanceIdentifier);
- String dstMacAddress = macVrfEntry.getMac();
- long vni = macVrfEntry.getL2vni();
- DataStoreJobCoordinator.getInstance().enqueueJob(dstMacAddress, () -> {
- List<ListenableFuture<Void>> futures = new ArrayList<>();
- dpnInterfaceLists.forEach(dpnInterfaces -> {
- BigInteger dpId = dpnInterfaces.getDpId();
- LOG.info("ADD: Build DMAC flow with dpId {}, nexthopIP {}, elanTag {},"
- + "vni {}, dstMacAddress {}, elanName {} ",
- dpId, nexthopIP, elanTag, vni, dstMacAddress, elanName);
- ElanEvpnFlowUtils.EvpnDmacFlowBuilder dmacFlowBuilder = new ElanEvpnFlowUtils.EvpnDmacFlowBuilder();
- dmacFlowBuilder.setDpId(dpId).setNexthopIP(nexthopIP).setElanTag(elanTag).setVni(vni)
- .setDstMacAddress(dstMacAddress).setElanName(elanName);
- Flow flow = elanEvpnFlowUtils.evpnBuildDmacFlowForExternalRemoteMac(dmacFlowBuilder.build());
-
- futures.add(mdsalManager.installFlow(dpId, flow));
- });
- return futures;
- }, ElanConstants.JOB_MAX_RETRIES);
- }