[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Questions




Iam working on MPLS performance evaluation and I have some questions:
1- I wrote a tcl that defines a network with MPLS nodes when I run a
simulation I do not see any flow of LDP messages with their colors defined
in my tcl which is the same provided in MPLS examples while I see
rtproto packets moving at the begining of the simulation when it is  
enable.

2- When I mark EXPOO sources data I do not see them coloured as the case
when I mark CBR sources data I see it with the assigned colors.          

3- When I measure the bandwidth of an MPLS network it looks the same as
that of an IP network. I would like also to know how I can measure the
bandwidth consume as a result of having LDP overhead.

Iam attching here one of my tcl files if you could give it a look may be
the problem is there.

############################################################
#
#
#         < An example of MPLS Network >
#
#
#
#                                            #
#############################################################

set ns [new Simulator]

#
# Open files to write trace-data for NAM and Xgraph
#
set nf [open mp.nam w]
$ns namtrace-all $nf
set f0 [open mp0.tr w]
set f1 [open mp1.tr w]
set f2 [open mp2.tr w]
set f3 [open mp3.tr w]
set f4 [open mp4.tr w]

#
# Finish procedure which closes the trace file and opens Xgraph and NAM
#
proc finish {} {
	global ns nf f0 f1 f2 f3 f4
	$ns flush-trace
	close $nf
	close $f0
	close $f1
	close $f2
        close $f3
	close $f4
        exec nam mp.nam &    
        exec xgraph mp0.tr mp1.tr mp2.tr mp3.tr mp4.tr -geometry 800x400 &
        exit 0
}

# Set dynamic distance-vector routing protocol
#
$ns rtproto DV
#
# make nodes & MPLSnodes
#
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]

#
# make links
#

$ns duplex-link $Node0  $LSR2  10Mb  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  10Mb  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} {
	set a LSR$i
	for {set j [expr $i+1]} {$j < 9} {incr j} {
		set b LSR$j
		eval $ns LDP-peer $$a $$b
	}
set m [eval $$a get-module "MPLS"]
$m enable-reroute "new"	
}	
	

#
# 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

# Define trigger strategy, Label Distribution Control Mode
# and Label Allocation and Distribution Scheme

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

# Define procedure to create a CBR traffic flow and connect it to a UDP
agent
#
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
}

#Create three traffic sinks and attach them to node10
set sink0 [new Agent/LossMonitor]
set sink1 [new Agent/LossMonitor]
set sink2 [new Agent/LossMonitor]
set sink3 [new Agent/LossMonitor]
set sink4 [new Agent/LossMonitor]


$ns attach-agent $Node10 $sink0
$ns attach-agent $Node10 $sink1
$ns attach-agent $Node10 $sink2
$ns attach-agent $Node10 $sink3
$ns attach-agent $Node10 $sink4

#
# Create 5 traffic sources
#
set src0 [attach-expoo-traffic $Node0  $sink0 200 0 0 400k]
set src1 [attach-expoo-traffic $Node0  $sink1 200 0 0 400k]
set src2 [attach-expoo-traffic $Node0  $sink2 200 0 0 400k]
set src3 [attach-expoo-traffic $Node1  $sink3 200 0 0 400k]
set src4 [attach-expoo-traffic $Node1  $sink4 200 0 0 400k]

#
# Create a TCP agent and connect it to an application like FTP or Telnet,
which
# generates the data
#



set totalpkt 0
proc record {} {
        
        global sink0 sink1 sink2 sink3 sink4 f0 f1 f2 f3 f4 totalpkt

	set ns [Simulator instance]
	
	#Set the time after which the procedure should be called again
        set time 0.005
        
       
	

	#How many bytes have been received by the traffic sink?
        set bw0 [$sink0 set bytes_]
        set bw1 [$sink1 set bytes_]
	set bw2 [$sink2 set bytes_]
	set bw3 [$sink3 set bytes_] 
	set bw4 [$sink4 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]"
        puts $f1 "$now [expr $bw1/$time*8/1000000]"
        puts $f2 "$now [expr $bw2/$time*8/1000000]"
        puts $f3 "$now [expr $bw3/$time*8/1000000]"
        puts $f4 "$now [expr $bw4/$time*8/1000000]"
	
	#Reset the bytes_ values on the traffic sink
        $sink0 set bytes_ 0
        $sink1 set bytes_ 0
        $sink2 set bytes_ 0
        $sink3 set bytes_ 0
        $sink4 set bytes_ 0

	#Re-schedule the procedure
        $ns at [expr $now+$time] "record"
        
       
        set bw0 [expr $bw0 / 200]
        set totalpkt [expr $totalpkt + $bw0]
        set bw1 [expr $bw1 / 200]
        set totalpkt [expr $totalpkt + $bw1]
        set bw2 [expr $bw2 / 200]
        set totalpkt [expr $totalpkt + $bw2]
        set bw3 [expr $bw3 / 200]
        set totalpkt [expr $totalpkt + $bw3]
        set bw4 [expr $bw4 / 200]
        set totalpkt [expr $totalpkt + $bw4]

}
proc recv-pkts {} {
     global totalpkt
     flush stdout
     puts "The Number of Total received packet is $totalpkt"
}

$ns at 0.0   "record"

#
# Source start
#
$ns at 0.1   "$src0 start"
$ns at 0.1   "$src1 start"
$ns at 0.1   "$src2 start"
$ns at 0.1   "$src3 start"
$ns at 0.1   "$src4 start"

$ns at 4.6 "$src0 stop"
$ns at 4.6 "$src1 stop"
$ns at 4.6 "$src2 stop"
$ns at 4.6 "$src3 stop"
$ns at 4.6 "$src4 stop"

$src0 set fid_ 1
$src1 set fid_ 2
$src2 set fid_ 3
$src3 set fid_ 4

$ns color 1 Green
$ns color 2 Red 
$ns color 3 Blue
$ns color 4 ORANGE


$ns at 10.0 "recv-pkts"
$ns at 10.0 "finish"

#
# The last line finally starts the simulation
#
$ns run