LEPTON   Documentation Download Videos About

How to run LEPTON with DoDWAN nodes

Preamble

DoDWAN is an opportunistic networking middleware system that allows mobile devices to exchange information using the publish/subscribe model.

LEPTON can emulate DoDWAN nodes, allowing such nodes to run concurrently on a single host platform (or on a cluster of hosts), while simulating the mobility of these nodes, and while conducting communications between them according to their respective positions in the simulation area.

Requirements

Besides LEPTON you need to install DoDWAN on your host platform, as well as a specific adapter. This adapter will allow LEPTON to control DoDWAN nodes, and to process traffic received from these nodes.

Installation of DoDWAN and its adapter

In the following we assume you have already installed LEPTON on your system, but DoDWAN and its adapter are still missing.

Download the latest DoDWAN archive, as well as the corresponding adapter archive:

wget http://casa-irisa.univ-ubs.fr/download/dodwan.zip
wget http://casa-irisa.univ-ubs.fr/download/dodwan-adapter.zip

Unzip both archives:

unzip dodwan.zip
unzip dodwan-adapter.zip

Set environment variables DODWAN_HOME and DODWAN_ADAPTER_HOME so they point to the folders you've just created:

cat << EOF >> ~/.$(basename $SHELL)rc
#
# DODWAN_HOME environment variable
export DODWAN_HOME="${PWD}/dodwan"
export PATH="\${DODWAN_HOME}/bin:\${PATH}"
#
# DODWAN_ADAPTER_HOME environment variable
export DODWAN_ADAPTER_HOME="${PWD}/dodwan-adapter"
#
EOF
source ~/.$(basename $SHELL)rc

Running LEPTON with DoDWAN nodes: a short tutorial

LEPTON supports several modes of operation. In the following we assume LEPTON and several DoDWAN nodes must run concurrently on the same host. Other options would be to distribute the DoDWAN nodes on a cluster of workstations, or to run each DoDWAN node on a distinct real device (e.g., smartphone, laptop, or tablet).

Starting LEPTON

When starting LEPTON a reference to DoDWAN's adapter must be provided, so LEPTON knows how to process the traffic it will receive from DoDWAN nodes. This is obtained by defining argument oppnet_adapter when starting LEPTON:

lepton.sh start oppnet_adapter=${DODWAN_ADAPTER_HOME}/bin/adapter.sh

In this example, LEPTON is started with its default configuration, except that argument oppnet_adapter indicates where to find the adapter required for interacting with DoDWAN nodes.

Using LEPTON's default configuration means that a number of nodes are created automatically when LEPTON starts. After running the command above you should thus see a number of nodes moving in the display window.

So what's the difference between starting LEPTON with or without argument oppnet_adapter? The difference is that when oppnet_adapter is used, the nodes you see on the display screen are not just blips moving around. For each node you observe on the screen there is an instance of DoDWAN (we'll call it a "DoDWAN node") running in the background on your system.

At any time you can use the following command to check whether LEPTON is running or not, and how many DoDWAN nodes are running as well:

lepton.sh status

If you're really curious you can also use the following command to verify that many instances of DoDWAN are indeed running in the background on your system:

ps ux | grep dodwand | grep -v grep

Now what are these DoDWAN nodes doing? Well, they are trying to discover one another, and engage in gossiping transactions. But they are doing so via a software hub that is part of LEPTON, so LEPTON actually orchestrates communications between all these nodes. You can observe the activity of LEPTON's hub by scanning its log file:

tail -f /dev/shm/${USER}/lepton/lepton.out
(Use Ctrl-C to terminate)

You should see that there is a lot of traffic passing through LEPTON's hub, which means that DoDWAN nodes are indeed exchanging messages whenever LEPTON estimantes that they are close enough to do so.

What happens on the display screen?

You may have observed that the vertices that appear between nodes change color every now and then. A blue vertex between two nodes means that LEPTON considers that these nodes are "in radio range", that is, close enough to communicate. This does not mean that they are actually communicating, though: they are just close enough to do so. A vertex turns red when a connection is actually established between both nodes, which means that they have discovered one another, and have reacted accordingly.

By default DoDWAN nodes use UDP transmissions for neighbor discovery, and a TCP session is established between two neighbor nodes as soon as they have discovered one another. This TCP session is maintained as long as possible, that is until the link between the nodes is disrupted because they are not in transmission range anymore.

When running with LEPTON, all DoDWAN nodes redirect their traffic to the hub, which serves as some kind of a proxy. A red vertex between two DoDWAN nodes on the screen therefore means that these nodes are connected by TCP... but through the hub.

Interacting with the DoDWAN nodes at runtime

DoDWAN comes with a bash script dodwan.sh that makes it easy to control a DoDWAN node at runtime. This script is meant to control a single instance of DoDWAN, though.

Since many DoDWAN nodes can run concurrently on the same host when running with LEPTON, the script lepton.sh makes it possible to control each node individually, using the same set of commands as that offered by dodwan.sh:

lepton.sh exec [node_id] start
                       | stop
                       | status
                       | clear
                       | publish <desc> <fname>
                       | subscribe <key> <pattern> {-d dir | -e cmd}
                       | unsubscribe <key>
                       | console (for experts)

Please refer to DoDWAN's documentation for details about these commands, but remember that when calling lepton.sh with option exec the second argument must always be node_id, so LEPTON knows which DoDWAN node the command must be addressed to.

Let us assume you would like node N00 to publish a (pseudo) music file:

echo "Let us pretend this is jazz music" > /tmp/file1.mp3
lepton.sh exec N00 publish type=music,style=jazz /tmp/file1.mp3

And if you wish node N12 to be able to receive music files and save them in directory /tmp/music_for_N12, you simply need to set a subscription accordingly on that node:

mkdir /tmp/music_for_N12
lepton.sh exec N12 subscribe myMusicPrefs "type=music,style=(jazz|classical)" -d /tmp/music_for_N12

You can now wait for N12 to receive the file published by N00:

watch -n 1 ls /tmp/music_for_N12
(Use Ctrl-C to terminate)

This may take some time, of course, since you have to wait for nodes N00 and N12 to come within radio range.

But you can make things way faster by setting subscriptions on some of the other nodes, so they become mobile carriers for any kind of music:

for node in N00 N01 N02 N03 N04 N05 N06 N07 N08 N09 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 ; do
  lepton.sh exec $node subscribe anyMusic "type=music" ;
done

Now it shouldn't take too long for N12 to receive file1.mp3!

Stopping LEPTON

lepton.sh stop

This command stops LEPTON, but also all the DoDWAN nodes that may be running as well.