Problem in running TCL Code
[email protected] Sun, 03 Jan 2016 22:57:15 -0500
| Newsgroups | gmane.network.simulator.isi |
|---|---|
| Message-ID | <[email protected]> |
Dear Users!
I am running the attached tcl as an mpls script where i am trying to
simulate a topology.I am getting the undermentioned error!
can somebody help me!
ns: _o53 routing-nochange 15 0.0620372786541084: can't schedule command
in past
(_o493 cmd line 1)
invoked from within
"_o493 cmd at 0.0620372786541084 {_o52 ldp-trigger-by-routing-table}"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o493" line 2)
(SplitObject unknown line 2)
invoked from within
"_o493 at 0.0620372786541084 {_o52 ldp-trigger-by-routing-table}"
("eval" body line 1)
invoked from within
"eval $scheduler_ at $args"
(procedure "_o3" line 3)
(Simulator at line 3)
invoked from within
"[Simulator instance] at $time "$mpls_mod_
ldp-trigger-by-routing-table""
(procedure "_o53" line 12)
(Classifier/Addr/MPLS routing-nochange line 12)
invoked from within
"_o53 routing-nochange 15 0.0620372786541084"
Regards!
makam6node.tcl
(text/x-pascal, 6.9 KB)
set ns [new Simulator]
set nf [open makam6node.nam w]
$ns namtrace-all $nf
set f0 [open makam6node.tr w]
$ns trace-all $f0
proc finish {} {
global ns nf f0
$ns flush-trace
close $nf
close $f0
exec nam makam6node.nam &
exit 0
}
$ns rtproto DV
set Node0 [$ns node]
$ns node-config -MPLS ON
set LSR1 [$ns node]
set LSR2 [$ns node]
set LSR3 [$ns node]
set LSR4 [$ns node]
set LSR5 [$ns node]
set LSR6 [$ns node]
set LSR7 [$ns node]
set LSR8 [$ns node]
set LSR9 [$ns node]
set LSR10 [$ns node]
set LSR11 [$ns node]
set LSR12 [$ns node]
set LSR13 [$ns node]
set LSR14 [$ns node]
#set LSR15 [$ns node]
$ns node-config -MPLS OFF
set Node15 [$ns node]
$ns duplex-link $Node0 $LSR1 1Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 1Mb 10ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 10ms DropTail
#$ns duplex-link $LSR3 $LSR4 1Mb 10ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 10ms DropTail
$ns duplex-link $LSR4 $LSR6 1Mb 10ms DropTail
#$ns duplex-link $LSR5 $LSR6 1Mb 10ms DropTail
$ns duplex-link $LSR5 $LSR7 1Mb 10ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 10ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 10ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 10ms DropTail
$ns duplex-link $LSR8 $LSR10 1Mb 10ms DropTail
$ns duplex-link $LSR9 $LSR11 1Mb 10ms DropTail
$ns duplex-link $LSR10 $LSR12 1Mb 10ms DropTail
$ns duplex-link $LSR11 $LSR12 1Mb 10ms DropTail
#$ns duplex-link $LSR11 $Node13 1Mb 10ms DropTail
$ns duplex-link $LSR11 $LSR13 1Mb 10ms DropTail
$ns duplex-link $LSR12 $LSR14 1Mb 10ms DropTail
$ns duplex-link $LSR13 $LSR14 1Mb 10ms DropTail
$ns duplex-link $LSR14 $Node15 1Mb 10ms DropTail
#$ns duplex-link $LSR12 $LSR14 1Mb 10ms DropTail
#$ns duplex-link $LSR613 $LSR14 1Mb 10ms DropTail
#$ns duplex-link $LSR12 $LSR13 1Mb 10ms DropTail
#$ns duplex-link $LSR13 $Node14 1Mb 10ms DropTail
#$ns duplex-link $LSR15 $Node16 1Mb 10ms DropTail
for {set i 1} {$i < 15} {incr i} {
set a LSR$i
for {set j [expr $i+1]} {$j < 15} {incr j} {
set b LSR$j
eval $ns LDP-peer $$a $$b
}
set m [eval $$a get-module "MPLS"]
$m enable-reroute "new"
}
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color yellow
[$LSR1 get-module "MPLS"] enable-control-driven
[$LSR2 get-module "MPLS"] enable-control-driven
[$LSR3 get-module "MPLS"] enable-control-driven
[$LSR4 get-module "MPLS"] enable-control-driven
[$LSR5 get-module "MPLS"] enable-control-driven
[$LSR6 get-module "MPLS"] enable-control-driven
[$LSR7 get-module "MPLS"] enable-control-driven
[$LSR8 get-module "MPLS"] enable-control-driven
Classifier/Addr/MPLS set control_driven_ 1
Classifier/Addr/MPLS enable-on-demand
Classifier/Addr/MPLS enable-ordered-control
Agent/LDP set trace_ldp_ 1
Classifier/Addr/MPLS set trace_mpls_ 1
$ns use-scheduler List
proc attach-expoo-traffic { node sink size burst idle rate } {
global ns
set udp [new Agent/UDP]
$ns attach-agent $node $udp
set traffic [new Application/Traffic/Exponential]
$traffic set packetSize_ $size
$traffic set burst_time_ $burst
$traffic set idle_time_ $idle
$traffic set rate_ $rate
$traffic attach-agent $udp
$ns connect $udp $sink
return $traffic
}
set sink0 [new Agent/LossMonitor]
$ns attach-agent $Node15 $sink0
set src0 [attach-expoo-traffic $Node0 $sink0 200 0 0 400k]
set tcp [new Agent/TCP]
$ns attach-agent $Node0 $tcp
set ftp [new Application/FTP]
$tcp set packetSize_ 1024
$ftp attach-agent $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $Node15 $sink
$ns connect $tcp $sink
proc monitor {} {
global tcp
$tcp instvar ndatapack_
puts "packets send: $ndatapack_"
$tcp instvar nackpack_
puts "packets received: $nackpack_"
}
set totalpkt 0
proc record {} {
global sink0 f0 totalpkt
set ns [Simulator instance]
set time 0.005
#How many bytes have been received by the traffic sink?
set bw0 [$sink0 set bytes_]
#Get the current time
set now [$ns now]
#Calculate the bandwidth (in MBit/s) and write it to the file
puts $f0 "$now [expr $bw0/$time*8/1000000]"
#Reset the bytes_ values on the traffic sink
$sink0 set bytes_ 0
#Re-schedule the procedure
$ns at [expr $now+$time] "record"
set bw0 [expr $bw0 / 200]
set totalpkt [expr $totalpkt + $bw0]
}
#
# Procedure to dump the number of received packets calculated by the procedur
# record at the command prompt
#
proc recv-pkts {} {
global totalpkt
flush stdout
puts "The Number of Total received packet is $totalpkt"
}
#
# From here on the simulation events are defined
#
# Start procedure "record"
#
$ns at 0.0 "record"
#
# Source start
#
$ns at 0.1 "$src0 start"
#
# Example of defining protection paths according to Haskin's model
$ns at 2.0 "[$LSR7 get-module MPLS] make-explicit-route 13 0_1_2_4_6_8_10_12_14 1000 -1"
#$ns at 2.0 "[$LSR7 get-module MPLS] make-explicit-route 10 1_3_5_7_9_ 1000 -1"
#
# Reroute option used to simulate Haskin's model
#
$ns at 2.0 "[$LSR7 get-module MPLS] reroute-binding 12 -1 1005"
#
# Define link failures
$ns rtmodel-at 2.0 down $LSR5 $LSR7
# Define when the link have to be restored
$ns rtmodel-at 3.0 up $LSR5 $LSR7
# Trace results (MPLS/LDP packets) at a given LSR are dumped at the #prompt
$ns at 2.0 "[$LSR3 get-module MPLS] trace-mpls"
$ns at 2.0 "[$LSR4 get-module MPLS] trace-ldp"
# Source stop
$ns at 4.5 "$src0 stop"
# Calls procedure "recv-pkts" (and dumps the nr of received packets at the
$ns at 2.0 "recv-pkts"
# Displays the erb/lib/pft-table of the given LSR at the command prompt
$ns at 2.0 "[$LSR1 get-module MPLS] erb-dump"
$ns at 2.0 "[$LSR1 get-module MPLS] lib-dump"
$ns at 2.0 "[$LSR1 get-module MPLS] pft-dump"
$ns at 5.0 "finish"
$ns run