functional stats service

Change-Id: I90de3aa5d7721db8ef6a154e122af8b446243f60
diff --git a/core/api/src/main/java/org/onlab/onos/net/statistic/DefaultLoad.java b/core/api/src/main/java/org/onlab/onos/net/statistic/DefaultLoad.java
new file mode 100644
index 0000000..1826dde
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/statistic/DefaultLoad.java
@@ -0,0 +1,56 @@
+package org.onlab.onos.net.statistic;
+
+import org.onlab.onos.net.flow.FlowRuleProvider;
+
+/**
+ * Implementation of a load.
+ */
+public class DefaultLoad implements Load {
+
+    private final boolean isValid;
+    private final long current;
+    private final long previous;
+    private final long time;
+
+    /**
+     * Creates an invalid load.
+     */
+    public DefaultLoad() {
+        this.isValid = false;
+        this.time = System.currentTimeMillis();
+        this.current = -1;
+        this.previous = -1;
+    }
+
+    /**
+     * Creates a load value from the parameters.
+     * @param current the current value
+     * @param previous the previous value
+     */
+    public DefaultLoad(long current, long previous) {
+        this.current = current;
+        this.previous = previous;
+        this.time = System.currentTimeMillis();
+        this.isValid = true;
+    }
+
+    @Override
+    public long rate() {
+        return (current - previous) / FlowRuleProvider.POLL_INTERVAL;
+    }
+
+    @Override
+    public long latest() {
+        return current;
+    }
+
+    @Override
+    public boolean isValid() {
+        return isValid;
+    }
+
+    @Override
+    public long time() {
+        return time;
+    }
+}