This is the description for a set of tools to interface with static ethernet testbeds. It consists of a *very* simple configuration specification, a perl module and a java class to parse it, and a set of scripts and programs (perl, bash, and java).
platformindicates the platform that the testbed uses. Currently, we assume all motes to be of the same platform. A line starting with
motespecifies a ... mote! The format is:
mote <id> <ip address> <x> <y>.
x and y are used by some other scripts, for example to draw graphs of the testbed, etc.
TOS_TESTBED_CONFIG - some scripts expect this to point to the testbed configuration file you want to use
testbed-program.plis a wrapper to the rsc scripts that reads from a configuration file and allows interaction with the testbed (programming, pinging, etc). It requires an extra argument,
--testbed=, that indicates the file.
The format of experiments I am currently running creates a serial forwarder to each mote, which forwards the data to and from port 9100 + mote id. The reason for this is that this indirection is useful if you want to multiplex access to the motes: otherwise, if you connect directly to the mote from the packet logger, you can't open a second connection simultaneously. I use this to log and at the same time send commands to the motes.
Use
testbed_start_sf.plto start the serial forwarders. It reads the config file from
$TOS_TESTBED_CONFIGand starts them.
Then start
java net.tinyos.testbed.TestBedPacketLogger <testbed config file> <time> to run(seconds)>. This will log all packets that the motes send to the UART to a binary file, and to STDOUT in textual format.
The format of the text output is:
id and time are decimal numbers, and the other bytes are 0X (hex) representations of the packet bytes.
The format of the binary output is as follows. The byte order is whatever java's DataOutputStream writes.
short id; long time; short packet_length; byte[packet_length] packet;
export PERL5LIB=$PERL5LIB:/path/to/scripts (bash) or
setenv PERL5LIB $PERL5LIB:/path/to/scripts
use TinyOS::Util::TestBedConfig; $cfg = TinyOS::Util::TestBedConfig->new($config_file); $n = cfg->getNumberOfMotes();Iterating over the motes
my @mote_array; $cfg->getMotes(\@mote_array); for $mote (@mote_array) { $address = $mote->{'address'}; $id = $mote->{'id'}; $x = $mote->{'x'}; $y = $mote->{'y'}; #do whatever you want }Other calls:
$moteref = getMote($id); getMotes(\@array); $n = getNumberOfMotes(); $platform = getPlatform();The array of motes returned by getMotes() is an array of hash references with the following keys:
TestBedConfig.TestBedConfigMote getMote(int i) java.util.Iterator getMotesIterator() int getNumberOfMotes()
Method summary for
TestBedConfigMote. This is just a wrapper for the information in the config file about a mote.
Constructor Summary
TestBedConfig.TestBedConfigMote(int id, java.lang.String address) TestBedConfig.TestBedConfigMote(int id, java.lang.String address, double x, double y)
Method Summary
java.lang.String getAddress() int getId() double getX() double getY()