Analisis Kinerja Content Delivery Network yang Menggunakan Webmapper

LAMPIRAN 1
Proses Saat Menjalankan Simulasi NS-2
1. Hal yang pertama dilakukan adalah membuka “command line” pada OS
Ubuntu 12.35. Dengan cara “Ctrl + Alt + T, apabila sudah dilakukan akan
terlihat seperti gambar berikut:

2. Pada “Terminal” ketik perintah “cd” yang berfungsi untuk masuk kedalam
folder yang telah dibuat. Pada simulasi ini nama folder yang digunakan
“webmapper”. Kemudian tekan “Enter”.

3. Setelah selesai ketik perintah “ns” yang berfungsi untuk menjalankan program
NS-2. Lalu tekan “Enter”.

Universitas Sumatera Utara

4. Pada gambar dibawah menunjukkan proses simulasi NS-2 sedang berjalan

5. Pada saat proses simulasi sudah selesai, akan muncul display out .nam yang
sudah dilakukan menggunakan program. Untuk melihat hasil simulasi klik
“Play Forward”.


Universitas Sumatera Utara

6. Dari hasil simulasi pada NS-2 didapat file yang berbentuk.txt. Data tersebut
dipindahkan kedalam MS.Excel untuk menghitung Qos. Untuk tugas akhir ini
hanya menganalisa permintaan client saja sehingga file dengan nama “udprec”
yang akan digunakan.

Universitas Sumatera Utara

Universitas Sumatera Utara

LAMPIRAN 2
Script Webmapper
set ns [new Simulator]
$ns color 0 pink
$ns color 1 red
$ns color 2 green
$ns color 3 yellow
$ns color 4 brown
$ns color 5 purple

$ns color 6 black
$ns color 7 grey
$ns color 8 maroon
set n0 [$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]
set n11 [$ns node]
set n12 [$ns node]
set n13 [$ns node]
set n14 [$ns node]
set n15 [$ns node]
set n16 [$ns node]

set n17 [$ns node]
set n18 [$ns node]
set n19 [$ns node]
set n20 [$ns node]
set n21 [$ns node]
set n22 [$ns node]
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
$ns duplex-link $n0 $n3 5Mb 2ms DropTail
$ns duplex-link $n1 $n3 5Mb 2ms DropTail

Universitas Sumatera Utara

$ns duplex-link $n2 $n3 5Mb 2ms DropTail
$ns duplex-link $n10 $n3 1.5Mb 10ms DropTail
$ns duplex-link $n9 $n10 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n16 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n11 1.5Mb 10ms DropTail

$ns duplex-link $n10 $n17 1.5Mb 10ms DropTail
$ns duplex-link $n3 $n4 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n6 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n7 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n8 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n12 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n13 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n14 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n15 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n18 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n19 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n20 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n21 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n22 1.5Mb 10ms DropTail
$ns duplex-link-op $n0 $n3 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n2 $n3 orient down
$ns duplex-link-op $n10 $n3 orient up

$ns duplex-link-op $n9 $n10 orient right-up
$ns duplex-link-op $n10 $n11 orient right
$ns duplex-link-op $n10 $n16 orient down
$ns duplex-link-op $n10 $n17 orient right-down
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n4 $n5 orient right-up
$ns duplex-link-op $n4 $n11 orient down
$ns duplex-link-op $n5 $n6 orient right
$ns duplex-link-op $n6 $n7 orient right-up
$ns duplex-link-op $n6 $n8 orient right
$ns duplex-link-op $n11 $n12 orient right
$ns duplex-link-op $n12 $n13 orient right-up
$ns duplex-link-op $n12 $n14 orient right
$ns duplex-link-op $n12 $n15 orient right-down
$ns duplex-link-op $n11 $n18 orient right-down
$ns duplex-link-op $n18 $n19 orient left-down
$ns duplex-link-op $n18 $n20 orient right-down
$ns duplex-link-op $n5 $n21 orient right-up
$ns duplex-link-op $n5 $n22 orient left-up


Universitas Sumatera Utara

$ns duplex-link-op $n2 $n3 queuePos 0.5
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
set udp1 [new Agent/UDP]
$ns attach-agent $n3 $udp1
$udp1 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
set udp2 [new Agent/UDP]
$ns attach-agent $n9 $udp2
$udp2 set class_ 2
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
set udp3 [new Agent/UDP]
$ns attach-agent $n16 $udp3
$udp3 set class_ 3

