[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scenario Generator



Greetings,

	I just checked in a very first cut on the scenario-generator 
package consisting of the following components:
the topology generator (already checked in, updated with minor changes)
			[note that this needs the ITM package and the 
			sgb2ns code in your path, check the topology
			generation home page thru ns pages, or the
			changes log]
the routing generator (to assign unicast/mcast routing basically)
the agent generator (to assign the topological distribution/# of 
			connections/groups of tcp/srm agents along with
			their traffic sources, and the time distrbution
			of the start/end of these connections)

these exist as a temp measure under tcl/ex/{topo,agent,route}-gen.tcl

Each of these files contains some help explaining how to use the command 
line and giving some info about the supported features (type of agents, 
traffics... etc).

to find out about these generators you can source the above files and type
'topology -h' or 'agents -h' or 'routing -h'.

There's also sample scripts in the same dir:
topo-gen-script.tcl [for the topology generation]
agent-gen-script.tcl [for all three components]

This is the very first cut (breadth first) on the scenario generator, it 
still needs lots of work, so your feedback is very much appreciated.

to give you a feel of how this works and what it produces, I've included 
some sample inputs (incomplete) and one sample output script for the 
agent generator,

Best Regards,
-Ahmed

----------------------- sample input (part of script)----------------------
# generate a flat random 50 node topology using ITM
topology -outfile $topofile -nodes 50 -connection_prob 0.1

# set the route settings for unicast/mcast
routing -outfile $routefile -unicast Session -multicast CtrMcast

# generate the agent creation script
agents -outfile $agentfile -transport TCP/Reno -src FTP \
	-sink TCPSink/DelAck -num 60% -start 1-3 -stop 9-11

agents -outfile $agentfile -transport TCP -sink TCPSink -num 8

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 -src CBR/UDP \
	-traffic Expoo


----------------- sample output of agent generator -----------------

 proc generate-agents { sim nodes } { 

	 upvar $nodes n; upvar $sim ns 



 ################# 
 # The command line generating this part of the script is: 
 # agents -outfile agent1.tcl -transport TCP/Reno -src FTP -sink TCPSink/DelAck -num 60% -start 1-3 -stop 9-11 
 ################# 
 

 # XXX cuz we use [array names src], we unset it first.
 catch {unset src} 


 # generate 30 connections of TCP/Reno, using TCPSink/DelAck 
 # sink types, and FTP sources. Distribute randomly. 
 
 set i 0 
 foreach pair {{6 37} {22 26} {10 2} {33 46} {19 25} {41 1} {2 26} {33 0} {19 3} {20 34} {29 46} {42 26} {4 32} {20 35} {45 38} {13 2} {36 16} {31 37} {49 18} {12 49} {36 37} {32 3} {31 44} {13 21} {38 23} {11 13} {17 8} {24 44} {45 3} {45 25}} { 
 	 set sorc [lindex $pair 0] 
 	 set dst [lindex $pair 1] 
 	 set fid $sorc$dst 
 	 set tcp($i) [$ns create-connection TCP/Reno $n($sorc) TCPSink/DelAck $n($dst) $fid] 
 	 set src($i) [$tcp($i) attach-source FTP] 
 	 incr i 
 }

 # randomize the start time for the 30 sources in
 # the range [1,3]
 
 set i 0 
 foreach time {2.032584 1.638066 2.973284 1.987953 1.532289 1.181466 2.895528 1.147498 2.001414 1.768284 1.554164 2.827635 2.059495 1.928892 2.881960 1.100168 2.523029 2.540409 2.655635 1.250731 1.031735 2.376911 2.736494 2.259087 2.472449 2.450824 2.9989
16 2.777144 1.466390 1.612644} { 
 	 $ns at $time "$src($i) start" 
 	 incr i 
 } 
 
 # randomize the stop time for the 30 sources in
 # the range [9,11]
 
 set i 0 
 foreach time {9.702030 10.026547 10.182227 10.691963 9.824162 10.683021 9.538635 9.830789 10.074608 9.935835 9.574425 9.356655 9.307440 10.143310 10.604811 9.066108 10.068900 9.996960 10.910722 10.496585 10.109168 10.781475 10.249699 10.684079 9.319535 9
.425503 10.429420 9.260855 9.181981 9.549176} { 
 	 $ns at $time "$src($i) stop" 
 	 incr i 
 } 


 ################# 
 # The command line generating this part of the script is: 
 # agents -outfile agent1.tcl -transport TCP -sink TCPSink -num 8 
 ################# 
 

 # XXX cuz we use [array names src], we unset it first.
 catch {unset src} 


 # generate 8 connections of TCP, using TCPSink 
 # sink types, and FTP sources. Distribute randomly. 
 
 set i 0 
 foreach pair {{0 20} {1 35} {46 11} {9 15} {44 32} {7 34} {19 24} {7 29}} { 
 	 set sorc [lindex $pair 0] 
 	 set dst [lindex $pair 1] 
 	 set fid $sorc$dst 
 	 set tcp($i) [$ns create-connection TCP $n($sorc) TCPSink $n($dst) $fid] 
 	 set src($i) [$tcp($i) attach-source FTP] 
 	 incr i 
 }
  # start the sources at 0 
  foreach i [array names src] { 
 	 $ns at 0 "$src($i) start" 
  }

 ################# 
 # The command line generating this part of the script is: 
 # agents -outfile agent1.tcl -transport SRM/Deterministic -num 75% -join 0-2 -src CBR/UDP -traffic Pareto -srcnum 20% -start 3-10 
 ################# 
 

 # XXX cuz we use array names of srm and srmsrc, we unset.
 catch {unset srmsrc} 
 catch {unset srm} 


 # generate 37 SRM/Deterministic agents, 10 of which are 
 # srcs CBR/UDP/Pareto. Distribute randomly. 
 
 set group [Node allocaddr] 
 foreach i {23 48 6 9 15 31 32 40 19 10 1 45 21 44 4 8 3 18 39 22 17 46 33 43 25 30 37} { 
 	 set srm($i) [new Agent/SRM/Deterministic] 
 	 $srm($i) set dst_ $group 
 	 $ns attach-agent $n($i) $srm($i) 
 } 
 foreach i {42 29 47 27 7 49 20 28 12 24} { 
 	 set srmsrc($i) [new Agent/SRM/Deterministic] 
 	 $srmsrc($i) set dst_ $group 
 	 $ns attach-agent $n($i) $srmsrc($i) 
 	 set s($i) [new Agent/CBR/UDP] 
 	 set traffic($i) [new Traffic/Pareto] 
 	 $s($i) attach-traffic $traffic($i) 
 	 $srmsrc($i) traffic-source $s($i) 
 } 


 # randomize start times in the [3,10] range
 # for 10 srm sources. 
 
 set i 0 
 set times {6.235715 9.659572 7.429171 6.075312 8.772882 7.822866 7.915447 9.910018 9.680904 8.958888} 
 foreach j [array names srmsrc] { 
 	 set time [lindex $times $i] 
 	 $ns at $time "$srmsrc($j) start-source" 
 	 incr i 
 } 
 
 # randomize the join times for 37 srm agents in
 # the range [0,2] 
 
 set i 0 
 set times {0.578632 1.074851 1.028869 0.206868 0.828057 1.153433 1.753131 0.880077 1.459495 1.738527 1.431285 1.601441 1.413071 1.483432 0.038185 1.772062 1.049975 0.926645 0.130388 1.426845 0.977886 1.335358 1.364098 0.399109 1.833268 1.731765 1.780037 
1.087897 0.278390 0.900695 1.978725 0.431064 0.892047 0.631465 1.029319 1.763008 0.879451} 
 foreach j [array names srmsrc] { 
 	 set time [lindex $times $i] 
 	 $ns at $time "$srmsrc($j) start" 
 	 incr i 
 } 
 foreach j [array names srm] { 
 	 set time [lindex $times $i] 
 	 $ns at $time "$srm($j) start" 
 	 incr i 
 } 


 ################# 
 # The command line generating this part of the script is: 
 # agents -outfile agent1.tcl -transport SRM -src CBR/UDP -traffic Expoo 
 ################# 
 

 # XXX cuz we use array names of srm and srmsrc, we unset.
 catch {unset srmsrc} 
 catch {unset srm} 


 # generate 50 SRM agents, 5 of which are 
 # srcs CBR/UDP/Expoo. Distribute randomly. 
 
 set group [Node allocaddr] 
 foreach i {7 31 30 0 38 36 15 20 34 41 35 4 19 47 13 14 39 21 9 12 6 8 11 5 37 33 2 29 26 27 16 24 43 25 22 3 17 32 45 48 42 1 28 44 46} { 
 	 set srm($i) [new Agent/SRM] 
 	 $srm($i) set dst_ $group 
 	 $ns attach-agent $n($i) $srm($i) 
 } 
 foreach i {23 40 18 10 49} { 
 	 set srmsrc($i) [new Agent/SRM] 
 	 $srmsrc($i) set dst_ $group 
 	 $ns attach-agent $n($i) $srmsrc($i) 
 	 set s($i) [new Agent/CBR/UDP] 
 	 set traffic($i) [new Traffic/Expoo] 
 	 $s($i) attach-traffic $traffic($i) 
 	 $srmsrc($i) traffic-source $s($i) 
 } 

 # start all 5 srm sources at 0. 
 foreach i [array names srmsrc] { 
 	 $ns at 0 "$srmsrc($i) start-source" 
 } 
 # srm agents join at 0
 foreach j [array names srm] { 
 	 $ns at 0 "$srm($j) start" 
 } 
 foreach j [array names srmsrc] { 
 	 $ns at 0 "$srmsrc($j) start" 
 } 

 
 } ; # ending the generate-agents proc.

 ############## End of file marker ##########
 # Following are the command lines used:
 # agents -outfile agent1.tcl -transport TCP/Reno -src FTP -sink TCPSink/DelAck -num 60% -start 1-3 -stop 9-11
 # agents -outfile agent1.tcl -transport TCP -sink TCPSink -num 8
 # agents -outfile agent1.tcl -transport SRM/Deterministic -num 75% -join 0-2 -src CBR/UDP -traffic Pareto -srcnum 20% -start 3-10
 # agents -outfile agent1.tcl -transport SRM -src CBR/UDP -traffic Expoo