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

[ns] Problems with MPLS



Hi at all ,
I work with Red Hat Linux 7 and NS-allinone-21b7a released 16-oct-2000.
I have as soon as begun to work on MPLS leaving from script 
MPLS-sim-template.txt.
In it there were some banal errors that I have eliminated
but I do not know to eliminate the following errors:

...$links_ ($1) trace-dynamics $ns $f $op...
...$ret trace $self $trace "nam"...
...eval $self rtmodel Manual [list $parms] $args...
...$ns rtmodel-at 0.3 down $LSR6 $LSR3... .

I have attached my MPLS-sim-template.txt to the message,

>  please can you tell me where is the problem?
    moreover
>  where I can learn the structure of commands used in
    MPLS ?
    and
>  where I can find other MPLS scripts?

Thank you very much,
Marco.















# NS tcl script template - tested on snapshot 18-09-00
#
# Jan-Rutger Schrader, KPN Research, the Netherlands
# [email protected]
# version 0.3
# contributed by Schrader, J.H.R. <[email protected]>
# $Header: /nfs/jade/vint/CVSROOT/ns-2/tcl/ex/MPLS-sim-template.txt,v 1.3 2000/09/29 19:37:43 haoboy Exp $

#
# Create simulator object
#
set ns [new Simulator]

#
# Open files to write trace-data for NAM and Xgraph
#
set nf [open mpls.nam w]
$ns namtrace-all $nf
set f0 [open mpls.tr w]

#
# Finish procedure which closes the trace file and opens Xgraph and NAM
#
proc finish {} {
	global ns nf f0
	$ns flush-trace
	close $nf
	close $f0
        exec nam mpls.nam &
	exit 0
}

#
# Set dynamic distance-vector routing protocol
#
$ns rtproto DV

#
# define nodes and MPLS LSRs (in case of a LSR, the [$ns node]
# command has to be preceded by node-config -MPLS ON
# and succeeded by node-config -MPLS OFF
#
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]
$ns node-config -MPLS OFF
set node12  [$ns node]

#
# Define links, bandwidth 1 Mb, delay 10ms, queue managementDropTail 
#
$ns duplex-link $node0 $LSR4  1Mb  10ms DropTail 
$ns duplex-link $LSR1  $LSR2  1Mb  10ms DropTail 
$ns duplex-link $LSR1  $LSR4  1Mb  10ms DropTail
$ns duplex-link $LSR2  $LSR3  1Mb  10ms DropTail
$ns duplex-link $LSR3  $LSR4  1Mb  10ms DropTail
$ns duplex-link $LSR4  $LSR5  1Mb  10ms DropTail
$ns duplex-link $LSR5  $LSR6  1Mb  10ms DropTail 
$ns duplex-link $LSR6  $LSR7  1Mb  10ms DropTail
$ns duplex-link $LSR7  $LSR8  1Mb  10ms DropTail
$ns duplex-link $LSR8  $LSR9  1Mb  10ms DropTail
$ns duplex-link $LSR9  $LSR10  1Mb  10ms DropTail
$ns duplex-link $LSR10 $LSR11 1Mb  10ms DropTail 
$ns duplex-link $LSR11 $node12 1Mb 10ms DropTail



# The default value of a link cost (1) can be adjusted  
# Notice that the procedure sets the cost along one direction only!  
#
$ns cost $LSR4 $LSR5 3
$ns cost $LSR5 $LSR4 3 

#
# Install/configure LDP agents on all MPLS nodes,
# and set path restoration function that reroutes traffic
# around a link failure in a LSP to an alternative LSP.
# There are 2 options as follows:
# "new": create new alternative path if one doesn't exist
# "drop": do not create any new alternative path
#
# Adjust loop length to address all LSRs (MPLS nodes).
#
for {set i 1} {$i < 12} {incr i} {
	for {set j [expr $i+1]} {$j < 12} {incr j} {
                set a LSR$i
		set b LSR$j
		eval $ns LDP-peer $$a $$b
	}
	set m [eval $$a get-module "MPLS"]
	$m enable-reroute "new"
}

#
# Set ldp-message color in NAM
#
$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
#
# when the following line is omitted, trigger strategy is
# set to data-driven
Classifier/Addr/MPLS set control_driven_ 1
Classifier/Addr/MPLS enable-on-demand
Classifier/Addr/MPLS enable-ordered-control

#
# Trigger strategy can also be defined per LSR
#
[$LSR4 get-module "MPLS"] enable-control-driven
[$LSR3 get-module "MPLS"] enable-data-driven

#
# Turn on all traces to stdout
#
Agent/LDP set trace_ldp_ 1
Classifier/Addr/MPLS set trace_mpls_ 1

#
# use 'List' scheduling of events
#
$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 a traffic sink and attach it to the node node12
#
set sink0 [new Agent/LossMonitor]
$ns attach-agent $node12  $sink0

#
# Create a traffic source
#
set src0 [attach-expoo-traffic $node0  $sink0 200 0 0 400k]

#
# Create a TCP agent and connect it to an application like FTP or Telnet, which
# generates the data
#
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 $node12 $sink 

$ns connect $tcp $sink
#
# Procedure which dumps the nr of packets sent/received at the prompt
# (in case of a TCP source)
#
proc monitor {} { 
   global tcp 

   $tcp instvar ndatapack_ 
   puts "packets send: $ndatapack_" 
   $tcp instvar nackpack_
   puts "packets received: $nackpack_"
} 

#
# Define a procedure which periodically records the bandwidth received by the
# traffic sink sink0 and writes it to the file f0.
#

set totalpkt 0
proc record {} {
        global sink0 f0 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_]
	
	#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 procedure
# 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 0.1 "[$LSR4 get-module MPLS] make-explicit-route 11  1_2_3_10_11  1000  -1"
$ns at 0.2 "[$LSR11 get-module MPLS] make-explicit-route 11 11_10_9_8_7_4_1000 1005 -1"
#
# Reroute option used to simulate Haskin's model
#
$ns at 0.3   "[$LSR9 get-module MPLS] reroute-binding   12   -1   1005"

#
# Define link failures
#
$ns rtmodel-at 0.3 down $LSR5 $LSR6
$ns rtmodel-at 0.3 down $LSR6 $LSR3
		
$ns rtmodel-at 0.4 down $LSR9 $LSR10

#
# Define when the link have to be restored
#
$ns rtmodel-at 0.5 up   $LSR5 $LSR6
$ns rtmodel-at 0.5 up   $LSR6 $LSR3
		
$ns rtmodel-at 0.5 up   $LSR9 $LSR10

#
# Trace results (MPLS/LDP packets) at a given LSR are dumped at the prompt
#
$ns at 0.1 "[$LSR3 get-module MPLS] trace-mpls"
$ns at 0.1 "[$LSR4 get-module MPLS] trace-LDP"

#
# Source stop
#
$ns at 0.6 "$src0 stop"

#
# Calls procedure "recv-pkts" (and dumps the nr of received packets at the 
# command prompt
#
$ns at 0.7 "recv-pkts"

#
# Displays the erb/lib/pft-table of the given LSR at the command prompt
#
$ns at 0.7 "[$LSR1 get-module MPLS] erb-dump"
$ns at 0.7 "[$LSR1 get-module MPLS] lib-dump"
$ns at 0.7 "[$LSR1 get-module MPLS] pft-dump"

#
# Calls the procedure "finish"
#
$ns at 0.7 "finish"

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