Bug fixes after MRI version bump 01/90201/3
authorR P Karthika <r.p.karthika@ericsson.com>
Tue, 2 Jun 2020 07:58:35 +0000 (13:28 +0530)
committerR P Karthika <r.p.karthika@ericsson.com>
Tue, 2 Jun 2020 11:20:08 +0000 (16:50 +0530)
Change-Id: I9fc2351cf37877427c698fdb6a2d38a0ce5b02f4
Signed-off-by: R P Karthika <r.p.karthika@ericsson.com>
Signed-off-by: Apurba Mukherjee <apurba.mukherjee@ericsson.com>
Signed-off-by: R P Karthika <r.p.karthika@ericsson.com>
alivenessmonitor/alivenessmonitor-impl/src/main/java/org/opendaylight/genius/alivenessmonitor/internal/HwVtepTunnelsStateHandler.java
interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/impl/ItmUtils.java
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/itmdirecttunnels/renderer/ovs/utilities/DirectTunnelUtils.java
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/rpc/ItmManagerRpcService.java

index 6ed5dfb32ecfdfda21e3d3d77cfd9a7b4854d874..926170de616275c0896e395082539e625e458946 100644 (file)
@@ -349,8 +349,8 @@ public class HwVtepTunnelsStateHandler extends AbstractSyncDataTreeChangeListene
     }
 
     private void setBfdParamForEnable(Map<BfdParamsKey, BfdParams> bfdParams, boolean isEnabled) {
-        bfdParams.put(getBfdParams(AlivenessMonitorConstants.BFD_PARAM_ENABLE, Boolean.toString(isEnabled)).key(),
-                getBfdParams(AlivenessMonitorConstants.BFD_PARAM_ENABLE, Boolean.toString(isEnabled)));
+        BfdParams getBfdParam = getBfdParams(AlivenessMonitorConstants.BFD_PARAM_ENABLE, Boolean.toString(isEnabled));
+        bfdParams.put(getBfdParam.key(), getBfdParam);
     }
 
     private BfdParams getBfdParams(String key, String value) {
index aa0d99dd1702e7a24c55747926edc04b187c935f..9dbb7e9336f7f9f6fdeadfd8cb7eb083f4b03dfa 100644 (file)
@@ -207,9 +207,9 @@ public final class FlowBasedServicesUtils {
             // incrementing instructionSize and using it as actionKey. Because
             // it won't clash with any other instructions
             int actionKey = ++serviceInstructionsSize;
-            instructionSet.put(MDSALUtil.buildAndGetPopVlanActionInstruction(actionKey,
-                    ++serviceInstructionsSize).key(), MDSALUtil.buildAndGetPopVlanActionInstruction(actionKey,
-                    ++serviceInstructionsSize));
+            Instruction getPopVlanActionInstruction = MDSALUtil.buildAndGetPopVlanActionInstruction(actionKey,
+                    ++serviceInstructionsSize);
+            instructionSet.put(getPopVlanActionInstruction.key(), getPopVlanActionInstruction);
         }
 
         if (lportTag != 0L) {
@@ -220,10 +220,9 @@ public final class FlowBasedServicesUtils {
             Uint64 metadataMask = MetaDataUtil.getMetaDataMaskForLPortDispatcher(
                     MetaDataUtil.METADATA_MASK_SERVICE_INDEX, MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG,
                     metadataValues[1]);
-            instructionSet.put(
-                    MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask,
-                            ++serviceInstructionsSize).key(),
-                    MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, ++serviceInstructionsSize));
+            Instruction writeMetadaInstruction = MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask,
+                    ++serviceInstructionsSize);
+            instructionSet.put(writeMetadaInstruction.key(), writeMetadaInstruction);
         }
 
         if (instructions != null && !instructions.isEmpty()) {
@@ -284,9 +283,10 @@ public final class FlowBasedServicesUtils {
         Uint64 metadataMask = MetaDataUtil.getWriteMetaDataMaskForDispatcherTable();
 
         // build the final instruction for LPort Dispatcher table flow entry
-        Map<InstructionKey, Instruction> instructions = new HashMap<>();
-        instructions.put(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, ++instructionSize).key(),
-                MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, ++instructionSize));
+        Map<InstructionKey, Instruction> instructionsMap = new HashMap<>();
+        Instruction instruction = MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask,
+                ++instructionSize);
+        instructionsMap.put(instruction.key(),instruction);
         if (serviceInstructions != null && !serviceInstructions.isEmpty()) {
             for (Instruction info : serviceInstructions.values()) {
                 // Skip meta data write as that is handled already
@@ -300,7 +300,7 @@ public final class FlowBasedServicesUtils {
                             ((ApplyActionsCase) info.getInstruction()).getApplyActions().getAction()));
                 }
                 //instructions.values().add(info);
