if (elanDpnInterfacesList != null) {
dpnInterfaceLists = elanDpnInterfacesList.getDpnInterfaces();
}
- if (dpnInterfaceLists == null) {
- dpnInterfaceLists = new ArrayList<>();
+ if (dpnInterfaceLists != null && !dpnInterfaceLists.isEmpty()) {
+ Uint64 dstDpId = interfaceInfo.getDpId();
+ processRemoteDmacFlowForInterface(dstDpId, elanInstance, dpnInterfaceLists, writeFlowGroupTx);
}
+ }
+
+ private void processRemoteDmacFlowForInterface(Uint64 dstDpId, ElanInstance elanInstance,
+ List<DpnInterfaces> dpnInterfaceLists, TypedWriteTransaction<Configuration> writeFlowGroupTx) {
for (DpnInterfaces dpnInterfaces : dpnInterfaceLists) {
- Uint64 dstDpId = interfaceInfo.getDpId();
if (Objects.equals(dpnInterfaces.getDpId(), dstDpId)) {
continue;
}
List<String> remoteElanInterfaces = dpnInterfaces.getInterfaces();
+ if (remoteElanInterfaces == null || remoteElanInterfaces.isEmpty()) {
+ continue;
+ }
for (String remoteIf : remoteElanInterfaces) {
ElanInterfaceMac elanIfMac = elanUtils.getElanInterfaceMacByInterfaceName(remoteIf);
InterfaceInfo remoteInterface = interfaceManager.getInterfaceInfo(remoteIf);
if (elanIfMac == null || remoteInterface == null) {
continue;
}
- List<MacEntry> remoteMacEntries = elanIfMac.getMacEntry();
- if (remoteMacEntries != null) {
- for (MacEntry macEntry : remoteMacEntries) {
- String macAddress = macEntry.getMacAddress().getValue();
- LOG.info("Programming remote dmac {} on the newly added DPN {} for elan {}", macAddress,
- dstDpId, elanInstance.getElanInstanceName());
- elanUtils.setupRemoteDmacFlow(dstDpId, remoteInterface.getDpId(),
- remoteInterface.getInterfaceTag(), elanInstance.getElanTag(), macAddress,
- elanInstance.getElanInstanceName(), writeFlowGroupTx, remoteIf, elanInstance);
- }
+ List<MacEntry> remoteMacEntries = elanIfMac.nonnullMacEntry();
+ for (MacEntry macEntry : remoteMacEntries) {
+ String macAddress = macEntry.getMacAddress().getValue();
+ LOG.info("Programming remote dmac {} on the newly added DPN {} for elan {}", macAddress,
+ dstDpId, elanInstance.getElanInstanceName());
+ elanUtils.setupRemoteDmacFlow(dstDpId, remoteInterface.getDpId(),
+ remoteInterface.getInterfaceTag(), elanInstance.getElanTag(), macAddress,
+ elanInstance.getElanInstanceName(), writeFlowGroupTx, remoteIf, elanInstance);
}
}
}
macAddress, interfaceName, elanInstance.getElanInstanceName());
return;
}
- Flow flowEntity;
// if openstack-vni-semantics are enforced, segmentation ID is passed as network VNI for VxLAN based provider
// networks, 0 otherwise
long lportTagOrVni = !isOpenstackVniSemanticsEnforced() ? lportTag : isVxlanNetworkOrVxlanSegment(elanInstance)
? getVxlanSegmentationId(elanInstance).longValue() : 0;
- flowEntity = buildRemoteDmacFlowEntry(srcDpId, destDpId, lportTagOrVni, elanTag, macAddress, displayName,
+ Flow flowEntity = buildRemoteDmacFlowEntry(srcDpId, destDpId, lportTagOrVni, elanTag, macAddress, displayName,
elanInstance);
mdsalManager.addFlow(writeFlowGroupTx, srcDpId, flowEntity);
setupEtreeRemoteDmacFlow(srcDpId, destDpId, lportTagOrVni, elanTag, macAddress, displayName, interfaceName,