Prototyping GUI & CLI for the intent performance test fixture.

Change-Id: I1f33872e62b55d168ccd8f2904472e41ecba4cc8
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>