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

📄 basic5a.tcl

📁 obs网络试验平台
💻 TCL
字号:
#  Copyright (c) University of Maryland, Baltimore County, 2003.#   Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam.#   This software is developed at the University of Maryland, Baltimore County under#   grants from Cisco Systems Inc and the University of Maryland, Baltimore County.#   Permission to use, copy, modify, and distribute this software and its#   documentation in source and binary forms for non-commercial purposes#   and without fee is hereby granted, provided that the above copyright#   notice appear in all copies and that both the copyright notice and#   this permission notice appear in supporting documentation. and that#   any documentation, advertising materials, and other materials related#   to such distribution and use acknowledge that the software was#   developed by the University of Maryland, Baltimore County.  The name of#   the University may not be used to endorse or promote products derived from#   this software without specific prior written permission.#   Copyright (C) 2000-2003 Washington State University. All rights reserved.#   This software was originally developed at Alcatel USA and subsequently modified#   at Washington State University, Pullman, WA  through research work which was#   supported by Alcatel USA, Inc and Cisco Systems Inc.#   The  following notice is in adherence to the Washington State University#   copyright policy follows.#   License is granted to copy, to use, and to make and to use derivative#   works for research and evaluation purposes, provided that Washington#   State University is acknowledged in all documentation pertaining to any such#   copy or derivative work. Washington State University grants no other#   licenses expressed or implied. The Washington State University name#   should not be used in any advertising without its written permission.#   WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER#   THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE#   FOR ANY PARTICULAR PURPOSE.  The software is provided "as is"#   without express or implied warranty of any kind. These notices must#   be retained in any copies of any part of this software.# Example demo topology as shown below :##    ___________          ___________          ___________#   |           |        |           |        |           |#   | Edge node |========| Core node |========| Edge node |#   |___________|        |___________|        |___________|##StatCollector set debug_ 0Classifier/BaseClassifier/EdgeClassifier set type_ 0Classifier/BaseClassifier/CoreClassifier set type_ 1# Per node bhp processing time is 1 micro-secondsource ../lib/ns-obs-lib.tclsource ../lib/ns-obs-defaults.tclsource ../lib/ns-optic-link.tcl set ns [new Simulator]set sc [new StatCollector]#open trace file for IPKTs and data pkts dropped within the networkset tf [open trace5a.tr w]#open trace file for data pkts entering and leaving networkset ndf [open ndtrace5a.tr w]#trace IPKTs and dropped data pkts$ns trace-all $tf#trace data pkts at ingress and egress$ns nodetrace-all $ndf#====================================================================## constant definitions# set the offset time To to 20 microseconds#BurstManager offsettime 0.00002BurstManager offsettime 0.002BurstManager maxburstsize 1250BurstManager bursttimeout 0.1# set the bhp processing time 1 microsecondClassifier/BaseClassifier/CoreClassifier set bhpProcTime 0.000006Classifier/BaseClassifier/EdgeClassifier set bhpProcTime 0.000006Classifier/BaseClassifier set proc_time 0.0OBSFiberDelayLink set FDLdelay 0.000005# total number of edge nodesset edge_count 2# total number of core routersset core_count 1# total bandwidth/channel (1mb = 1000000)set bwpc 1000000#set bwpc # delay in millisecondsset delay 1ms# total number of channels per linkset maxch 16# number of control channels per linkset ncc 4# number of data-channelsset ndc 12# set the variables too.$ns set bwpc_  $bwpc$ns set maxch_ $maxch$ns set ncc_ $ncc$ns set ndc_ $ndc#====================================================================## support procedures# finish procedureproc finish {} {    global ns sc tf    $ns flush-trace    close $tf        $sc display-sim-list    puts "Simulation complete";    exit 0}#create a edge-core-edge topologySimulator instproc  create_topology { } {    $self instvar Node_    global E C     global edge_count core_count    global bwpc maxch ncc ndc delay    set i 0    # set up the edge nodes    while { $i < $edge_count } {	set E($i) [$self create-edge-node $edge_count]        set nid [$E($i) id]        set string1 "E($i) node id:     $nid"        puts $string1	incr i    }        set i 0    # set up the core nodes    while { $i < $core_count } {	set C($i) [$self create-core-node $core_count]        set nid [$C($i) id]        set string1 "C($i) node id:     $nid"        puts $string1	incr i    }        $self createDuplexFiberLink $E(0) $C(0) $bwpc $delay $ncc $ndc $maxch    $self createDuplexFiberLink $C(0) $E(1) $bwpc $delay $ncc $ndc $maxch    $self build-routing-table   }$ns create_topology#set ftp0 [$ns create-ftp-connection $E(0) $E(1)]#puts "constructed a ftp connection between Edge node 0 and 1 "#$ns at 1.0 "$ftp0 start"#$ns at 1000.0 "$ftp0 stop"Agent/UDP set packetSize_ 1250set udp0 [new Agent/UDP]$ns attach-agent $E(0) $udp0set cbr0 [new Application/Traffic/CBR]$cbr0 set packetSize_ 1250$cbr0 set interval_ 0.01$cbr0 attach-agent $udp0set null0 [new Agent/Null]$ns attach-agent $E(1) $null0$ns connect $udp0 $null0$ns at 1.0 "$cbr0 start"$ns at 101.0 "$cbr0 stop"$ns at 105.0 "finish"$ns run

⌨️ 快捷键说明

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