[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Patch for MNS2.0
Gaiel, all,
I start playing with MNS2.0 and found some bugs (well, actually code
cruft). I know MNS2.0 per se is out of the main ns branch so this
might be considered off-topic (*ahem* Btw how many MPLS code forks we
have ? *ahem*). Still, it may be intresting for people playing w/ MPLS
stuff on top of ns.
So, here's the scoop:
- In "test-constraint-routing.tcl" the line
$ns duplex-link $LSR1 $LSR2 1Mb 10ms CBQ
is duplicated. Pick your favourite and zap the other one.
- In "ns-mpls-cr.tcl" there is cruft code that loops uselessly through
all neighbors for all LSRs. The patch (in unified diff format) that
cleans up that cruft is attached as text at the end of this mail.
"Just for the archives" (tm).
Enjoy. Comments and reports are welcome, use at own risk, yadda-yadda,
Florian
--- ns-mpls-cr.tcl Thu Jun 14 20:13:53 2001
+++ my-ns-mpls-cr.tcl Thu Jun 14 20:11:13 2001
@@ -312,7 +312,7 @@
global TE_DB
set dbptr [open ./te.db w]
-
+
set len [llength $allnodes]
for { set i 0 } { $i < $len } { incr i 1 } {
for { set j 0 } { $j < $len } { incr j 1 } {
@@ -332,7 +332,7 @@
Simulator instproc collect-resource-info {interval} {
set dbptr [open ./te.db w]
-
+
set allnodes [$self set linked_mplsnodes_]
set len [llength $allnodes]
@@ -343,32 +343,24 @@
for { set j 0 } { $j < $len } { incr j 1 } {
- set node1 [lindex $allnodes $i]
set node2 [lindex $allnodes $j]
if { $i == $j } {
puts $dbptr 0
} else {
- set nlen [llength $neighbor]
- for { set k 0 } { $k < $nlen } { incr k 1 } {
- set n [lsearch $neighbor [lindex $allnodes $j]]
-
- if { $n >= 0} {
- set linkptr [$node1 get-link-ptr $node2]
+ set n [lsearch $neighbor [lindex $allnodes $j]]
+ if { $n >= 0} {
+ set linkptr [$me get-link-ptr $node2]
puts $dbptr [$linkptr get-usable-bw]
- break
- }
- }
- if {$k ==$nlen} {
- puts $dbptr 1000
- }
- }
+ } else {
+ puts $dbptr 1000
+ }
+ }
}
}
flush $dbptr
close $dbptr
-
set now [$self now]
$self at [expr $now + $interval] "$self collect-resource-info $interval"
}
@@ -380,6 +372,7 @@
if { [$classifier_ set is_cbq_installed_] != 1 } {
exit
}
+
set ns [Simulator instance]
set allnodes [$ns set linked_mplsnodes_]
set er [$ns get-qos-path $allnodes [$self id] $dst $bw]