-                instructions.put(info.key(),info);
+                instructionsMap.put(info.key(),info);
             }
         }
 
@@ -308,7 +308,8 @@ public final class FlowBasedServicesUtils {
         String flowRef = getFlowRef(dpId, NwConstants.LPORT_DISPATCHER_TABLE, interfaceName,
                 currentServiceIndex);
         Flow ingressFlow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
-                DEFAULT_DISPATCHER_PRIORITY, serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(), matches, instructions);
+                DEFAULT_DISPATCHER_PRIORITY, serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(),
+                matches, instructionsMap);
         LOG.debug("Installing LPort Dispatcher Flow on DPN {}, for interface {}, with flowRef {}", dpId,
             interfaceName, flowRef);
         installFlow(dpId, ingressFlow, tx);
@@ -348,14 +349,14 @@ public final class FlowBasedServicesUtils {
 
         // build the final instruction for LPort Dispatcher table flow entry
         List<Action> finalApplyActions = new ArrayList<>();
-        Map<InstructionKey, Instruction> instructions = new HashMap<>();
+        Map<InstructionKey, Instruction> instructionMap = new HashMap<>();
         if (boundService.getServicePriority().toJava() != ServiceIndex.getIndex(NwConstants.DEFAULT_EGRESS_SERVICE_NAME,
                 NwConstants.DEFAULT_EGRESS_SERVICE_INDEX)) {
             Uint64[] metadataValues = IfmUtil.mergeOpenflowMetadataWriteInstructions(serviceInstructions);
             Uint64 metadataMask = MetaDataUtil.getWriteMetaDataMaskForEgressDispatcherTable();
-            instructions.put(MDSALUtil.buildAndGetWriteMetadaInstruction(metadataValues[0], metadataMask,
-                    instructions.size()).key(),MDSALUtil.buildAndGetWriteMetadaInstruction(metadataValues[0],
-                    metadataMask, instructions.size()));
+            Instruction instruction = MDSALUtil.buildAndGetWriteMetadaInstruction(metadataValues[0], metadataMask,
+                    instructionMap.size());
+            instructionMap.put(instruction.key(), instruction);
             finalApplyActions.add(MDSALUtil.createSetReg6Action(finalApplyActions.size(), 0, 31,
                     MetaDataUtil.getReg6ValueForLPortDispatcher(interfaceTag, nextServiceIndex)));
         }
@@ -365,8 +366,9 @@ public final class FlowBasedServicesUtils {
             if (info.getInstruction() instanceof WriteActionsCase) {
                 List<Action> writeActions = ActionConverterUtil.convertServiceActionToFlowAction(
                         ((WriteActionsCase) info.getInstruction()).getWriteActions().getAction());
-                instructions.put(MDSALUtil.buildWriteActionsInstruction(writeActions, instructions.size()).key(),
-                        MDSALUtil.buildWriteActionsInstruction(writeActions, instructions.size()));
+                Instruction writeActionsInstruction = MDSALUtil.buildWriteActionsInstruction(writeActions,
+                        instructionMap.size());
+                instructionMap.put(writeActionsInstruction.key(), writeActionsInstruction);
             } else if (info.getInstruction() instanceof ApplyActionsCase) {
                 List<Action> applyActions = ActionConverterUtil.convertServiceActionToFlowAction(
                         ((ApplyActionsCase) info.getInstruction()).getApplyActions().getAction(),
@@ -374,13 +376,14 @@ public final class FlowBasedServicesUtils {
                 finalApplyActions.addAll(applyActions);
             } else if (!(info.getInstruction() instanceof WriteMetadataCase)) {
                 // Skip meta data write as that is handled already
-                instructions.put(MDSALUtil.buildInstruction(info, instructions.size()).key(),
-                        MDSALUtil.buildInstruction(info, instructions.size()));
+                Instruction buildInstruction = MDSALUtil.buildInstruction(info, instructionMap.size());
+                instructionMap.put(buildInstruction.key(), buildInstruction);
             }
         }
         if (!finalApplyActions.isEmpty()) {
-            instructions.put(MDSALUtil.buildApplyActionsInstruction(finalApplyActions, instructions.size()).key(),
-                    MDSALUtil.buildApplyActionsInstruction(finalApplyActions, instructions.size()));
+            Instruction buildApplyActionsInstruction = MDSALUtil.buildApplyActionsInstruction(finalApplyActions,
+                    instructionMap.size());
+            instructionMap.put(buildApplyActionsInstruction.key(), buildApplyActionsInstruction);
         }
 
         // build the flow and install it
@@ -391,7 +394,7 @@ public final class FlowBasedServicesUtils {
                 currentServiceIndex);
         Flow egressFlow = MDSALUtil.buildFlowNew(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, flowRef,
                 boundService.getServicePriority().toJava(), serviceRef, 0, 0, stypeOpenflow.getFlowCookie(),
-                matches, instructions);
+                matches, instructionMap);
         LOG.debug("Installing Egress Dispatcher Flow for interface : {}, with flow-ref : {}", interfaceName, flowRef);
         installFlow(dpId, egressFlow, tx);
     }
@@ -696,18 +699,20 @@ public final class FlowBasedServicesUtils {
             actions.add(MDSALUtil.createNxOfInPortAction(++actionKey, 0));
         }
         if (!actions.isEmpty()) {
-            instructions.put(MDSALUtil.buildApplyActionsInstruction(actions, instructionKey++).key(),
-                    MDSALUtil.buildApplyActionsInstruction(actions, instructionKey++));
+            Instruction buildApplyActionsInstruction = MDSALUtil.buildApplyActionsInstruction(actions,
+                    instructionKey++);
+            instructions.put(buildApplyActionsInstruction.key(), buildApplyActionsInstruction);
         }
         Uint64 metadata = MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, (short) 0, Uint64.ZERO,
                 isExternal(iface));
         Uint64 metadataMask = MetaDataUtil
                 .getMetaDataMaskForLPortDispatcher(MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG);
