All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 7bdaf14f authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add queue objects to lan nodes. Also add a second hack class (LLink)

that allows the user to get a handle on that queue object so it
can be changed. Add a routine (lanlink) to the sim class that operates
much like link command (gets the hack class, which in turn is used to
get the queue object).

Note, there needs to be some work done in the event parser in sim.tcl
to deal with lan queues (assumed to be link queues). I'll take care of
that later.
parent 4662c733
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -22,6 +22,8 @@ Class Queue -superclass NSObject
# This class is a hack. It's sole purpose is to associate to a Link
# and a direction for accessing the Queue class.
Class SimplexLink -superclass NSObject
# Ditto, another hack class.
Class LLink -superclass NSObject
SimplexLink instproc init {link dir} {
$self set mylink $link
......@@ -32,6 +34,18 @@ SimplexLink instproc queue {} {
$self instvar mydir
return [$mylink set ${mydir}queue]
}
LLink instproc init {lan node} {
$self set mylan $lan
$self set mynode $node
}
LLink instproc queue {} {
$self instvar mylan
$self instvar mynode
set port [$mylan get_port $mynode]
return [$mylan set linkq([list $mynode $port])]
}
# Don't need any rename procs since these never use their own name and
# can not be generated during Link creation.
......@@ -125,6 +139,8 @@ Link instproc init {s nodes bw d type} {
}
LanLink instproc init {s nodes bw d type} {
var_import GLOBALS::new_counter
# This is a list of {node port} pairs.
$self set nodelist {}
......@@ -170,6 +186,7 @@ LanLink instproc init {s nodes bw d type} {
$self instvar loss
$self instvar rloss
$self instvar cost
$self instvar linkq
foreach node $nodes {
set nodepair [list $node [$node add_lanlink $self]]
......@@ -181,6 +198,10 @@ LanLink instproc init {s nodes bw d type} {
set rloss($nodepair) 0
set cost($nodepair) 1
lappend nodelist $nodepair
set lq q[incr new_counter]
Queue lq$lq $self $type to
set linkq($nodepair) lq$lq
}
}
......@@ -398,6 +419,54 @@ Link instproc updatedb {DB} {
}
}
Lan instproc updatedb {DB} {
$self next $DB
$self instvar nodelist
$self instvar linkq
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
foreach nodeport $nodelist {
set linkqueue $linkq($nodeport)
set limit_ [$linkqueue set limit_]
set maxthresh_ [$linkqueue set maxthresh_]
set thresh_ [$linkqueue set thresh_]
set q_weight_ [$linkqueue set q_weight_]
set linterm_ [$linkqueue set linterm_]
set queue-in-bytes_ [$linkqueue set queue-in-bytes_]
if {${queue-in-bytes_} == "true"} {
set queue-in-bytes_ 1
} elseif {${queue-in-bytes_} == "false"} {
set queue-in-bytes_ 0
}
set bytes_ [$linkqueue set bytes_]
if {$bytes_ == "true"} {
set bytes_ 1
} elseif {$bytes_ == "false"} {
set bytes_ 0
}
set mean_pktsize_ [$linkqueue set mean_pktsize_]
set red_ [$linkqueue set red_]
if {$red_ == "true"} {
set red_ 1
} elseif {$red_ == "false"} {
set red_ 0
}
set gentle_ [$linkqueue set gentle_]
if {$gentle_ == "true"} {
set gentle_ 1
} elseif {$gentle_ == "false"} {
set gentle_ 0
}
set wait_ [$linkqueue set wait_]
set setbit_ [$linkqueue set setbit_]
set droptail_ [$linkqueue set drop-tail_]
set nodeportraw [join $nodeport ":"]
sql exec $DB "update virt_lans set q_limit=$limit_, q_maxthresh=$maxthresh_, q_minthresh=$thresh_, q_weight=$q_weight_, q_linterm=$linterm_, q_qinbytes=${queue-in-bytes_}, q_bytes=$bytes_, q_meanpsize=$mean_pktsize_, q_wait=$wait_, q_setbit=$setbit_, q_droptail=$droptail_, q_red=$red_, q_gentle=$gentle_ where pid=\"$pid\" and eid=\"$eid\" and vname=\"$self\" and member=\"$nodeportraw\""
}
}
# updatedb DB
# This adds a row to the virt_lans table.
LanLink instproc updatedb {DB} {
......
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -121,6 +121,10 @@ Simulator instproc duplex-link {n1 n2 bw delay type args} {
perror "\[duplex-link] $n2 is not a node."
set error 1
}
# if { [$n1 set isvirt] != [$n2 set isvirt] } {
# perror "\[duplex-link] Bad link between real and virtual node!"
# set error 1
# }
if { $simulated == 1 && ( [$n1 set simulated] == 0 || [$n2 set simulated] == 0 ) } {
set simulated 0
......@@ -160,6 +164,24 @@ Simulator instproc make-lan {nodelist bw delay args} {
punsup "Arguments for make-lan: $args"
}
#
# The number of virtual nodes has to be zero, or equal to the number
# of nodes (In other word, no mixing of real and virtual nodes).
#
# set acount 0
# set vcount 0
# foreach node $nodelist {
# if { [$node set isvirt] } {
# incr vcount
# }
# incr acount
# }
# if { ($vcount != 0) && ($vcount != $acount) } {
# perror "\[duplex-link] Bad lan between real and virtual nodes!"
# set error 1
# return ""
# }
# At this point we have one of the nodes of
# the lan to be real. We need to make sure
# that this is not being defined in make-simulated.
......@@ -215,6 +237,8 @@ Simulator instproc run {} {
var_import ::GLOBALS::wa_delay_solverweight
var_import ::GLOBALS::wa_bw_solverweight
var_import ::GLOBALS::wa_plr_solverweight
var_import ::GLOBALS::uselinkdelays
var_import ::GLOBALS::forcelinkdelays
# Fill out IPs
foreach obj [concat [array names lanlink_list]] {
......@@ -295,7 +319,7 @@ Simulator instproc run {} {
$prog updatedb $DB
}
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 exec $DB "update experiments set forcelinkdelays=$forcelinkdelays,uselinkdelays=$uselinkdelays,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 {
......@@ -701,6 +725,26 @@ Simulator instproc link {src dst} {
return [SimplexLink $name $reallink $dir]
}
Simulator instproc lanlink {lan node} {
if {[$node info class] != "Node"} {
perror "\[lanlink] $node is not a node."
return
}
if {[$lan info class] != "Lan"} {
perror "\[lanlink] $lan is not a lan."
return
}
set port [$lan get_port $node]
if {$port == {}} {
perror "\[lanlink] $node is not in $lan."
return
}
var_import GLOBALS::new_counter
set name ll[incr new_counter]
return [LLink $name $lan $node]
}
# get_subnet
# This is called by lanlinks. When called get_subnet will find an available
# IP subnet, mark it as used, and return it to the caller.
......
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