+ private int getLocalBcGroupBuckets(DpnInterfaces dpn,
+ List<Bucket> listBucket, int bucketId) {
+ for (String intf : dpn.getInterfaces()) {
+ InterfaceInfo ifInfo = interfaceManager.getInterfaceInfo(intf);
+ if (!isOperational(ifInfo)) {
+ continue;
+ }
+ listBucket.add(MDSALUtil.buildBucket(
+ getInterfacePortActions(ifInfo), MDSALUtil.GROUP_WEIGHT,
+ bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ }
+ return bucketId;
+ }
+
+ private void getRemoteBCGroupBuckets(ElanInstance elanInfo,
+ BigInteger dpnId, List<Bucket> listBucket, int bucketId) {
+ int elanTag = elanInfo.getElanTag().intValue();
+ ElanDpnInterfacesList elanDpns = ElanUtils
+ .getElanDpnInterfacesList(elanInfo.getElanInstanceName());
+ if (elanDpns != null) {
+ List<DpnInterfaces> dpnInterfaceses = elanDpns.getDpnInterfaces();
+ for (DpnInterfaces dpnInterface : dpnInterfaceses) {
+ if (ElanUtils.isDpnPresent(dpnInterface.getDpId())
+ && dpnInterface.getDpId() != dpnId
+ && dpnInterface.getInterfaces() != null
+ && !dpnInterface.getInterfaces().isEmpty()) {
+ try {
+ List<Action> listActionInfo = ElanUtils
+ .getInternalItmEgressAction(dpnId,
+ dpnInterface.getDpId(), elanTag);
+ listBucket.add(MDSALUtil.buildBucket(listActionInfo, 0,
+ bucketId, 0xffffffffL, 0xffffffffL));
+ bucketId++;
+ } catch (Exception ex) {
+ logger.error(
+ "Logical Group Interface not found between source Dpn - {}, destination Dpn - {} ",
+ dpnId, dpnInterface.getDpId());
+ }
+ }
+ }
+ }
+ List<Bucket> elanL2GwDevicesBuckets = getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnId, bucketId);
+ listBucket.addAll(elanL2GwDevicesBuckets);
+ }
+
+ public static List<Bucket> getRemoteBCGroupBucketsOfElanL2GwDevices(ElanInstance elanInfo, BigInteger dpnId,
+ int bucketId) {
+ List<Bucket> listBucketInfo = new ArrayList<Bucket>();
+ ConcurrentMap<String, L2GatewayDevice> map = ElanL2GwCacheUtils
+ .getAllElanL2GatewayDevicesFromCache(elanInfo.getElanInstanceName());
+ for (L2GatewayDevice device : map.values()) {
+ String interfaceName = ElanL2GatewayUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId),
+ device.getHwvtepNodeId());
+ if (interfaceName == null) {
+ continue;
+ }
+ List<Action> listActionInfo = ElanUtils.buildItmEgressActions(interfaceName, elanInfo.getVni());
+ listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
+ MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ }
+ return listBucketInfo;