The Network Simulator ns-2: Topology Generation
Topology generation is required for network simulations. In NS-2 you may create a topology for simulation using one of the following methods:
- by using the Inet topology generator.
- by using the GT-ITM topology generator.
- by using the Tiers topology generator.
- by using the other topology generators.
- by hand
Inet Topology Generator
- Generating graphs from Inet topology generator
- Conversion of Inet output to ns-2 format
Use inet2ns to convert the inet topology to ns.
#!/usr/bin/perl # Program to convert a inet topology to ns format # Usage: inet2ns < inet.topo > ns.topo # Usage in ns : source ns.topo in your tcl script and then # call the procedure to create the topology using # create-topology linkbw [scaling factor for delay] # Assumptions: Eucliedian distance between the nodes is in miles. # Hence propogation delay = distance / speed of light (186 x 10^3 miles/sec) #Read first line for number of nodes and links chomp($line = <STDIN>); ($nodes, $links) = split(' ',$line); print "proc create-topology { linkBW {sf 1} } {/n"; print "/tglobal ns/n"; print "/n/t#Create $nodes nodes in the topology/n"; print "/tfor {set i 0} {/$i < $nodes} {incr i} {/n"; print "/t/tset n(/$i) [/$ns node]/n"; print "/t}/n/n/n"; print "/t#Create $links edges in the topology/n"; #Skip all the location information for ($i=0; $i<$nodes;$i++){ $line = <STDIN>;