Commit d564e0fb authored by Leigh Stoller's avatar Leigh Stoller

Allow slightly altered tb-fix-node syntax for creating jails on local

nodes. The second argument can now be an NS node instead of the name
of a real testbed node. For example:

	tb-set-hardware $node3  pc600
	tb-set-hardware $nodev1 pcvm600
	tb-fix-node $nodev1 $node3

So, "fix" $nodev1 to $node3. The intent is that once $node3 is
allocated by assign to a real testbed node, we can then allocate a
virtual node on pcXX to $nodev1. I did this primarily to allow for
easy testing of jails via my NS file, without having to hack assign
wrapper to deeply. Note there are still hacks in assign_wrapper to
support this, but they are not extensive.

Also my old usewatunnels stuff I never checked in:

	tb-set-usewatunnels 0/1
parent 84f2b79a
......@@ -49,6 +49,9 @@ Node instproc init {s} {
# Is remote flag. Used when we do IP assignment later.
$self set isremote 0
# Sorta ditto for virt.
$self set isvirt 0
# If osid remains blank when updatedb is called it is changed
# to the default OS based on it's type (taken from node_types
# table).
......@@ -243,14 +246,16 @@ Node instproc add-route {dst nexthop} {
}
#
# Set the type/isremote for a node. Called from tb_compat.
# Set the type/isremote/isvirt for a node. Called from tb_compat.
#
Node instproc set_hwtype {hwtype isrem} {
Node instproc set_hwtype {hwtype isrem isv} {
$self instvar type
$self instvar isremote
$self instvar isvirt
set type $hwtype
set isremote $isrem
set isvirt $isv
}
#
......
......@@ -34,6 +34,7 @@ proc tb-make-hard-vtype {name types} {}
proc tb-set-lan-simplex-params {lan node todelay tobw toloss fromdelay frombw fromloss} {}
proc tb-set-link-simplex-params {link src delay bw loss} {}
proc tb-set-uselatestwadata {onoff} {}
proc tb-set-usewatunnels {onoff} {}
proc tb-set-wasolver-weights {delay bw plr} {}
Class Program
......
......@@ -196,6 +196,9 @@ namespace eval GLOBALS {
# For remote nodes. Use latest widearea data.
variable uselatestwadata 0
# For remote nodes. Use tunnels
variable usewatunnels 1
# For remote nodes. The solver weights.
variable wa_delay_solverweight 1
variable wa_bw_solverweight 7
......
......@@ -211,6 +211,7 @@ Simulator instproc run {} {
var_import ::GLOBALS::impotent
var_import ::GLOBALS::vtypes
var_import ::GLOBALS::uselatestwadata
var_import ::GLOBALS::usewatunnels
var_import ::GLOBALS::wa_delay_solverweight
var_import ::GLOBALS::wa_bw_solverweight
var_import ::GLOBALS::wa_plr_solverweight
......@@ -294,7 +295,7 @@ Simulator instproc run {} {
$prog updatedb $DB
}
sql exec $DB "update experiments set uselatestwadata=$uselatestwadata,wa_delay_solverweight=$wa_delay_solverweight,wa_bw_solverweight=$wa_bw_solverweight,wa_plr_solverweight=$wa_plr_solverweight where pid='$pid' and eid='$eid'"
sql exec $DB "update experiments set usewatunnels=$usewatunnels,uselatestwadata=$uselatestwadata,wa_delay_solverweight=$wa_delay_solverweight,wa_bw_solverweight=$wa_bw_solverweight,wa_plr_solverweight=$wa_plr_solverweight where pid='$pid' and eid='$eid'"
sql endquery $DB
foreach event $event_list {
......
......@@ -51,28 +51,34 @@ namespace eval TBCOMPAT {
# Let's set up a hwtypes table that contains all valid hardware types.
variable hwtypes
variable isremote
sql query $DB "select type,isremotenode from node_types"
variable isvirt
sql query $DB "select type,isremotenode,isvirtnode from node_types"
while {[set row [sql fetchrow $DB]] != ""} {
set type [lindex $row 0]
set isrem [lindex $row 1]
set isv [lindex $row 2]
set hwtypes($type) 1
set isremote($type) $isrem
set isvirt($type) $isv
}
sql endquery $DB
sql query $DB "select class,isremotenode from node_types"
sql query $DB "select class,isremotenode,isvirtnode from node_types"
while {[set row [sql fetchrow $DB]] != ""} {
set type [lindex $row 0]
set isrem [lindex $row 1]
set isv [lindex $row 2]
set hwtypes($type) 1
set isremote($type) $isrem
set isvirt($type) $isv
}
sql endquery $DB
# NSE hack: sim type is not in DB. Just adding it now
set hwtypes(sim) 1
set isremote(sim) 0
set isvirt(sim) 0
# The permissions table. Entries in this table indicate who is allowed
# to use nodes of a particular type. No entries means anyone can use it.
......@@ -151,6 +157,7 @@ proc tb-set-ip-link {src link ip} {
proc tb-set-hardware {node type args} {
var_import ::TBCOMPAT::hwtypes
var_import ::TBCOMPAT::isremote
var_import ::TBCOMPAT::isvirt
var_import ::GLOBALS::vtypes
if {(! [info exists hwtypes($type)]) &&
(! [info exists vtypes($type)])} {
......@@ -179,7 +186,11 @@ proc tb-set-hardware {node type args} {
if {[info exists isremote($type)]} {
set remote $isremote($type)
}
$node set_hwtype $type $remote
set isv 0
if {[info exists isvirt($type)]} {
set isv $isvirt($type)
}
$node set_hwtype $type $remote $isv
}
proc tb-set-node-os {node os} {
......@@ -515,6 +526,17 @@ proc tb-set-uselatestwadata {onoff} {
set uselatestwadata $onoff
}
proc tb-set-usewatunnels {onoff} {
var_import ::GLOBALS::usewatunnels
if {$onoff != 0 && $onoff != 1} {
perror "\[tb-set-usewatunnels] $onoff must be 0/1"
return
}
set usewatunnels $onoff
}
proc tb-set-wasolver-weights {delay bw plr} {
var_import ::GLOBALS::wa_delay_solverweight
var_import ::GLOBALS::wa_bw_solverweight
......
......@@ -122,8 +122,22 @@ Agent instproc updatedb {DB} {
set target_port [$destination set port]
# At some point allow users to set link. For now, first link (0).
set ip [$node ip 0]
set target_ip [$target_vnode ip 0]
# XXX Hack for local virtual nodes. Eventually use ipinip tunnels,
# but for now just send over the existing link.
if { [$node set isvirt] == 1 &&
[$node set isremote] == 0 } {
set foo [$node set fixed]
set ip [$foo ip 0]
} else {
set ip [$node ip 0]
}
if { [$target_vnode set isvirt] == 1 &&
[$target_vnode set isremote] == 0 } {
set foo [$target_vnode set fixed]
set target_ip [$foo ip 0]
} else {
set target_ip [$target_vnode ip 0]
}
if {$role == "sink"} {
set application $self
......
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