Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set ns [new Simulator]
- set nf [open ass2.nam w]
- set f [open ass2.tr w]
- $ns namtrace-all $nf
- $ns trace-all $f
- $ns rtproto Session
- proc finish {} {
- global ns f
- $ns flush-trace
- close $f
- exec nam ass2.nam &
- exit 0
- }
- set n11 [$ns node]
- set n1 [$ns node]
- set n2 [$ns node]
- set n3 [$ns node]
- set n4 [$ns node]
- set n5 [$ns node]
- set n6 [$ns node]
- set n7 [$ns node]
- set n8 [$ns node]
- set n9 [$ns node]
- set n10 [$ns node]
- $n1 color red
- $n7 color blue
- $n3 color green
- $n6 color blue
- $n10 color green
- $n7 color blue
- $ns color 1 red
- $ns color 2 green
- $ns color 3 blue
- $ns duplex-link $n1 $n2 20Mb 10ms DropTail
- $ns duplex-link $n3 $n4 20Mb 10ms DropTail
- $ns duplex-link $n4 $n5 20Mb 10ms DropTail
- $ns duplex-link $n5 $n6 20Mb 10ms DropTail
- $ns duplex-link $n1 $n4 20Mb 10ms DropTail
- $ns duplex-link $n2 $n5 20Mb 10ms DropTail
- $ns duplex-link $n8 $n9 20Mb 10ms DropTail
- $ns duplex-link $n7 $n11 20Mb 10ms DropTail
- $ns duplex-link $n8 $n11 20Mb 10ms DropTail
- $ns duplex-link $n9 $n11 20Mb 10ms DropTail
- $ns duplex-link $n11 $n10 20Mb 10ms DropTail
- $ns simplex-link $n3 $n7 10Mb 5ms SFQ
- $ns simplex-link $n4 $n8 10Mb 5ms SFQ
- $ns simplex-link $n9 $n5 10Mb 5ms SFQ
- $ns simplex-link $n6 $n10 10Mb 5ms SFQ
- $ns simplex-link $n7 $n8 10Mb 5ms SFQ
- $ns simplex-link $n10 $n9 10Mb 5ms SFQ
- $ns attach-agent $n1 $udp0
- $udp0 set fid_ 1
- set cbr0 [new Application/Traffic/CBR]
- $cbr0 set packetSize_ 512
- $cbr0 set random_ false
- $cbr0 set rate_ 0.4Mb
- $cbr0 attach-agent $udp0
- set null0 [ new Agent/Null ]
- $ns attach-agent $n11 $null0
- $ns connect $udp0 $null0
- set udp1 [new Agent/UDP]
- $ns attach-agent $n3 $udp1
- $udp1 set fid_ 2
- set cbr1 [new Application/Traffic/CBR]
- $cbr1 set packetSize_ 1024i
- $cbr1 set random_ false
- $cbr1 set rate_ 0.5Mb
- $cbr1 attach-agent $udp1
- set null1 [ new Agent/Null ]
- $ns attach-agent $n11 $null1
- $ns connect $udp1 $null1
- set udp2 [new Agent/UDP]
- $ns attach-agent $n6 $udp2
- $udp1 set fid_ 3
- set cbr2 [new Application/Traffic/CBR]
- $cbr2 set packetSize_ 2048
- $cbr2 set random_ false
- $cbr2 set rate_ 0.6Mb
- $cbr2 attach-agent $udp2
- set null2 [ new Agent/Null ]
- $ns attach-agent $n7 $null2
- $ns connect $udp2 $null2
- $ns at 0.0 "$cbr0 start"
- $ns at 0.0 "$cbr1 start"
- $ns at 0.0 "$cbr2 start"
- $ns rtmodel-at 10.0 down $n4 $n5
- $ns rtmodel-at 20.0 up $n4 $n5
- $ns rtmodel-at 30.0 down $n8 $n9
- $ns rtmodel-at 55.0 up $n8 $n9
- $ns at 100.0 "finish"
- $ns run
Add Comment
Please, Sign In to add comment