Commit c60863af authored by Jonathon Duerig's avatar Jonathon Duerig

Slightly less bogus capacity measurement for stitched links.

parent 188fe215
......@@ -453,12 +453,14 @@ my %external_links;
my %contact_nodes;
my %contact_ifaces;
my %stitch_points;
my %external_speeds;
$result = DBQueryFatal("select w.node_id1, w.card1, w.port1, i1.iface, ".
"w.node_id2, w.card2, w.port2, i2.iface, ".
"w.external_interface, w.external_wire, ".
"e.node_id, e.vlans, ".
"e.external_manager, e.network_id, e.external_interface, e.external_wire, e.external_subport ".
"e.external_manager, e.network_id, e.external_interface, ".
"e.external_wire, e.external_subport, i1.current_speed, i2.current_speed ".
"from wires as w ".
"left join external_networks as e ".
"on w.node_id1=e.node_id or w.node_id2=e.node_id ".
......@@ -469,7 +471,15 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface,
$external_iface_urn, $external_link_urn, $external, $vlanList,
$external_manager_urn,
$external_network_id, $external_network_iface_urn,
$external_network_link_urn, $subport) = $result->fetchrow_array) {
$external_network_link_urn, $subport, $speed1, $speed2) = $result->fetchrow_array) {
# Speed is the lesser of the interface speeds
my $speed = $speed1;
if ($speed1 == 0 ||
($speed2 < $speed && $speed2 != 0)) {
$speed = $speed2;
}
# Convert to kbps
$speed = $speed * 1000;
if ($external eq $cnode) {
my $temp;
$temp = $cnode; $cnode = $enode; $enode = $temp;
......@@ -513,6 +523,7 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface,
$contact_nodes{$cnode} = [$enode];
}
$contact_ifaces{"$cnode:$enode"} = $ciface_urn;
$external_speeds{"$cnode:$enode"} = $speed;
}
print_header();
......@@ -3104,12 +3115,13 @@ sub print_stitch_node
my $node_urn = GeniHRN::Generate($OURDOMAIN, "node", $node);
print "<node id=\"$node_urn\">\n";
foreach my $external (@{ $contact_nodes{$node} }) {
my $speed = $external_speeds{"$node:$external"};
my $vlans = $external_nodes{$external};
if (defined($external_links{"$node:$external"})) {
print_stitch_port($node,
$contact_ifaces{"$node:$external"},
$external_ifaces{"$node:$external"},
1000000, $vlans, 0);
$speed, $vlans, 0);
}
}
print "</node>\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