Commit 24e8df06 authored by Robert Ricci's avatar Robert Ricci

Put a fake 'LAN' called 'internet' into the ptop file for widearea

nodes, and include the code necessary in the parser and assign_wrapper
to handle this.

The idea is to be able to talk about 'internet' on PlanetLab nodes - ie.
to request link tracing on it.
parent ffa25d91
...@@ -451,6 +451,9 @@ sub physnodeinterface($$) { return $phys_node_interfaces{$_[0]}{$_[1]}; } ...@@ -451,6 +451,9 @@ sub physnodeinterface($$) { return $phys_node_interfaces{$_[0]}{$_[1]}; }
sub physinterfacetype($$) { sub physinterfacetype($$) {
return $phys_node_interfaces{$_[0]}{$_[1]}{"interface_type"}; return $phys_node_interfaces{$_[0]}{$_[1]}{"interface_type"};
} }
sub physinterfacerole($$) {
return $phys_node_interfaces{$_[0]}{$_[1]}{"role"};
}
# #
# More physical side data structures. # More physical side data structures.
...@@ -2288,11 +2291,21 @@ foreach $vnodeport (keys(%portmap)) { ...@@ -2288,11 +2291,21 @@ foreach $vnodeport (keys(%portmap)) {
if (! defined($IPaliases{"$pnode:$pport"})) { if (! defined($IPaliases{"$pnode:$pport"})) {
printdb("IP: $pnode:$pport $ip\n"); printdb("IP: $pnode:$pport $ip\n");
DBQueryFatal("update interfaces set ". #
" IP='$ip',IPaliases=NULL,mask='$mask',". # Never update control net interfaces. This is so that we can
" vnode_id=$vvnode,rtabid='$rtabid' ". # consider them for mapping purposes (ie. PlanetLab), but don't
"where node_id='$pnode' and iface='$pport'"); # have to worry about their IPs getting changed, since that's
$IPaliases{"$pnode:$pport"} = 1; # important persistent state!
#
if (physinterfacerole($pnode,$pport) != TBDB_IFACEROLE_CONTROL) {
printdb("Not setting IP for control interface: $pnode:$pport\n");
} else {
DBQueryFatal("update interfaces set ".
" IP='$ip',IPaliases=NULL,mask='$mask',".
" vnode_id=$vvnode,rtabid='$rtabid' ".
"where node_id='$pnode' and iface='$pport'");
$IPaliases{"$pnode:$pport"} = 1;
}
} }
else { else {
printdb("IP: $pnode:$pport $ip (alias)\n"); printdb("IP: $pnode:$pport $ip (alias)\n");
...@@ -3500,12 +3513,17 @@ sub LoadPhysInfo() ...@@ -3500,12 +3513,17 @@ sub LoadPhysInfo()
# #
# Now get interface speeds for each type/class. We use this for determining # Now get interface speeds for each type/class. We use this for determining
# if a delay node is required. Very hacky, quite wrong. # if a delay node is required. Very hacky, quite wrong.
# XXX: PlanetLab hack - PlanetLab 'control' interfaces are also
# 'experimental' interfaces! We probably need a way to express this in the
# interfaces table or interface_types
# #
$query_result = $query_result =
DBQueryFatal("select distinct i.interface_type,n.type ". DBQueryFatal("select distinct i.interface_type,n.type ".
" from interfaces as i ". " from interfaces as i ".
"left join nodes as n on n.node_id=i.node_id ". "left join nodes as n on n.node_id=i.node_id ".
"where i.role='" . TBDB_IFACEROLE_EXPERIMENT . "'"); "where i.role='" . TBDB_IFACEROLE_EXPERIMENT . "' ".
" or (n.type='pcplabphys' and i.role='" .
TBDB_IFACEROLE_CONTROL . "')");
# XXX Special hack for sim nodes. # XXX Special hack for sim nodes.
$node_type_linkbw{"sim"} = {}; $node_type_linkbw{"sim"} = {};
......
...@@ -397,7 +397,8 @@ LanLink instproc fill_ips {} { ...@@ -397,7 +397,8 @@ LanLink instproc fill_ips {} {
} }
} }
if {$isremote && [$self info class] != "Link"} { if {$isremote && [$self info class] != "Link"} {
perror "Not allowed to use a remote node in lan $self!" puts stderr "Warning: Remote nodes used in LAN $self - no IPs assigned"
#perror "Not allowed to use a remote node in lan $self!"
return return
} }
set widearea $isremote set widearea $isremote
......
...@@ -622,18 +622,35 @@ foreach $node (keys(%nodes)) { ...@@ -622,18 +622,35 @@ foreach $node (keys(%nodes)) {
# physnode. # physnode.
# #
if ($widearea) { if ($widearea) {
#
# Set up 'the Internet' as a fake switch that all widearea nodes can
# talk to.
# Some day, it may make sense to connect control net ports to this
# switch.
#
my $fake_inet_switch = "internet";
my @inet_protos = ("ipv4");
print "node $fake_inet_switch ", join(" ",map("*$_:*",@inet_protos)), "\n";
#
# Note - there is currently an assumption in this query that widearea nodes
# have only one interface.
#
$result = $result =
DBQueryFatal("select n.node_id,nt.type,ns.status,r.pid,r.eid,wn.site ". DBQueryFatal("select n.node_id,nt.type,ns.status,r.pid,r.eid,wn.site,".
"i.card,i.port,i.iface ".
"from nodes as n ". "from nodes as n ".
"left join node_types as nt on nt.type=n.type ". "left join node_types as nt on nt.type=n.type ".
"left join reserved as r on r.node_id=n.node_id ". "left join reserved as r on r.node_id=n.node_id ".
"left join node_status as ns on ns.node_id=n.node_id ". "left join node_status as ns on ns.node_id=n.node_id ".
"left join widearea_nodeinfo as wn on ". "left join widearea_nodeinfo as wn on ".
" wn.node_id=n.node_id ". " wn.node_id=n.node_id ".
"left join interfaces as i on ".
" n.node_id=i.node_id ".
"where (n.role='testnode' and nt.isremotenode=1 and ". "where (n.role='testnode' and nt.isremotenode=1 and ".
" nt.isvirtnode=0)"); " nt.isvirtnode=0)");
while (($physnode,$ptype,$status,$mpid,$meid,$site) while (($physnode,$ptype,$status,$mpid,$meid,$site,$card,$port,$iface)
= $result->fetchrow_array) { = $result->fetchrow_array) {
my $class = $typemap{$ptype}->{'CLASS'}; my $class = $typemap{$ptype}->{'CLASS'};
my @types; my @types;
...@@ -697,6 +714,18 @@ if ($widearea) { ...@@ -697,6 +714,18 @@ if ($widearea) {
" - " . join(" ",@flags); " - " . join(" ",@flags);
print "$text\n"; print "$text\n";
#
# Print out a link to the 'internet'.
# Note - we make up a fake bandwidth. In the future, maybe we
# could put something real in there.
#
if ($iface) {
print "link link-$physnode:$iface-$fake_inet_switch:(null) ".
"$physnode:$physnode/$iface $fake_inet_switch:(null) " .
"100000 0 0 1 ".
join(" ",@inet_protos). "\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