set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
set udp4 [new Agent/UDP]
$ns attach-agent $n19 $udp4
$udp4 set class_ 4
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
set udp5 [new Agent/UDP]
$ns attach-agent $n7 $udp5
$udp5 set class_ 5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
set udp6 [new Agent/UDP]
$ns attach-agent $n14 $udp6
$udp6 set class_ 6
set cbr6 [new Application/Traffic/CBR]
$cbr6 attach-agent $udp6
set udp7 [new Agent/UDP]
$ns attach-agent $n13 $udp7
$udp7 set class_ 7


Universitas Sumatera Utara

set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
set udp8 [new Agent/UDP]
$ns attach-agent $n1 $udp8
$udp8 set class_ 8
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
set null0 [new Agent/Null]
$ns attach-agent $n14 $null0
set null1 [new Agent/Null]
$ns attach-agent $n13 $null1
set null2 [new Agent/Null]
$ns attach-agent $n8 $null2
set null3 [new Agent/Null]
$ns attach-agent $n20 $null3
set null4 [new Agent/Null]
$ns attach-agent $n14 $null4

set null5 [new Agent/Null]
$ns attach-agent $n20 $null5
set null6 [new Agent/Null]
$ns attach-agent $n21 $null6
set null7 [new Agent/Null]
$ns attach-agent $n22 $null7
set null8 [new Agent/Null]
$ns attach-agent $n17 $null8
$ns connect $udp0 $null0
$ns connect $udp1 $null1
$ns connect $udp2 $null2
$ns connect $udp3 $null3
$ns connect $udp4 $null4
$ns connect $udp5 $null5
$ns connect $udp6 $null6
$ns connect $udp7 $null7
$ns connect $udp8 $null8

Universitas Sumatera Utara


# creation trace traffic
set max_fragmented_size 1024
#add udp header(8 bytes) and IP header (20bytes)
set packetSize 1052
set original_file_name trafik
set trace_file_name video1.dat
set original_file_id [open $original_file_name r]
set trace_file_id [open $trace_file_name w]
set pre_time 0
while {[eof $original_file_id] == 0} {
gets $original_file_id current_line
scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_
set time [expr int(($tmp2_ - $pre_time)*1000000.0)]
if { $frametype_ == "I" } {
set type_v 1
set prio_p 0
}
if { $frametype_ == "P" } {
set type_v 2
set prio_p 0

}
if { $frametype_ == "B" } {
set type_v 3
set prio_p 0
}
if { $frametype_ == "H" } {
set type_v 1
set prio_p 0
}
puts $trace_file_id "$time $length_ $type_v $prio_p $max_fragmented_size"
set pre_time $tmp2_
}
close $original_file_id
close $trace_file_id
set end_sim_time $tmp2_
puts "$end_sim_time"
set trace_file [new Tracefile]
$trace_file filename $trace_file_name
#Attach video to server
#create source traffic
#Create a UDP agent and attach it to node n0
set udp_1 [new Agent/myUDP]
$udp_1 set_filename udpSend1

Universitas Sumatera Utara

$udp_1 set packetSize_ 1052
$ns attach-agent $n2 $udp_1 ;#Server 2
set udp_8 [new Agent/myUDP]
$udp_8 set_filename udpSend8
$udp_8 set packetSize_ 1052
$ns attach-agent $n2 $udp_8 ;#Server 2
set udp_9 [new Agent/myUDP]
$udp_9 set_filename udpSend9
$udp_9 set packetSize_ 1052
$ns attach-agent $n2 $udp_9 ;#Server 2
set udp_16 [new Agent/myUDP]
$udp_16 set_filename udpSend16
$udp_16 set packetSize_ 1052
$ns attach-agent $n2 $udp_16 ;#Server 2
set udp_19 [new Agent/myUDP]
$udp_19 set_filename udpSend19
$udp_19 set packetSize_ 1052
$ns attach-agent $n20 $udp_19 ;#Server 20
set udp_21 [new Agent/myUDP]
$udp_21 set_filename udpSend21
$udp_21 set packetSize_ 1052
$ns attach-agent $n20 $udp_21 ;#Server 20
set udp_0 [new Agent/myUDP]
$udp_0 set_filename udpSend0
$udp_0 set packetSize_ 1052
$ns attach-agent $n22 $udp_0 ;#Server 22
set udp_7 [new Agent/myUDP]
$udp_7 set_filename udpSend7
$udp_7 set packetSize_ 1052
$ns attach-agent $n22 $udp_7 ;#Server 22
set udp_14 [new Agent/myUDP]
$udp_14 set_filename udpSend14
$udp_14 set packetSize_ 1052
$ns attach-agent $n22 $udp_14 ;#Server 22
set udp_15 [new Agent/myUDP]
$udp_15 set_filename udpSend15
$udp_15 set packetSize_ 1052

