Prototyping GUI & CLI for the intent performance test fixture.

Change-Id: I1f33872e62b55d168ccd8f2904472e41ecba4cc8
diff --git a/apps/intent-perf/pom.xml b/apps/intent-perf/pom.xml
index 038ecd8..2d4ddf1 100644
--- a/apps/intent-perf/pom.xml
+++ b/apps/intent-perf/pom.xml
@@ -31,6 +31,19 @@
 
     <description>ONOS intent perf app bundle</description>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-cli</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
     <build>
         <plugins>
             <plugin>
diff --git a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCollector.java b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCollector.java
new file mode 100644
index 0000000..333fa4e
--- /dev/null
+++ b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCollector.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.intentperf;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.ControllerNode;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
+import org.onosproject.store.cluster.messaging.ClusterMessage;
+import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
+import org.onosproject.store.cluster.messaging.MessageSubject;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import static org.onlab.util.Tools.groupedThreads;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Collects and distributes performance samples.
+ */
+@Component(immediate = true)
+@Service(value = IntentPerfCollector.class)
+public class IntentPerfCollector {
+
+    private static final long SAMPLE_WINDOW = 5_000;
+    private final Logger log = getLogger(getClass());
+
+    private static final int MAX_SAMPLES = 1_000;
+
+    private final List<Sample> samples = new LinkedList<>();
+
+    private static final MessageSubject SAMPLE = new MessageSubject("intent-perf-sample");
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterCommunicationService communicationService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY)
+    protected IntentPerfUi ui;
+
+    // Auxiliary structures used to accrue data for normalized time interval
+    // across all nodes.
+    private long newestTime;
+    private Sample overall;
+    private Sample current;
+
+    private ControllerNode[] nodes;
+    private Map<NodeId, Integer> nodeToIndex;
+
+    private NodeId nodeId;
+    private ExecutorService messageHandlingExecutor;
+
+    @Activate
+    public void activate() {
+        this.nodeId = clusterService.getLocalNode().id();
+        this.newestTime = 0;
+
+        messageHandlingExecutor = Executors.newSingleThreadExecutor(
+                groupedThreads("onos/perf", "message-handler"));
+
+        communicationService.addSubscriber(SAMPLE, new InternalSampleCollector(),
+                                           messageHandlingExecutor);
+
+        nodes = clusterService.getNodes().toArray(new ControllerNode[]{});
+        Arrays.sort(nodes, (a, b) -> a.id().toString().compareTo(b.id().toString()));
+
+        nodeToIndex = new HashMap<>();
+        for (int i = 0; i < nodes.length; i++) {
+            nodeToIndex.put(nodes[i].id(), i);
+        }
+        overall = new Sample(0, nodes.length);
+        current = new Sample(0, nodes.length);
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        messageHandlingExecutor.shutdown();
+        communicationService.removeSubscriber(SAMPLE);
+        log.info("Stopped");
+    }
+
+    /**
+     * Records a sample point of data about intent operation rate.
+     *
+     * @param overallRate overall rate
+     * @param currentRate current rate
+     */
+    public void recordSample(double overallRate, double currentRate) {
+        try {
+            long now = System.currentTimeMillis();
+            addSample(now, nodeId, overallRate, currentRate);
+            broadcastSample(now, nodeId, overallRate, currentRate);
+        } catch (Exception e) {
+            log.error("Boom!", e);
+        }
+    }
+
+    /**
+     * Returns set of node ids as headers.
+     *
+     * @return node id headers
+     */
+    public List<String> getSampleHeaders() {
+        List<String> headers = new ArrayList<>();
+        for (ControllerNode node : nodes) {
+            headers.add(node.id().toString());
+        }
+        return headers;
+    }
+
+    /**
+     * Returns set of all accumulated samples normalized to the local set of
+     * samples.
+     *
+     * @return accumulated samples
+     */
+    public synchronized List<Sample> getSamples() {
+        return ImmutableList.copyOf(samples);
+    }
+
+    /**
+     * Returns overall throughput performance for each of the cluster nodes.
+     *
+     * @return overall intent throughput
+     */
+    public synchronized Sample getOverall() {
+        return overall;
+    }
+
+    // Records a new sample to our collection of samples
+    private synchronized void addSample(long time, NodeId nodeId,
+                                        double overallRate, double currentRate) {
+        Sample fullSample = createCurrentSampleIfNeeded(time);
+        setSampleData(current, nodeId, currentRate);
+        setSampleData(overall, nodeId, overallRate);
+        pruneSamplesIfNeeded();
+
+        if (fullSample != null && ui != null) {
+            ui.reportSample(fullSample);
+        }
+    }
+
+    private Sample createCurrentSampleIfNeeded(long time) {
+        Sample oldSample = time - newestTime > SAMPLE_WINDOW || current.isComplete() ? current : null;
+        if (oldSample != null) {
+            newestTime = time;
+            current = new Sample(time, nodes.length);
+            if (oldSample.time > 0) {
+                samples.add(oldSample);
+            }
+        }
+        return oldSample;
+    }
+
+    private void setSampleData(Sample sample, NodeId nodeId, double data) {
+        Integer index = nodeToIndex.get(nodeId);
+        if (index != null) {
+            sample.data[index] = data;
+        }
+    }
+
+    private void pruneSamplesIfNeeded() {
+        if (samples.size() > MAX_SAMPLES) {
+            samples.remove(0);
+        }
+    }
+
+    // Performance data sample.
+    static class Sample {
+        final long time;
+        final double[] data;
+
+        public Sample(long time, int nodeCount) {
+            this.time = time;
+            this.data = new double[nodeCount];
+            Arrays.fill(data, -1);
+        }
+
+        public boolean isComplete() {
+            for (int i = 0; i < data.length; i++) {
+                if (data[i] < 0) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    private void broadcastSample(long time, NodeId nodeId, double overallRate, double currentRate) {
+        String data = String.format("%d|%f|%f", time, overallRate, currentRate);
+        communicationService.broadcast(new ClusterMessage(nodeId, SAMPLE, data.getBytes()));
+    }
+
+    private class InternalSampleCollector implements ClusterMessageHandler {
+        @Override
+        public void handle(ClusterMessage message) {
+            String[] fields = new String(message.payload()).split("\\|");
+            log.info("Received sample from {}: {}", message.sender(), fields);
+            addSample(Long.parseLong(fields[0]), message.sender(),
+                      Double.parseDouble(fields[1]), Double.parseDouble(fields[1]));
+        }
+    }
+}
diff --git a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCommand.java b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCommand.java
new file mode 100644
index 0000000..928a8f8
--- /dev/null
+++ b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfCommand.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.intentperf;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.intentperf.IntentPerfCollector.Sample;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Displays accumulated performance metrics.
+ */
+@Command(scope = "onos", name = "intent-perf",
+        description = "Displays accumulated performance metrics")
+public class IntentPerfCommand extends AbstractShellCommand {
+
+    @Option(name = "-s", aliases = "--summary", description = "Output just summary",
+            required = false, multiValued = false)
+    private boolean summary = false;
+
+    @Override
+    protected void execute() {
+        if (summary) {
+            printSummary();
+        } else {
+            printSamples();
+        }
+    }
+
+    private void printSummary() {
+        IntentPerfCollector collector = get(IntentPerfCollector.class);
+        List<String> headers = collector.getSampleHeaders();
+        Sample overall = collector.getOverall();
+        double total = 0;
+        for (int i = 0; i < overall.data.length; i++) {
+            print("%12s: %12.2f", headers.get(i), overall.data[i]);
+            total += overall.data[i];
+        }
+        print("%12s: %12.2f", "total", total);
+    }
+
+    private void printSamples() {
+        IntentPerfCollector collector = get(IntentPerfCollector.class);
+        List<String> headers = collector.getSampleHeaders();
+        List<Sample> samples = collector.getSamples();
+
+        System.out.print(String.format("%10s  ", "Time"));
+        for (String header : headers) {
+            System.out.print(String.format("%12s  ", header));
+        }
+        System.out.println(String.format("%12s", "Total"));
+
+        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+        for (Sample sample : samples) {
+            double total = 0;
+            System.out.print(String.format("%10s  ", sdf.format(new Date(sample.time))));
+            for (int i = 0; i < sample.data.length; i++) {
+                if (sample.data[i] >= 0) {
+                    System.out.print(String.format("%12.2f  ", sample.data[i]));
+                    total += sample.data[i];
+                } else {
+                    System.out.print(String.format("%12s  ", " "));
+                }
+            }
+            System.out.println(String.format("%12.2f", total));
+        }
+    }
+
+}
diff --git a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
index 5c8a015..029d70a 100644
--- a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
+++ b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
@@ -94,7 +94,7 @@
     //FIXME add path length
 
     @Property(name = "numKeys", intValue = DEFAULT_NUM_KEYS,
-              label = "Number of keys (i.e. unique intents) to generate per instance")
+            label = "Number of keys (i.e. unique intents) to generate per instance")
     private int numKeys = DEFAULT_NUM_KEYS;
 
     //TODO implement numWorkers property
@@ -103,11 +103,11 @@
 //    private int numWokers = DEFAULT_NUM_WORKERS;
 
     @Property(name = "cyclePeriod", intValue = DEFAULT_GOAL_CYCLE_PERIOD,
-              label = "Goal for cycle period (in ms)")
+            label = "Goal for cycle period (in ms)")
     private int cyclePeriod = DEFAULT_GOAL_CYCLE_PERIOD;
 
     @Property(name = "numNeighbors", intValue = DEFAULT_NUM_NEIGHBORS,
-              label = "Number of neighbors to generate intents for")
+            label = "Number of neighbors to generate intents for")
     private int numNeighbors = DEFAULT_NUM_NEIGHBORS;
 
     @Reference(cardinality = MANDATORY_UNARY)
