Modify nemo-ui 23/31923/1
authorswsiyu <swsiyu@163.com>
Sat, 26 Dec 2015 04:01:59 +0000 (12:01 +0800)
committerswsiyu <swsiyu@163.com>
Sat, 26 Dec 2015 04:03:48 +0000 (12:03 +0800)
Change-Id: I453a17a137fd710a0ee2081402f7f632d38e6e56
Signed-off-by: swsiyu <swsiyu@163.com>
14 files changed:
nemo-ui/src/main/resources/nemo/css/nemo_main.css
nemo-ui/src/main/resources/nemo/css/nemo_user_main.css
nemo-ui/src/main/resources/nemo/css/register.css
nemo-ui/src/main/resources/nemo/images/phyHos_t.png [new file with mode: 0644]
nemo-ui/src/main/resources/nemo/images/phyHost.png [new file with mode: 0644]
nemo-ui/src/main/resources/nemo/js/Nemo_Main.js
nemo-ui/src/main/resources/nemo/js/intentTopo.js
nemo-ui/src/main/resources/nemo/js/jquery.cookie.js [new file with mode: 0644]
nemo-ui/src/main/resources/nemo/js/phyNetwork.js
nemo-ui/src/main/resources/nemo/js/svg.xml [new file with mode: 0644]
nemo-ui/src/main/resources/nemo/js/vnMapping.js
nemo-ui/src/main/resources/nemo/module/test/bod_userJson.js
nemo-ui/src/main/resources/nemo/nemo.tpl.html
nemo-ui/src/main/resources/nemo/register.html

index 2b49f69c3d1e5a82dd9816187b62471e7d2e8805..49ccef4614dc7eadd30f3e68c9c27d1732ce1519 100644 (file)
@@ -26,6 +26,20 @@ span.key
 .header p{\r
   float: left;\r
 }\r
+.header span{\r
+  color:#000 !important;\r
+  text-shadow:0 0 0 #fff;\r
+  text-decoration: underline;\r
+  /*text-decoration-color:green;*/\r
+  /*border-bottom:1px solid green;*/\r
+  font-weight: normal;\r
+  font-size: 18px;\r
+  line-height: 30px;\r
+  display: inline-block;\r
+  margin-left: 20px;\r
+  cursor: pointer;\r
+  font-family:'cursive','-webkit-pictograp',sans-serif,Verdana;\r
+}\r
 #selectUser{\r
 width: 290px;\r
 height: 30px;\r
index 13493f4106835c81f52cf3335715a4b54bfbe3df..429965d3d965b300336470128f9fb09b52e4fad2 100644 (file)
@@ -84,7 +84,7 @@ svg{
 }\r
 /*tab ui li*/\r
 .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {\r
-  border: 1px solid #fbd850;\r
+  /*border: 1px solid #fbd850;*/\r
   background: #fff url("../images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;\r
   font-weight: bold;\r
   color: #eb8f00;\r
@@ -100,6 +100,19 @@ svg{
   background: #eee url("../images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;\r
   color: #333;\r
 }\r
+.ui-tabs .ui-tabs-nav li {\r
+    background: #fff;\r
+    /*opacity: 0.9;*/\r
+}\r
+.ui-tabs .ui-tabs-nav li a{\r
+    color:gray !important;\r
+}\r
+li.ui-state-default.ui-corner-top.ui-tabs-active.ui-state-active {\r
+    background: #eee;\r
+}\r
+li.ui-state-default.ui-corner-top.ui-tabs-active.ui-state-active a{\r
+   color:#eb8f00 !important;\r
+}\r
 /*jquery ui tab css end*/\r
 div#pageContent {\r
   height: 1000px;\r
index 23d76f358721a96830026a5871bf7a7e571ddc5b..85f78582d52e3237b25487f876c6b279d36e6673 100644 (file)
@@ -8,8 +8,11 @@ body
        font-family: verdana,Geneva,Arial,sans-serif;\r
 }\r
 #logPage{\r