Universitas Sumatera Utara

$ns attach-agent $n22 $udp_15 ;#Server 22
# Attach video traffic source
set video0 [new Application/Traffic/myEvalvid]
$video0 attach-tracefile $trace_file
$video0 attach-agent $udp_0
set video1 [new Application/Traffic/myEvalvid]
$video1 attach-tracefile $trace_file
$video1 attach-agent $udp_1
set video2 [new Application/Traffic/myEvalvid]
$video2 attach-tracefile $trace_file
$video2 attach-agent $udp_7
set video3 [new Application/Traffic/myEvalvid]
$video3 attach-tracefile $trace_file
$video3 attach-agent $udp_8
set video4 [new Application/Traffic/myEvalvid]
$video4 attach-tracefile $trace_file
$video4 attach-agent $udp_9
set video5 [new Application/Traffic/myEvalvid]
$video5 attach-tracefile $trace_file
$video5 attach-agent $udp_14
set video6 [new Application/Traffic/myEvalvid]
$video6 attach-tracefile $trace_file
$video6 attach-agent $udp_15
set video7 [new Application/Traffic/myEvalvid]
$video7 attach-tracefile $trace_file
$video7 attach-agent $udp_16
set video8 [new Application/Traffic/myEvalvid]
$video8 attach-tracefile $trace_file
$video8 attach-agent $udp_19
set video9 [new Application/Traffic/myEvalvid]
$video9 attach-tracefile $trace_file
$video9 attach-agent $udp_21

# Create the Null agent to sink traffic
set null_0 [new Agent/myEvalvid_Sink]

Universitas Sumatera Utara

$null_0 set_filename udpRec0
$ns attach-agent $n0 $null_0
set null_1 [new Agent/myEvalvid_Sink]
$null_1 set_filename udpRec1
$ns attach-agent $n1 $null_1
set null_7 [new Agent/myEvalvid_Sink]
$null_7 set_filename udpRec7
$ns attach-agent $n7 $null_7
set null_8 [new Agent/myEvalvid_Sink]
$null_8 set_filename udpRec8
$ns attach-agent $n8 $null_8
set null_9 [new Agent/myEvalvid_Sink]
$null_9 set_filename udpRec9
$ns attach-agent $n9 $null_9
set null_14 [new Agent/myEvalvid_Sink]
$null_14 set_filename udpRec14
$ns attach-agent $n14 $null_14
set null_15 [new Agent/myEvalvid_Sink]
$null_15 set_filename udpRec15
$ns attach-agent $n15 $null_15
set null_16 [new Agent/myEvalvid_Sink]
$null_16 set_filename udpRec16
$ns attach-agent $n16 $null_16
set null_19 [new Agent/myEvalvid_Sink]
$null_19 set_filename udpRec19
$ns attach-agent $n19 $null_19
set null_21 [new Agent/myEvalvid_Sink]
$null_21 set_filename udpRec21
$ns attach-agent $n21 $null_21
# Attach the 2 agents
$ns connect $udp_0 $null_0
$ns connect $udp_1 $null_1
$ns connect $udp_7 $null_7
$ns connect $udp_8 $null_8
$ns connect $udp_9 $null_9
$ns connect $udp_14 $null_14

Universitas Sumatera Utara

$ns connect $udp_15 $null_15
$ns connect $udp_16 $null_16
$ns connect $udp_19 $null_19
$ns connect $udp_21 $null_21
$ns at 1.0 "$cbr0 start"
$ns at 6.1 "$cbr1 start"
$ns at 1.3 "$cbr2 start"
$ns at 2.6 "$cbr3 start"
$ns at 1.8 "$cbr4 start"
$ns at 3.0 "$cbr5 start"
$ns at 2.1 "$cbr6 start"
$ns at 5.2 "$cbr7 start"
$ns at 7.3 "$cbr8 start"
$ns at 4.0 "$cbr5 stop"
$ns at 5.1 "$cbr6 stop"
$ns at 5.8 "$cbr7 stop"