-        instructions.put(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, instructionKey++).key(),
-                MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, instructionKey++));
-        instructions.put(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.LPORT_DISPATCHER_TABLE,
-                instructionKey++).key(),
-                MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.LPORT_DISPATCHER_TABLE, instructionKey++));
+        Instruction metadaInstruction = MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask,
+                instructionKey++);
+        instructions.put(metadaInstruction.key(),metadaInstruction);
+        Instruction gotoTableInstruction = MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.LPORT_DISPATCHER_TABLE,
+                instructionKey++);
+        instructions.put(gotoTableInstruction.key(), gotoTableInstruction);
         int priority = isVlanTransparent ? 1
                 : vlanId == 0 ? IfmConstants.FLOW_PRIORITY_FOR_UNTAGGED_VLAN : IfmConstants.FLOW_HIGH_PRIORITY;
         String flowRef = getFlowRef(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, dpId, iface.getName());
index 03473ea6fd6ddb367e6c71051b4705d03805ca8d..469ded5f96b0cdbdc7862c8c983a1a6ebca73b0a 100644 (file)
@@ -572,16 +572,18 @@ public final class ItmUtils {
     public static Map<InternalTunnelKey, InternalTunnel> getInternalTunnelsFromCache(DataBroker dataBroker) {
         Collection<InternalTunnel> internalInterfaces = ITM_CACHE.getAllInternalTunnel();
         LOG.trace("getInternalTunnelsFromCache - List of InternalTunnels in the Cache: {} ", internalInterfaces);
-        Map<InternalTunnelKey, InternalTunnel> tunnelList = new HashMap<>();
+        Map<InternalTunnelKey, InternalTunnel> tunnelMap = new HashMap<>();
         if (internalInterfaces.isEmpty()) {
             LOG.trace("ItmUtils.getInternalTunnelsFromCache invoking getAllInternalTunnlInterfacesFromDS");
-            tunnelList = getAllInternalTunnels(dataBroker);
+            tunnelMap = getAllInternalTunnels(dataBroker);
         } else {
             LOG.debug("No. of Internal Tunnel Interfaces in cache: {} ", internalInterfaces.size());
-            tunnelList.values().addAll(internalInterfaces);
+            for (InternalTunnel internalTunnel : internalInterfaces) {
+                tunnelMap.put(internalTunnel.key(), internalTunnel);
+            }
         }
-        LOG.trace("List of Internal Tunnels: {}", tunnelList);
-        return tunnelList;
+        LOG.trace("List of Internal Tunnels: {}", tunnelMap);
+        return tunnelMap;
     }
 
     @SuppressFBWarnings("RV_CHECK_FOR_POSITIVE_INDEXOF")
index 6111ec4dd02a2134027d5b24de90e311f2e46230..85018bf2d1ac3e4bb792d8997d49322e89f712fc 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import edu.umd.cs.findbugs.annotations.CheckReturnValue;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -54,7 +55,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 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.genius.idmanager.rev160406.AllocateIdInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput;
@@ -418,10 +418,10 @@ public final class DirectTunnelUtils {
             actions.add(new ActionOutput(0, new Uri(portNo)));
         }
         String flowRef = getTunnelInterfaceFlowRef(dpnId, NwConstants.EGRESS_TUNNEL_TABLE, interfaceName);
-        Flow egressFlow = MDSALUtil.buildFlowNew(NwConstants.EGRESS_TUNNEL_TABLE, flowRef, 5, flowRef, 0, 0,
-            NwConstants.COOKIE_ITM_EGRESS_TUNNEL_TABLE, matches,
-                (Map<InstructionKey, Instruction>)(MDSALUtil.buildApplyActionsInstruction(MDSALUtil
-                        .buildActions(actions))));
+        Instruction instruction = MDSALUtil.buildApplyActionsInstruction(MDSALUtil.buildActions(actions));
+        Flow egressFlow = MDSALUtil.buildFlowNew(NwConstants.EGRESS_TUNNEL_TABLE, flowRef, 5, flowRef,
+                0, 0, NwConstants.COOKIE_ITM_EGRESS_TUNNEL_TABLE, matches,
+                Collections.singletonMap(instruction.key(),instruction));
         mdsalApiManager.addFlow(tx, dpnId, egressFlow);
     }
 
