[ONOS-3851] Initial implementation of Web GUI of CPMan
- Revise chart model to provide default label
- Visualize control message stats per device
Change-Id: I88b8e63ce92114907bba185b1906569fa8cc0b83
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
index 36e436a..40c1d04 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
@@ -17,6 +17,7 @@
import com.google.common.base.MoreObjects;
+import java.util.Arrays;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
@@ -29,13 +30,14 @@
private final long latest;
private final long average;
private final long time;
+ private long[] recent;
/**
* Instantiates a new control metric response with given latest, average, time.
*
- * @param latest latest value of control metric
+ * @param latest latest value of control metric
* @param average average value of control metric
- * @param time last logging time fo control metric
+ * @param time last logging time of control metric
*/
public ControlLoadSnapshot(long latest, long average, long time) {
this.latest = latest;
@@ -44,6 +46,22 @@
}
/**
+ * Instantiates a new control metric response with given latest, average, time,
+ * recent values.
+ *
+ * @param latest latest value of control metric
+ * @param average average value of control metric
+ * @param time last logging time of control metric
+ * @param recent a set of historical data
+ */
+ public ControlLoadSnapshot(long latest, long average, long time, long[] recent) {
+ this.latest = latest;
+ this.average = average;
+ this.time = time;
+ this.recent = recent;
+ }
+
+ /**
* Returns latest value of control metric.
*
* @return latest value of control metric
@@ -70,9 +88,18 @@
return average;
}
+ /**
+ * Returns a set of historical recent of control metric.
+ *
+ * @return a set of historical recent of control metric
+ */
+ public long[] recent() {
+ return recent;
+ }
+
@Override
public int hashCode() {
- return Objects.hash(latest, average, time);
+ return Objects.hash(latest, average, time, recent);
}
@Override
@@ -84,7 +111,8 @@
final ControlLoadSnapshot other = (ControlLoadSnapshot) obj;
return Objects.equals(this.latest, other.latest) &&
Objects.equals(this.average, other.average) &&
- Objects.equals(this.time, other.time);
+ Objects.equals(this.time, other.time) &&
+ Arrays.equals(this.recent, other.recent);
}
return false;
}
@@ -95,7 +123,9 @@
helper = toStringHelper(this)
.add("latest", latest)
.add("average", average)
- .add("time", time);
+ .add("time", time)
+ .add("recent", recent);
+
return helper.toString();
}
}