Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

nepi-ng - D - testbed preping

INTRO
D1
D2
D3
D4
WRAP UP

Preparation

At this point, you should have a clear understanding of how to design your experiment using nepi-ng. In this tutorial section, we come back to the initialization and preparation stages, that we had done manually at first - i.e. using the shell tools - and show how to account for these various preparation tasks in a nepi-ng script.

To this end we will improve our script so that it takes care of initializations, and specifically we will add a command line option that, when enabled:

  • loads the ubuntu image on the nodes that we do use,

  • and makes sure that all the nodes that we do not use are actually turned off.

It is a rather common need for all experiments to take these aspects into account. We do recommend to make image loading an option though, since performing this for every run very quickly gets in the way when fine-tuning your experiment.

Please note that the script will not try to get a lease automatically, instead we keep the simple policy of just checking that we have a valid lease.

Like always, we will improve the code by small incremental changes.

Important note on shell tools

Convenience tools are mostly just aliases

Before we dive in this area, we need to stress an important point. In the tutorial on the shell tools, we had seen sessions like this:

rleases
all-off
n 1-5 33,37 ~3
rload -i fedora

It is important to emphasize that the commands involved here are all volatile bash materials like aliases or functions. This means that, as of beginning of Feb. 2018 at least, if you try to run from your laptop something like this:

$ ssh r2lab-tutorial@faraday.inria.fr rleases
bash: rleases: command not found

you get an error, that is to be compared this with:

$ ssh r2lab-tutorial@faraday.inria.fr rhubarbe leases
----- <Leases from PLCAPIproxy@https://r2labapi.inria.fr:443/PLCAPI/ - 25 lease(s)>
  1  < from 02-22 @ 08:00 until 09:00 CET inria_oai
...

The rationale being that there is a need for very short commands in an interactive shell environment. But when invoking commands remotely through ssh, you don’t run bash and so the bash-written convenience layer does not come into play.

How to find out long commands

For starters, as a rule of thumb, all convenience commands that are derived from rhubarbe are made up the same way. Just like rleases is an alias for rhubarbe leases, you will find that rbye is an alias for rhubarbe bye.

r2lab-tutorial@faraday:~$ type rload
rload is aliased to `rhubarbe load'
r2lab-tutorial@faraday:~$ type rwait
rwait is aliased to `rhubarbe wait'

As you can see, it is very easy to find out about a given command when logged on faraday, using bash’s built-in type command; note that type is much more powerful and accurate than the old-school which thing, that is only able to locate a command along your path, while type knows about aliases and functions as well.

r2lab-tutorial@faraday:~$ which rwait
r2lab-tutorial@faraday:~$

How to use short commands in scripts

Finally, note that you can expose short commands in your scripts by adding a line Like this in your shell script:

# this would define e.g. the 'rwait' command
source /etc/profile.d/faraday.sh

The same goes of course for convenience tools exposed from the nodes environment; as we have seen on a few occasions before, if you need to use any of these commands in code meant to run on nodes, you can insert this line in your bash script:

# this would define e.g. the `r2lab-id` command
source /etc/profile.d/nodes.sh

All this being said, let us now see in the next tab (D1) how to extend the A5 script and turn it into D1 that knows how to load images.