This page and its sub-pages presents some information related to the previous OMF 5.2 release

Please visit the pages linked from the Main User Guide page for the documentation on the latest OMF version


Configure/Send actions to all resources in one/many group(s), with substitutions

1. Prerequisites

2. Goal

  • This tutorial shows you:
    • how to configure or send actions to all the resources in one specific group (or all the groups)
    • how to use the basic substitution feature of OMF

3. Scenario

  • We will modify this example, to allow us to:
    • configure the 1st wireless interface of all nodes in all the groups in one aggregated command
    • send actions to all the nodes in a specific group

4. The New "Hello World" Experiment Description

 1 defGroup('Sender', [1,2]) {|node|
 2   node.addApplication("test:app:otg2") {|app|
 3     app.setProperty('udp:local_host', '192.168.0.2')
 4     app.setProperty('udp:dst_host', '192.168.0.3')
 5     app.setProperty('udp:dst_port', 3000)
 6     app.measure('udp_out', :interval => 3)
 7   }
 8 }
 9 
10 defGroup('Receiver', [1,3]) {|node|
11   node.addApplication("test:app:otr2") {|app|
12     app.setProperty('udp:local_host', '192.168.0.3')
13     app.setProperty('udp:local_port', 3000)
14     app.measure('udp_in', :interval => 3)
15   }
16 }
17 
18 allGroups.net.w0 { |interface|
19   interface.mode = "adhoc" 
20   interface.type = 'g'
21   interface.channel = "6" 
22   interface.essid = "helloworld" 
23   interface.ip = "%192.168.0.%y" 
24 }
25 
26 whenAllInstalled() {|node|
27   wait 10
28   group("Receiver").startApplications
29   wait 5
30   group("Sender").startApplications
31   wait 30
32   group("Sender").stopApplications
33   wait 5
34   group("Receiver").stopApplications
35   Experiment.done
36 }
  • Line 18-24: we use the allGroups command to assign configuration values for some parameters of all the nodes in all the groups
    • More precisely:
      • Line 18: allGroups is followed by a Resource Path, which specify that we want to access a network interface (net), and more specifically the 1st wireless one (w0)
      • Line 19-23: we assign values to the different parameters available for the 1st wireless interface
  • Line 23: we use the special character "%" to request a substitution to be done in the following string
    • More precisely:
      • When a string passed as a value starts with an "%", OMF will parse the entire string and replace any character following another "%" with a specific value for each node
      • For example: "%192.168.0.%y"
      • OMF will replace the characters "%y" with the specific Y coordinate value for each node
      • Thus, on node [1,5] this string will be replaced by the string "192.168.0.5", similarly on node [4,24] the string "192.168.0.24" will be used
      • Another example: "%192.168.%x.%y" will result in "192.168.6.10" for node [6,10]
  • Line 28, 30, 32, 34: we use the group command send a command to all the resources in a specific group
    • More precisely:
      • Line 28: we send the command "startApplications" to the nodes in the specific group "Receiver". We then do the same with other groups and commands in the following lines 30, 32, and 34.
      • Note, that you can also configure parameters of all the nodes in a specific group using the Resource Paths in conjunction with group
      • For example: "group('Sender').net.w0.channel = 11" will assign channel 11 to the 1st wireless interface of all the nodes in the specific 'Sender' group.

5. Running the experiment

To run this experiment you should use the exact same commands and instructions as for the Basic "Hello World" tutorial and example. Indeed, it is the same experiment, but with a alternate way to describe it.

So please refer to the Basic "Hello World" tutorial and example and the Getting Started page if you do not know how to run an experiment with OMF.

You should also see the exact same type of output as for the Basic "Hello World" example.

6. The Results

Again here, you should obtain the exact same type of result as in the Basic "Hello World" example, and you should be able to do the same processing to obtain a similar graph.

7. What is Next?

Now that you have learnt how to pass commands to groups of resources you can:

- either go back to refer to the Basic "Hello World" tutorial and example

- or continue reading the following basic OMF tutorials. Each one of them is introducing a new basic OMF feature, incrementally building on the simple "Hello World" example. You do not need to follow them in the order suggested below.

And finally, a "Conference Room" scenario which combines all of the above features:


This page and its sub-pages presents some information related to the previous OMF 5.2 release

Please visit the pages linked from the Main User Guide page for the documentation on the latest OMF version