Commit ccf73d52 authored by Jonathon Duerig's avatar Jonathon Duerig

Checkpoint for interface and link support in ptopgen-new.

Basic link lookup and interface lookup is complete. Need to finish bandwidth
calculations, link types, wireless links, and interface printing.
parent 64ec2c5a
......@@ -189,21 +189,7 @@ sub Lookup($$$$)
return undef
if (!$query_result->numrows);
my $interface = {};
$interface->{"DBROW"} = $query_result->fetchrow_hashref();
bless($interface, $class);
#
# Grab the wires table entry.
#
$query_result =
DBQueryWarn("select * from wires ".
"where node_id1='$nodeid' and ".
" card1='$card' and port1='$port'");
if ($query_result && $query_result->numrows) {
$interface->{'WIRES'} = $query_result->fetchrow_hashref();
}
my $iface_row = $query_result->fetchrow_hashref();
#
# And the interface_state table.
......@@ -217,14 +203,44 @@ sub Lookup($$$$)
if (!$query_result);
return undef
if (!$query_result->numrows);
$interface->{'STATE'} = $query_result->fetchrow_hashref();
my $state_row = $query_result->fetchrow_hashref();
my $interface = LookupRow($class, $iface_row, $state_row);
#
# Grab the wires table entry.
#
$query_result =
DBQueryWarn("select * from wires ".
"where node_id1='$nodeid' and ".
" card1='$card' and port1='$port'");
if ($query_result && $query_result->numrows) {
$interface->{'WIRES'} = $query_result->fetchrow_hashref();
}
return $interface;
}
sub LookupRow($$$)
{
my ($class, $iface_row, $state_row) = @_;
my $nodeid = $iface_row->{'node_id'};
my $card = $iface_row->{'card'};
my $port = $iface_row->{'port'};
my $interface = {};
$interface->{"DBROW"} = $iface_row;
$interface->{'STATE'} = $state_row;
bless($interface, $class);
# Cache by card,port and by iface
my $iface = $interface->iface();
$all_interfaces{"$nodeid:$card:$port"} = $interface;
$all_interfaces{"$nodeid:$iface"} = $interface;
return $interface;
}
......
This diff is collapsed.
......@@ -11,8 +11,6 @@
use strict;
use English;
use Getopt::Std;
#use Math::BigInt;
#use List::Util 'shuffle';
#use lib "@prefix@/lib";
use lib "/usr/testbed/lib";
......@@ -64,7 +62,10 @@ sub consultDatabase()
# Bulk lookup of osids for features and genimode
libptopnew::LookupOsids();
# Bulk lookup of wires and interfaces
# Bulk lookup of interfaces
libptopnew::LookupInterfaces();
# Bulk lookup of wires
libptopnew::LookupLinks();
# Process each node adding ptypes and features
......@@ -91,6 +92,15 @@ sub printResults()
}
}
}
foreach my $current (values(%{ libptopnew::Links() })) {
if ($current->willPrint()) {
if ($print_xml) {
$current->toXML($rspec);
} else {
print $current->toString()."\n";
}
}
}
if ($print_xml) {
print GeniXML::Serialize($rspec, 1)."\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment