Commit a9acd6e9 authored by Christopher Alfeld's avatar Christopher Alfeld
Browse files

Improved output.

parent c36031fd
#!/usr/local/bin/tclsh
proc outs {args} {
global logFp
if {[llength $args] == 1} {
set out stdout
set s [lindex $args 0]
} else {
set out [lindex $args 0]
set s [lindex $args 1]
}
puts $out $s
puts $logFp $s
}
if {[file dirname [info script]] == "."} {
set updir ".."
} else {
......@@ -24,35 +38,37 @@ if {[catch "open $logFile w" logFp]} {
exit 1
}
puts "Input: $nsFile"
puts "Output: $irFile"
puts "Log: $logFile"
outs "Input: $nsFile"
outs "Output: $irFile"
outs "Log: $logFile"
outs ""
outs "Beginning Testbed pre run for $nsFile. [clock format [clock seconds]]"
if {! [file exists $nsFile]} {
puts stderr "$nsFile does not exist"
outs stderr "$nsFile does not exist"
exit 1
}
puts "Parsing ns input."
outs "Parsing ns input."
if {[catch "exec $ns2ir $nsFile $irFile >@ $logFp 2>@ $logFp" err]} {
puts stderr "Error parsing ns input. ($err)"
outs stderr "Error parsing ns input. ($err)"
exit 1
}
if {! [file exists $irFile]} {
puts stderr "$irFile not generated. Make sure you have a 'run' command in your ns file."
outs stderr "$irFile not generated. Make sure you have a 'run' command in your ns file."
exit 1
}
puts "PLACEHOLDER - Determining available resources."
outs "PLACEHOLDER - Determining available resources."
puts "Allocating resources - This may take a while."
outs "Allocating resources - This may take a while."
if {[catch "exec $assign $irFile >@ $logFp 2>@ $logFp" err]} {
puts stderr "Error allocating resources. ($err)"
outs stderr "Error allocating resources. ($err)"
exit 1
}
puts "PLACEHODLER - Reserving resources."
outs "PLACEHODLER - Reserving resources."
puts "Setup finished - $irFile generated."
outs "Setup finished - $irFile generated."
#!/usr/local/bin/tclsh
proc outs {args} {
global logFp
if {[llength $args] == 1} {
set out stdout
set s [lindex $args 0]
} else {
set out [lindex $args 0]
set s [lindex $args 1]
}
puts $out $s
puts $logFp $s
}
if {[file dirname [info script]] == "."} {
set updir ".."
} else {
......@@ -17,32 +32,34 @@ set t [split $nsFile .]
set prefix [join [lrange $t 0 [expr [llength $t] - 2]] .]
set logFile "$prefix.log"
if {[catch "open $logFile w" logFp]} {
if {[catch "open $logFile a+" logFp]} {
puts stderr "Could not open $logFile for writing."
exit 1
}
puts "Input: $irFile"
puts "Log: $logFile"
outs "Input: $irFile"
outs "Log: $logFile"
if {! [file exists $irFile]} {
puts stderr "$irFile does not exist"
outs stderr "$irFile does not exist"
exit 1
}
puts "Setting up VLANs"
outs "Beginning Testbed run for $irFile. [clock format [clock seconds]]"
outs "Setting up VLANs"
if {[catch "exec $snmpit $irFile >@ $logFp 2>@ $logFp" err]} {
puts stderr "Error running $smpit. ($err)"
outs stderr "Error running $smpit. ($err)"
exit 1
}
puts "PLACEHOLDER - Verifying virtual network."
puts "PLACEHOLDER - Copying disk images."
puts "PLACEHOLDER - Booting for the first time."
puts "PLACEHOLDER - Verifyin OS functionality."
puts "PLACEHOLDER - Setting up interfaces."
puts "PLACEHOLDER - Installing secondary pacakages."
puts "PLACEHOLDER - Rebooting."
puts "Testbed ready for use."
outs "PLACEHOLDER - Verifying virtual network."
outs "PLACEHOLDER - Copying disk images."
outs "PLACEHOLDER - Booting for the first time."
outs "PLACEHOLDER - Verifyin OS functionality."
outs "PLACEHOLDER - Setting up interfaces."
outs "PLACEHOLDER - Installing secondary pacakages."
outs "PLACEHOLDER - Rebooting."
outs "Testbed ready for use."
Supports Markdown
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