@@ -131,6 +131,9 @@
     @Reference(cardinality = MANDATORY_UNARY)
     protected ComponentConfigService configService;
 
+    @Reference(cardinality = MANDATORY_UNARY)
+    protected IntentPerfCollector sampleCollector;
+
     private ExecutorService workers;
     private ApplicationId appId;
     private Listener listener;
@@ -141,9 +144,11 @@
     // FIXME this variable isn't shared properly between multiple worker threads
     private int lastKey = 0;
 
+    private IntentPerfUi perfUi;
+
     @Activate
     public void activate() {
-        configService.registerProperties(getClass());
+//        configService.registerProperties(getClass());
 
         String nodeId = clusterService.getLocalNode().ip().toString();
         appId = coreService.registerApplication("org.onosproject.intentperf." + nodeId);
@@ -169,7 +174,7 @@
 
     @Deactivate
     public void deactivate() {
-        configService.unregisterProperties(getClass(), false);
+//        configService.unregisterProperties(getClass(), false);
         stop();
     }
 
@@ -266,19 +271,15 @@
      * @return set of intents
      */
     private Set<Intent> createIntents(int numberOfKeys, int pathLength, int firstKey) {
-        //Set<Intent> result = new HashSet<>();
-
         List<NodeId> neighbors = getNeighbors();
 
         Multimap<NodeId, Device> devices = ArrayListMultimap.create();
-        deviceService.getAvailableDevices().forEach(device ->
-            devices.put(mastershipService.getMasterFor(device.id()), device));
+        deviceService.getAvailableDevices()
+                .forEach(device -> devices.put(mastershipService.getMasterFor(device.id()), device));
 
         // ensure that we have at least one device per neighbor
-        neighbors.forEach(node ->
-            checkState(devices.get(node).size() > 0,
-                       "There are no devices for {}", node));
-
+        neighbors.forEach(node -> checkState(devices.get(node).size() > 0,
+                                             "There are no devices for {}", node));
 
         // TODO pull this outside so that createIntent can use it
         // prefix based on node id for keys generated on this instance
@@ -401,6 +402,7 @@
         }
 
         int cycleCount = 0;
+
         private void adjustRates() {
 
             int addDelta = Math.max(1000 - cycleCount, 10);
@@ -483,6 +485,10 @@
                      format("%.2f", runningTotal.throughput()),
                      format("%.2f", processedThroughput),
                      stringBuilder);
+
+            sampleCollector.recordSample(runningTotal.throughput(),
+                                         processedThroughput);
         }
     }
