Friday, February 3, 2012

[ns] MPLS simulation error

Hello all,

I am simulating MPLS on ns2. i used the following code but didnot get
the results.
please if anyone can help me..
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

#set tf [open out.tr w]
#$ns trace-all $tf


set Node0 [$ns node]
set Node1 [$ns node]
$ns node-config -MPLS ON
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]
$ns node-config -MPLS OFF
set Node9 [$ns node]
set Node10 [$ns node]

$ns duplex-link $Node0 $LSR2 1Mb 10ms DropTail
$ns duplex-link $Node1 $LSR2 1Mb 10ms DropTail
$ns duplex-link $LSR2 $LSR3 1Mb 10ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 10ms DropTail
$ns duplex-link $LSR4 $LSR8 1Mb 10ms DropTail
$ns duplex-link $LSR2 $LSR5 1Mb 10ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 10ms DropTail
$ns duplex-link $LSR5 $LSR4 1Mb 10ms DropTail
$ns duplex-link $LSR6 $LSR7 1Mb 10ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 10ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 10ms DropTail
$ns duplex-link $LSR7 $Node9 1Mb 10ms DropTail
$ns duplex-link $LSR8 $Node10 1Mb 10ms DropTail

#
# configure ldp agents on all mpls nodes
#
for {set i 2} {$i < 9} {incr i} {
for {set j [expr $i+1]} {$j < 9} {incr j} {
set a LSR$i
set b LSR$j
eval $ns LDP-peer $$a $$b
}
}

[$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

#
# set ldp-message clolr
#
$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

#$ns enable-data-driven
#$ns enable-ordered-control

#
# make agent to send packets
#
set Src0 [new Application/Traffic/CBR]
set udp0 [new Agent/UDP]
$Src0 attach-agent $udp0
$ns attach-agent $Node0 $udp0
$Src0 set packetSize 500
$Src0 set interval 0.010

set Src1 [new Application/Traffic/CBR]
set udp1 [new Agent/UDP]
$Src1 attach-agent $udp1
$ns attach-agent $Node1 $udp1
$Src1 set packetSize 500
$Src1 set interval 0.010

set Dst0 [new Agent/Null]
$ns attach-agent $Node9 $Dst0
set Dst1 [new Agent/Null]
$ns attach-agent $Node10 $Dst1
$ns connect $udp0 $Dst0
$ns connect $udp1 $Dst1

$ns at 0.1 "$Src0 start"
$ns at 0.1 "$Src1 start"

for {set i 2} {$i < 9} {incr i} {
set a LSR$i
set m [eval $$a get-module "MPLS"]
eval set LSR$i $m
}

$ns at 0.2 "$LSR7 ldp-trigger-by-withdraw 9 -1"
$ns at 0.2 "$LSR8 ldp-trigger-by-withdraw 10 -1"

$ns at 0.3 "$LSR2 flow-aggregation 9 -1 6 -1"
$ns at 0.3 "$LSR2 flow-aggregation 10 -1 6 -1"
$ns at 0.5 "$LSR6 ldp-trigger-by-withdraw 6 -1"
$ns at 0.7 "$Src1 stop"

$ns at 0.7 "$LSR2 make-explicit-route 7 5_4_8_6_7 3000 -1"
$ns at 0.9 "$LSR2 flow-erlsp-install 9 -1 3000"
$ns at 1.1 "$LSR2 ldp-trigger-by-release 7 3000"

$ns at 1.2 "$LSR4 make-explicit-route 8 4_5_6_8 3500 -1"
$ns at 1.4 "$LSR2 make-explicit-route 7 2_3_4_3500_7 3600 -1"
$ns at 1.6 "$LSR2 flow-erlsp-install 9 -1 3600"

$ns at 2.0 "$Src0 stop"

$ns at 2.1 "$LSR2 pft-dump"
$ns at 2.1 "$LSR2 erb-dump"
$ns at 2.1 "$LSR2 lib-dump"

$ns at 2.1 "$LSR3 pft-dump"
$ns at 2.1 "$LSR3 erb-dump"
$ns at 2.1 "$LSR3 lib-dump"

$ns at 2.1 "$LSR4 pft-dump"
$ns at 2.1 "$LSR4 erb-dump"
$ns at 2.1 "$LSR4 lib-dump"

$ns at 2.1 "$LSR5 pft-dump"
$ns at 2.1 "$LSR5 erb-dump"
$ns at 2.1 "$LSR5 lib-dump"

$ns at 2.1 "$LSR6 pft-dump"
$ns at 2.1 "$LSR6 erb-dump"
$ns at 2.1 "$LSR6 lib-dump"

$ns at 2.1 "$LSR7 pft-dump"
$ns at 2.1 "$LSR7 erb-dump"
$ns at 2.1 "$LSR7 lib-dump"

$ns at 2.1 "$LSR8 pft-dump"
$ns at 2.1 "$LSR8 erb-dump"
$ns at 2.1 "$LSR8 lib-dump"

#define 'finish' procedure
proc finish {} {
global ns nf
$ns flush trace
#close the trace files
close $nf
#close $tf

#execute nam on trace file
exec nam out.nam &
exit 0
}


$ns at 14.0 "finish"
$ns run
<---------------------------->

error is as:

ns: finish:
(_o3 cmd line 1)
invoked from within
"_o3 cmd flush trace"
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 "_o3" line 2)
(SplitObject unknown line 2)
invoked from within
"$ns flush trace"
(procedure "finish" line 3)
invoked from within
"finish"

<----------------------->

Please help..

No comments:

Post a Comment

Counter

blogger analytics