#Evaluated traffics
$ns at 2.0 "$video0 start"
$ns at 2.5 "$video1 start"
$ns at 3.0 "$video2 start"
$ns at 3.4 "$video3 start"
$ns at 3.8 "$video4 start"
$ns at 4.0 "$video5 start"
$ns at 4.5 "$video6 start"
$ns at 5.0 "$video7 start"
$ns at 5.5 "$video8 start"
$ns at 6.0 "$video9 start"
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.2 "$ftp start"
$ns at 1.35 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]

Universitas Sumatera Utara

$ns at 500.0 "finish"
proc finish {} {
global ns f nf
$ns flush-trace
close $f
close $nf
puts "running nam..."
exec nam out.nam &
exit 0
}
$ns run

LAMPIRAN 3

Universitas Sumatera Utara

SCRIPT PROGRAM SINGLE SERVER

set ns [new Simulator]
$ns color 0 blue
$ns color 1 red
$ns color 2 green
$ns color 3 yellow
$ns color 4 brown
$ns color 5 purple
$ns color 6 black
$ns color 7 grey
$ns color 8 maroon
set n0 [$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]
set n11 [$ns node]
set n12 [$ns node]
set n13 [$ns node]
set n14 [$ns node]
set n15 [$ns node]
set n16 [$ns node]
set n17 [$ns node]
set n18 [$ns node]
set n19 [$ns node]
set n20 [$ns node]
set n21 [$ns node]
set n22 [$ns node]
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
$ns duplex-link $n0 $n3 5Mb 2ms DropTail
$ns duplex-link $n1 $n3 5Mb 2ms DropTail
$ns duplex-link $n2 $n3 5Mb 2ms DropTail
$ns duplex-link $n10 $n3 1.5Mb 10ms DropTail
$ns duplex-link $n9 $n10 1.5Mb 10ms DropTail

Universitas Sumatera Utara

$ns duplex-link $n10 $n16 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n17 1.5Mb 10ms DropTail
$ns duplex-link $n3 $n4 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n6 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n7 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n8 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n12 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n13 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n14 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n15 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n18 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n19 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n20 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n21 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n22 1.5Mb 10ms DropTail
$ns duplex-link-op $n0 $n3 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n2 $n3 orient down
$ns duplex-link-op $n10 $n3 orient up
$ns duplex-link-op $n9 $n10 orient right-up
$ns duplex-link-op $n10 $n11 orient right
$ns duplex-link-op $n10 $n16 orient down
$ns duplex-link-op $n10 $n17 orient right-down
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n4 $n5 orient right-up
$ns duplex-link-op $n4 $n11 orient down
$ns duplex-link-op $n5 $n6 orient right
$ns duplex-link-op $n6 $n7 orient right-up
$ns duplex-link-op $n6 $n8 orient right
$ns duplex-link-op $n11 $n12 orient right
$ns duplex-link-op $n12 $n13 orient right-up
$ns duplex-link-op $n12 $n14 orient right
$ns duplex-link-op $n12 $n15 orient right-down
$ns duplex-link-op $n11 $n18 orient right-down
$ns duplex-link-op $n18 $n19 orient left-down
$ns duplex-link-op $n18 $n20 orient right-down
$ns duplex-link-op $n5 $n21 orient right-up
$ns duplex-link-op $n5 $n22 orient left-up
$ns duplex-link-op $n2 $n3 queuePos 0.5
set udp0 [new Agent/UDP]

Universitas Sumatera Utara

$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
set udp1 [new Agent/UDP]
$ns attach-agent $n3 $udp1
$udp1 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
set udp2 [new Agent/UDP]
$ns attach-agent $n9 $udp2
$udp2 set class_ 2
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
set udp3 [new Agent/UDP]
$ns attach-agent $n16 $udp3
$udp3 set class_ 3
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
set udp4 [new Agent/UDP]
$ns attach-agent $n19 $udp4
$udp4 set class_ 4
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
set udp5 [new Agent/UDP]
$ns attach-agent $n7 $udp5
$udp5 set class_ 5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
set udp6 [new Agent/UDP]
$ns attach-agent $n14 $udp6
$udp6 set class_ 6
set cbr6 [new Application/Traffic/CBR]
$cbr6 attach-agent $udp6
set udp7 [new Agent/UDP]
$ns attach-agent $n13 $udp7
$udp7 set class_ 7
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7

Universitas Sumatera Utara

