GetNodes( array($node_id)); if (empty($nodes)) { drupal_set_message ("Node " . $node_id . " not found"); return; } $node=$nodes[0]; // node info $hostname= $node['hostname']; $boot_state= $node['boot_state']; $site_id= $node['site_id']; $model= $node['model']; $version= $node['version']; $node_type = $node['node_type']; // arrays of ids of node info $slice_ids= $node['slice_ids']; $conf_file_ids= $node['conf_file_ids']; $interface_ids= $node['interface_ids']; $nodegroup_ids= $node['nodegroup_ids']; $pcu_ids= $node['pcu_ids']; // get peers $peer_id = $node['peer_id']; $peers=new Peers ($api); // gets site info $sites= $api->GetSites( array( $site_id ) ); $site=$sites[0]; $site_name= $site['name']; $site_node_ids= $site['node_ids']; // hash node_id=>hostname for this site's nodes $site_node_hash=array(); if( !empty( $site_node_ids ) ) { // get site node info basics $site_nodes= $api->GetNodes( $site_node_ids ); foreach( $site_nodes as $site_node ) { $site_node_hash[$site_node['node_id']]= $site_node['hostname']; } } // gets slice info for each slice if( !empty( $slice_ids ) ) $slices= $api->GetSlices( $slice_ids, array( "slice_id", "name" , "peer_id" ) ); // get interface info if( !empty( $interface_ids ) ) $interfaces= $api->GetInterfaces( $interface_ids ); // gets nodegroup info if( !empty( $nodegroup_ids ) ) $nodegroups= $api->GetNodeGroups( $nodegroup_ids, array("groupname","tag_type_id","value")); // xxx Thierry : remaining stuff // (*) events: should display the latest events relating to that node. // disabling call to GetEvents, that gets the session deleted in the DB // (*) conf_files: is fetched but not displayed if( !empty( $conf_file_ids ) ) $conf_files= $api->GetConfFiles( $conf_file_ids ); // (*) idem for PCUs // gets pcu and port info key to both is $pcu_id if( !empty( $pcu_ids ) ) $PCUs= $api->GetPCUs( $pcu_ids ); //////////////////// display node info drupal_set_title("Details for node " . $hostname); $local_peer= ! $peer_id; // extra privileges to admins, and (pi||tech) on this site $privileges = (plc_is_admin () && $local_peer) || ( plc_in_site($site_id) && ( plc_is_pi() || plc_is_tech())); $tabs=array(); // available actions if ( $local_peer && $privileges ) { $tabs['Delete'] = array ('url'=>l_actions(), 'method'=>'POST', 'values'=>array('action'=>'delete-node','node_id'=>$node_id), 'bubble'=>"Delete node $hostname", 'confirm'=>'Are you sure to delete ' . $hostname. ' ?'); // xxx subject to roles $tabs["Add Interface"]=array('url'=>l_interface_add($node_id), 'bubble'=>"Declare new network interface on $hostname"); $tabs["Events"]=array_merge(tabs_events(), array('url'=>l_event("Node","node",$node_id), 'bubble'=>"Events for node $hostname")); $tabs["Comon"]=array_merge(tabs_comon(), array('url'=>l_comon("node_id",$node_id), 'bubble'=>"Comon page about node $hostname")); } $tabs["All nodes"]=l_nodes(); plc_tabs($tabs); // show gray background on foreign objects : start a
'; plc_warning_html("This node has no interface"); echo "Please add an interface to make this a usable PLC node.
\n"; } else { $headers=array(); $headers["IP"]="IPAddress"; $headers["Method"]="string"; $headers["Type"]="string"; $headers["MAC"]="string"; $headers["bw limit"]="FileSize"; // a single symbol, marking 'p' for primary and a delete button for non-primary if ( $privileges ) $headers[plc_delete_icon()]='string'; $table_options=array('search_area'=>false,"pagesize_area"=>false,'notes_area'=>false); $table=new PlcTable("node_interfaces",$headers,2,$table_options); $table->start(); foreach ( $interfaces as $interface ) { $interface_id= $interface['interface_id']; $interface_ip= $interface['ip']; $interface_broad= $interface['broadcast']; $interface_primary= $interface['is_primary']; $interface_network= $interface['network']; $interface_dns1= $interface['dns1']; $interface_dns2= $interface['dns2']; $interface_hostname= $interface['hostname']; $interface_netmaks= $interface['netmask']; $interface_gatewary= $interface['gateway']; $interface_mac= $interface['mac']; $interface_bwlimit= $interface['bwlimit']; $interface_type= $interface['type']; $interface_method= $interface['method']; $table->row_start(); $table->cell(l_interface_t($interface_id,$interface_ip)); $table->cell($interface_method); $table->cell($interface_type); $table->cell($interface_mac); $table->cell($interface_bwlimit); if ( $privileges ) { if ($interface_primary) { $table->cell(plc_bubble("p","Cannot delete a primary interface")); } else { $table->cell ($form->checkbox_html('interface_ids[]',$interface_id)); } } $table->row_end(); } if ($privileges) { $table->tfoot_start(); $table->row_start(); $add_button=new PlcFormButton (l_interface_add($node_id),"add_interface","Add interface","GET"); // we should have 6 cols, use 3 for the left (new) and the rest for the right (remove) $table->cell($add_button->html(), 3,"left"); $table->cell($form->submit_html("delete-interfaces","Remove Interfaces"), $table->columns()-3,"right"); $table->row_end(); } $table->end(); } } //////////////////////////////////////////////////////////// slices // display slices plc_section ("Slices"); if ( ! $slices ) { plc_warning ("This node is not associated to any slice"); } else { $headers=array(); $headers['Peer']="string"; $headers['Name']="string"; $headers['Slivers']="string"; $reasonable_page=10; $table_options = array('notes_area'=>false,"search_width"=>10,'pagesize'=>$reasonable_page); if (count ($slices) <= $reasonable_page) { $table_options['search_area']=false; $table_options['pagesize_area']=false; } $table=new PlcTable("node_slices",$headers,1,$table_options); $table->start(); foreach ($slices as $slice) { $table->row_start(); $table->cell ($peers->shortname($peer_id)); $table->cell (l_slice_t ($slice['slice_id'],$slice['name'])); $table->cell (l_sliver_t ($node_id,$slice['slice_id'],'view')); $table->row_end(); } $table->end(); } $form->end(); //////////////////////////////////////////////////////////// $peers->block_end($peer_id); // Print footer include 'plc_footer.php'; ?>