wiki:Old/NodeHandler/Commands/defNodes

Documentation | NodeHandler | Commands | defNodes

defNodes: Define Nodes used in Experiment

This command defines a set of nodes used in the experiment. An experiment can contain multiple such declarations.

Syntax: defNodes(setName, selector, &block = nil)

  • setName: Name of the defined set.
  • selector: Selects the nodes contained in this set.
  • block: Instructions for all nodes in the set.

The 'setName' is a simple string which is used in the remander of the experiment script to refer to this set of nodes.

The 'selector' defines which nodes are in the set. A selector can have the following forms:

  • 'topology': The URI of a previously defined topology (see defTopology)
  • [x,y]: Describes a single node at location x@y
  • [x1..x2, y]: Describes a set of nodes along a line starting at x1@y and ending at x2@y. For instance, [2..4, 5] defines the nodes [2,5], [3,5], [4,5].
  • [x, y1..y2]: Same as previous, but for the y coordinate.
  • [x1..x2, y1..y2]: This defines a rectangle area of nodes within the grid.
  • 'setName': Includes all the nodes defined by another set
  • x1,y1], [x2,y2], [x3,y3: An arbitrary long list of single nodes. Obvioulsy, any entry in this list can also use any of th e above defined syntaxes.

The optional 'block' allows the experimenter to configure all the nodes in the set as a single entity. The following commands are defined inside the block:

The following, additional commands are for expert users only:

Usage

defNodes('sender1', [1, 1]) # set contains 1 node

defNodes('sender2', [2, 1..8]) # set contains 8 nodes [2,1], [2,2], ... [2,8]

defNodes('sender', ['sender1', 'sender2', [3, 1..8]]) {|node|
  node.prototype("test:proto:sender", {
    'destinationHost' => '192.168.1.1',
    'packetSize' => 1024,   #Packet size
    'rate' => 300,          #Offered load = 300 kbps
    'protocol' => 'udp'     #Protocol = UDP
  })
  node.net.w0.mode = "master" #802.11 Master Mode
}

See Also

Last modified 17 years ago Last modified on Jul 28, 2007, 5:32:15 AM
Note: See TracWiki for help on using the wiki.