ckp
[plewww.git] / planetlab / nodes / comon.php
index d049e71..2406c1c 100644 (file)
@@ -44,40 +44,40 @@ function plc_comon_url_from_ips($comon_server_url, $ips) {
 // peer_id
 // from that we get a set of nodes and compute a comon URL to gather them all
 
-$fields=array("hostname","node_id","peer_id", "nodenetwork_ids");
+$fields=array("hostname","node_id","peer_id", "interface_ids");
 
 if ($_GET['node_id']) {
   $node_id=intval($_GET['node_id']);
   $nodes=$api->GetNodes(array("node_id"=>array($node_id)),$fields);
  } else if ($_GET['site_id']) {
   $site_id=intval($_GET['site_id']);
-  $nodes=$api->GetNodes(array("site_id"=>array($site_id)),$fields);
+  $nodes=$api->GetNodes(array("node_type"=>"regular","site_id"=>array($site_id)),$fields);
  } else if ($_GET['slice_id']) {
   $slice_id=intval($_GET['slice_id']);
   $return=$api->GetSlices(array("slice_id"=>array($slice_id)),array("node_ids"));
   $node_ids=$return[0]['node_ids'];
-  $nodes=$api->GetNodes(array("node_id"=>$node_ids),$fields);
+  $nodes=$api->GetNodes(array("node_type"=>"regular","node_id"=>$node_ids),$fields);
  } else if (isset($_GET['peer_id'])) {
   $peer_id=intval($_GET['peer_id']);
   if ( ($peer_id == 0) || ($peer_id == "") )
     $peer_id=NULL;
-  $nodes=$api->GetNodes(array("peer_id"=>$peer_id),$fields);
+  $nodes=$api->GetNodes(array("node_type"=>"regular","peer_id"=>$peer_id),$fields);
  } else {
   echo "<div class='plc-warning'> Unexpected args in comon.php </div>\n";
   exit();
  }
 
 // first pass 
-// * gather nodenetwork_ids for local nodes
+// * gather interface_ids for local nodes
 // * gather hostnames for foreign nodes
 
-$nodenetwork_ids=array();
+$interface_ids=array();
 $hostnames = array();
 
 foreach ($nodes as $node) {
   if (empty($node['peer_id'])) {
-    foreach ($node['nodenetwork_ids'] as $id=>$nnid) {
-      $nodenetwork_ids [] = $nnid;
+    foreach ($node['interface_ids'] as $id=>$nnid) {
+      $interface_ids [] = $nnid;
     }
   } else {
     $hostnames[] = $node['hostname'];
@@ -85,16 +85,14 @@ foreach ($nodes as $node) {
 }
   
 // Gather local ips from primary interfaces
-// fetch primary nodenetworks
+// fetch primary interfaces
 $local_ips=array();
-$nns = $api->GetNodeNetworks(array("is_primary"=>TRUE,"nodenetwork_id"=>$nodenetwork_ids),
+$nns = $api->GetInterfaces(array("is_primary"=>TRUE,"interface_id"=>$interface_ids),
                             array("ip"));
 foreach ($nns as $nn) {
   $local_ips[] = $nn['ip'];
 }
 
-plc_debug('locals',$local_ips);
-
 // for foreign hosts we're left with dns resolving them
 $remote_ips=array();
 foreach ($hostnames as $hostname) {
@@ -106,15 +104,11 @@ foreach ($hostnames as $hostname) {
   }
 }
 
-plc_debug('remote ips',$remote_ips);
-
-
 // add both lists
 $all_ips=$local_ips+$remote_ips;
 // compute comon URL
 $url = plc_comon_url_from_ips("http://comon.cs.princeton.edu",$all_ips);
 
-plc_debug('url',$url);
 
 // redirect to comon
 header("Location: " . $url);