set udp8 [new Agent/UDP]
$ns attach-agent $n1 $udp8
$udp8 set class_ 8
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
set null0 [new Agent/Null]
$ns attach-agent $n14 $null0
set null1 [new Agent/Null]
$ns attach-agent $n13 $null1
set null2 [new Agent/Null]
$ns attach-agent $n8 $null2
set null3 [new Agent/Null]
$ns attach-agent $n20 $null3
set null4 [new Agent/Null]
$ns attach-agent $n14 $null4
set null5 [new Agent/Null]
$ns attach-agent $n20 $null5
set null6 [new Agent/Null]
$ns attach-agent $n21 $null6
set null7 [new Agent/Null]
$ns attach-agent $n22 $null7
set null8 [new Agent/Null]
$ns attach-agent $n17 $null8
$ns connect $udp0 $null0
$ns connect $udp1 $null1
$ns connect $udp2 $null2
$ns connect $udp3 $null3
$ns connect $udp4 $null4
$ns connect $udp5 $null5
$ns connect $udp6 $null6
$ns connect $udp7 $null7
$ns connect $udp8 $null8

# creation trace traffic
set max_fragmented_size 1024

Universitas Sumatera Utara

#add udp header(8 bytes) and IP header (20bytes)
set packetSize 1052
set original_file_name trafik
set trace_file_name video1.dat
set original_file_id [open $original_file_name r]
set trace_file_id [open $trace_file_name w]
set pre_time 0
while {[eof $original_file_id] == 0} {
gets $original_file_id current_line
scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_ tmp2_
set time [expr int(($tmp2_ - $pre_time)*1000000.0)]
if { $frametype_ == "I" } {
set type_v 1
set prio_p 0
}
if { $frametype_ == "P" } {
set type_v 2
set prio_p 0
}
if { $frametype_ == "B" } {
set type_v 3
set prio_p 0
}
if { $frametype_ == "H" } {
set type_v 1
set prio_p 0
}
puts $trace_file_id "$time $length_ $type_v $prio_p $max_fragmented_size"
set pre_time $tmp2_
}
close $original_file_id
close $trace_file_id
set end_sim_time $tmp2_
puts "$end_sim_time"
set trace_file [new Tracefile]
$trace_file filename $trace_file_name
#Attach video to server
#create source traffic
#Create a UDP agent and attach it to node n0
set udp_0 [new Agent/myUDP]
$udp_0 set_filename udpSend0
$udp_0 set packetSize_ 1052
$ns attach-agent $n2 $udp_0 ;#Server 2

Universitas Sumatera Utara

set udp_1 [new Agent/myUDP]
$udp_1 set_filename udpSend1
$udp_1 set packetSize_ 1052
$ns attach-agent $n2 $udp_1 ;#Server 2
set udp_7 [new Agent/myUDP]
$udp_7 set_filename udpSend7
$udp_7 set packetSize_ 1052
$ns attach-agent $n2 $udp_7 ;#Server 2
set udp_8 [new Agent/myUDP]
$udp_8 set_filename udpSend8
$udp_8 set packetSize_ 1052
$ns attach-agent $n2 $udp_8 ;#Server 2
set udp_9 [new Agent/myUDP]
$udp_9 set_filename udpSend9
$udp_9 set packetSize_ 1052
$ns attach-agent $n2 $udp_9 ;#Server 2
set udp_14 [new Agent/myUDP]
$udp_14 set_filename udpSend14
$udp_14 set packetSize_ 1052
$ns attach-agent $n2 $udp_14 ;#Server 2
set udp_15 [new Agent/myUDP]
$udp_15 set_filename udpSend15
$udp_15 set packetSize_ 1052
$ns attach-agent $n2 $udp_15 ;#Server 2
set udp_16 [new Agent/myUDP]
$udp_16 set_filename udpSend16
$udp_16 set packetSize_ 1052
$ns attach-agent $n2 $udp_16 ;#Server 2
set udp_19 [new Agent/myUDP]
$udp_19 set_filename udpSend19
$udp_19 set packetSize_ 1052
$ns attach-agent $n2 $udp_19 ;#Server 2
set udp_21 [new Agent/myUDP]
$udp_21 set_filename udpSend21
$udp_21 set packetSize_ 1052
$ns attach-agent $n2 $udp_21 ;#Server 2

Universitas Sumatera Utara

