Hello,

I'd like to simulate MPLS Traffic Engineering function in a DiffServ enabled 
Network.
I configured MPLS functions to nodes and DiffServ to routers, etc. and then 
got no error in ns2.26 and ns 2.30.  The following script is the code.
Is that okay?
I'm not sure this code is really simulating MPLS/DiffServ.
Or do I need to install MPLS/diffserv patch from the website
http://www.eeng.dcu.ie/~murphys/ns-work/mpls-diffserv/  to simulate it 
correctly only in ns2.1b6?

Thank you in advance!

---------------------------------------------------------------
set ns [new Simulator]

set nf [open /tmp/hjc/diffMpls.nam w]
$ns namtrace-all $nf
set tf [open /tmp/hjc/diffMpls.tr w]
$ns trace-all $tf

set cir0 100000
set pir0 500000
set rate0 4000000
set cir1 400000
set pir1 1000000
set rate1 2000000

set testTime 25.0
set packetSize 1000

### set up the network topology
set s1 [$ns node]
$ns node-config -MPLS ON
set s2 [$ns node]
$ns node-config -MPLS ON
set e1 [$ns node]
$ns node-config -MPLS ON
set core [$ns node]
$ns node-config -MPLS ON
set e2 [$ns node]
$ns node-config -MPLS OFF
set dest [$ns node]

$ns duplex-link $s1 $e1 10Mb 5ms DropTail
$ns duplex-link $s2 $e1 10Mb 5ms DropTail

$ns simplex-link $e1 $core 10Mb 5ms dsRED/edge
$ns simplex-link $core $e1 10Mb 5ms dsRED/core

$ns simplex-link $core $e2 5Mb 5ms dsRED/core
$ns simplex-link $e2 $core 5Mb 5ms dsRED/edge

$ns duplex-link $e2 $dest 10Mb 5ms DropTail

set qE1C [[$ns link $e1 $core] queue]
set qE2C [[$ns link $e2 $core] queue]
set qCE1 [[$ns link $core $e1] queue]
set qCE2 [[$ns link $core $e2] queue]

##$ns LDP-peer $e1 $core

$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


set qE1C [[$ns link $e1 $core] queue]
set qE2C [[$ns link $e2 $core] queue]
set qCE1 [[$ns link $core $e1] queue]
set qCE2 [[$ns link $core $e2] queue]

# Set DS RED parameters from Edge1 to Core:
$qE1C meanPktSize $packetSize
$qE1C set numQueues_ 2
$qE1C setNumPrec 3
$qE1C addPolicyEntry [$s1 id] [$dest id] TSW3CM 10 $cir0 $pir0
$qE1C addPolicyEntry [$s2 id] [$dest id] TSW3CM 20 $cir1 $pir1
$qE1C addPolicyEntry -1 -1 TSW3CM 10 $cir1 $pir1
$qE1C addPolicerEntry TSW3CM 10 11 12
$qE1C addPolicerEntry TSW3CM 20 21 22

$qE1C addPHBEntry 10 0 0
$qE1C addPHBEntry 11 0 1
$qE1C addPHBEntry 12 0 2
$qE1C addPHBEntry 20 1 0^M
$qE1C addPHBEntry 21 1 1^M
$qE1C addPHBEntry 22 1 2^M
$qE1C addPHBEntry 0 0 2

$qE1C configQ 0 0 20 40 0.02
$qE1C configQ 0 1 10 20 0.10
$qE1C configQ 0 2  5 10 0.20
$qE1C configQ 1 0 20 40 0.02^M
$qE1C configQ 1 1 10 20 0.10^M
$qE1C configQ 1 2  5 10 0.20^M

