var ne_flag=0;
// Node_List = a[Node_Id][x](x = 0,label;x = 1,title;x = 2,P2mpGroupId)
var Node_List = new Array();
// Edge_List = b[Edge_Id][y](y = 0,connection name;y = 1,from;y = 2,to)
var Edge_List = new Array();
var node_count=0;
var node_X=[];
var conn_Item=[];
var vlandata1;
/////////////Main Data//////////////
var nodes, edges, graph;
var Node_Id = 0;
var Edge_Id = 0;
var Edge_Count=0;
var Node_Sp=[];
var Node_Sp_Id=[];
var Node_Sc=[];
var Node_Sc_Id=[];
var policy_count=[];
var policy_set=[];
var chain_count=[];
var chain_set=[];
var conn_set=[];
//flow
var flow_count = [];
var ext_ip = [];
// create an array with nodes
nodes = new vis.DataSet();
// create an array with edges
edges = new vis.DataSet();
/////////////P2mp Group Data//////////////
var Group_Id = 0;
var Group_List= new Array();
var options = {
stabilize: true,
//Manipulation:true,
//hierarchicalLayout: true,
nodes: {
// default for all nodes
shape: 'dot',
fontSize:16 ,
radius:16,
fixed:true
},
edges: {
smooth: false
//length:1
},
groups: {
null: {
color: {
border: 'white',
background: 'white',
highlight: {
border: 'white',
background: '#white'
}
},
fontSize: 0,
radius:0,
//fontFace: 'arial',
shape: 'dot'
},
host: {
color: {
border: 'black',
background: '#B0E2FF',
highlight: {
border: 'black',
background: '#4F94CD'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
firewall: {
color: {
border: 'black',
background: '#FF0000',
highlight: {
border: 'black',
background: '#FF7256'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
internet: {
color: {
border: 'black',
background: '#7FFF00',
highlight: {
border: 'black',
background: '#6B8E23'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
forwarding: {
color: {
border: 'black',
background: '#878787',
highlight: {
border: 'black',
background: '#4A4A4A'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
loadbalance: {
color: {
border: '#black',
background: '#FF9933',
highlight: {
border: 'black',
background: '#FDCEBF'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
group: {
color: {
border: 'black',
background: 'yellow',
highlight: {
border: 'black',
background: '#ECE5D0'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
}
}
};
// used in Service_Policy
var options2 = {
stabilize: false,
//Manipulation:true,
//hierarchicalLayout: true,
nodes: {
// default for all nodes
shape: 'dot',
fontSize:16 ,
radius:16,
fixed:true
},
edges: {
smooth: false
//length:1
},
groups: {
null: {
color: {
border: 'white',
background: 'white',
highlight: {
border: 'white',
background: '#white'
}
},
fontSize: 0,
radius:0,
//fontFace: 'arial',
shape: 'dot'
},
host: {
color: {
border: 'black',
background: '#B0E2FF',
highlight: {
border: 'black',
background: '#4F94CD'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
firewall: {
color: {
border: 'black',
background: '#FF0000',
highlight: {
border: 'black',
background: '#FF7256'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
internet: {
color: {
border: 'black',
background: '#7FFF00',
highlight: {
border: 'black',
background: '#6B8E23'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
forwarding: {
color: {
border: 'black',
background: '#878787',
highlight: {
border: 'black',
background: '#4A4A4A'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
loadbalance: {
color: {
border: '#black',
background: '#FF9933',
highlight: {
border: 'black',
background: '#FDCEBF'
}
},
fontSize: 15,
radius:15,
fontFace: 'arial',
shape: 'dot'
},
group: {
color: {
border: 'black',
background: 'yellow',
highlight: {
border: 'black',
background: '#ECE5D0'
}
},
fontSize: 15,
radius:15,
}
},
physics: {
repulsion: {
centralGravity: 0,
springLength: 100,//弹簧长度
springConstant: 0,//弹簧常数
nodeDistance: 0,
damping: 0 //阻尼,减幅,衰减
}}
};
var DOMURL = window.URL || window.webkitURL || window;
var nemoModule = [
/* no host in mode */
'',
/* 1 host in mode */
'',
/* 2 hosts in mode */
'',
/* 3 hosts in mode */
'' ,
/* 4 hosts in mode */
'',
/* more than 4 hosts in mode */
''];
//function
function calculatePos(n){
var res = new Array();
if(n <= 0)return res;
var start;
var offset = 2 * Math.PI / n;
if(n % 2 == 1){
start = Math.PI / 2;
}else{
start = Math.PI / 2 + Math.PI / n;
}
res.push(start);
for(var i = 1; i < n; i++){
start += offset;
res.push(start);
}
return res;
}