-min-width: 1140px;\r
-/*border:2px solid red; */\r
+    min-width: 1140px;\r
+    width: 1140px;\r
+    height: 566px;\r
+    /* border: 2px solid red; */\r
+    background-color: #aaa;\r
 }\r
 .nemo_info{\r
        background-color: #ddd;\r
@@ -99,7 +102,7 @@ table tr td
 {\r
        width: 160px;\r
        height: 25px;\r
-       background-color: #ccc !important;\r
+       background-color: #fff !important;\r
        font-size: 18px;\r
        color: black;\r
        font-family:Verdana,Arial; \r
diff --git a/nemo-ui/src/main/resources/nemo/images/phyHos_t.png b/nemo-ui/src/main/resources/nemo/images/phyHos_t.png
new file mode 100644 (file)
index 0000000..7efc820
Binary files /dev/null and b/nemo-ui/src/main/resources/nemo/images/phyHos_t.png differ
diff --git a/nemo-ui/src/main/resources/nemo/images/phyHost.png b/nemo-ui/src/main/resources/nemo/images/phyHost.png
new file mode 100644 (file)
index 0000000..e4f79ab
Binary files /dev/null and b/nemo-ui/src/main/resources/nemo/images/phyHost.png differ
index 8cb7645ccaa264c5503236b72db2396fce72e865..2a0c49b96c91efecd54d8ef421f2466b4adaac7b 100644 (file)
@@ -1,4 +1,20 @@
 /// <reference path="_references.js" />\r
+       function setCookie(name,value,Days) \r
+{ \r
+    if(!Days) Days = 3; \r
+    var exp = new Date(); \r
+    exp.setTime(exp.getTime() + Days*24*60*60*1000); \r
+    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+';path=/'; \r
+} \r
+function getCookie(name) \r
+{ \r
+    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");\r
\r
+    if(arr=document.cookie.match(reg)) \r
+        return unescape(arr[2]); \r
+    else \r
+        return null; \r
+} \r
 jQuery.noConflict();\r
 jQuery(document).ready(function ($) {\r
      //localStorage.clear();\r
index 480f70069aaeac6daa9b6f60bf038e55fec7109f..306b09e3950e54fd63fd2b18d3ed729e34b8696f 100644 (file)
@@ -26,12 +26,12 @@ function getIntentInfos(){
        if(!Datas){\r
        Datas=userinfo;\r
        }\r
-       IntentInfos=Datas;\r
+       // IntentInfos=Datas;\r
        //return virtualDatas;\r
  }\r
 \r
 getIntentInfos();\r
-\r
+//getIntentDatas();\r
  function getIntentInfoById(user_id,Data){\r
                //console.log(1);\r
        if(!Data) Data=IntentInfos;\r
@@ -172,6 +172,8 @@ getIntentInfos();
        }\r
 \r
        function flow_get_end_name(src_ip, dest_ip) {\r
+               // console.log(src_ip);\r
+               // console.log(dest_ip);\r
                var host_name = ['', ''];\r
                if (typeof(phy_host_ip[src_ip]) != "undefined")\r
                        host_name[0] = phy_host_ip[src_ip];\r
@@ -202,6 +204,8 @@ getIntentInfos();
        function flow_get_group(src_ip, dest_ip) {\r
                var src_host_name = flow_get_end_name(src_ip, dest_ip)[0];\r
                var dest_host_name = flow_get_end_name(src_ip, dest_ip)[1];\r
+               console.log(src_host_name);\r
+               console.log(dest_host_name);\r
                var group_node = ['', ''];\r
                for (var i = 0; i < jQuery("#service_svg2 g").length; i++) {\r
                        host_list = jQuery("#service_svg2 g:eq(" + i + ")").attr("sub").split(",");\r
@@ -227,6 +231,8 @@ getIntentInfos();
        function draw_flow_data(src_ip, dest_ip, flow_name) {\r
                var src_group = flow_get_group(src_ip, dest_ip)[0];\r
                var dest_group = flow_get_group(src_ip, dest_ip)[1];\r
+               console.log(src_group);\r
+               console.log(dest_group);\r
                //get flow count\r
                var flow_count_temp = 0;\r
                while (1) {\r
@@ -345,6 +351,10 @@ getIntentInfos();
        }\r
 \r
        function draw_connection_data(conn_name, node_name_1, node_name_2, bandwidth) {\r
+               // console.log(conn_name);\r
+               // console.log(node_name_1);\r
+               // console.log(node_name_2);\r
+               // console.log(bandwidth);\r
                if (conn_name != null && typeof(conn_name) != "undefined")\r
                        jQuery("#" + conn_name).remove();\r
                try {\r
@@ -352,6 +362,10 @@ getIntentInfos();
                        var node_cy_1 = jQuery("#" + node_name_1 + "_group").attr("cy");\r
                        var node_cx_2 = jQuery("#" + node_name_2 + "_group").attr("cx");\r
                        var node_cy_2 = jQuery("#" + node_name_2 + "_group").attr("cy");\r
+                       // console.log(node_cx_1);\r
+                       // console.log(node_cy_1);\r
+                       // console.log(node_cx_2);\r
+                       // console.log(node_cy_2);\r
                        //var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r
                        var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\r
                        var path_main = jQuery(path).attr({\r
@@ -443,7 +457,7 @@ getIntentInfos();
                                "stroke-width": 0.8\r
 \r
                        });\r
-                       jQuery(text1).text(node_type);\r
+                       jQuery(text1).text(node_name);\r
                        var text2 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text2_main = jQuery(text2).attr({\r
                                id: node_name + "_title2",\r
@@ -452,7 +466,7 @@ getIntentInfos();
                                fill: "                       ",\r
                                'text-anchor': 'middle'\r
                        });\r
-                       jQuery(text2).text(node_name);\r
+                       jQuery(text2).text(node_type);\r
                        var g_main = jQuery(g).append(inCircle1_main);\r
                        jQuery(g).append(text1_main);\r
                        jQuery(g).append(text2_main);\r
@@ -504,7 +518,7 @@ getIntentInfos();
                                "stroke": "black",\r
                                "stroke-width": 0.8\r
                        });\r
-                       jQuery(text1).text(node_type);\r
+                       jQuery(text1).text(node_name);\r
                        var text2 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text2_main = jQuery(text2).attr({\r
                                id: node_name + "_title2",\r
@@ -513,7 +527,7 @@ getIntentInfos();
                                fill: "black",\r
                                'text-anchor': 'middle'\r
                        });\r
-                       jQuery(text2).text(node_name);\r
+                       jQuery(text2).text(node_type);\r
                        var text3 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text3_main = jQuery(text3).attr({\r
                                id: node_list[0] + '_text',\r
@@ -530,9 +544,10 @@ getIntentInfos();
                        jQuery(g).append(text3_main);\r
                        jQuery(g).attr("id", node_name);\r
                        jQuery(g).attr("type", node_type);\r
-                       jQuery(g).attr("sub", node_list[0]);\r
+                       jQuery(g).attr("sub", node_name,node_list[0]);\r
                        if (node_type.indexOf("chain") > -1)\r
                                jQuery(g).attr("flow", 0);\r
+                       if(ip) jQuery(g).attr("ip-prefix", ip);\r
                        jQuery('#service_svg2').append(g_main);\r
                } else if (node_number == 2) {\r
                        var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r
@@ -578,7 +593,7 @@ getIntentInfos();
                                "stroke": "black",\r
                                "stroke-width": 0.8\r
                        });\r
-                       jQuery(text1).text(node_type);\r
+                       jQuery(text1).text(node_name);\r
                        var text2 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text2_main = jQuery(text2).attr({\r
                                id: node_name + "_title2",\r
@@ -587,7 +602,7 @@ getIntentInfos();
                                fill: "black",\r
                                'text-anchor': 'middle'\r
                        });\r
-                       jQuery(text2).text(node_name);\r
+                       jQuery(text2).text(node_type);\r
                        var text3 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text3_main = jQuery(text3).attr({\r
                                id: node_list[0] + "_text",\r
@@ -615,13 +630,13 @@ getIntentInfos();
                        jQuery(g).append(text4_main);\r
                        jQuery(g).attr("id", node_name);\r
                        jQuery(g).attr("type", node_type);\r
-                       jQuery(g).attr("sub", node_list[0] + "," + node_list[1]);\r
+                       jQuery(g).attr("sub", node_name,node_list[0] + "," + node_list[1]);\r
                        if (node_type.indexOf("chain") > -1)\r
                                jQuery(g).attr("flow", 0);\r
+                   if(ip) jQuery(g).attr("ip-prefix", ip);\r
                        jQuery('#service_svg2').append(g);\r
 \r
                } else if (node_number == 3) {\r
-                       var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r
                        var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r
                        var circle_main = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\r
                        var inCircle1_main = jQuery(circle_main).attr({\r
@@ -676,7 +691,7 @@ getIntentInfos();
                                "stroke": "black",\r
                                "stroke-width": 0.8\r
                        });\r
-                       jQuery(text1).text(node_type);\r
+                       jQuery(text1).text(node_name);\r
                        var text2 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text2_main = jQuery(text2).attr({\r
                                id: node_name + "_title2",\r
@@ -685,7 +700,7 @@ getIntentInfos();
                                fill: "black",\r
                                'text-anchor': 'middle'\r
                        });\r
-                       jQuery(text2).text(node_name);\r
+                       jQuery(text2).text(node_type);\r
                        var text3 = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r
                        var text3_main = jQuery(text3).attr({\r
                                id: node_list[0] + '_text',\r
@@ -724,7 +739,7 @@ getIntentInfos();
                        jQuery(g).append(text5_main);\r
                        jQuery(g).attr("id", node_name);\r
                        jQuery(g).attr("type", node_type);\r
-                       jQuery(g).attr("sub", node_list[0] + "," + node_list[1] + "," + node_list[2]);\r
+                       jQuery(g).attr("sub", node_name,node_list[0] + "," + node_list[1] + "," + node_list[2]);\r
                        if (node_type.indexOf("chain") > -1)\r
                                jQuery(g).attr("flow", 0);\r
                        jQuery('#service_svg2').append(g);\r
@@ -804,7 +819,16 @@ getIntentInfos();
                                sub_list[sub_count] = host_list[user_json_data["node"][lgroup_cursor]["sub-node"][sub_cursor]["node-id"]];\r
                                sub_count++;\r
                        }\r
-                       draw_group_data(user_json_data["node"][lgroup_cursor]["node-name"], sub_list.length, sub_list, user_json_data["node"][lgroup_cursor]["node-type"], "");\r
+                       var ip='';\r
+                       var myProperty=user_json_data["node"][lgroup_cursor]['property'];\r
+                       if(myProperty){\r
+                       for(var item in myProperty){\r
+                               if(myProperty[item]['property-name']=='ip-prefix'){\r
+                                       ip=myProperty[item]['property-values']['string-value'][0]['value'];\r
+                               }\r
+                       }\r
+               }\r
+                       draw_group_data(user_json_data["node"][lgroup_cursor]["node-name"], sub_list.length, sub_list, user_json_data["node"][lgroup_cursor]["node-type"], ip);\r
                        redraw_node_possition_data();\r
                        node_list[user_json_data["node"][lgroup_cursor]["node-id"]] = user_json_data["node"][lgroup_cursor]["node-name"];\r
                }\r
@@ -846,7 +870,7 @@ getIntentInfos();
                for (var conn_cursor in user_json_data["connection"]) {\r
                        var start_name = node_list[user_json_data["connection"][conn_cursor]["end-node"][0]["node-id"]];\r
                        var end_name = node_list[user_json_data["connection"][conn_cursor]["end-node"][1]["node-id"]];\r
-                       var bandwidth\r
+                       var bandwidth;\r
                        if (user_json_data["connection"][conn_cursor]["property"] != null)\r
                                bandwidth = user_json_data["connection"][conn_cursor]["property"][0]["property-values"]["int-value"][0]["value"];\r
                        else\r
@@ -875,6 +899,8 @@ getIntentInfos();
                //operation\r
                if (user_data["operations"] != null) {\r
                        for (var operation_cursor in user_data["operations"]["operation"]) {\r
+                               var myTarget=user_data["operations"]["operation"][operation_cursor]["action"][0]['action-name'];\r
+                               if(myTarget!='go-through') continue;\r
                                var flow_name = flow_list[user_data["operations"]["operation"][operation_cursor]["target-object"]];\r
                                var chain_name = node_list[user_data["operations"]["operation"][operation_cursor]["action"][0]["parameter-values"]["string-value"][0]["value"]];\r
                                var node_start = jQuery("#" + flow_name).attr("node_start");\r
@@ -908,9 +934,6 @@ getIntentInfos();
                                lead_policy(node_start, chain_name, parseInt(jQuery("#" + flow_name).attr("count")), jQuery("#" + flow_name).attr("stroke"), flow_name + "_1", chain_name, node_start, node_end)\r
                                lead_policy(chain_name, node_end, parseInt(jQuery("#" + flow_name).attr("count")), jQuery("#" + flow_name).attr("stroke"), flow_name + "_2", chain_name, node_start, node_end)\r
                                jQuery("#" + flow_name).remove();\r
-\r
-\r
-\r
                        }\r
 \r
                }\r
@@ -1030,7 +1053,10 @@ getIntentInfos();
                                        if (match && match.length > 0) {\r
                                                nemo_str += " Match ";\r
                                                for (var k in match) {\r
+                                                       if(match[k]["match-item-value"]['string-value'])\r
                                                        nemo_str += match[k]['match-item-name'] + ':"' + match[k]["match-item-value"]['string-value'] + '",';\r
+                                                   else if(match[k]["match-item-value"]['int-value'])\r
+                                                       nemo_str += match[k]['match-item-name'] + ':' + match[k]["match-item-value"]['int-value'] + ',';\r
                                                }\r
                                                nemo_str = nemo_str.substring(0, nemo_str.length - 1);\r
                                        }\r
@@ -1057,7 +1083,10 @@ getIntentInfos();
                                if (action && action.length > 0) {\r
                                        nemo_str += " Action "\r
                                        for (var k in action) {\r
+                                               if(action[k]['action-name']=='go-through')\r
                                                nemo_str += action[k]['action-name'] + ":" + nodes[action[k]['parameter-values']["string-value"][0]['value']] + ',';\r
+                                          if(action[k]['action-name']=='deny')\r
+                                               nemo_str+= action[k]['action-name']+',';\r
                                        }\r
                                        nemo_str = nemo_str.substring(0, nemo_str.length - 1);\r
                                }\r
diff --git a/nemo-ui/src/main/resources/nemo/js/jquery.cookie.js b/nemo-ui/src/main/resources/nemo/js/jquery.cookie.js
new file mode 100644 (file)
index 0000000..8218817
--- /dev/null
@@ -0,0 +1,114 @@
+/*!
+ * jQuery Cookie Plugin v1.4.1
+ * https://github.com/carhartl/jquery-cookie
+ *
+ * Copyright 2006, 2014 Klaus Hartl
+ * Released under the MIT license
+ */
+(function (factory) {
+       if (typeof define === 'function' && define.amd) {
+               // AMD (Register as an anonymous module)
+               define(['jquery'], factory);
+       } else if (typeof exports === 'object') {
+               // Node/CommonJS
+               module.exports = factory(require('jquery'));
+       } else {
+               // Browser globals
+               factory(jQuery);
+       }
+}(function ($) {
+
+       var pluses = /\+/g;
+
+       function encode(s) {
+               return config.raw ? s : encodeURIComponent(s);
+       }
+
+       function decode(s) {
+               return config.raw ? s : decodeURIComponent(s);
+       }
+
+       function stringifyCookieValue(value) {
+               return encode(config.json ? JSON.stringify(value) : String(value));
+       }
+
+       function parseCookieValue(s) {
+               if (s.indexOf('"') === 0) {
+                       // This is a quoted cookie as according to RFC2068, unescape...
+                       s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
+               }
+
+               try {
+                       // Replace server-side written pluses with spaces.
+                       // If we can't decode the cookie, ignore it, it's unusable.
+                       // If we can't parse the cookie, ignore it, it's unusable.
+                       s = decodeURIComponent(s.replace(pluses, ' '));
+                       return config.json ? JSON.parse(s) : s;
+               } catch(e) {}
+       }
+
+       function read(s, converter) {
+               var value = config.raw ? s : parseCookieValue(s);
+               return $.isFunction(converter) ? converter(value) : value;
+       }
+
+       var config = $.cookie = function (key, value, options) {
+
+               // Write
+
+               if (arguments.length > 1 && !$.isFunction(value)) {
+                       options = $.extend({}, config.defaults, options);
+
+                       if (typeof options.expires === 'number') {
+                               var days = options.expires, t = options.expires = new Date();
+                               t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
+                       }
+
+                       return (document.cookie = [
+                               encode(key), '=', stringifyCookieValue(value),
+                               options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
+                               options.path    ? '; path=' + options.path : '',
+                               options.domain  ? '; domain=' + options.domain : '',
+                               options.secure  ? '; secure' : ''
+                       ].join(''));
+               }
+
+               // Read
+
+               var result = key ? undefined : {},
+                       // To prevent the for loop in the first place assign an empty array
+                       // in case there are no cookies at all. Also prevents odd result when
+                       // calling $.cookie().
+                       cookies = document.cookie ? document.cookie.split('; ') : [],
+                       i = 0,
+                       l = cookies.length;
+
+               for (; i < l; i++) {
+                       var parts = cookies[i].split('='),
+                               name = decode(parts.shift()),
+                               cookie = parts.join('=');
+
+                       if (key === name) {
+                               // If second argument (value) is a function it's a converter...
+                               result = read(cookie, value);
+                               break;
+                       }
+
+                       // Prevent storing a cookie that we couldn't decode.
+                       if (!key && (cookie = read(cookie)) !== undefined) {
+                               result[name] = cookie;
+                       }
+               }
+
+               return result;
+       };
+
+       config.defaults = {};
+
+       $.removeCookie = function (key, options) {
+               // Must not alter options, thus extending a fresh object...
+               $.cookie(key, '', $.extend({}, options, { expires: -1 }));
+               return !$.cookie(key);
+       };
+
+}));
index d2961f01e70522714837ea55c7d78ec8122b66d2..da12a7bf7cfb83ae01e139a748054f443fb08233 100644 (file)
@@ -54,6 +54,174 @@ if(!physicalData) return;
  if(!physicalData) return;
  }
 getPhysicalData();
+
+function createPhysicalTopo(Data){
+       nodes_phy.clear();
+       edges_phy.clear();
+       if(!Data) Data=physicalData;
+       if(!Data) return;
+       var physicalHost=Data['physical-network']['physical-hosts'];
+       var physicalNode=Data['physical-network']['physical-nodes']['physical-node'];
+       var physicalLink=Data['physical-network']['physical-links'];
+       var myHost=[];//host_id----->[vis_node_id,connected node_id,host_name]
+       var myHostPort=[];//host_id----->host_port_id
+       var myNode=[];//node_id----->[vis_node_id,node_type]
+       var externalNode=[];//external_port_id----->[vis_node_id,node_id]
+       var myLink=[];//null
+       if(physicalHost){
+               physicalHost=physicalHost['physical-host'];             
+               for(var i in physicalHost){
+                       myHost[physicalHost[i]['host-id']]=[+i+1,physicalHost[i]['node-id'],physicalHost[i]['host-name']];
+                       myHostPort[physicalHost[i]['host-id']]=physicalHost[i]['port-id'];
+                       nodes_phy.add({
+                               id: +i+1,
+                label: physicalHost[i]["host-name"],
+                image: "src/app/nemo/images/phyHost.png",
+                shape: 'image',
+                           fontSize: 15
+                       });
+               }
+       }
+       console.log(myHost);
+       if(physicalNode){
+               var nodeslen=nodes_phy.get().length;
+               for(var i in physicalNode){
+                       myNode[physicalNode[i]['node-id']]=[nodeslen+1,physicalNode[i]['node-type'],''];
+                       nodes_phy.add({
+                               id: ++nodeslen,
+                label: physicalNode[i]["node-type"]+physicalNode[i]["node-id"].split(":")[1],
+                group: physicalNode[i]["node-type"],
+                       });
+                       var physicalPort=physicalNode[i]['physical-port'];
+                       if(physicalPort){
+                               for(var item in physicalPort){
+                                       if(physicalPort[item]['port-type']=='external')
+                                       {
+                                       var flag=true;
+                                       for(var hostPort in myHostPort){
+                                               if(physicalPort[item]['port-id']==myHostPort[hostPort])
+                                                       flag=false;
+                                       }
+                                       if(flag)        
+                                       externalNode[physicalPort[item]['port-id']]=[physicalNode[i]['node-id']];
+                                   }
+                               }
+                       }
+               }
+       }
+       console.log(myNode);
+       console.log(externalNode);
+
+       var externalnodecount=0;
+    for(var x in externalNode){externalnodecount++;}
+    if(externalnodecount>0){
+       var nodeslen=nodes_phy.get().length;
+       for(var i in externalNode){
+               externalNode[i]=[nodeslen+1,externalNode[i][0]];
+               nodes_phy.add({
+                               id: ++nodeslen,
+                label: '',
+                image: "src/app/nemo/images/ext-group.png",
+                shape: 'image',
+                       });
+       }
+       console.log(externalNode);
+       var edgeslen=edges_phy.get().length;
+       for(var i in externalNode){
+               edges_phy.add({
+                               id: ++edgeslen,
+                from:externalNode[i][0],
+                           to:myNode[externalNode[i][1]][0],
+                           length:150,
+                           width: 1
+                       });
+       }
+    }
+       if(physicalLink){
+               physicalLink=physicalLink['physical-link'];
+               var edgeslen=edges_phy.get().length;
+               for(var i in physicalLink){
+                       // myLink[]
+                       edges_phy.add({
+                    id:++edgeslen,
+                       from:myNode[physicalLink[i]['src-node-id']][0],
+                       to:myNode[physicalLink[i]['dest-node-id']][0],
+                       length:150,
+                       width: 2
+                       });
+               }
+       }
+
+    var hostcount=0;
+       for(var x in physicalHost){hostcount++;}
+       if(hostcount>0){
+               var edgeslen=edges_phy.get().length;
+               console.log(edgeslen);
+               for(var i in myHost){
+                       // myLink[]
+                       edges_phy.add({
+                   id:++edgeslen,
+                       from:myHost[i][0],
+                       to:myNode[myHost[i][1]][0],
+                       length:150,
+                       width: 1
+                       });
+               }
+       }
+
+var data = {
+               nodes: nodes_phy,
+               edges: edges_phy
+       };
+
+var options_phy = {
+               /* physics: {
+               repulsion: {
+                       centralGravity: 0,
+                       springLength: 200,//弹簧长度
+                       springConstant: 0,//弹簧常数
+                       nodeDistance: 0,
+                       damping: 0 //阻尼,减幅,衰减
+               }}, */
+               smoothCurves: false,
+               stabilize: false,
+               nodes: {
+          // default for all nodes
+                       shape: 'dot', 
+                       fontSize:16,
+                       radius:23,
+                       fixed:true
+               },
+               edges:{
+                       // length:200,
+                       width: 1
+               },
+               groups:{
+                       switch:{
+                               color: {
+                                       border: 'black',
+                                       background: '#B0E2FF',                          
+                               }
+            },
+                               
+                       router:{
+                               color: {
+                                       border: 'black',
+                                       background: '#7FFF00',
+                               }       
+
+                       }
+               }
+               
+       };
+       console.log(jQuery('#phy_graph').width());
+       jQuery('#phy_graph').width(800).height(500);
+       console.log(jQuery('#phy_graph').width());
+       var container = document.getElementById('phy_graph');
+       if(!container) return;
+       var graph = new vis.Graph(container, data, options_phy);
+}
+
 function analy_topo(topo_data)
 {
        phy_hosts = [];
diff --git a/nemo-ui/src/main/resources/nemo/js/svg.xml b/nemo-ui/src/main/resources/nemo/js/svg.xml
new file mode 100644 (file)
index 0000000..b005ac8
--- /dev/null
@@ -0,0 +1,35 @@
+<svg id="service_svg2" width="800" height="560" viewBox="100 40 900 780">\r
+       <path id="c2" node_start="interior" node_end="dmz1_n2" type="connection" d="M762.1320343559642 662.1320343559643 L337.86796564403573 237.86796564403573" stroke="black" stroke-width="1" fill="black"></path>\r
+       <path id="dmz1_c1" node_start="dmz1_n1" node_end="dmz1_n2" type="connection" d="M337.86796564403573 662.1320343559643 L337.86796564403573 237.86796564403573" stroke="black" stroke-width="1" fill="black"></path>\r
+       <path id="c1" node_start="internet" node_end="dmz1_n1" type="connection" d="M762.1320343559643 237.8679656440358 L337.86796564403573 662.1320343559643" stroke="black" stroke-width="1" fill="black"></path>\r
+\r
+       <defs>\r
+               <marker id="idArrow2" viewBox="0 0 20 20" refX="0" refY="10" markerUnits="strokeWidth" markerWidth="6" markerHeight="15" orient="auto"><path d="M 0 0 L 20 10 L0 20 z" fill="purple" stroke="black"></path> </marker>                   <marker id="idtext2" viewBox="0 0 120 50" refX="0" refY="0" markerUnits="strokeWidth" markerWidth="20" markerHeight="20" orient="auto"><text style="font-family:sans-serif; font-size:14pt;" x="20" y="20">text</text></marker>\r
+       </defs>\r
+       <g id="dmz1_n2" type="l2-group" sub="vm2,server1" ip-prefix="192.168.12.0/24">\r
+               <circle id="dmz1_n2_group" cx="337.86796564403573" cy="237.86796564403573" r="90" stroke="black" stroke-width="3" fill="white"></circle>\r
+               <rect id="vm2" x="282.86796564403573" y="212.86796564403573" width="110" height="34" stroke="black" stroke-width="1" fill="white"></rect>\r
+               <rect id="server1" x="282.86796564403573" y="255.86796564403573" width="110" height="34" stroke="black" stroke-width="1" fill="white"></rect>\r
+               <text id="dmz1_n2_title1" x="337.86796564403573" y="189.86796564403573" fill="black" text-anchor="middle" stroke="black" stroke-width="0.8">l2-group</text>\r
+               <text id="dmz1_n2_title2" x="337.86796564403573" y="206.86796564403573" fill="black" text-anchor="middle">dmz1_n2</text>\r
+               <text id="vm2_text" x="337.86796564403573" y="232.86796564403573" fill="black" text-anchor="middle">vm2</text>\r
+               <text id="server1_text" x="337.86796564403573" y="277.86796564403573" fill="black" text-anchor="middle">server1</text>\r
+       </g>\r
+       <g id="dmz1_n1" type="chain-group" sub="dmz1_fw1" flow="0">\r
+               <circle id="dmz1_n1_group" cx="337.86796564403573" cy="662.1320343559643" r="90" stroke="black" stroke-width="3" fill="white"></circle>\r
+               <rect id="dmz1_fw1" x="280.86796564403573" y="637.1320343559643" width="114" height="50" stroke="black" stroke-width="1" fill="white"></rect>\r
+               <text id="dmz1_n1_title1" x="337.86796564403573" y="614.1320343559643" fill="black" text-anchor="middle" stroke="black" stroke-width="0.8">chain-group</text>\r
+               <text id="dmz1_n1_title2" x="337.86796564403573" y="632.1320343559643" fill="black" text-anchor="middle">dmz1_n1</text>\r
+               <text id="dmz1_fw1_text" x="337.86796564403573" y="662.1320343559643" fill="black" text-anchor="middle">dmz1_fw1</text>\r
+       </g>\r
+       <g id="interior" type="ext-group" sub="interior" ip-prefix="192.168.13.0/24">\r
+               <circle id="interior_group" cx="762.1320343559642" cy="662.1320343559643" r="90" stroke="black" stroke-width="3" fill="white"></circle>\r
+               <text id="interior_title1" x="762.1320343559642" y="654.1320343559643" fill="black" text-anchor="middle" stroke="black" stroke-width="0.8">ext-group</text>\r
+               <text id="interior_title2" x="762.1320343559642" y="672.1320343559643" fill="                       " text-anchor="middle">interior</text>\r
+       </g>\r
+       <g id="internet" type="ext-group" sub="internet" ip-prefix="172.168.1.0/24">\r
+               <circle id="internet_group" cx="762.1320343559643" cy="237.8679656440358" r="90" stroke="black" stroke-width="3" fill="white"></circle>\r
+               <text id="internet_title1" x="762.1320343559643" y="229.8679656440358" fill="black" text-anchor="middle" stroke="black" stroke-width="0.8">ext-group</text>\r
+               <text id="internet_title2" x="762.1320343559643" y="247.8679656440358" fill="                       " text-anchor="middle">internet</text>\r
+       </g>\r
+</svg>
\ No newline at end of file
index 059e54951b1b65dd298f1bdad7d991340ebfaf3d..fb20300e7b4de3e1486c4ef287bf836ccc02cc01 100644 (file)
@@ -106,7 +106,9 @@ var createMappingTables = {
                        }\r
                        console.log(virtualnodes);\r
                        jQuery("#" + id).find('tr:gt(1)').empty();\r
-                       if (!virtual_nodes) return;\r
+                       var count=0;\r
+                       for(var x in virtual_nodes){count++;}\r
+                       if(count==0) return;\r
                        for (var i in virtualnodes) {\r
                                var $tr = '<tr><td>' + virtual_nodes[i][1] + '</td><td>' + virtualnodes[i] + '</td></tr>'\r
                                jQuery("#" + id).append($tr);\r
@@ -132,6 +134,9 @@ var createMappingTables = {
                        var paths = createMappingTables.getPaths(virtuallinks, vn_pnData, physicalData, PathId); //physical-path-id----->[Physical Nodes passed by Path](count=0,1,2,3...)\r
                        console.log(PathId);\r
                        console.log(paths);\r
+                       var count=0;\r
+                       for(var x in virtual_nodes){count++;}\r
+                       if(count==0) return;\r
                        for (var i in virtuallinks) {\r
                                var $tr = '<tr><td>' + virtual_nodes[virtuallinks[i][0]][1] + '-' + virtual_nodes[virtuallinks[i][1]][1] + '</td><td>' + virtual_nodes[virtuallinks[i][0]][1] + '</td><td>' + virtual_nodes[virtuallinks[i][1]][1] + '</td><td>' + PathId[i] + '</td>'\r
                                var pathsNode = ''\r
index a97bf5b9468729a17fbcbad0bec0eba440b58825..294b0006f203e0e4b6c874d9e99ffd67c7241ed0 100644 (file)
@@ -297,6 +297,811 @@ var userinfo ={
   }\r
 }\r
 //console.log(userinfo);\r
+userinfo={\r
+  "users": {\r
+    "user": [\r
+      {\r
+        "user-id": "14ce424a-3e50-4a2a-ad5c-b29845158c8b",\r
+        "user-role": "tenant",\r
+        "user-password": "abc",\r
+        "user-name": "user2",\r
+        "objects": {\r
+          "node": [\r
+            {\r
+              "node-id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",\r
+              "node-name": "server1",\r
+              "node-type": "host"\r
+            },\r
+            {\r
+              "node-id": "9d6f5343-f38e-4101-ab60-309e6322ace3",\r
+              "property": [\r
+                {\r
+                  "property-name": "location",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:1:1",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "operating-mode",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "layer3",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                }\r
+              ],\r
+              "node-type": "fw",\r
+              "node-name": "dmz1_fw1"\r
+            },\r
+            {\r
+              "node-id": "ae83ca1d-43ef-4d02-a48b-6c250bb084bd",\r
+              "property": [\r
+                {\r
+                  "property-name": "ip-prefix",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "192.168.13.0/24",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "ac-info-network",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "layer3",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "ac-info-protocol",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "static",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "location",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:4:2",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                }\r
+              ],\r
+              "node-type": "ext-group",\r
+              "node-name": "interior"\r
+            },\r
+            {\r
+              "node-id": "7dc2233e-f8a2-416c-902a-95cff42b398a",\r
+              "property": [\r
+                {\r
+                  "property-name": "location",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:3",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "ip-prefix",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "192.168.12.0/24",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "gateway-ip",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "192.168.12.1",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                }\r
+              ],\r
+              "node-type": "l2-group",\r
+              "node-name": "dmz1_n2",\r
+              "sub-node": [\r
+                {\r
+                  "node-id": "6c787caa-156a-49ed-8546-547bdccf283c",\r
+                  "order": 0\r
+                },\r
+                {\r
+                  "node-id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",\r
+                  "order": 1\r
+                }\r
+              ]\r
+            },\r
+            {\r
+              "node-id": "c3afb4f5-ffb4-4413-bad9-020babc67ed8",\r
+              "property": [\r
+                {\r
+                  "property-name": "ip-prefix",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "172.168.1.0/24",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "ac-info-network",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "layer3",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "ac-info-protocol",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "static",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "property-name": "location",\r
+                  "property-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:3:4",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                }\r
+              ],\r
+              "node-type": "ext-group",\r
+              "node-name": "internet"\r
+            },\r
+            {\r
+              "node-id": "6c787caa-156a-49ed-8546-547bdccf283c",\r
+              "node-name": "vm2",\r
+              "node-type": "host"\r
+            },\r
+            {\r
+              "node-id": "0dc22c0a-8ff0-448f-afc3-86fa22976242",\r
+              "node-type": "chain-group",\r
+              "node-name": "dmz1_n1",\r
+              "sub-node": [\r
+                {\r
+                  "node-id": "9d6f5343-f38e-4101-ab60-309e6322ace3",\r
+                  "order": 0\r
+                }\r
+              ]\r
+            }\r
+          ],\r
+          "connection": [\r
+            {\r
+              "connection-id": "94709024-6675-4a9a-b098-07e14d18633f",\r
+              "end-node": [\r
+                {\r
+                  "node-id": "c3afb4f5-ffb4-4413-bad9-020babc67ed8",\r
+                  "order": 0\r
+                },\r
+                {\r
+                  "node-id": "0dc22c0a-8ff0-448f-afc3-86fa22976242",\r
+                  "order": 0\r
+                }\r
+              ],\r
+              "connection-type": "p2p",\r
+              "connection-name": "c1"\r
+            },\r
+            {\r
+              "connection-id": "a88b037d-0aa0-4a50-8076-225449c8f036",\r
+              "end-node": [\r
+                {\r
+                  "node-id": "0dc22c0a-8ff0-448f-afc3-86fa22976242",\r
+                  "order": 0\r
+                },\r
+                {\r
+                  "node-id": "7dc2233e-f8a2-416c-902a-95cff42b398a",\r
+                  "order": 1\r
+                }\r
+              ],\r
+              "connection-type": "p2p",\r
+              "connection-name": "dmz1_c1"\r
+            },\r
+            {\r
+              "connection-id": "06c60ef9-f16d-4368-9697-aa6b1cf1340a",\r
+              "end-node": [\r
+                {\r
+                  "node-id": "ae83ca1d-43ef-4d02-a48b-6c250bb084bd",\r
+                  "order": 0\r
+                },\r
+                {\r
+                  "node-id": "7dc2233e-f8a2-416c-902a-95cff42b398a",\r
+                  "order": 0\r
+                }\r
+              ],\r
+              "connection-type": "p2p",\r
+              "connection-name": "c2"\r
+            }\r
+          ],\r
+          "flow": [\r
+            {\r
+              "flow-id": "613648ce-1059-4d06-b25a-0d54193c6586",\r
+              "match-item": [\r
+                {\r
+                  "match-item-name": "dst-port",\r
+                  "match-item-value": {\r
+                    "int-value": 80\r
+                  }\r
+                },\r
+                {\r
+                  "match-item-name": "dst-ip",\r
+                  "match-item-value": {\r
+                    "string-value": "192.168.12.0/24"\r
+                  }\r
+                },\r
+                {\r
+                  "match-item-name": "src-ip",\r
+                  "match-item-value": {\r
+                    "string-value": "172.168.1.0/24"\r
+                  }\r
+                }\r
+              ],\r
+              "flow-name": "dmz1_f1"\r
+            }\r
+          ]\r
+        },\r
+        "operations": {\r
+          "operation": [\r
+            {\r
+              "operation-id": "315b1a21-f5b3-4298-868f-6b08729d2622",\r
+              "priority": 0,\r
+              "action": [\r
+                {\r
+                  "action-name": "deny",\r
+                  "order": 0\r
+                }\r
+              ],\r
+              "target-object": "613648ce-1059-4d06-b25a-0d54193c6586",\r
+              "operation-name": "dmz1.o1"\r
+            }\r
+          ]\r
+        },\r
+        "template-instances": {\r
+          "template-instance": [\r
+            {\r
+              "template-instance-id": "e630091d-f336-4a3a-a699-fe3a4fe7c6e2",\r
+              "template-parameter": [\r
+                {\r
+                  "parameter-name": "subnodes-n2",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "vm2",\r
+                        "order": 0\r
+                      },\r
+                      {\r
+                        "value": "server1",\r
+                        "order": 1\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "parameter-name": "location-fw",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:1:1",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "parameter-name": "ipprefix",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "192.168.12.0/24",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "parameter-name": "location-n2",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "openflow:3",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "parameter-name": "gatewayip",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "192.168.12.1",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                },\r
+                {\r
+                  "parameter-name": "srcip",\r
+                  "parameter-values": {\r
+                    "string-value": [\r
+                      {\r
+                        "value": "172.168.1.0/24",\r
+                        "order": 0\r
+                      }\r
+                    ]\r
+                  }\r
+                }\r
+              ],\r
+              "template-name": "dmz",\r
+              "template-instance-name": "dmz1"\r
+            }\r
+          ]\r
+        }\r
+      },\r
+      {\r
+        "user-id": "af4fc2be-e3f4-4388-a8ef-3aabae872f2b",\r
+        "user-role": "admin",\r
+        "user-password": "abcd",\r
+        "user-name": "admin",\r
+        "template-definitions": {\r
+          "template-definition": [\r
+            {\r
+              "template-name": "dmz",\r
+              "abstract-intents": {\r
+                "abstract-objects": {\r
+                  "abstract-connection": [\r
+                    {\r
+                      "connection-id": "86f56efc-db49-4d7c-853c-6e7db169f56c",\r
+                      "end-node": [\r
+                        {\r
+                          "node-id": "fc096b0b-95cb-4f12-af28-b700a1228191",\r
+                          "order": 0\r
+                        },\r
+                        {\r
+                          "node-id": "9cfda02c-ba8b-41c2-9b36-b7144390fcc3",\r
+                          "order": 1\r
+                        }\r
+                      ],\r
+                      "connection-type": "p2p",\r
+                      "connection-name": "c1"\r
+                    }\r
+                  ],\r
+                  "abstract-node": [\r
+                    {\r
+                      "node-id": "f011ae1d-bb3e-42e0-9fa1-f6fa3641f02d",\r
+                      "property": [\r
+                        {\r
+                          "property-name": "location",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "location-fw",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        },\r
+                        {\r
+                          "property-name": "operating-mode",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "layer3",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        }\r
+                      ],\r
+                      "node-type": "fw",\r
+                      "node-name": "fw1"\r
+                    },\r
+                    {\r
+                      "node-id": "9cfda02c-ba8b-41c2-9b36-b7144390fcc3",\r
+                      "property": [\r
+                        {\r
+                          "property-name": "ip-prefix",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "ipprefix",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        },\r
+                        {\r
+                          "property-name": "gateway-ip",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "gatewayip",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        },\r
+                        {\r
+                          "property-name": "location",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "location-n2",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        },\r
+                        {\r
+                          "property-name": "sub-nodes",\r
+                          "property-values": {\r
+                            "string-value": [\r
+                              {\r
+                                "value": "subnodes-n2",\r
+                                "order": 0\r
+                              }\r
+                            ]\r
+                          }\r
+                        }\r
+                      ],\r
+                      "node-type": "l2-group",\r
+                      "node-name": "n2"\r
+                    },\r
+                    {\r
+                      "node-id": "fc096b0b-95cb-4f12-af28-b700a1228191",\r
+                      "node-type": "chain-group",\r
+                      "node-name": "n1",\r
+                      "sub-node": [\r
+                        {\r
+                          "node-id": "f011ae1d-bb3e-42e0-9fa1-f6fa3641f02d",\r
+                          "order": 0\r
+                        }\r
+                      ]\r
+                    }\r
+                  ],\r
+                  "abstract-flow": [\r
+                    {\r
+                      "flow-id": "815c0bee-b04e-4c56-9bb8-b743d72ba66f",\r
+                      "match-item": [\r
+                        {\r
+                          "match-item-name": "dst-port",\r
+                          "match-item-value": {\r
+                            "int-value": 80\r
+                          }\r
+                        },\r
+                        {\r
+                          "match-item-name": "dst-ip",\r
+                          "match-item-value": {\r
+                            "string-value": "ipprefix"\r
+                          }\r
+                        },\r
+                        {\r
+                          "match-item-name": "src-ip",\r
+                          "match-item-value": {\r
+                            "string-value": "srcip"\r
+                          }\r
+                        }\r
+                      ],\r
+                      "flow-name": "f1"\r
+                    }\r
+                  ]\r
+                },\r
+                "abstract-operations": {\r
+                  "abstract-operation": [\r
+                    {\r
+                      "operation-id": "769c52f5-1c75-4c21-b270-15fa259de39b",\r
+                      "priority": 0,\r
+                      "action": [\r
+                        {\r
+                          "action-name": "deny",\r
+                          "order": 0\r
+                        }\r
+                      ],\r
+                      "target-object": "815c0bee-b04e-4c56-9bb8-b743d72ba66f",\r
+                      "operation-name": "o1"\r
+                    }\r
+                  ]\r
+                }\r
+              },\r
+              "template-parameter": [\r
+                {\r
+                  "parameter-name": "subnodes-n2",\r
+                  "parameter-value-type": "string"\r
+                },\r
+                {\r
+                  "parameter-name": "location-fw",\r
+                  "parameter-value-type": "string"\r
+                },\r
+                {\r
+                  "parameter-name": "ipprefix",\r
+                  "parameter-value-type": "string"\r
+                },\r
+                {\r
+                  "parameter-name": "location-n2",\r
+                  "parameter-value-type": "string"\r
+                },\r
+                {\r
+                  "parameter-name": "gatewayip",\r
+                  "parameter-value-type": "string"\r
+                },\r
+                {\r
+                  "parameter-name": "srcip",\r
+                  "parameter-value-type": "string"\r
+                }\r
+              ]\r
+            }\r
+          ]\r
+        }\r
+      }\r
+    ]\r
+  }\r
+  }\r
+var physicalJson2={\r
+  "physical-network": {\r
+    "physical-hosts": {\r
+      "physical-host": [\r
+        {\r
+          "host-id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",\r
+          "node-id": "openflow:2",\r
+          "host-name": "video-server2",\r
+          "mac-address": "08:00:27:a0:a9:b3",\r
+          "port-id": "openflow:2:2",\r
+          "ip-addresses": {\r
+            "ip-address": [\r
+              "192.168.12.4"\r
+            ]\r
+          }\r
+        },\r
+        {\r
+          "host-id": "7b796915-adf4-4356-b5ca-de005ac410c1",\r
+          "node-id": "openflow:1",\r
+          "host-name": "video-server1",\r
+          "mac-address": "00:00:00:00:00:03",\r
+          "port-id": "openflow:1:1",\r
+          "ip-addresses": {\r
+            "ip-address": [\r
+              "192.168.11.2"\r
+            ]\r
+          }\r
+        },\r
+        {\r
+          "host-id": "6c787caa-156a-49ed-8546-547bdccf283c",\r
+          "node-id": "openflow:2",\r
+          "host-name": "vm2",\r
+          "mac-address": "00:00:00:00:00:02",\r
+          "port-id": "openflow:2:1",\r
+          "ip-addresses": {\r
+            "ip-address": [\r
+              "192.168.12.3"\r
+            ]\r
+          }\r
+        },\r
+        {\r
+          "host-id": "1eaf9a67-a171-42a8-9282-71cf702f61dd",\r
+          "node-id": "openflow:1",\r
+          "host-name": "vm1",\r
+          "mac-address": "00:00:00:00:00:01",\r
+          "port-id": "openflow:1:2",\r
+          "ip-addresses": {\r
+            "ip-address": [\r
+              "192.168.12.2"\r
+            ]\r
+          }\r
+        }\r
+      ]\r
+    },\r
+    "physical-nodes": {\r
+      "physical-node": [\r
+        {\r
+          "node-id": "openflow:3",\r
+          "attribute": [\r
+            {\r
+              "attribute-name": "location",\r
+              "attribute-value": {\r
+                "string-value": "openflow:3"\r
+              }\r
+            }\r
+          ],\r
+          "node-type": "router"\r
+        },\r
+        {\r
+          "node-id": "openflow:4",\r
+          "attribute": [\r
+            {\r
+              "attribute-name": "location",\r
+              "attribute-value": {\r
+                "string-value": "openflow:4"\r
+              }\r
+            }\r
+          ],\r
+          "node-type": "router"\r
+        },\r
+        {\r
+          "node-id": "openflow:1",\r
+          "attribute": [\r
+            {\r
+              "attribute-name": "location",\r
+              "attribute-value": {\r
+                "string-value": "openflow:1"\r
+              }\r
+            }\r
+          ],\r
+          "node-type": "switch",\r
+          "physical-port": [\r
+            {\r
+              "port-id": "openflow:1:1",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:1:1"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "external",\r
+              "mac-address": "56:21:6B:B3:3E:1A",\r
+              "bandwidth": 10240\r
+            },\r
+            {\r
+              "port-id": "openflow:1:2",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:1:2"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "external",\r
+              "mac-address": "FE:2C:6E:85:F0:E1",\r
+              "bandwidth": 10240\r
+            },\r
+            {\r
+              "port-id": "openflow:1:3",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:1:3"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "internal",\r
+              "mac-address": "B2:78:02:9F:FA:2C",\r
+              "bandwidth": 10240\r
+            }\r
+          ]\r
+        },\r
+        {\r
+          "node-id": "openflow:2",\r
+          "attribute": [\r
+            {\r
+              "attribute-name": "location",\r
+              "attribute-value": {\r
+                "string-value": "openflow:2"\r
+              }\r
+            }\r
+          ],\r
+          "node-type": "switch",\r
+          "physical-port": [\r
+            {\r
+              "port-id": "openflow:2:3",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:2:3"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "internal",\r
+              "mac-address": "52:B8:9B:40:CF:43",\r
+              "bandwidth": 10240\r
+            },\r
+            {\r
+              "port-id": "openflow:2:2",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:2:2"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "external",\r
+              "mac-address": "00:0C:29:98:7E:13",\r
+              "bandwidth": 10240\r
+            },\r
+            {\r
+              "port-id": "openflow:2:1",\r
+              "attribute": [\r
+                {\r
+                  "attribute-name": "location",\r
+                  "attribute-value": {\r
+                    "string-value": "openflow:2:1"\r
+                  }\r
+                }\r
+              ],\r
+              "port-type": "external",\r
+              "mac-address": "52:A7:95:B0:0F:FE",\r
+              "bandwidth": 10240\r
+            }\r
+          ]\r
+        }\r
+      ]\r
+    },\r
+    "physical-links": {\r
+      "physical-link": [\r
+        {\r
+          "link-id": "openflow:3:3",\r
+          "loss-rate": 1,\r
+          "delay": 1,\r
+          "src-port-id": "openflow:3:3",\r
+          "dest-node-id": "openflow:4",\r
+          "metric": 1,\r
+          "dest-port-id": "openflow:4:1",\r
+          "bandwidth": 10240,\r
+          "src-node-id": "openflow:3"\r
+        },\r
+        {\r
+          "link-id": "openflow:1:3",\r
+          "loss-rate": 1,\r
+          "delay": 1,\r
+          "src-port-id": "openflow:1:3",\r
+          "dest-node-id": "openflow:3",\r
+          "metric": 1,\r
+          "dest-port-id": "openflow:3:1",\r
+          "bandwidth": 10240,\r
+          "src-node-id": "openflow:1"\r
+        }\r
+      ]\r
+    }\r
+  }\r
+}\r
 var physicalJson={\r
   "physical-network": {\r
     "physical-hosts": {\r
index 289ae2474922b6a6bc9ed11e585c8bee3ec102d9..40350c285b731cd3f1d9efc5c64342bd0156cdbf 100644 (file)
@@ -9,11 +9,11 @@
      <!-- // <script src="src/app/nemo/module/migrate_js.js"></script> -->\r
     <script src="src/app/nemo/js/Nemo_Main.js"></script>\r
     <script src="src/app/nemo/module/keyWords.js"></script>\r
-    <!-- // <script src="src/app/nemo/module/migrate.js"></script> -->\r
+    <script src="src/app/nemo/module/migrate.js"></script>\r
     <!-- SFC -->\r
-    <!-- // <script src="src/app/nemo/module/test/servicechain_userJson.js"></script>  -->\r
+     <!-- // <script src="src/app/nemo/module/test/servicechain_userJson.js"></script>  -->\r
     <!-- Bod -->\r
-     <!-- // <script src="src/app/nemo/module/test/bod_userJson.js"></script>  -->\r
+    <!-- // <script src="src/app/nemo/module/test/bod_userJson.js"></script>  -->\r
 \r
     <script src="src/app/nemo/js/Nemo_Annouce_vis.js"></script>\r
     <script src="src/app/nemo/js/phyNetwork.js"></script>\r
         \r
 \r
         $(".tabs ul li[aria-controls='PhyNet']").click(function(){\r
+             createPhysicalTopo();\r
              analy_topo(physicalData);\r
-             create_physical_topo();\r
-             creataPhysicalTables.createPhyicalNodeTable('phyNodeTab',null)\r
-             creataPhysicalTables.createPhyicalLinkTable('phyLinkTab',null)\r
+             // create_physical_topo();\r
+              creataPhysicalTables.createPhyicalNodeTable('phyNodeTab',null)\r
+              creataPhysicalTables.createPhyicalLinkTable('phyLinkTab',null)\r
         });\r
 \r
         $(".tabs ul li[aria-controls='PhyNet']").click();\r
 \r
     });\r
 \r
+       $('#logout').click(function(){\r
+        // alert(1);\r
+        setCookie('nemo_userpwd','',-1);\r
+        $("#pageContent").empty();\r
+        $("#pageContent").load('src/app/nemo/register.html');\r
+        // alert(2);\r
+       });\r
+\r
         });\r
     </script>\r
 </head>\r
 <body>\r
       <div class="header">\r
-        <p>Hello Admin!</p>\r
+        <p>Hello Admin!</p><span id='logout'>Logout</span>\r
         <div id='selectUser'>\r
             <p>Tenant:</p>\r
             <select value="intentUser">\r
index c8fb3fffc6bff1fac408035d0360ce0873b53a17..17c43e51a0ea85cc814e82fa61763be84a0dbf3a 100644 (file)
@@ -5,10 +5,31 @@
        <title>nemo-register</title>\r
        <link rel="stylesheet" href="src/app/nemo/css/register.css">\r
         <script src="lib/jquery-2.1.4.min.js"></script>\r
+        <script src="src/app/nemo/js/jquery.cookie.js"></script>\r
        <script>\r
+       function setCookie(name,value,Days) \r
+{ \r
+    if(!Days) Days = 3; \r
+    var exp = new Date(); \r
+    exp.setTime(exp.getTime() + Days*24*60*60*1000); \r
+    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+';path=/'; \r
+} \r
+function getCookie(name) \r
+{ \r
+    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");\r
\r
+    if(arr=document.cookie.match(reg)) \r
+        return unescape(arr[2]); \r
+    else \r
+        return null; \r
+} \r
+\r
+       //setCookie('username','user123');\r
+        //alert(getCookie('username'));\r
+         // jQuery.cookie('name', 'value');\r
      jQuery(document).ready(function ($) {\r
-        var userInfoStorage={};\r
 \r
+        var userInfoStorage={};\r
       function getUserId(username,userpwd){\r
        var userid = null;\r
         var users = localStorage.getItem("AllRegUserInfo");//localstorage data\r
                        });\r
        return user_data;\r
       }\r
-\r
+      (function(){\r
+       var cook_username=getCookie('nemo_username');\r
+       var cook_userpwd=getCookie('nemo_userpwd');\r
+       if(!cook_username) return;\r
+       if(!cook_userpwd) return;\r
+       if(cook_username=='admin'&&cook_userpwd=='admin'){\r
+               $("#pageContent").empty();\r
+            $("#pageContent").load('src/app/nemo/nemo.tpl.html');\r
+       }\r
+      }());\r
+      $("#usename").focus();\r
+//add enter evevt\r
+      document.onkeydown = function(e){ \r
+          var ev = document.all ? window.event : e;\r
+           if(ev.keyCode==13) {\r
+           $("#log_ok").click();\r
+     }\r
+}\r
            $("#log_ok").click(function () {\r
                //validate all use\r
+               // alert('test');\r
                var userName = $("#usename").val().trim();\r
                var userPassword = $("#usepwd").val().trim();\r
                if (userName == "" || userPassword == "") {\r
@@ -51,7 +90,8 @@
                    return;\r
                }\r
             if(userName.toLowerCase()=="admin"&&userPassword.toLowerCase()=="admin") {\r
-\r
+            setCookie('nemo_username',userName);\r
+               setCookie('nemo_userpwd',userPassword);\r
             $("#pageContent").empty();\r
             $("#pageContent").load('src/app/nemo/nemo.tpl.html');\r
             }\r
                                {\r
                                        userInfoStorage.userName=userName;\r
                                        localStorage.setItem("nemo_userInfo",JSON.stringify(userInfoStorage));\r
-                           $("#pageContent").empty();\r
-                $("#pageContent").load('src/app/nemo/nemo.tpl.user.html');\r
+                               // setCookie('username',userName);\r
+                               // setCookie('username',userPassword);\r
+                               $("#pageContent").empty();\r
+                       $("#pageContent").load('src/app/nemo/nemo.tpl.user.html');\r
                 return;\r
                            }\r
                            else{\r
 </head>\r
 <body>\r
        <div id="logPage">\r
-   \r
    <div class='nemo_info'>\r
        <img src="src/app/nemo/images/nemo-overview.png" width="500px" height="320px" alt="nemo-overview.png">\r
        <p>\r