index 4232ea0cef39148f85d332734699b6122280dfa8..c2ecab9aeaf50d430ddf3a32b69cf35f4662d995 100644 (file)
@@ -1027,8 +1027,7 @@ public class ItmManagerRpcService implements ItmRpcService {
 
         Map<DcGatewayIpKey, DcGatewayIp> dcGatewayIpList = new HashMap<>();
         txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION,
-            tx -> dcGatewayIpList.values().addAll(getDcGatewayIpList(tx).values())).isDone();
-
+            tx -> dcGatewayIpList.putAll(getDcGatewayIpList(tx))).isDone();
         String dcgwIpStr = input.getDcgwIp();
         IpAddress dcgwIpAddr = IpAddressBuilder.getDefaultInstance(dcgwIpStr);
         long retVal;
@@ -1199,7 +1198,7 @@ public class ItmManagerRpcService implements ItmRpcService {
     public static Map<DcGatewayIpKey, DcGatewayIp>
         getDcGatewayIpList(TypedReadWriteTransaction<Datastore.Configuration> tx)
             throws ExecutionException, InterruptedException {
-        Map<DcGatewayIpKey, DcGatewayIp> dcGatewayIpList = new HashMap<>();
+        Map<DcGatewayIpKey, DcGatewayIp> dcGatewayIpMap = new HashMap<>();
         FluentFuture<Optional<DcGatewayIpList>> future =
                 tx.read(InstanceIdentifier.builder(DcGatewayIpList.class).build());
         future.addCallback(new FutureCallback<Optional<DcGatewayIpList>>() {
@@ -1211,7 +1210,7 @@ public class ItmManagerRpcService implements ItmRpcService {
                     if (opt.isPresent()) {
                         DcGatewayIpList list = opt.get();
                         if (list != null) {
-                            dcGatewayIpList.values().addAll(list.getDcGatewayIp().values());
+                            dcGatewayIpMap.putAll(list.getDcGatewayIp());
                         }
                     }
                 } catch (ExecutionException | InterruptedException e) {
@@ -1224,6 +1223,6 @@ public class ItmManagerRpcService implements ItmRpcService {
                 LOG.error("DcGateway IpList read failed", error);
             }
         }, MoreExecutors.directExecutor());
-        return dcGatewayIpList;
+        return dcGatewayIpMap;
     }
 }