== Exercise 1: Simple MobilityFirst Network Deployment and Test == [[TOC(../oMF*)]] === Objective === In this exercise we will establish a simple topology consisting of Mobilityfirst routers, hosts and applications, deploy the software components onto physical nodes, and run a end-to-end 'ping' application. === Topology === In this exercise we will start with a simple linear topology consisting of two MobilityFirst routers (MFR) that interconnect two hosts: Host1 will initiate a 'ping' communication and Host2 will respond to the ping request: {{{ #!sh Host1 ---- MFR1 ---- MFR2 ---- Host2 }}} === MobilityFirst ORBIT Image === The complete set of components from the latest release of MobilityFirst software is available as a compressed image within the ORBIT testbed for imaging nodes using the 'omf' tool. The current pre-prepared image is built over Ubuntu 12.04 LTS distribution and will be moved to newer distributions as they become available and we've had a chance to test compatibility. Once logged into the console of the reserved domain, the image can be loaded onto a node using the command line: {{{ #!sh omf load -i 'mf-release-latest.ndz' -t 'node1-1.sb9.orbit-lab.org' }}} where the above assumes you are attempting to image node1-1 in the 'sb9.orbit-lab.org' domain (Sandbox 9). You could also just use 'node1-1' without the domain part - assumed from the console you issue the command from. So for installing the image across 4 nodes - node1-1, node1-2, node1-3, node1-4 - the following can be used: {{{ #!sh omf load -i 'mf-release-latest.ndz' -t 'node1-1,node1-2,node1-3,node1-4' }}} The imaging should be done for each node to be used in our network deployment, and can be done in a single shot by providing multiple comma separated hostnames within the '-t' topology argument above. === Deploy Network === Software and experiment control in the ORBIT testbed can be automated greatly using the OMF framework. An OMF control script is written in Ruby and allows the experimenter to specify the set of nodes, their network configuration, to specify software components and arguments, and to control their execution on one or more nodes. We will use an OMF script to bring up 4 ORBIT nodes to host our topology, with corresponding software components as shown below: {{{ #!sh mfping mfping Software mfapi lib gnrs gnrs mfapi lib mfstack click click mfstack Topology Host1 ------- MFR1 ---- MFR2 ------- Host2 ORBIT Node node1-1 node1-2 node1-3 node1-4 }}} The entire script is available as part of the tutorial package as orbit/tutorial/scripts/exercise1.rb The following sub-sections dissect the key parts of this script: ==== Software Component Specification ==== The following snippet shows the specification of the MobilityFirst router along with the required arguments: {{{ #!ruby defApplication('MF-Router', 'router') {|app| app.shortDescription = "Click-based MobilityFirst Router" app.path = ";/usr/local/bin/click" # click options app.defProperty('num_threads', 'number of threads', "--threads",{:type =>; :integer, :mandatory => true, :default => 4, :order => 1}) app.defProperty('ctrl_port', 'port for Click control socket', "--port",{:type => :integer, :order => 2}) # click config file app.defProperty('config_file', 'Click configuration file', nil,{:type => :string,:mandatory=> true}) # keyword parameters used in click config file app.defProperty('my_GUID', 'router GUID', "my_GUID",{:type => :string, :mandatory => true}) app.defProperty('topo_file', 'path to topology file', "topo_file",{:type => :string, :mandatory => true}) app.defProperty('core_dev', 'core network interface', "core_dev",{:type => :string,:mandatory=> true}) app.defProperty('GNRS_server_ip', 'IP of local GNRS server', "GNRS_server_ip",{:type => :string,:mandatory=> true}) app.defProperty('GNRS_server_port', 'Port of GNRS server', "GNRS_server_port",{:type => :string,:mandatory=> true}) app.defProperty('GNRS_listen_ip', 'IP to listen for GNRS response', "GNRS_server_ip",{:type => :string,:default=> "0.0.0.0"}) app.defProperty('GNRS_listen_port', 'port to listen for GNRS response', "GNRS_server_port",{:type => :string,:default=> 10001}) app.defProperty('edge_dev', 'edge network interface', "edge_dev",{:type => :string,:mandatory=> true}) app.defProperty('edge_dev_ip', 'IP assigned to edge interface', "edge_dev_ip",{:type => :string,:mandatory=> true}) } }}} As seen above, the router is configured with both 'core' and 'edge' interfaces. The core interfaces connect routers towards the core of the network, while the edge interface enables hosts to connect and access the MobilityFirst network. Also seen above is the GNRS service related arguments that specify which server (IP and port) the router should use for in-network name resolution purpose, both for sending requests and to receive responses. By default it will listen on all interfaces and port 10001. ==== Setting up the Software Node Groups ==== The following shows how the node groups for the routers are setup in the OMF control scripts. Node groups allows experimenters to use single statements to set configuration and execute commands across all nodes in the group. {{{ #!ruby for i in 1..num_routers defTopology("topo:router_#{i}") { |t| aNode = routersTopo.getNodeByIndex(i-1) t.addNode(aNode) print "Adding node: ", aNode, " router with GUID: #{i+num_hosts}\n" } defGroup("router_#{i}", "topo:router_#{i}") {|node| node.addApplication('MF-Router') {|app| app.setProperty('my_GUID', router_guid[i-1]) app.setProperty('topo_file', topo_file) app.setProperty('conf_file', click_conf) app.setProperty('core_dev', core_dev) app.setProperty('gnrs_server_ip', router_gnrs_if_ip[i-1]) app.setProperty('gnrs_server_port', gnrs_server_port) app.setProperty('edge_dev', edge_dev) app.setProperty('edge_dev_ip', router_wifi_if_ip[i-1]) } node.addApplication('MF-GNRS') {|app| app.setProperty('config_file', gnrs_conf_file) } } end }}} ==== Configuring the Network Interfaces ==== {{{ #!ruby # clean up and initialize networking for routers for i in 1..num_routers # click router cleanup group("router_#{i}").exec("killall -9 click") # gnrsd cleanup group("router_#{i}").exec("killall -9 java") # bring up gnrs interface if required - in sb4 we use ctrl iface # group("router_#{i}").exec("ifconfig " + core_dev + " " + router_gnrs_if_ip + " netmask " + router_gnrs_if_netmask) #bring up edge wifi interface group("router_#{i}").exec("modprobe ath5k") group("router_#{i}").exec("ifconfig " + edge_dev + " " + router_wifi_if_ip + " netmask " + wifi_netmask) end #clean up and initialize networking for hosts for i in 1..num_hosts group("host_#{i}").exec("killall -9 mfstack") #bring up edge wifi interface group("host_#{i}").exec("modprobe ath5k") group("host_#{i}").exec("ifconfig " + edge_dev + " " + host_wifi_if_ip + " netmask " + wifi_netmask) end }}} ==== Starting the MobilityFirst Components ==== The following snippet shows the starting of the router software and the gnrs servers on the two router nodes: {{{ #!ruby # bring up the routers (along with gnrs servers) print "Bringing up routers...\n" for i in 1..num_routers group("router_#{i}").startApplications end }}} === Test The Network === Once the host and router components are up, you can log in to the sender and receiver host nodes (two separate terminals) and run the 'mfping' application. Run the mfping 'server' specifying the application GUID: {{{ #!sh mfping -S }}} To run the mfping 'client' {{{ #!sh mfping -C -i -c }}} You should see an out at the client similar to below: {{{ #!sh }}}