Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Experimentation Scripts 0.7.2

danbim edited this page Jul 27, 2012 · 1 revision

Testbed Runtime provides a set of bash-scripts that trigger the execution of various BeanShell scripts by the Scripting Client. You can download the current version here. Then, unpack it by running:

tar xvzf tr.experimentation-scripts-current.tar.gz

The extracted directory contains the following subdirectories:

bin
lib
scripts

The directory bin contains the executable bash scripts described below, lib contains the Scripting Client used to execute the BeanShell scripts and scripts contains the BeanShell scripts that are being passed to the Scripting Client upon invocation of one of the bash scripts from the bin directory.

All scripts can be used in a similar way: the first argument is always a property file that contains the actual endpoint URLs of the WISEBED testbed to be used and the users' credentials. Here's an example of such a configuration file:

testbed.snaa.endpointurl  = http://wisebed.itm.uni-luebeck.de:8890/snaa
testbed.rs.endpointurl    = http://wisebed.itm.uni-luebeck.de:8889/rs
testbed.sm.endpointurl    = http://wisebed.itm.uni-luebeck.de:8888/sessions
testbed.urnprefixes       = urn:wisebed:uzl1:

testbed.usernames         = yourusernamehere
testbed.passwords         = yourpasswordhere

testbed.protobuf.hostname = wisebed.itm.uni-luebeck.de
testbed.protobuf.port     = 8885

The first three lines point to the endpoint URLs of the SNAA, RS and SessionManagement endpoints of the specific testbed on which to conduct experiments. The property testbed.urnprefixes contains the URN prefix which is served by the testbeds' endpoint (note the colon : at the end of the value, e.g. urn:wisebed:uzl1:!). If you are unsure which URN prefix your testbed is serving just check which prefix the individual node URNs have in common. Usually the URN prefix is concatenated with a nodes' MAC address so that, e.g. for a given node URN urn:wisebed:uzl1:0x1234 of a node with MAC address 0x1234 the testbeds' URN prefix is urn:wisebed:uzl1:.

Lines 6 and 7 contain the users' credentials.

The properties testbed.protobuf.hostname and testbed.protobuf.port are optional and are only used by the experimentation scripts ending on *-protobuf. They use the unofficial protocol buffers based WISEBED API implemented by Testbed Runtime that allows to use the testbed without public IP and being firewalled as all communication happens through a client-initiated bidirectional TCP connection unlike the official APIs.

check-alive

