Adding ONOS Segment Routing CLI files to new repo
diff --git a/sdncon/ui/static/js/topology.js b/sdncon/ui/static/js/topology.js
new file mode 100755
index 0000000..7ebfc43
--- /dev/null
+++ b/sdncon/ui/static/js/topology.js
@@ -0,0 +1,192 @@
+/*
+Copyright (c) 2013 Sencha Inc. - Author: Nicolas Garcia Belmonte (http://philogb.github.com/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+ */
+/*
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
+#
+# 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.
+#
+*/
+
+//
+// ForceDirected example1.js Javascript
+//
+// Slightly modified for use in rendering a simple network diagram topology
+//
+
+var labelType, useGradients, nativeTextSupport, animate;
+
+(function() {
+ var ua = navigator.userAgent,
+ iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
+ typeOfCanvas = typeof HTMLCanvasElement,
+ nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
+ textSupport = nativeCanvasSupport
+ && (typeof document.createElement('canvas').getContext('2d').fillText == 'function');
+ //I'm setting this based on the fact that ExCanvas provides text support for IE
+ //and that as of today iPhone/iPad current text support is lame
+ labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
+ nativeTextSupport = labelType == 'Native';
+ useGradients = nativeCanvasSupport;
+ animate = !(iStuff || !nativeCanvasSupport);
+})();
+
+var Log = {
+ elem: false,
+ write: function(text){
+ if (!this.elem)
+ this.elem = document.getElementById('log');
+ this.elem.innerHTML = text;
+ this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px';
+ }
+};
+
+
+ // init data
+ var json = loadTopologyJSON();
+ // end
+ // init ForceDirected
+ var fd = new $jit.ForceDirected({
+ //id of the visualization container
+ injectInto: 'infovis',
+ //force height
+ height: 900,
+ //Enable zooming and panning
+ //by scrolling and DnD
+ Navigation: {
+ enable: true,
+ //Enable panning events only if we're dragging the empty
+ //canvas (and not a node).
+ panning: 'avoid nodes',
+ zooming: 10 //zoom speed. higher is more sensible
+ },
+ // Change node and edge styles such as
+ // color and width.
+ // These properties are also set per node
+ // with dollar prefixed data-properties in the
+ // JSON structure.
+ Node: {
+ overridable: true
+ },
+ Edge: {
+ overridable: true,
+ color: '#23A4FF',
+ lineWidth: 0.4
+ },
+ //Native canvas text styling
+ Label: {
+ type: labelType, //Native or HTML
+ size: 10,
+ color: '#000000',
+ style: 'bold'
+ },
+ //Add Tips
+ Tips: {
+ enable: true,
+ onShow: function(tip, node) {
+ if(!node) return;
+ // Build the relations list as a tooltip.
+ // This is done by traversing the clicked node connections.
+ var html = "<div class=\"dynamictable2\"> <table> <tr><td>" + node.name + " links:</td></tr><tr><td>",
+ list = [];
+ node.eachAdjacency(function(adj){
+ list.push(adj.nodeTo.name);
+ });
+ //append connections information
+ tip.innerHTML = html + list.join("</td></tr><tr><td>") + "</td></tr></table></div>";
+ }
+ },
+ // Add node events
+ Events: {
+ enable: true,
+ type: 'Native',
+ //Change cursor style when hovering a node
+ onMouseEnter: function() {
+ fd.canvas.getElement().style.cursor = 'move';
+ },
+ onMouseLeave: function() {
+ fd.canvas.getElement().style.cursor = '';
+ },
+ //Update node positions when dragged
+ onDragMove: function(node, eventInfo, e) {
+ var pos = eventInfo.getPos();
+ node.pos.setc(pos.x, pos.y);
+ fd.plot();
+ },
+ //Implement the same handler for touchscreens
+ onTouchMove: function(node, eventInfo, e) {
+ $jit.util.event.stop(e); //stop default touchmove event
+ this.onDragMove(node, eventInfo, e);
+ },
+ //No node click-handler for now
+ //onClick: function(node) {
+ //}
+ },
+ //Number of iterations for the FD algorithm
+ iterations: 10,
+ //Edge length
+ levelDistance: 130,
+ // Add text to the labels. This method is only triggered
+ // on label creation and only for DOM labels (not native canvas ones).
+ onCreateLabel: function(domElement, node){
+ domElement.innerHTML = node.name;
+ var style = domElement.style;
+ style.fontSize = "0.8em";
+ style.color = "#ddd";
+ },
+ // Change node styles when DOM labels are placed
+ // or moved.
+ onPlaceLabel: function(domElement, node){
+ var style = domElement.style;
+ var left = parseInt(style.left);
+ var top = parseInt(style.top);
+ var w = domElement.offsetWidth;
+ style.left = (left - w / 2) + 'px';
+ style.top = (top + 10) + 'px';
+ style.display = '';
+ }
+ });
+ // load JSON data.
+ fd.loadJSON(json);
+ // compute positions incrementally and animate.
+ fd.computeIncremental({
+ iter: 40,
+ property: 'end',
+ onStep: function(perc){
+ Log.write(perc + '% loaded...');
+ },
+ onComplete: function(){
+ Log.write('done');
+ }
+ });
+ // end