wiki:Tutorial/HowtoWriteScripts/OrbitRuby

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

Orbit > Tutorial > Writing Experiment Scripts > ORBIT-Specific Methods

ORBIT-specific Methods

Four ORBIT-specific methods are available for debugging help: error( ), warn( ), info( ), and debug( ). How do they work? Like assertions? What arguments do they take? Besides these debugging methods, there are three classes of ORBIT-specific methods discussed below: implicit, Experiment, and NodeSet.

Among the implicit methods two are used to define resources:

      defProperty(name, value, description)
      defNodes(setName, nodeList) {}

Some ORBIT-specific methods work with node sets to specify a set of nodes for each member of which the associated block of code is executed:

      nodes(setName) {}
      allNodes {}
      nodes("_ALL_") {}

Other ORBIT-specific methods use events which delay execution of the associated block of code and sequential execution until that event is true:

	whenAll(setTest, nodeTest, interval = 5) {}
      whenAllInstalled()
      whenAll("_ALL_", "apps/app/status[text()='INSTALLED.OK']") {}
      wait time_in_sec

The Experiment methods and properties are ORBIT-specific methods and properties associated with the Experiment object. They have the form Experiment.method. These methods include:

      name = "tutorial-1a"
      project = "orbit:tutorial"
      props.propName = ""
      Done

It is anticipated that the 'Experiment' prefix will be removed in future versions.

Other ORBIT-specific methods are NodeSet methods that set properties for the specified set of nodes. They have the form

NodeSet ( nodes(setName).method )
      image =
      pxeImage =
      prototype(name) {|node| 
}
      onNodesUp {|node| 
}
      startApplication(appName), startApplications
      stopApplication(appName), stopApplications
      resource
      net.if_name

The defNodes method declares the nodes used in the experiment:

      defNodes(setName:string, nodeList) {}

There are various ways to declare node list:

      A single node: [x,y]
      multiple nodes: [[x1,y1], [x2, y2], [x3, y3]]
      ranges of nodes: [x1..x2, y1..y2]
      the entire grid: [1..20, 1..20]
      with other node sets: [‘nodeSet1’, ‘nodeSet2’]

These methods are useful for declaring common functionality over multiple sets. The various network parameters that may be configured within a defNodes or allNodes block are shown in Figure 9 below, here the first and second Ethernet interfaces are e0 and e1, and the first and second wireless interfaces are w0 and w1.

• net
	– e0, e1
		• arp = true|false En/disable ARP
		• forward = true|false Enable forwarding
		• ip = address/netmask IP address of interface
		• up = true|false En/disable interface
		• route
	– w0, w1
		• All the above
		• channelI = 1..11; 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161
		• essid = string
		• frequencyI = 2.412 – 2.462 (5 Mhz steps); 5.18Ghz (20Mhz steps)
		• mode = master|managed|ad-hocI|monitorI
		• rtsA = packetSizeThreshold [bytes]
		• rateI = 1, 5, 11; 6, 9, 12, 18, 24, 36, 48, 54
		• tx_power = -12 .. 15 dBm (intel), 0 .. 20 dBm (atheros)
		• type = a/b/g
Note: See TracWiki for help on using the wiki.