[SEBA-719] Display counters in onos cli and reset counters

Change-Id: Ia9fc1865d13a366c9a7cd3e7ae11c39dcc284fd9
diff --git a/api/src/main/java/org/opencord/aaa/AaaStatistics.java b/api/src/main/java/org/opencord/aaa/AaaStatistics.java
index 9764427..921de5f 100644
--- a/api/src/main/java/org/opencord/aaa/AaaStatistics.java
+++ b/api/src/main/java/org/opencord/aaa/AaaStatistics.java
@@ -16,36 +16,61 @@
 
 package org.opencord.aaa;
 
+import java.util.LinkedList;
 import java.util.concurrent.atomic.AtomicLong;
 
 public class AaaStatistics {
-    //Number of access accept packets sent to the server
+    // Number of access accept packets sent to the server
     private AtomicLong acceptResponsesRx = new AtomicLong();
-    //Number of access reject packets sent to the server
+    // Number of access reject packets sent to the server
     private AtomicLong rejectResponsesRx = new AtomicLong();
-    //Number of access challenge packets sent to the server
+    // Number of access challenge packets sent to the server
     private AtomicLong challengeResponsesRx = new AtomicLong();
-    //Number of access request packets sent to the server
+    // Number of access request packets sent to the server
     private AtomicLong accessRequestsTx = new AtomicLong();
-    //Number of access request packets pending a response from the server
+    // Number of access request packets pending a response from the server
     private AtomicLong pendingRequests = new AtomicLong();
-    //Number of packets of an unknown RADIUS type received from the accounting server
+    // Number of packets of an unknown RADIUS type received from the accounting
+    // server
     private AtomicLong unknownTypeRx = new AtomicLong();
-    //Number of access response packets received from the server with an invalid validator
+    // Number of access response packets received from the server with an invalid
+    // validator
     private AtomicLong invalidValidatorsRx = new AtomicLong();
-    //Number of dropped packets received from the accounting server
+    // Number of dropped packets received from the accounting server
     private AtomicLong droppedResponsesRx = new AtomicLong();
-    //Number of malformed access response packets received from the server
+    // Number of malformed access response packets received from the server
     private AtomicLong malformedResponsesRx = new AtomicLong();
-    //Number of packets received from an unknown server
+    // Number of packets received from an unknown server
     private AtomicLong unknownServerRx = new AtomicLong();
-    //Roundtrip packet time to the accounting server
+    // Roundtrip packet time to the accounting server
     private AtomicLong requestRttMilis = new AtomicLong();
-    //Number of access request packets retransmitted to the server
+    // Number of access request packets retransmitted to the server
     private AtomicLong requestReTx = new AtomicLong();
-    //Number of sessions expired
+    // Number of sessions expired
     private AtomicLong numberOfSessionsExpired = new AtomicLong();
 
+    private LinkedList<Long> packetRoundTripTimeList = new LinkedList<Long>();
+
+    public LinkedList<Long> getPacketRoundTripTimeList() {
+        return packetRoundTripTimeList;
+    }
+
+    public int getPacketRoundTripTimeListSize() {
+        return packetRoundTripTimeList.size();
+    }
+
+    public void clearPacketRoundTripTimeList() {
+        packetRoundTripTimeList.clear();
+    }
+
+    public void getPacketRoundTripTimeListRemoveFirst() {
+        packetRoundTripTimeList.removeFirst();
+    }
+
+    public void getPacketRoundTripTimeListAdd(long time) {
+        packetRoundTripTimeList.add(time);
+    }
+
     public Long getRequestReTx() {
         return requestReTx.get();
     }
@@ -153,4 +178,21 @@
         numberOfDroppedPackets += numberOfSessionsExpired.get();
         this.droppedResponsesRx = new AtomicLong(numberOfDroppedPackets);
     }
+
+    public void resetAllCounters() {
+        clearPacketRoundTripTimeList();
+
+        accessRequestsTx.set(0);
+        acceptResponsesRx.set(0);
+        challengeResponsesRx.set(0);
+        droppedResponsesRx.set(0);
+        invalidValidatorsRx.set(0);
+        malformedResponsesRx.set(0);
+        pendingRequests.set(0);
+        rejectResponsesRx.set(0);
+        requestReTx.set(0);
+        requestRttMilis.set(0);
+        unknownServerRx.set(0);
+        unknownTypeRx.set(0);
+    }
 }
diff --git a/api/src/main/java/org/opencord/aaa/AuthenticationStatisticsService.java b/api/src/main/java/org/opencord/aaa/AuthenticationStatisticsService.java
index bdb9f2d..37a2205 100644
--- a/api/src/main/java/org/opencord/aaa/AuthenticationStatisticsService.java
+++ b/api/src/main/java/org/opencord/aaa/AuthenticationStatisticsService.java
@@ -23,38 +23,42 @@
  */
 
 public interface AuthenticationStatisticsService extends
-        ListenerService<AuthenticationStatisticsEvent, AuthenticationStatisticsEventListener> {
+ListenerService<AuthenticationStatisticsEvent, AuthenticationStatisticsEventListener> {
 
     /**
      * Returns AaaStatistics object.
      *
      * @return AaaStatistics
-    */
+     */
     public AaaStatistics getAaaStats();
-
     /**
      * Returns AuthenticationStatisticsDelegate object.
      *
      * @return AuthenticationStatisticsDelegate
-    */
+     */
     public AuthenticationStatisticsDelegate getStatsDelegate();
 
     /**
      * Handle the roundTrip time of Radius Packet.
      *
      * @param identifier identifier of incoming radius packet
-    */
+     */
     public void handleRoundtripTime(byte identifier);
 
     /**
      * Calculate average roundTrip time of multiple Packets.
-    */
+     */
     public void calculatePacketRoundtripTime();
 
     /**
      * Put the identifier value to map.
      *
      * @param identifier identifier of incoming radius packet
-    */
+     */
     public void putOutgoingIdentifierToMap(byte identifier);
+
+   /**
+    * Reset all the values of aaa counters to 0.
+    */
+    public void resetAllCounters();
 }