Calls [WSN.areNodesAlive()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/wsn/WSN.html#areNodesAlive(java.util.List<java.lang.String>)) to check for a sensor nodes liveness.

Usage

./check-alive PROPERTIES_FILE SECRET_RESERVATION_KEYS [NODEURNS]

Example

./check-alive live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900 urn:wisebed:uzl1:0xf859,urn:wisebed:uzl1:0xf860

flash

Calls [WSN.flashPrograms()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/wsn/WSN.html#flashPrograms(java.util.List<java.lang.String>, java.util.List<java.lang.Integer>, java.util.List<eu.wisebed.api.wsn.Program>)) to reprogram devices.

Usage

./flash PROPERTIES_FILE SECRET_RESERVATION_KEYS IMAGE [NODEURNS]

Example

./flash live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900 iseraerial-isense.bin urn:wisebed:uzl1:0xcc3d,urn:wisebed:uzl1:0xcc3e

free

Calls [SessionManagement.free()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/sm/SessionManagement.html#free(java.util.List<eu.wisebed.api.sm.SecretReservationKey>)) to "free" the testbed back end from all experiment specific data such as pipeline or virtual link configurations. Sets back the state of the testbed back end to what it was when the experiment (i.e. the reservation time slot) started.

Usage

./free PROPERTIES_FILE SECRET_RESERVATION_KEYS

Example

./free live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900

list-node-urns

Calls [SessionManagement.getNetwork()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/sm/SessionManagement.html#getNetwork(\)), parses the returned WiseML, extracts and prints all node-urns.

Usage

./list-node-urns PROPERTIES_FILE [NODE_TYPES]

Example

./list-node-urns live.properties isense,telosb

list-nodes

Calls [SessionManagement.getNetwork()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/sm/SessionManagement.html#getNetwork(\)), parses the returned WiseML, extracts and prints information about all nodes.

Usage

./list-nodes PROPERTIES_FILE [NODE_TYPES]

Example

./list-nodes live.properties isense,telosb

listen

Starts a Controller on the local host and connects to the running experiment. Prints out all data and notifications received.

Usage

./listen PROPERTIES_FILE SECRET_RESERVATION_KEYS

Example

./listen live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900

reserve

Calls [RS.makeReservation()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/rs/RS.html#makeReservation(java.util.List<eu.wisebed.api.rs.SecretAuthenticationKey>, eu.wisebed.api.rs.ConfidentialReservationData)) to make a reservation with the given arguments.

Usage

./reserve PROPERTIES_FILE DURATION_IN_MINUTES [OFFSET_IN_MINUTES] [NODE_URNS]

Example

./reserve ../live.properties 30 10 urn:wisebed:uzl1:0xcbe4

reset

Calls [WSN.resetNodes()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/wsn/WSN.html#resetNodes(java.util.List<java.lang.String>)) to reset the nodes.

Usage

./reset PROPERTIES_FILE SECRET_RESERVATION_KEYS [NODEURNS]

Example

./reset live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900 urn:wisebed:uzl1:0xf859,urn:wisebed:uzl1:0xf860

show-wiseml

Calls [SessionManagement.getNetwork()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/sm/SessionManagement.html#getNetwork(\)) and pretty-prints the returned WiseML.

Usage

./show-wiseml PROPERTIES_FILE

Example

./show-wiseml live.properties

set-channel-pipeline

Calls [WSN.setChannelPipeline()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/wsn/WSN.html#setChannelPipeline(java.util.List<java.lang.String>, java.util.List<eu.wisebed.api.wsn.ChannelHandlerConfiguration>)) to configure the back ends channel pipeline.

Usage

./set-channel-pipeline PROPERTIES_FILE SECRET_RESERVATION_KEYS CONFIG_FILE [NODEURNS]

./set-channel-pipeline live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900 handlerchain.xml urn:wisebed:uzl1:0xcc3d,urn:wisebed:uzl1:0xcc3e

Arguments

The parameter CONFIG_FILE contains an XML description of the protocol stack (i.e. the channel pipeline) that should be set for the individial node. An example of such a configuration can be seen below:

<itm-netty-handlerstack>
    <handler factory="protocoly"/>
    <handler factory="protocolx-encoder">
        <option key="1" value="1"/>
        <option key="2" value="2"/>
    </handler>
    <handler factory="protocolx-decoder">
        <option key="11" value="11"/>
        <option key="22" value="22"/>
    </handler>
</itm-netty-handlerstack>

The order of the <handler>-tags corresponds to the position of the protocol handler in the stack. Please check the netty-handlerstack project for the available handlers or invoke the get-channel-pipeline script.

The parameter NODEURNS can either be 1.) omitted, 2.) may contain a set of comma-separated node URNs or 3.) may contain the string "portal".

  1. If the parameter is omitted the channel pipeline will be set on all reserved node URNs, i.e. each node has the same channel pipeline configuration but each node has its own channel pipeline.
  2. If the parameter contains a set of node URNs only these node URNs will have their channel pipeline configured with the given configuration. Other nodes are left as they currently are.
  3. If the string "portal" is passed as argument there will be one channel pipeline with that configuration on the portal server of the testbed through which the traffic of all nodes will be flowing.

get-supported-channelhandlers

Calls [WSN.getSupportedChannelHandlers()](http://wisebed.eu/api/java/current/reference/eu/wisebed/api/wsn/WSN.html#getSupportedChannelHandlers(\)) and pretty-prints the returned data.

Usage

./get-supported-channelhandlers PROPERTIES_FILE SECRET_RESERVATION_KEYS

Example

./get-supported-channelhandlers live.properties urn:wisebed:uzl1:,D2C88AEE416EDD2FD4038BC1252A8900

prints the supported channel handlers that can be configured into the backend by calling the set-channel-pipeline script. The name value in the example below corresponds to the value of the factory attribute of the handler tag in the XML configuration file of the set-channel-pipeline script (see above). The configurationOptions values correspond to what can be set as options in the corresponding handler tags.

ChannelHandler {
	name="isense-otap"
	description="The module implements over-the-air-programming (OTAP) functionality to program a set of iSense nodes from coalesenses wirelessly. The nodes must be in single-hop range of the node that is connected to this pipeline. The connected sensor must have iSerAerial functionality enabled while the to-be-programmed devices must be OTAP-capable. Also see https://github.com/itm/netty-handlerstack/wiki/ISense-over-the-air-programming-Protocol."
	configurationOptions={
		key="timeoutMultiplier", description="(short, optional, default=1000)"
		key="maxRerequests", description="(short, optional, default=30)"
		key="timeunit", description="(int, optional, default=MILLISECONDS)"
		key="threadCount", description="(int, optional, default=10)"
		key="deviceTimeout", description="(int, optional, default=160*presenceDetectInterval)"
		key="presenceDetectInterval", description="(int, optional, default=2000)"
	}
}
ChannelHandler {
	name="dlestxetx-framing-encoder"
	description="Wraps an incoming ChannelBuffer with DLE STX (0x10 0x02) and DLE ETX (0x10 0x03) and does byte stuffing inside the ChannelBuffer (i.e. escape every DLE with another DLE). Also see https://github.com/itm/netty-handlerstack/wiki/DLESTXETX-Framing-Decoder-Encoder."
	configurationOptions={}
}
ChannelHandler {
	name="dlestxetx-framing-decoder"
	description="Unwraps a ChannelBuffer instance that is wrapped with DLE STX (0x10 0x02) and DLE ETX (0x10 0x03) and does byte unstuffing (i.e. bytes of value DLE that were escaped with another DLE have the escape character removed. Also See https://github.com/itm/netty-handlerstack/wiki/DLESTXETX-Framing-Decoder-Encoder."
	configurationOptions={}
}
...