⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test-suite-friendly.tcl

📁 跑leach需要的
💻 TCL
📖 第 1 页 / 共 4 页
字号:
    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0]    $ns_ at 0.0 "$tf1 start"    set udp1 [$ns_ create-connection UDP $node_(s2) UDP $node_(s4) 1]		set cbr1 [$udp1 attach-app Traffic/CBR]		$cbr1 set rate_ 3Mb		$ns_ at [expr $stopTime1_/3.0] "$cbr1 start"   		$ns_ at [expr 2.0*$stopTime1_/3.0] "$cbr1 stop"       $self tfccDump 1 $tf1 $interval_ $dumpfile_    $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_]    $ns_ at $stopTime "$self cleanupAll $testName_"     if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    # trace only the bottleneck link    $ns_ run}Class Test/HighLossTCP -superclass TestSuiteTest/HighLossTCP instproc init {} {    $self instvar net_ test_ guide_ stopTime1_    set net_	net2    set test_ HighLossTCP	    set guide_  \    "TCP competing against a CBR flow."    Agent/TFRCSink set discount_ 1    Agent/TFRCSink set smooth_ 1    Agent/TFRC set df_ 0.95    Agent/TFRC set ca_ 1    set stopTime1_ 60    $self next pktTraceFile}Test/HighLossTCP instproc run {} {    global quiet    $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ stopTime1_    if {$quiet == "false"} {puts $guide_}    $self setTopo    set interval_ 1    set stopTime $stopTime1_    set stopTime0 [expr $stopTime - 0.001]    set stopTime2 [expr $stopTime + 0.001]    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 0]    set ftp1 [$tcp1 attach-app FTP]    $ns_ at 0.0 "$ftp1 start"    set udp1 [$ns_ create-connection UDP $node_(s2) UDP $node_(s4) 1]		set cbr1 [$udp1 attach-app Traffic/CBR]		$cbr1 set rate_ 3Mb		$ns_ at [expr $stopTime1_/3.0] "$cbr1 start"   		$ns_ at [expr 2.0*$stopTime1_/3.0] "$cbr1 stop"       $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_]    $ns_ at $stopTime "$self cleanupAll $testName_"    if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    # trace only the bottleneck link    $ns_ run}Class Test/TFRC_FTP -superclass TestSuiteTest/TFRC_FTP instproc init {} {    $self instvar net_ test_ guide_ stopTime1_    set net_	net2    set test_ TFRC_FTP	    set guide_  \    "TFRC with a data source with limited, bursty data."    Agent/TFRC set SndrType_ 1     Agent/TFRCSink set smooth_ 1    Agent/TFRC set df_ 0.95    Agent/TFRC set ca_ 1    Agent/TFRC set discount_ 1    Agent/TCP set oldCode_ false    set stopTime1_ 15    $self next pktTraceFile}Test/TFRC_FTP instproc run {} {    global quiet    $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ stopTime1_    if {$quiet == "false"} {puts $guide_}    $self setTopo    set interval_ 1    set stopTime $stopTime1_    set stopTime0 [expr $stopTime - 0.001]    set stopTime2 [expr $stopTime + 0.001]    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0]    set ftp [new Application/FTP]    $ftp attach-agent $tf1    $ns_ at 0 "$ftp produce 100"    $ns_ at 5 "$ftp producemore 100"    $self tfccDump 1 $tf1 $interval_ $dumpfile_    $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    $ns_ at $stopTime "$self cleanupAll $testName_"     if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    # trace only the bottleneck link    $ns_ run}  Class Test/printLosses -superclass TestSuiteTest/printLosses instproc init {} {    $self instvar net_ test_ guide_    set net_	net2    set test_	printLosses    set guide_  \    "One TFRC flow, with the loss intervals from the TFRC receiver."    Agent/TFRCSink set printLosses_ 1    Agent/TFRCSink set printLoss_ 1    $self next pktTraceFile}Test/printLosses instproc run {} {    global quiet    $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_    if {$quiet == "false"} {puts $guide_}    $self setTopo    set interval_ 0.1    set stopTime 3.0    set stopTime0 [expr $stopTime - 0.001]    set stopTime2 [expr $stopTime + 0.001]    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0]    $ns_ at 0.0 "$tf1 start"    $self tfccDump 1 $tf1 $interval_ $dumpfile_    $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_]    $ns_ at $stopTime "$self cleanupAll $testName_"    if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    # trace only the bottleneck link    $ns_ run}TestSuite instproc printpkts { label tcp } {        puts "tcp $label highest_seqment_acked [$tcp set ack_]"}TestSuite instproc printTFRCpkts { label src } {        puts "tfrc $label [$src set ndatapack_] " }Class Test/goodTFRC superclass TestSuiteTest/goodTFRC instproc init {} {    $self instvar net_ test_ guide_ period_    set net_	net2    set test_	goodTFRC    set guide_  \    "One TFRC flow, no reordering and no extra drops."    set period_ 10000.0    $self next pktTraceFile}Test/goodTFRC instproc run {} {    global quiet    $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ period_    if {$quiet == "false"} {puts $guide_}    $self setTopo    set interval_ 0.1    set stopTime 20.0    set stopTime0 [expr $stopTime - 0.001]    set stopTime2 [expr $stopTime + 0.001]    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tf1 [$ns_ create-connection TFRC $node_(s1) TFRCSink $node_(s3) 0]    $ns_ at 0.0 "$tf1 start"    $self dropPktsPeriodic [$ns_ link $node_(r2) $node_(s3)] 0 1000.0 $period_    $self tfccDump 1 $tf1 $interval_ $dumpfile_    $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_]    $ns_ at $stopTime "$self cleanupAll $testName_"     if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    # $ns_ at $stopTime0 "$self printTFRCpkts 0 $tf1"    # trace only the bottleneck link    $ns_ run}Class Test/droppedTFRC superclass TestSuiteTest/droppedTFRC instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   droppedTFRC    set guide_  \    "One TFRC flow, with extra dropped packets."    set period_ 40.0    Test/droppedTFRC instproc run {} [Test/goodTFRC info instbody run ]    $self next pktTraceFile}Class Test/delayedTFRC superclass TestSuiteTest/delayedTFRC instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   delayedTFRC    set guide_  \    "One TFRC flow, with some packets delayed 0.03 seconds, numPkts_ 1."    set period_ 40.0    ErrorModel set delay_pkt_ true    ErrorModel set drop_ false    ErrorModel set delay_ 0.03    Agent/TFRCSink set numPkts_ 1    Test/delayedTFRC instproc run {} [Test/goodTFRC info instbody run ]    $self next pktTraceFile}Class Test/delayedTFRC1 superclass TestSuiteTest/delayedTFRC1 instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   delayedTFRC1    set guide_  \    "One TFRC flow, with some packets delayed 0.03 seconds, numPkts_ 5."    set period_ 40.0    ErrorModel set delay_pkt_ true    ErrorModel set drop_ false    ErrorModel set delay_ 0.03    Agent/TFRCSink set numPkts_ 5    Test/delayedTFRC1 instproc run {} [Test/goodTFRC info instbody run ]    $self next pktTraceFile}Class Test/delayedTFRC2 superclass TestSuiteTest/delayedTFRC2 instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   delayedTFRC2    set guide_  \    "One TFRC flow, with some packets delayed 0.01 seconds, numPkts_ 3."    set period_ 40.0    ErrorModel set delay_pkt_ true    ErrorModel set drop_ false    ErrorModel set delay_ 0.01    Agent/TFRCSink set numPkts_ 3    Test/delayedTFRC2 instproc run {} [Test/goodTFRC info instbody run ]    $self next pktTraceFile}Class Test/goodTCP superclass TestSuiteTest/goodTCP instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_	net2    set test_	goodTCP    set guide_  \    "One TCP flow, no reordering and no extra drops."    set list_ {50000 50001}    set period_ 1000.0    $self next pktTraceFile}Test/goodTCP instproc run {} {    global quiet    $self instvar ns_ node_ testName_ interval_ dumpfile_ guide_ list_ period_    if {$quiet == "false"} {puts $guide_}    $self setTopo    set interval_ 0.1    set stopTime 20.0    set stopTime0 [expr $stopTime - 0.001]    set stopTime2 [expr $stopTime + 0.001]    set dumpfile_ [open temp.s w]    if {$quiet == "false"} {        set tracefile [open all.tr w]        $ns_ trace-all $tracefile    }    set tcp1 [$ns_ create-connection TCP/Sack1 $node_(s1) TCPSink/Sack1 $node_(s3) 0]    set ftp1 [$tcp1 attach-app FTP]    $ns_ at 0.0 "$ftp1 start"    $self pktsDump 1 $tcp1 $interval_ $dumpfile_    $self dropPktsPeriodic [$ns_ link $node_(r2) $node_(s3)] 0 200.0 $period_    $ns_ at $stopTime0 "close $dumpfile_; $self finish_1 $testName_"    #$self traceQueues $node_(r1) [$self openTrace $stopTime $testName_]    $ns_ at $stopTime "$self cleanupAll $testName_"     if {$quiet == "false"} {	$ns_ at $stopTime2 "close $tracefile"    }    $ns_ at $stopTime2 "exec cp temp2.rands temp.rands; exit 0"    $ns_ at $stopTime0 "$self printpkts 0 $tcp1"    # trace only the bottleneck link    $ns_ run}Class Test/droppedTCP superclass TestSuiteTest/droppedTCP instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   droppedTCP    set guide_  \    "One TCP flow, with extra dropped packets."    set period_ 40.0    Test/droppedTCP instproc run {} [Test/goodTCP info instbody run ]    $self next pktTraceFile}Class Test/delayedTCP superclass TestSuiteTest/delayedTCP instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   delayedTCP    set guide_  \    "One TCP flow, with some packets delayed 0.03 seconds."    set period_ 40.0    ErrorModel set delay_pkt_ true    ErrorModel set drop_ false    ErrorModel set delay_ 0.03    Test/delayedTCP instproc run {} [Test/goodTCP info instbody run ]    $self next pktTraceFile}Class Test/delayedTCP2 superclass TestSuiteTest/delayedTCP2 instproc init {} {    $self instvar net_ test_ guide_ list_ period_    set net_    net2    set test_   delayedTCP2    set guide_  \    "One TCP flow, with some packets delayed 0.01 seconds."    set period_ 40.0    ErrorModel set delay_pkt_ true    ErrorModel set drop_ false    ErrorModel set delay_ 0.01    Test/delayedTCP2 instproc run {} [Test/goodTCP info instbody run ]    $self next pktTraceFile}TestSuite runTest

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -