Changes between Version 4 and Version 5 of Tutorials/oMF/tut1


Ignore:
Timestamp:
Oct 15, 2014, 4:29:41 PM (10 years ago)
Author:
wontoniii
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/oMF/tut1

    v4 v5  
    149149#!ruby
    150150
     151#Create router groups
    151152for i in 1..num_routers
     153        #Create a topology with a single router in it
    152154        defTopology("topo:router_#{i}") { |t|
    153155                aNode = routersTopo.getNodeByIndex(i-1)
     
    156158        }
    157159 
     160        #Through the group definition we set up the applications to run
    158161        defGroup("router_#{i}", "topo:router_#{i}") {|node|
    159162                node.addApplication('MF-Router') {|app|
     
    171174                }
    172175
    173           #If is the first router add the GNRS
     176          #If it is the first router add the GNRS
    174177          if i == 1
    175       aNode = routersTopo.getNodeByIndex(i-1)
    176       info aNode, " will also host the GNRS server"
    177                   node.addApplication('MF-GNRS') {|app|
    178                     app.setProperty('log4j_config_file', GNRS_log_file)
    179                     app.setProperty('jar_file', GNRS_jar_file)
    180                     app.setProperty('config_file', GNRS_conf_file)
    181                   }
     178                aNode = routersTopo.getNodeByIndex(i-1)
     179                info aNode, " will also host the GNRS server"
     180                node.addApplication('MF-GNRS') {|app|
     181                      app.setProperty('log4j_config_file', GNRS_log_file)
     182                      app.setProperty('jar_file', GNRS_jar_file)
     183                      app.setProperty('config_file', GNRS_conf_file)
     184                }
    182185          end
    183186       
     187          #Setup the node interfaces
     188          #The first ethernet interface is used as the core interface
    184189          node.net.e0.ip = "192.168.100.#{i}"
    185190          node.net.e0.netmask = '255.255.255.0'
    186191   
    187     node.net.w0.mode = "adhoc"
    188     node.net.w0.type = 'g'
    189     node.net.w0.channel = "11"
    190     node.net.w0.essid = "SSID_group_#{i}"
    191     node.net.w0.ip = "192.168.#{i}.1"
     192          #The first wireless interface is used to give access to clients
     193          node.net.w0.mode = "adhoc"
     194          node.net.w0.type = 'g'
     195          node.net.w0.channel = "11"
     196          node.net.w0.essid = "SSID_group_#{i}"
     197          node.net.w0.ip = "192.168.#{i}.1"
    192198        }
    193199end
     
    195201#Create host groups
    196202for i in 1..num_hosts
     203        #Create a topology with a single router in it
    197204        defTopology("topo:host_#{i}") { |t|
    198205                aNode = hostsTopo.getNodeByIndex(i-1)
     
    201208        }
    202209 
     210        #Through the group definition we set up the applications to run
    203211        defGroup("host_#{i}", "topo:host_#{i}") {|node|
    204212                node.addApplication('MF-HostStack') {|app|
     
    206214                        app.setProperty('log_level', log_level)
    207215                }
    208          
    209     #node.net.e0.ip = "192.168.#{i}.#{i+100}"
    210           #node.net.e0.netmask = '255.255.255.0'
    211    
    212     node.net.w0.mode = "adhoc"
    213     node.net.w0.type = 'g'
    214     node.net.w0.channel = "11"
    215     node.net.w0.essid = "SSID_group_#{i}"
    216     node.net.w0.ip = "192.168.#{i}.2"
    217         }
     216   
     217          #The first wifi interface is used to connect to the Access Router
     218          node.net.w0.mode = "adhoc"
     219          node.net.w0.type = 'g'
     220          node.net.w0.channel = "11"
     221          node.net.w0.essid = "SSID_group_#{i}"
     222          node.net.w0.ip = "192.168.#{i}.2"
     223      }
    218224end
    219225}}}