# Attach video traffic source
set video0 [new Application/Traffic/myEvalvid]
$video0 attach-tracefile $trace_file
$video0 attach-agent $udp_0
set video1 [new Application/Traffic/myEvalvid]
$video1 attach-tracefile $trace_file
$video1 attach-agent $udp_1
set video2 [new Application/Traffic/myEvalvid]
$video2 attach-tracefile $trace_file
$video2 attach-agent $udp_7
set video3 [new Application/Traffic/myEvalvid]
$video3 attach-tracefile $trace_file
$video3 attach-agent $udp_8
set video4 [new Application/Traffic/myEvalvid]
$video4 attach-tracefile $trace_file
$video4 attach-agent $udp_9
set video5 [new Application/Traffic/myEvalvid]
$video5 attach-tracefile $trace_file
$video5 attach-agent $udp_14
set video6 [new Application/Traffic/myEvalvid]
$video6 attach-tracefile $trace_file
$video6 attach-agent $udp_15
set video7 [new Application/Traffic/myEvalvid]
$video7 attach-tracefile $trace_file
$video7 attach-agent $udp_16
set video8 [new Application/Traffic/myEvalvid]
$video8 attach-tracefile $trace_file
$video8 attach-agent $udp_19
set video9 [new Application/Traffic/myEvalvid]
$video9 attach-tracefile $trace_file
$video9 attach-agent $udp_21
# Create the Null agent to sink traffic
set null_0 [new Agent/myEvalvid_Sink]
$null_0 set_filename udpRec0
$ns attach-agent $n0 $null_0

Universitas Sumatera Utara

set null_1 [new Agent/myEvalvid_Sink]
$null_1 set_filename udpRec1
$ns attach-agent $n1 $null_1
set null_7 [new Agent/myEvalvid_Sink]
$null_7 set_filename udpRec7
$ns attach-agent $n7 $null_7
set null_8 [new Agent/myEvalvid_Sink]
$null_8 set_filename udpRec8
$ns attach-agent $n8 $null_8
set null_9 [new Agent/myEvalvid_Sink]
$null_9 set_filename udpRec9
$ns attach-agent $n9 $null_9
set null_14 [new Agent/myEvalvid_Sink]
$null_14 set_filename udpRec14
$ns attach-agent $n14 $null_14
set null_15 [new Agent/myEvalvid_Sink]
$null_15 set_filename udpRec15
$ns attach-agent $n15 $null_15
set null_16 [new Agent/myEvalvid_Sink]
$null_16 set_filename udpRec16
$ns attach-agent $n16 $null_16
set null_19 [new Agent/myEvalvid_Sink]
$null_19 set_filename udpRec19
$ns attach-agent $n19 $null_19
set null_21 [new Agent/myEvalvid_Sink]
$null_21 set_filename udpRec21
$ns attach-agent $n21 $null_21
# Attach the 2 agents
$ns connect $udp_0 $null_0
$ns connect $udp_1 $null_1
$ns connect $udp_7 $null_7
$ns connect $udp_8 $null_8
$ns connect $udp_9 $null_9
$ns connect $udp_14 $null_14
$ns connect $udp_15 $null_15
$ns connect $udp_16 $null_16
$ns connect $udp_19 $null_19

Universitas Sumatera Utara

$ns connect $udp_21 $null_21
$ns at 1.0 "$cbr0 start"
$ns at 6.1 "$cbr1 start"
$ns at 1.3 "$cbr2 start"
$ns at 2.6 "$cbr3 start"
$ns at 1.8 "$cbr4 start"
$ns at 3.0 "$cbr5 start"
$ns at 2.1 "$cbr6 start"
$ns at 5.2 "$cbr7 start"
$ns at 7.3 "$cbr8 start"
$ns at 4.0 "$cbr5 stop"
$ns at 5.1 "$cbr6 stop"
$ns at 5.8 "$cbr7 stop"
#Evaluated traffics
$ns at 2.0 "$video0 start"
$ns at 2.5 "$video1 start"
$ns at 3.0 "$video2 start"
$ns at 3.5 "$video3 start"
$ns at 4.0 "$video4 start"
$ns at 4.5 "$video5 start"
$ns at 5.0 "$video6 start"
$ns at 5.5 "$video7 start"
$ns at 6.0 "$video8 start"
$ns at 6.5 "$video9 start"
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.2 "$ftp start"
$ns at 1.35 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]
$ns at 500.0 "finish"
proc finish {} {
global ns f nf

Universitas Sumatera Utara

$ns flush-trace
close $f
close $nf
puts "running nam..."
exec nam out.nam &
exit 0
}
$ns run

Universitas Sumatera Utara