wiki:Tutorials/a0Basic/Tutorial2

Version 4 (modified by seskar, 18 years ago) ( diff )

Tutorial 1: Hello World Example

Tutorial TOC

    Error: Page Tutorial does not exist
    Error: Page Tutorial/Testbed does not exist
    Error: Page Tutorial/HelloWorld does not exist
    Error: Page Tutorial/UnderstandingHelloWorld does not exist
    Error: Page Tutorial/HowtoWriteScripts does not exist
    Error: Page Tutorial/CollectMeasurements does not exist
    Error: Page Tutorial/AnalyzeResults does not exist

The "Hello World" Experiment is simple. The script for this experiment is shown below.

#
# Define nodes used in experiment
#
defNodes('sender', [1,1]) {|node|
  node.image = nil  # assume the right image to be on disk

  node.prototype("test:proto:sender", {
    'destinationHost' => '192.168.1.2',
    'packetSize' => 1024,
    'rate' => 300,
    'protocol' => 'udp'    
  })
  node.net.w0.mode = "managed"
}

defNodes('receiver', [1,2]) {|node|
  node.image = nil  # assume the right image to be on disk
  node.prototype("test:proto:receiver" , {
    'protocol' => 'udp'
  })
  node.net.w0.mode = "master"
}

allNodes.net.w0 { |w|
  w.type = 'b'
  w.essid = "helloworld"
  w.ip = "%192.168.%x.%y"
}

#
# Now, start the application
#
whenAllInstalled() {|node|
  wait 30 

  allNodes.startApplications
  wait 40

  Experiment.done
}

Figure 1. Script for "Hello World" Experiment

To understand the details of the script, go to Understanding the Hello World Script

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.