return group_node;\r
}\r
\r
- function draw_flow_data(src_ip, dest_ip, flow_name) {\r
- var src_group = flow_get_group(src_ip, dest_ip)[0];\r
+ function draw_flow_data(src_ip, dest_ip, flow_name,src_node,dest_node) {\r
+ if(!src_ip && !dest_ip){\r
+ var src_group = intentNodesArray[src_node];\r
+ var dest_group = intentNodesArray[dest_node];\r
+ }\r
+ else{\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
+ }\r
+\r
+ \r
console.log(src_group);\r
console.log(dest_group);\r
//get flow count\r
flow_count_temp++;\r
break;\r
}\r
-\r
}\r
}\r
if (end_flag != 1)\r
var deg = res[i];\r
var x = 550 + Math.cos(deg) * r;\r
var y = 450 - Math.sin(deg) * r;\r
+ if(node_count%2==1)\r
+ var y = 500 - Math.sin(deg) * r;\r
dis_x = x - parseInt(jQuery("#service_svg2 g:eq(" + i + ") circle:eq(0)").attr("cx"));\r
dis_y = y - parseInt(jQuery("#service_svg2 g:eq(" + i + ") circle:eq(0)").attr("cy"));\r
jQuery("#service_svg2 g:eq(" + i + ") circle:eq(0)").attr("cx", x);\r
}\r
}\r
\r
+ var intentNodesArray=[];//node id--->node name\r
+ function getUserNodes(data){\r
+ var nodes=data["node"];\r
+ for(var item in nodes){\r
+ intentNodesArray[nodes[item]["node-id"]]=nodes[item]["node-name"];\r
+ }\r
+ }\r
function analyjson_topo(user_data) {\r
//jQuery("#service_svg2").show();\r
//jQuery("#service_svg").hide();\r
var user_json_data = user_data['objects'];\r
if (user_json_data == null)\r
return;\r
-\r
+ getUserNodes(user_json_data);\r
+ console.log("intentNodesArray",intentNodesArray);\r
//host\r
var host_list = [];\r
for (var host_cursor in user_json_data["node"]) {\r
src_ip = user_json_data["flow"][flow_cursor]["match-item"][match_cursor]["match-item-value"]["string-value"];\r
}\r
}\r
+ if(!user_json_data["flow"][flow_cursor]["property"]){\r
draw_flow_data(src_ip, dst_ip, user_json_data["flow"][flow_cursor]["flow-name"]);\r
+ }\r
+ else{\r
+ var src_node,dest_node;\r
+ var property=user_json_data["flow"][flow_cursor]["property"];\r
+ for(var item in property){\r
+ if(property[item]["property-name"]=="src-node")\r
+ src_node=property[item]["property-values"]["string-value"][0]["value"];\r
+ if(property[item]["property-name"]=="dst-node")\r
+ dest_node=property[item]["property-values"]["string-value"][0]["value"];\r
+ }\r
+ draw_flow_data(null, null, user_json_data["flow"][flow_cursor]["flow-name"],src_node,dest_node);\r
+ }\r
flow_list[user_json_data["flow"][flow_cursor]["flow-id"]] = user_json_data["flow"][flow_cursor]["flow-name"]\r
}\r
\r
}\r
}\r
}\r
- if (c2_flag == 0 || c2_flag == 0) {\r
+ if (c1_flag == 0 && c2_flag == 0) {\r
alert("No connection!");\r
return;\r
}\r
for (var j in node) {\r
var nemo_str='';\r
if(node[j]['node-type']=='host'){\r
- nemo_str += "Import Node " + node[j]['node-name'] + " Type " + node[j]['node-type'];\r
+ nemo_str += "IMPORT Node " + node[j]['node-name'] + " Type " + node[j]['node-type'];\r
}else{\r
- nemo_str += "Create Node " + node[j]['node-name'] + " Type " + node[j]['node-type'];\r
+ nemo_str += "CREATE Node " + node[j]['node-name'] + " Type " + node[j]['node-type'];\r
} \r
var sub_node = node[j]['sub-node'];\r
if (sub_node && sub_node.length > 0) {\r
}\r
for (var item in nodeNemo) {\r
// alert(jQuery("#nemo_str_show").html);\r
- jQuery("#nemo_str_show").append('<p>'+nodeNemo[item]+' '+'</p>');\r
+ jQuery("#nemo_str_show").append('<p>'+nodeNemo[item]+'; '+'</p>');\r
}\r
console.log(nodeNemo);\r
} \r
var connectionNemo = [];\r
var conn = user_data["objects"]['connection'];\r
for (var j in conn) {\r
- var nemo_str = "Create Connection " + conn[j]['connection-name'] + ' Type ' + conn[j]['connection-type'];\r
+ var nemo_str = "CREATE Connection " + conn[j]['connection-name'] + ' Type ' + conn[j]['connection-type'];\r
nemo_str += " Endnodes " + nodes[conn[j]['end-node'][0]['node-id']] + ',' + nodes[conn[j]['end-node'][1]['node-id']];\r
var property = conn[j]['property'];\r
if(property&&property.length>0){\r
}\r
for (var item in connectionNemo) {\r
// alert(jQuery("#nemo_str_show").html);\r
- jQuery("#nemo_str_show").append('<p>'+connectionNemo[item]+' '+'</p>');\r
+ jQuery("#nemo_str_show").append('<p>'+connectionNemo[item]+'; '+'</p>');\r
}\r
console.log(connectionNemo);\r
} \r
var flowNemo = [];\r
var fl = user_data["objects"]['flow'];\r
for (var j in fl) {\r
- var nemo_str = 'Create Flow ' + fl[j]['flow-name'];\r
+ var nemo_str = 'CREATE Flow ' + fl[j]['flow-name'];\r
var match = fl[j]["match-item"];\r
if (match && match.length > 0) {\r
nemo_str += " Match ";\r
}\r
nemo_str = nemo_str.substring(0, nemo_str.length - 1);\r
}\r
+ var property=fl[j]["property"];\r
+ if(property && property.length > 0){\r
+ nemo_str += " Property ";\r
+ for (var k in property) {\r
+ if(property[k]["property-name"])\r
+ nemo_str += property[k]['property-name'] + ':"' + intentNodesArray[property[k]["property-values"]['string-value'][0]["value"]] + '",';\r
+ }\r
+ nemo_str = nemo_str.substring(0, nemo_str.length - 1);\r
+ }\r
flowNemo.push(nemo_str);\r
}\r
\r
for (var item in flowNemo) {\r
// alert(jQuery("#nemo_str_show").html);\r
- jQuery("#nemo_str_show").append('<p>'+flowNemo[item]+' '+'</p>');\r
+ jQuery("#nemo_str_show").append('<p>'+flowNemo[item]+'; '+'</p>');\r
}\r
console.log(flowNemo);\r
}\r
var opNemo = [];\r
var operation = user_data["operations"]['operation'];\r
for (var j in operation) {\r
- var nemo_str = 'Create Operation ' + operation[j]["operation-name"];\r
+ var nemo_str = 'CREATE Operation ' + operation[j]["operation-name"];\r
// console.log(flow[operation[j]['target-object']]);\r
- nemo_str += ' Target ' + flow[operation[j]['target-object']];\r
+ if(flow[operation[j]['target-object']])\r
+ nemo_str += ' Target ' + flow[operation[j]['target-object']];\r
+ else\r
+ nemo_str += ' Target ' + connection[operation[j]['target-object']];\r
+ var condition = operation[j]['condition-segment'];\r
+ if (condition && condition.length > 0) {\r
+ nemo_str += " Condition ";\r
+ condition = condition.sort(function(a,b){return a.order-b.order});\r
+ console.log(condition);\r
+ for (var k in condition) {\r
+ nemo_str+=relChars[condition[k]["precursor-relation-operator"]];\r
+ nemo_str+="(";\r
+ nemo_str+=condition[k]["condition-parameter-name"];\r
+ nemo_str+=opChars[condition[k]["condition-parameter-match-pattern"]];\r
+ nemo_str+=condition[k]["condition-parameter-target-value"]["string-value"];\r
+ nemo_str+=")";\r
+ \r
+ }\r
+ }\r
var action = operation[j]['action'];\r
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
+ 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
+ if(action[k]['action-name']=='qos-bandwidth'){\r
+ nemo_str+= action[k]['action-name']+':'+action[k]["parameter-values"]["int-value"][0]["value"]+'kbps,';\r
+ }\r
}\r
nemo_str = nemo_str.substring(0, nemo_str.length - 1);\r
}\r
+ \r
opNemo.push(nemo_str);\r
}\r
for (var item in opNemo) {\r
// alert(jQuery("#nemo_str_show").html);\r
- jQuery("#nemo_str_show").append('<p>'+opNemo[item]+' '+'</p>');\r
+ jQuery("#nemo_str_show").append('<p>'+opNemo[item]+'; '+'</p>');\r
}\r
console.log(opNemo);\r
}\r
// userId='af4fc2be-e3f4-4388-a8ef-3aabae872f2b';\r
//Bod\r
// var userId='14ce424a-3e50-4a2a-ad5c-b29845158c8b'\r
+ // if(userId=='0') userId='14ce424a-3e50-4a2a-ad5c-b29845158c8b';\r
\r
$('#service_svg2').empty();\r
$("#nemo_str_show").empty();\r
if(!IntentInfos) return;\r
var user_data = getIntentInfoById(userId);\r
if(!user_data) return;\r
-\r
+ // var user_data=getIntentInfoByName("user2",userinfo);\r
analyjson_topo(user_data);\r
parseNemoLan(user_data);\r
//set keyWords style\r
//Bod\r
//userId='14ce424a-3e50-4a2a-ad5c-b29845158c8b'\r
\r
+ // if(userId=='0') userId='14ce424a-3e50-4a2a-ad5c-b29845158c8b';\r
+ // virtualData=virtualJson;\r
+\r
if(!IntentInfos||!MappingResults||!VirtualDatas) return;\r
if(!getVirtualInfoById(userId)||!getIntentInfoById(userId)||!getMappingResultById(userId)) return;\r
create_virtual_topo(getVirtualInfoById(userId),getIntentInfoById(userId),getMappingResultById(userId));\r
\r
$(".tabs ul li[aria-controls='Mapping']").click(function(){\r
var userId=$("#selectUser option:selected").val();\r
+ // userId='14ce424a-3e50-4a2a-ad5c-b29845158c8b';\r
jQuery("#mapVirNodeTab").find('tr').remove();\r
jQuery("#mapVirLinkTab").find('tr').remove();\r
if(!physicalData||!PnMappingResults||!VirtualDatas) return;\r
<div id="intent_info">\r
<div id="intent_topo">\r
\r
- <svg id="service_svg2" width="800" height="560" viewBox="100 20 900 780">\r
+ <svg id="service_svg2" width="800" height="560" viewBox="100 40 900 780">\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"/> </marker>\r
<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