Commit 0c422bcd authored by Leigh Stoller's avatar Leigh Stoller

Merge Jon's xml branch into the trunk; appears to work okay.

parent ee3a6f4a
......@@ -317,7 +317,8 @@ if (defined($switchtouse)) {
}
else {
$result =
DBQueryFatal("select node_id from nodes where role = \"testswitch\"");
DBQueryFatal("select node_id from nodes ".
"where role='testswitch' or role='widearea_switch'");
while (($switch) = $result->fetchrow_array) {
if ($do_xml) {
......@@ -384,8 +385,15 @@ $result =
"left join reserved as m on a.phys_nodeid=m.node_id ".
"left join nodes as np on a.phys_nodeid=np.node_id ".
"left join node_types as t on t.type=a.type ".
"left outer join ".
" (select type,attrvalue ".
" from node_type_attributes ".
" where attrkey='dedicated_widearea' ".
" group by type) as dedicated_wa_types ".
" on t.type=dedicated_wa_types.type ".
"where $free_condition and ".
" (a.role='testnode' and t.isremotenode=0)");
" (a.role='testnode' and (t.isremotenode=0 or ".
" dedicated_wa_types.attrvalue=1))");
#
# Scan the results, checking permissions and adding to the list
......@@ -683,11 +691,11 @@ if ($widearea) {
#
# Note - there is currently an assumption in this query that widearea nodes
# have only one interface.
# have only one control interface.
#
$result =
DBQueryFatal("select n.node_id,nt.type,ns.status,r.pid,r.eid,wn.site,".
"i.card,i.port,i.iface,wn.bwlimit ".
"i.iface,wn.bwlimit ".
"from nodes as n ".
"left join node_types as nt on nt.type=n.type ".
"left join reserved as r on r.node_id=n.node_id ".
......@@ -695,12 +703,19 @@ if ($widearea) {
"left join widearea_nodeinfo as wn on ".
" wn.node_id=n.node_id ".
"left join interfaces as i on ".
" n.node_id=i.node_id ".
" n.node_id=i.node_id and ".
" i.role='" . TBDB_IFACEROLE_CONTROL() . "' ".
"left outer join ".
" (select type,attrvalue ".
" from node_type_attributes ".
" where attrkey='dedicated_widearea' ".
" group by type) as dedicated_wa_types ".
" on nt.type=dedicated_wa_types.type ".
"where (n.role='testnode' and nt.isremotenode=1 and ".
" nt.isvirtnode=0)");
" nt.isvirtnode=0 and ".
" dedicated_wa_types.attrvalue is NULL)");
while (($physnode,$ptype,$status,$mpid,$meid,$site,$card,$port,$iface,
$bwlimit)
while (($physnode,$ptype,$status,$mpid,$meid,$site,$iface,$bwlimit)
= $result->fetchrow_array) {
my $class = $typemap{$ptype}->{'CLASS'};
my @types;
......@@ -817,6 +832,9 @@ if ($widearea) {
join(" ",@inet_protos). "\n";
}
}
# Insert into nodes array in case there are wires entries.
$nodes{$physnode} = $ptype;
}
}
......@@ -873,6 +891,7 @@ while (($node1,$card1,$port1,$node2,$card2,$port2) =
$result->fetchrow_array) {
if ((defined($nodes{$node1}) || defined($switches{$node1})) &&
(defined($nodes{$node2}) || defined($switches{$node2}))) {
# Types for this link - for the time being, we assume that all
# links are Ethernet, though this will certaily change later.
......@@ -1043,9 +1062,13 @@ foreach my $interface (keys(%interfacetypes)) {
my ($node,$card,$port) = split(":", $interface);
next
if (!defined($nodes{$node}));
if (!defined($nodes{$node}));;
my $type = $interfacetypes{$interface};
next
if (!defined($interfaceprotocols{$type}));
my @protos = @{ $interfaceprotocols{$type} };
my $iface = get_iface($node,$card,$port);
......
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