Commit 7d3fab8c authored by Christopher Alfeld's avatar Christopher Alfeld

postparse.tcl - Added code to parse set-link-loss command.

parent 76d2a4e7
......@@ -14,7 +14,7 @@ source $scriptdir/../ir/libir.tcl
namespace import TB_LIBIR::ir
if {$argc != 2} {
puts "usage: $argv ns_file ir_file"
puts "usage: $argv0 ns_file ir_file"
exit 1
}
......@@ -37,6 +37,11 @@ while {[gets $nsFP line] >= 0} {
set type [lindex $line 3]
# XXX currently only shark-shelf supported
set hwtype($node) $type
} elseif {$cmd == "set-link-loss"} {
set src [lindex $line 2]
set dst [lindex $line 3]
set loss [lindex $line 4]
set linkloss($src:$dst) $loss
}
}
}
......@@ -55,5 +60,19 @@ foreach node $nodes {
}
ir set /topology/nodes $newnodes
set links [ir get /topology/links]
set newlinks {}
foreach link $links {
set src [lindex $link 1]
set dst [lindex $link 3]
if {[info exists linkloss($src:$dst)]} {
lappend newlinks [concat $link $linkloss($src:$dst)]
} else {
lappend newlinks [concat $link 0.0]
}
}
ir set /topology/links $newlinks
ir write $irfile
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