+
 }
diff --git a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java
new file mode 100644
index 0000000..d30fe4e
--- /dev/null
+++ b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.intentperf;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.intentperf.IntentPerfCollector.Sample;
+import org.onosproject.ui.UiConnection;
+import org.onosproject.ui.UiExtension;
+import org.onosproject.ui.UiExtensionService;
+import org.onosproject.ui.UiMessageHandler;
+import org.onosproject.ui.UiView;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static java.util.Collections.synchronizedSet;
+
+/**
+ * Mechanism to stream data to the GUI.
+ */
+@Component(immediate = true, enabled = false)
+public class IntentPerfUi {
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected UiExtensionService uiExtensionService;
+
+    private final Set<StreamingControl> handlers = synchronizedSet(new HashSet<>());
+
+    private List<UiView> views = ImmutableList.of(new UiView("intentPerf", "Intent Performance"));
+    private UiExtension uiExtension = new UiExtension(views, this::newHandlers,
+                                                      getClass().getClassLoader());
+
+    @Activate
+    protected void activate() {
+        uiExtensionService.register(uiExtension);
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        uiExtensionService.unregister(uiExtension);
+    }
+
+    /**
+     * Reports a single sample of performance data.
+     *
+     * @param sample performance sample
+     */
+    public void reportSample(Sample sample) {
+        synchronized (handlers) {
+            handlers.forEach(h -> h.send(sample));
+        }
+    }
+
+    // Creates and returns session specific message handler.
+    private Collection<UiMessageHandler> newHandlers() {
+        return ImmutableList.of(new StreamingControl());
+    }
+
+    // UI Message handlers for turning on/off reporting to a session.
+    private class StreamingControl extends UiMessageHandler {
+
+        private boolean streamingEnabled = false;
+
+        protected StreamingControl() {
+            super(ImmutableSet.of("intentPerfStart", "intentPerfStop"));
+        }
+
+        @Override
+        public void process(ObjectNode message) {
+            streamingEnabled = message.path("event").asText("unknown").equals("initPerfStart");
+        }
+
+        @Override
+        public void init(UiConnection connection, ServiceDirectory directory) {
+            super.init(connection, directory);
+            handlers.add(this);
+        }
+
+        @Override
+        public void destroy() {
+            super.destroy();
+            handlers.remove(this);
+        }
+
+        private void send(Sample sample) {
+            // FIXME: finish this
+            ObjectNode sn = mapper.createObjectNode()
+                    .put("time", sample.time);
+            connection().sendMessage("intentPerf", 0, sn);
+        }
+    }
+
+}
diff --git a/apps/intent-perf/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/intent-perf/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..1f1871d
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright 2015 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.onosproject.intentperf.IntentPerfCommand"/>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/apps/intent-perf/src/main/resources/app/view/intentPerf/Xdata.csv b/apps/intent-perf/src/main/resources/app/view/intentPerf/Xdata.csv
new file mode 100644
index 0000000..1673d26
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/app/view/intentPerf/Xdata.csv
@@ -0,0 +1,19 @@
+date,value,node
+00:55:15,68.38,node1
+00:55:15,55.61,node2
+00:55:15,74.00,node3
+00:55:30,74.20,node1
+00:55:30,77.60,node2
+00:55:30,74.80,node3
+00:55:45,74.60,node1
+00:55:45,72.80,node2
+00:55:45,77.00,node3
+00:56:00,73.60,node1
+00:56:00,75.00,node2
+00:56:00,76.98,node3
+00:56:15,75.82,node1
+00:56:15,75.40,node2
+00:56:15,76.00,node3
+00:56:30,75.60,node1
+00:56:30,74.59,node2
+00:56:30,74.01,node3
\ No newline at end of file
diff --git a/apps/intent-perf/src/main/resources/app/view/intentPerf/data.csv b/apps/intent-perf/src/main/resources/app/view/intentPerf/data.csv
new file mode 100644
index 0000000..f8f9938
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/app/view/intentPerf/data.csv
@@ -0,0 +1,19 @@
+key,value,date
+Group1,37,00:23:00
+Group2,12,00:23:00
+Group3,46,00:23:00
+Group1,32,00:23:05
+Group2,19,00:23:05
+Group3,42,00:23:05
+Group1,45,00:23:10
+Group2,16,00:23:10
+Group3,44,00:23:10
+Group1,24,00:23:15
+Group2,52,00:23:15
+Group3,64,00:23:15
+Group1,34,00:23:20
+Group2,62,00:23:20
+Group3,74,00:23:20
+Group1,34,00:23:25
+Group2,62,00:23:25
+Group3,74,00:23:25
\ No newline at end of file
diff --git a/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.css b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.css
new file mode 100644
index 0000000..604a169
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.css
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ ONOS GUI -- Intent Perf View -- CSS file
+ */
+
+.light #ov-intentPerf {
+    color: navy;
+}
+
+.dark #ov-intentPerf {
+    color: #1e5e6f;
+}
+
+.dark a {
+    color: #88c;
+}
+
+#ov-intentPerf .msg {
+    color: darkorange;
+}
+
+.light #ov-intentPerf .msg {
+    color: darkorange;
+}
+
+.dark #ov-intentPerf .msg {
+    color: #904e00;
+}
+
+
+
+.axis path,
+.axis line {
+    fill: none;
+    stroke: #000;
+    shape-rendering: crispEdges;
+}
+
+.browser text {
+    text-anchor: end;
+}
diff --git a/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.html b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.html
new file mode 100644
index 0000000..b1ef9d2
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.html
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright 2015 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!-- Intent Performance partial HTML -->
+<div id="ov-sample">
+    <h2> Intent Performance View </h2>
+
+    <span class="msg">{{ ctrl.message }}</span>
+
+    <div id="intent-perf-chart"></div>
+</div>
diff --git a/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.js b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.js
new file mode 100644
index 0000000..e18c47d
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/app/view/intentPerf/intentPerf.js
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ ONOS GUI -- Intent Performance View Module
+ */
+(function () {
+    'use strict';
+
+    // injected refs
+    var $log, tbs, flash;
+
+    function start() {
+        //var format = d3.time.format("%m/%d/%y");
+        var format = d3.time.format("%H:%M:%S");
+        var samples = [];
+
+        var margin = {top: 20, right: 30, bottom: 30, left: 40},
+            width = 960 - margin.left - margin.right,
+            height = 500 - margin.top - margin.bottom;
+
+        var x = d3.time.scale()
+            .range([0, width]);
+
+        var y = d3.scale.linear()
+            .range([height, 0]);
+
+        var z = d3.scale.category20c();
+
+        var xAxis = d3.svg.axis()
+            .scale(x)
+            .orient("bottom")
+            .ticks(d3.time.seconds);
+
+        var yAxis = d3.svg.axis()
+            .scale(y)
+            .orient("left");
+
+        var stack = d3.layout.stack()
+            .offset("zero")
+            .values(function(d) { return d.values; })
+            .x(function(d) { return d.date; })
+            .y(function(d) { return d.value; });
+
+        var nest = d3.nest()
+            .key(function(d) { return d.key; });
+
+        var area = d3.svg.area()
+            .interpolate("cardinal")
+            .x(function(d) { return x(d.date); })
+            .y0(function(d) { return y(d.y0); })
+            .y1(function(d) { return y(d.y0 + d.y); });
+
+        var svg = d3.select("body").append("svg")
+            .attr("width", width + margin.left + margin.right)
+            .attr("height", height + margin.top + margin.bottom)
+            .append("g")
+            .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+        svg.append("g")
+            .attr("class", "x axis")
+            .attr("transform", "translate(0," + height + ")")
+            .call(xAxis);
+
+        svg.append("g")
+            .attr("class", "y axis")
+            .call(yAxis);
+
+        function fetchData() {
+            d3.csv("app/view/intentPerf/data.csv", function (data) {
+                samples = data;
+                updateGraph();
+            });
+        }
+
+        function updateGraph() {
+            samples.forEach(function(d) {
+                d.date = format.parse(d.date);
+                d.value = +d.value;
+            });
+
+            var layers = stack(nest.entries(samples));
+
+            x.domain(d3.extent(samples, function(d) { return d.date; }));
+            y.domain([0, d3.max(samples, function(d) { return d.y0 + d.y; })]);
+
+            svg.selectAll(".layer")
+                .data(layers)
+                .enter().append("path")
+                .attr("class", "layer")
+                .attr("d", function(d) { return area(d.values); })
+                .style("fill", function(d, i) { return z(i); });
+
+            svg.select(".x")
+                .attr("transform", "translate(0," + height + ")")
+                .call(xAxis);
+
+            svg.select(".y")
+                .call(yAxis);
+
+            console.log('tick');
+        }
+    }
+
+    start();
+
+    // define the controller
+
+    angular.module('ovIntentPerf', ['onosUtil'])
+    .controller('OvIntentPerfCtrl',
+        ['$scope', '$log', 'ToolbarService', 'FlashService',
+
+        function ($scope, _$log_, _tbs_, _flash_) {
+            var self = this
+
+            $log = _$log_;
+            tbs = _tbs_;
+            flash = _flash_;
+
+            self.message = 'Hey there dudes!';
+            start();
+
+            // Clean up on destroyed scope
+            $scope.$on('$destroy', function () {
+            });
+
+         $log.log('OvIntentPerfCtrl has been created');
+    }]);
+}());
diff --git a/apps/intent-perf/src/main/resources/css.html b/apps/intent-perf/src/main/resources/css.html
new file mode 100644
index 0000000..06dd7e8
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/css.html
@@ -0,0 +1 @@
+<link rel="stylesheet" href="app/view/intentPerf/intentPerf.css">
diff --git a/apps/intent-perf/src/main/resources/dev.html b/apps/intent-perf/src/main/resources/dev.html
new file mode 100644
index 0000000..ad059df
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/dev.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<!--
+  ~ Copyright 2014 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<html>
+<head>
+    <title>Dev View</title>
+    <script src="tp/d3.min.js"></script>
+    <script src="tp/jquery-2.1.1.min.js"></script>
+
+    <link rel="stylesheet" href="app/view/intentPerf/intentPerf.css">
+</head>
+<body>
+<div id="intent-perf-chart" style="width: 1024px; height: 800px"></div>
+<script src="app/view/intentPerf/intentPerf.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/apps/intent-perf/src/main/resources/js.html b/apps/intent-perf/src/main/resources/js.html
new file mode 100644
index 0000000..e8bf551
--- /dev/null
+++ b/apps/intent-perf/src/main/resources/js.html
@@ -0,0 +1 @@
+<script src="app/view/intentPerf/intentPerf.js"></script>
diff --git a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
index 8fe0120..2987529 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
@@ -412,11 +412,6 @@
                         peerUpdateFunction.apply(key, value));
             notifyListeners(new EventuallyConsistentMapEvent<>(
                     EventuallyConsistentMapEvent.Type.REMOVE, key, value));
