Commit 45e5e3c7 authored by Leigh Stoller's avatar Leigh Stoller

Small hack requested by Jay to aid in creating wireless nodes; added

new directive for your NS file: tb-use-physnaming(1) which means that
if you have a line like this:

	set pc6 [$ns node]

and pc6 is an actual name of a physical node, then do an implicit
"fixnode" to pc6. In other words, pc6 is the name of the node in your
NS file (virtual topo) *and* will be fixed to the real pc6. Needless
to say, if pc6 is allocated when you go to swapin, you lose.
parent b92848e9
......@@ -132,6 +132,8 @@ Node instproc updatedb {DB} {
$self instvar nseconfig
$self instvar simulated
var_import ::TBCOMPAT::default_osids
var_import ::GLOBALS::use_physnaming
var_import ::TBCOMPAT::physnodes
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
var_import ::GLOBALS::default_ip_routing_type
......@@ -168,6 +170,13 @@ Node instproc updatedb {DB} {
set fixed "host-$self"
}
# Implicitly fix node if not already fixed.
if { $issubnode == 0 && $use_physnaming == 1 && $fixed == "" } {
if {[info exists physnodes($self)]} {
set fixed $self
}
}
# We need to generate the IP column from our iplist.
set ipraw {}
set i 0
......
......@@ -451,6 +451,17 @@ sub GenDefsFile($)
}
}
print TCL "# Physical Node Names\n";
$query_result =
DBQueryFatal("select n.node_id,nt.type from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"where n.node_id=n.phys_nodeid and nt.isremotenode=0 ".
"and n.role='testnode' and nt.type!='dnard'");
while (($node_id,$type) = $query_result->fetchrow_array()) {
print TCL "set physnodes($node_id) \"$type\"\n";
}
print TCL "}\n";
close(TCL);
}
......@@ -245,6 +245,9 @@ namespace eval GLOBALS {
# Allow override of jail and delay osids.
variable jail_osname {}
variable delay_osname {}
# Use phys naming
variable use_physnaming 0
}
# Load all our classes
......
......@@ -95,7 +95,7 @@ Simulator instproc node {args} {
# that already have FBSD-NSE as the default
# boot osid over others
$curnode add-desire "FBSD-NSE" 0.9
}
}
set node_list($curnode) {}
set last_class $curnode
......
......@@ -87,6 +87,9 @@ namespace eval TBCOMPAT {
variable reserved_type
variable reserved_node
set reserved_list {}
# Physical node names
variable physnodes
}
# IP addresses routines. These all do some checks and convert into set-ip
......@@ -818,3 +821,14 @@ proc tb-set-node-lan-setting {lanlink node capkey capval} {
}
$lanlink set_member_setting $node $capkey $capval
}
#
# Turn on or of the use of phys naming; if the user name for the node
# matches a real node in the testbed, do an implicit fix-node to it.
#
proc tb-use-physnaming {onoff} {
var_import ::GLOBALS::use_physnaming
set use_physnaming $onoff
}
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