5 require_once 'plc_login.php';
7 // Get session and API handles
8 require_once 'plc_session.php';
12 require_once 'plc_drupal.php';
15 require_once 'plc_functions.php';
17 require_once 'columns.php';
20 $slice_id=$_GET["slice_id"];
21 $tagN=$_GET["tagName"];
22 $data_source=$_GET["data_source"];
23 $data_type=$_GET["data_type"];
25 //print "getting column data for ".$slice_id." with ".$tagN." - ".$data_source." - ".$data_type;
26 $nodetags = array('node_id');
27 $extratags = explode("|", $tagN);
30 if ($slice_id == "nodes") {
32 if ($data_source == "comon") {
34 $comontags = $extratags;
35 $extratags = array ('hostname');
36 $nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
37 $ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
38 $comon_data = $ColumnsConfigure->comon_query_nodes(",".$tagN);
40 //print ("comon tags = ".$comontags);
42 if ($comon_data != "")
44 echo "---attached---";
45 if ($nodes) foreach ($nodes as $node) {
46 echo "|".$node['node_id'];
47 foreach ($comontags as $t)
48 echo ":".$ColumnsConfigure->convert_data($comon_data[$node['hostname']][$t], $data_type);
52 else if ($data_source == "tophat") {
54 $ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
56 $extratags = array ('hostname');
57 $nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
60 if ($nodes) foreach ($nodes as $n)
61 $dd[] = $n['hostname'];
63 if ($tagN == "hopcount")
65 $ref_node=$_GET["ref_node"];
66 //print("getting hop count with ref node = ".$ref_node);
67 $tophat_data = $ColumnsConfigure->getPairwise($ref_node, $dd, "traceroute", "hop_count");
70 $tophat_data = $ColumnsConfigure->getTopHatData($tagN, $dd);
72 //print_r($tophat_data);
74 if ($tophat_data != "") {
75 echo "---attached---";
76 if ($nodes) foreach ($nodes as $node) {
77 echo "|".$node['node_id'];
78 echo ":".$ColumnsConfigure->convert_data($tophat_data[$node['hostname']][$tagN], $data_type);
85 $nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
88 echo "---attached---";
90 foreach ($nodes as $node) {
91 echo "|".$node['node_id'];
92 foreach ($extratags as $t)
105 $slices= $api->GetSlices( array(intval($slice_id)));
106 if (empty($slices)) {
107 drupal_set_message ("Slice " . $slice_id . " not found");
112 if ($data_source == "comon") {
114 $comontags = $extratags;
115 $extratags = array ('hostname');
117 $nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
118 $potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
120 $ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
121 $comon_data = $ColumnsConfigure->comon_query_nodes(",".$tagN);
123 //print ("comon tags = ".$comontags);
125 if ($comon_data != "") {
126 echo "---attached---";
127 if ($nodes) foreach ($nodes as $node) {
128 echo "|".$node['node_id'];
129 foreach ($comontags as $t)
130 echo ":".$ColumnsConfigure->convert_data($comon_data[$node['hostname']][$t], $data_type);
132 echo "|---potential---";
133 if ($potential_nodes) foreach ($potential_nodes as $potential_node) {
134 echo "|".$potential_node['node_id'];
135 foreach ($comontags as $t)
136 echo ":".$ColumnsConfigure->convert_data($comon_data[$potential_node['hostname']][$t], $data_type);
140 else if ($data_source == "tophat") {
142 $ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
144 $extratags = array ('hostname');
145 $nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
146 $potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
149 if ($nodes) foreach ($nodes as $n)
150 $dd[] = $n['hostname'];
151 if ($potential_nodes) foreach ($potential_nodes as $n)
152 $dd[] = $n['hostname'];
154 if ($tagN == "hopcount")
156 $ref_node=$_GET["ref_node"];
157 print("getting hop count with ref node = ".$ref_node);
158 $tophat_data = $ColumnsConfigure->getPairwise($ref_node, $dd, "hop_count");
161 $tophat_data = $ColumnsConfigure->getTopHatData($tagN, $dd);
163 if ($tophat_data != "") {
164 echo "---attached---";
165 if ($nodes) foreach ($nodes as $node) {
166 echo "|".$node['node_id'];
167 echo ":".$ColumnsConfigure->convert_data($tophat_data[$node['hostname']][$tagN], $data_type);
170 echo "|---potential---";
171 if ($potential_nodes) foreach ($potential_nodes as $potential_node) {
172 echo "|".$potential_node['node_id'];
173 echo ":".$ColumnsConfigure->convert_data($tophat_data[$potential_node['hostname']][$tagN], $data_type);
180 $nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
181 $potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
184 echo "---attached---";
185 foreach ($nodes as $node) {
186 echo "|".$node['node_id'];
187 foreach ($extratags as $t)
191 if ($potential_nodes) {
192 echo "|---potential---";
193 foreach ($potential_nodes as $potential_node) {
194 echo "|".$potential_node['node_id'];
195 foreach ($extratags as $t)
196 echo ":".$potential_node[$t];