# Set DS RED parameters from Edge2 to Core:
$qE2C meanPktSize $packetSize
$qE2C set numQueues_ 2
$qE2C setNumPrec 3
$qE2C addPolicyEntry [$dest id] [$s1 id] TSW3CM 10 $cir0 $pir0
$qE2C addPolicyEntry [$dest id] [$s2 id] TSW3CM 20 $cir1 $pir1
$qE2C addPolicyEntry -1 -1 TSW3CM 10 $cir1 $pir1
$qE2C addPolicerEntry TSW3CM 10 11 12
$qE2C addPolicerEntry TSW3CM 20 21 22
$qE2C addPHBEntry 10 0 0
$qE2C addPHBEntry 11 0 1
$qE2C addPHBEntry 12 0 2
$qE2C addPHBEntry 20 0 0^M
$qE2C addPHBEntry 21 0 1^M
$qE2C addPHBEntry 22 0 2^M
$qE2C addPHBEntry 0 0 2

$qE2C configQ 0 0 20 40 0.02
$qE2C configQ 0 1 20 20 0.10
$qE2C configQ 0 2  5 10 0.20
$qE2C configQ 1 0 20 40 0.02^M
$qE2C configQ 1 1 20 20 0.10^M
$qE2C configQ 1 2  5 10 0.20^M

# Set DS RED parameters from Core to Edge1:
$qCE1 meanPktSize $packetSize
$qCE1 set numQueues_ 2
$qCE1 setNumPrec 3
$qCE1 addPHBEntry 10 0 0
$qCE1 addPHBEntry 11 0 1
$qCE1 addPHBEntry 12 0 2
$qCE1 addPHBEntry 20 0 0^M
$qCE1 addPHBEntry 21 0 1^M
$qCE1 addPHBEntry 22 0 2^M
$qCE1 addPHBEntry 0 0 2^M

$qCE1 configQ 0 0 20 40 0.02
$qCE1 configQ 0 1 10 20 0.10
$qCE1 configQ 0 2  5 10 0.20
$qCE1 configQ 1 0 20 40 0.02^M
$qCE1 configQ 1 1 10 20 0.10^M
$qCE1 configQ 1 2  5 10 0.20^M

# Set DS RED parameters from Core to Edge2:
$qCE2 meanPktSize $packetSize
$qCE2 set numQueues_ 2
$qCE2 setNumPrec 3
$qCE2 addPHBEntry 10 0 0
$qCE2 addPHBEntry 11 0 1
$qCE2 addPHBEntry 12 0 2
$qCE2 addPHBEntry 20 0 0^M
$qCE2 addPHBEntry 21 0 1^M
$qCE2 addPHBEntry 22 0 2^M
$qCE2 addPHBEntry 0 0 2^M
$qCE2 configQ 0 0 20 40 0.02
$qCE2 configQ 0 1 10 20 0.10
$qCE2 configQ 0 2  5 10 0.20
$qCE2 configQ 1 0 20 40 0.02^M
$qCE2 configQ 1 1 10 20 0.10^M
$qCE2 configQ 1 2  5 10 0.20^M

# Set up one CBR connection between each source and the destination:
set udp0 [new Agent/UDP]
$ns attach-agent $s1 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$cbr0 set packet_size_ $packetSize
$udp0 set packetSize_ $packetSize
$cbr0 set rate_ $rate0
set null0 [new Agent/Null]
$ns attach-agent $dest $null0
$ns connect $udp0 $null0

set udp1 [new Agent/UDP]
$ns attach-agent $s2 $udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packet_size_ $packetSize
$udp1 set packetSize_ $packetSize
$cbr1 set rate_ $rate1
set null1 [new Agent/Null]
$ns attach-agent $dest $null1
$ns connect $udp1 $null1

proc finish {} {
        global ns nf tf
        $ns flush-trace
        close $nf
        close $tf

        exit 0
}

$qE1C printPolicyTable
$qE1C printPolicerTable

$ns at 0.0 "$cbr0 start"
$ns at 0.0 "$cbr1 start"
$ns at 20.0 "$qCE2 printStats"
$ns at 40.0 "$qCE2 printStats"
$ns at 60.0 "$qCE2 printStats"
$ns at 80.0 "$qCE2 printStats"
$ns at $testTime "$cbr0 stop"
$ns at $testTime "$cbr1 stop"
$ns at [expr $testTime + 1.0] "finish"

$ns run

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Reply via email to