Fixup Augmentable and Identifiable methods changing
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / flow / FlowStatsResponseConvertor.java
index fb536a8998788042c9902541c12ea139ae858ddb..b061b9382d8c50f9584b90cbae75d9cf9a4ead6f 100644 (file)
@@ -40,11 +40,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 /**
  * Converts flow related statistics messages coming from openflow switch to MD-SAL messages.
  *
+ * <p>
  * Example usage:
  * <pre>
  * {@code
@@ -54,42 +54,43 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * }
  * </pre>
  */
-public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>, FlowStatsResponseConvertorData> {
+public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>,
+        FlowStatsResponseConvertorData> {
 
     private static final Set<Class<?>> TYPES = Collections.singleton(FlowStats.class);
 
     /**
-     * Method wraps openflow 1.0 actions list to Apply Action Instructions
+     * Method wraps openflow 1.0 actions list to Apply Action Instructions.
      *
      * @param actionsList list of action
      * @param ipProtocol ip protocol
      * @return OF10 actions as an instructions
      */
-    private Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList,
-                                                      final short version,
-                                                      final Short ipProtocol) {
+    private Instructions wrapOF10ActionsToInstruction(
+            List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions
+                .grouping.Action> actionsList,
+            final short version, final Short ipProtocol) {
         ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(version);
-        actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
         actionResponseConvertorData.setIpProtocol(ipProtocol);
 
-        InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
-        List<Instruction> salInstructionList = new ArrayList<>();
-
         ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
         ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
 
-        final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = getConvertorExecutor().convert(
-                actionsList, actionResponseConvertorData);
+        final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>>
+            actions = getConvertorExecutor().convert(actionsList, actionResponseConvertorData);
 
         applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
         applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
 
         InstructionBuilder instBuilder = new InstructionBuilder();
         instBuilder.setInstruction(applyActionsCaseBuilder.build());
-        instBuilder.setKey(new InstructionKey(0));
+        instBuilder.withKey(new InstructionKey(0));
         instBuilder.setOrder(0);
+        List<Instruction> salInstructionList = new ArrayList<>();
         salInstructionList.add(instBuilder.build());
 
+        InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
         instructionsBuilder.setInstruction(salInstructionList);
         return instructionsBuilder.build();
     }
@@ -126,7 +127,8 @@ public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<
             Short ipProtocol = null;
 
             if (flowStats.getMatchV10() != null) {
-                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatchV10(), data);
+                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
+                        flowStats.getMatchV10(), data);
 
                 if (matchBuilderOptional.isPresent()) {
                     if (Objects.nonNull(matchBuilderOptional.get().getIpMatch())) {
@@ -137,12 +139,14 @@ public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<
                 }
 
                 if (flowStats.getAction() != null && flowStats.getAction().size() != 0) {
-                    salFlowStatsBuilder.setInstructions(wrapOF10ActionsToInstruction(flowStats.getAction(), data.getVersion(), ipProtocol));
+                    salFlowStatsBuilder.setInstructions(wrapOF10ActionsToInstruction(flowStats.getAction(),
+                            data.getVersion(), ipProtocol));
                 }
             }
 
             if (flowStats.getMatch() != null) {
-                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatch(), data);
+                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
+                        flowStats.getMatch(), data);
 
                 if (matchBuilderOptional.isPresent()) {
                     final MatchBuilder matchBuilder = matchBuilderOptional.get();
@@ -154,7 +158,8 @@ public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<
                                     data.getMatchPath());
 
                     if (matchExtensionWrap != null) {
-                        matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(), matchExtensionWrap.getAugmentationObject());
+                        matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
+                                matchExtensionWrap.getAugmentationObject());
                     }
 
                     salFlowStatsBuilder.setMatch(matchBuilder.build());