group: Address a set of resources

This command allows the experimenter to address a specific group of resources, in order to configure them or send them some given sub-commands.

Syntax

group(groupSelector).subcommand(param1, param2,...)

group(groupSelector).resource_path = value

group(groupSelector).resource_path(param1, param2,...)

where:

  • groupSelector: The name of group of resources to address. Please refer to the description of the defGroup command for a list of valid syntax for groupSelector.
  • subcommand: The sub-command to send to all the resources within this specific group.
  • resource_path: A valid Resource Path to access/configure a given parameter of the resources within this specific group. Please refer to the Resource Path section of the OEDL Reference page for a list of valid Resource Paths.
group Sub-Commands Description
startApplications Start all the applications which are associated with the resources in this specific group.
stopApplications Stop all the applications which are associated with the resources in this specific group.
sendMessage(name, arg1, arg2, ...) Send a message to a given application associated with the resources in this specific group. This message will be sent on the standard-in (STDIN) input of this application.
sendMessage(name, arg1, arg2, ...)

name               - the name of the application to send the message to 
arg1, arg2, etc... - the list of arguments to send to the standard-in of the application

Note: the argX will be concatenated in a single text message separated by a blank space.
Thus if arg1="Hello" and arg2="There", the application will receive "Hello There" on its STDIN.
This is also equivalent to using only arg1="Hello There" 
A newline (\n) is added at the end of the string.
Some examples below.

Usage Examples

Example 1

Usage of 'group' with a Resource Path to set the ESSIDs and channels of the resource within some specific groups. The resources here are wifi-enabled nodes.

Please refer to the Resource Path section of the OEDL Reference page for a list of valid Resource Paths

 1 # Defines 2 groups of nodes: 'one_wifi_node' and 'two_wifi_nodes'
 2 #
 3 defGroup('one_wifi_node', [1,1])
 4 defGroup('two_wifi_nodes', [[1,2],[1,3]])
 5 
 6 # Use 'group' to set the ESSIDs for the 1st wifi interface w0
 7 #
 8 # 1 - Set ESSID of the single node in 'one_wifi_node'
 9 # 2 - Set ESSID of the two nodes in 'two_wifi_nodes'
10 #
11 group('one_wifi_node').net.w0.essid = "network_alpha" 
12 group('two_wifi_nodes').net.w0.essid = "network_beta" 
13 
14 # Now do the same to set the channels...
15 #
16 group('one_wifi_node').net.w0.channel = '6'
17 group('two_wifi_nodes').net.w0.channel = '11'
18 
19 #
20 # Another way to do the above operation in one go...
21 #
22 group('one_wifi_node').net.w0 { |w|
23   w.essid = "network_alpha" 
24   w.channel = '6'
25 }
26 
27 group('two_wifi_nodes').net.w0 { |w|
28   w.essid = "network_beta" 
29   w.channel = '11'
30 }

Example 2

Usage of 'group' with a sub-command to start, stop, and send message to an application associated with the resource within some specific groups. The resources here are PC-based nodes.

Please refer to the description of the defGroup command for more detailed information of the 'defGroup' syntax.

 1 # Defines a group of nodes: 'two_nodes'
 2 # and associate the application "videogen" to the nodes in this group
 3 # (videogen is a fictif application, which generate video packets)
 4 #
 5 defGroup('two_nodes', [[1,1],[1,2]]) { |n|
 6   n.prototype('videogen')
 7 }
 8 
 9 # Use 'group' to start the applications on the nodes 
10 #
11 group('two_nodes').startApplications
12 
13 # Now use 'group' to send a message to the applications on the nodes 
14 # The application will receive this message on its standard-in input
15 #
16 group('two_nodes').sendMessage('videogen', 'increase pkt rate to 1024')
17 
18 # Note: the following line also does the exact same thing...
19 #
20 group('two_nodes').sendMessage('videogen', 'increase', 'pkt', 'rate', 'to', '1024')
21 
22 # Finally, use 'group' to stop the applications on the nodes 
23 #
24 group('two_nodes').stopApplications