-        } else {
-            // TODO remove this extra call when ONOS-1207 is resolved
-            Timestamped<V> latest = (Timestamped) items.get(key);
-            log.info("Remove of intent {} failed; request time {} vs. latest time {}",
-                    key, timestamp, latest.timestamp());
         }
     }
 
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleClusterStore.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleClusterStore.java
index 34fee8b..20ede86 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleClusterStore.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleClusterStore.java
@@ -26,6 +26,8 @@
 import org.onosproject.cluster.ControllerNode;
 import org.onosproject.cluster.DefaultControllerNode;
 import org.onosproject.cluster.NodeId;
+import org.onosproject.net.intent.Key;
+import org.onosproject.net.intent.PartitionService;
 import org.onosproject.store.AbstractStore;
 import org.onlab.packet.IpAddress;
 import org.slf4j.Logger;
@@ -42,7 +44,7 @@
 @Service
 public class SimpleClusterStore
         extends AbstractStore<ClusterEvent, ClusterStoreDelegate>
-        implements ClusterStore {
+        implements ClusterStore, PartitionService {
 
     public static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1");
 
@@ -91,4 +93,13 @@
     public void removeNode(NodeId nodeId) {
     }
 
+    @Override
+    public boolean isMine(Key intentKey) {
+        return true;
+    }
+
+    @Override
+    public NodeId getLeader(Key intentKey) {
+        return instance.id();
+    }
 }
diff --git a/tools/test/cells/tom3 b/tools/test/cells/tom3
index 17d64be..c209f8f 100644
--- a/tools/test/cells/tom3
+++ b/tools/test/cells/tom3
@@ -4,7 +4,7 @@
 export OC1="192.168.56.11"
 export OC2="192.168.56.12"
 export OC3="192.168.56.13"
-export OCN="192.168.56.7"
+export OCN="192.168.56.14"
 export OCI="${OC1}"
 
-export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-fwd,onos-app-proxyarp,onos-app-mobility
+unset ONOS_FEATURES
diff --git a/tools/test/cells/tomx b/tools/test/cells/tomx
index 27f5cd4..700be43 100644
--- a/tools/test/cells/tomx
+++ b/tools/test/cells/tomx
@@ -9,4 +9,5 @@
 export OCI="${OC1}"
 export OCT="${OC1}"
 
-export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null"
+export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow"
+export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-null"