📄 agent-gen-script.tcl
字号:
# This file is an example script for using the topology generator,# the routing generator and the agents generator together as part# of the scenario generator# Created by Ahmed Helmy, June 98.# source the generators code (this is not part of the release yet)source topo-gen.tclsource agent-gen.tclsource route-gen.tcl# setup the files that will contain the scripts generatedset topofile topo1.tclset agentfile agent1.tclset routefile route1.tclset hier_flag 1# we remove the agentfile, to start afresh... the agentfile is# opened in append mode and previous runs may cause problemsif { [file exists $agentfile] } { catch { [exec rm $agentfile] }}# generate the topology creation script#puts {topology -outfile $topofile -num 50 -connection_prob 0.1}#topology -outfile $topofile -nodes 15 -connection_prob 0.1puts {topology -outfile $topofile -type transit_stub -nodes 50 -connection_prob 0.1}topology -outfile $topofile -type transit_stub -nodes 50 -connection_prob 0.1# set the route settings for unicast/mcastputs {routing -outfile $routefile -unicast Session -multicast CtrMcast}routing -outfile $routefile -unicast Session -multicast CtrMcast# generate the agent creation script# note that src and dest stub location info (for distribution of src and dest nodes)# should be given only when topology generated is of type transit-stubputs {agents -outfile $agentfile -transport TCP/Reno -src FTP \ -sink TCPSink/DelAck -num 60% -srcstub 1-4,8,10 -deststub 5-7,9,11,12 -start 1-3 -stop 9-11}agents -outfile $agentfile -transport TCP/Reno -src FTP \ -sink TCPSink/DelAck -num 60% -srcstub 1-4,8,10 -deststub 5-7,9,11,12 -start 1-3 -stop 9-11#puts {agents -outfile $agentfile -transport TCP -sink TCPSink -num 8}#agents -outfile $agentfile -transport TCP -sink TCPSink -num 8#puts {agents -outfile $agentfile -transport SRM/Deterministic -num 75% \ -join 0-2 -src CBR/UDP -traffic Pareto -srcnum 20% \ -start 3-10}#agents -outfile $agentfile -transport SRM/Deterministic -num 75% \ -join 0-2 -src CBR/UDP -traffic Pareto -srcnum 20% \ -start 3-10 #puts {agents -outfile $agentfile -transport SRM -src CBR/UDP \ -traffic Expoo }#agents -outfile $agentfile -transport SRM -src CBR/UDP \ -traffic Expoomark-end $agentfile# the marker merely serves as debugging aid to make sure that# all the code was written to file, and was not disrupted due# to failure or disk full... etc, it also contains all the # the command lines used to generate the code.# now that we've generated the tcl scripts, source them and call# the procs to start the simulations.source $routefilesource $topofilesource $agentfileset ns [new Simulator]# set up hierarchical routing (if needed) or any other address format#$ns set-address-format hierarchical# comment out the ns trace for now... it consumes a lot of mem# set f [open out.tr w]# $ns trace-all $fset nf [open out.nam w]$ns namtrace-all $nf# have to call these before the topology is generated, as# artifact of current ns !!!setup-mcastNaddr ns# call the topology scriptif {$hier_flag} { create-hier-topology ns node 1.5Mb} else { create-topology ns node 1.5Mb}# set routingcreate-routing ns# call the agent scriptgenerate-agents ns node$ns at 3.0 "finish"proc finish {} { global ns nf; #f $ns flush-trace # close $f close $nf puts "running nam..." exec nam out.nam & exit 0}$ns run
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -