[newOpenTAM] new Upgraded AFM and FlowStatisticService

New Upgraded AFM(Adaptive Flow Monitoring) and FlowStatisticService.
  .Reabsed from master 2016.12.06, and assumed avgPollInterval in FlowStatisticService with flowPollFrequency in case adativeFlowSampling is true or false
  .Fixed Yuta HIGUCHI comments, 2016.12.03
  .Fixed checkstyle warning
  .Rebased and added interrupted flag for exiting while() loop when IterruptException is caught in NewAdaptiveFlowStatsCollector.java

  .Fixed and added javadocs from Thomas Vachuska's comment
  .Removed synchronized block in OpenFlowRuleProvider.java for avoiding performance degradation
  .Rebased from master 2016.10.13 1.8.0.SNAPSHOT
  .Rebased from master 2016.09.09
  .Fixed Yuta HIGUCHI's comments
   (made default getFlowEntriesByLiveType interface,
    added checkArgument() for StoredFlowEntry,
    added @Deprecated annotation @deprecated javadoc,
    added Thread.currentThread.interrupt()
    and fixed Default Adaptive Flow Sampling value with false.)

  .Rebased from master branch
  .Fix typo in FlowRuleService.java comment line
  .Quick Bug fix in NewAdaptiveFlowStatCollector
  .master rebased for fixing build Failure
  .Removed synchronized block in FlowRuleProvider and NewAdaptiveFlowStatCollector for performance upgrade

  .Removed duplicated flow entries in NewAdaptiveFlowStatsCollector
  .Removed additional operation (add/remove/mod) of flow entry in OpenFlowRuleProvider
  .Set default adaptiveFlowSampling value with true
  .Added liveType (IMMEDIATE, SHORT, MID, LONG) member variable in FlowEntry
  .New added PollInterval static class for pollInterval value adjustment
  .Updated FlowEntryBuilder and FlowEntry constructor
  .Added liveType print in FlowListCommand CLI
  .Removed FlowStatisticStore, used existing StatisticStore
  .New added FlowEntryWithLoad for replacing the old TypedFlowEntryWithLoad
  .Added new interfaces in FlowStatisticService
  .Updated GetFlowStatistics CLI for using new interfaces
  .All Typedxxx classes are deprecated

  .new created review 9292 from review 9232
  .fixed Jian Li's review comment from review 9232
  .fixed Build failure in core/net/BUCK file

Change-Id: I7a0e39c5220a2b279b68a195347c183b5bdf1a49
diff --git a/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java b/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
index e55237e..926b291 100644
--- a/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
+++ b/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
@@ -19,6 +19,7 @@
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.Device;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.FlowEntry;
 import org.onosproject.net.flow.TypedStoredFlowEntry;
 import org.onosproject.net.flow.instructions.Instruction;
 
@@ -56,6 +57,66 @@
      * @param instType the InstructionType to filter, null means no filtering.
      * @return map of flow entry load
      */
+    Map<ConnectPoint, List<FlowEntryWithLoad>> loadAllByType(Device device,
+                                                             FlowEntry.FlowLiveType liveType,
+                                                             Instruction.Type instType);
+
+    /**
+     * Obtain the flow type and load list for the device with the given link or port.
+     *
+     * @param device the Device to query.
+     * @param pNumber the port number of the Device to query
+     * @param liveType the FlowLiveType  to filter, null means no filtering .
+     * @param instType the InstructionType to filter, null means no filtering.
+     * @return list of flow entry load
+     */
+    List<FlowEntryWithLoad> loadAllByType(Device device,
+                                          PortNumber pNumber,
+                                          FlowEntry.FlowLiveType liveType,
+                                          Instruction.Type instType);
+
+    /**
+     * Obtain the set of the flow type and load topn list for the device with the given link.
+     *
+     * @param device the Device  to query.
+     * @param liveType the FlowLiveType  to filter, null means no filtering .
+     * @param instType the InstructionType to filter, null means no filtering.
+     * @param topn the top number to filter, null means no filtering.
+     * @return map of flow entry load
+     */
+    Map<ConnectPoint, List<FlowEntryWithLoad>> loadTopnByType(Device device,
+                                                              FlowEntry.FlowLiveType liveType,
+                                                              Instruction.Type instType,
+                                                              int topn);
+
+    /**
+     * Obtain the flow type and load topn list for the device with the given link or port.
+     *
+     * @param device the Device  to query.
+     * @param pNumber the port number of the Device to query
+     * @param liveType the FlowLiveType  to filter, null means no filtering .
+     * @param instType the InstructionType to filter, null means no filtering.
+     * @param topn the top n list entry
+     * @return list of flow entry load
+     */
+    List<FlowEntryWithLoad> loadTopnByType(Device device,
+                                           PortNumber pNumber,
+                                           FlowEntry.FlowLiveType liveType,
+                                           Instruction.Type instType,
+                                           int topn);
+
+    // The belows are deprecated interfaces...
+
+    /**
+     * Obtain the set of the flow type and load list for the device with the given link.
+     *
+     * @param device the Device  to query.
+     * @param liveType the FlowLiveType  to filter, null means no filtering .
+     * @param instType the InstructionType to filter, null means no filtering.
+     * @return map of flow entry load
+     * @deprecated in Ibis(1.8.1) release
+     */
+    @Deprecated
     Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
                                                                   TypedStoredFlowEntry.FlowLiveType liveType,
                                                                   Instruction.Type instType);
@@ -68,8 +129,11 @@
      * @param liveType the FlowLiveType  to filter, null means no filtering .
      * @param instType the InstructionType to filter, null means no filtering.
      * @return list of flow entry load
+     * @deprecated in Ibis(1.8.1) release
      */
-    List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber,
+    @Deprecated
+    List<TypedFlowEntryWithLoad> loadAllByType(Device device,
+                                               PortNumber pNumber,
                                                TypedStoredFlowEntry.FlowLiveType liveType,
                                                Instruction.Type instType);
 
@@ -81,7 +145,9 @@
      * @param instType the InstructionType to filter, null means no filtering.
      * @param topn the top number to filter, null means no filtering.
      * @return map of flow entry load
+     * @deprecated in Ibis(1.8.1) release
      */
+    @Deprecated
     Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device,
                                                                    TypedStoredFlowEntry.FlowLiveType liveType,
                                                                    Instruction.Type instType,
@@ -96,8 +162,11 @@
      * @param instType the InstructionType to filter, null means no filtering.
      * @param topn topn //FIXME what?
      * @return list of flow entry load
+     * @deprecated in Ibis(1.8.1) release
      */
-    List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber,
+    @Deprecated
+    List<TypedFlowEntryWithLoad> loadTopnByType(Device device,
+                                                PortNumber pNumber,
                                                 TypedStoredFlowEntry.FlowLiveType liveType,
                                                 Instruction.Type instType,
                                                 int topn);