The commands that we have seen in the previous tutorial are useful for making quick changes on the testbed.
However once you are set up, it is much more convenient to control
experiments right from your own laptop, and to this end we provide a
set of tools that we collectively refer to as
nepi-ng is simply made of 2 python libraries. This page gives you
detailed instructions for installing them. You will also find a more
complete documentation on these 2 tools below :
- the asynciojobs documentation including its API reference
- the apssh documentation including its API reference
All the tools that we will write will run in a terminal, we assume you are familiar with dealing with such interfaces.
Requires asyncio and python-3.9
nepi-ng is a set of python libraries; these are based on the asyncio
library; these libraries
require *at least python-3.9.
$ python --version Python 3.9.13
You need to install these libraries, the recommended way is through
pip3 like this - if you're not using
might need to run these commands under
[sudo] pip3 install apssh
This should be sufficient as
asynciojobs is required by
apssh. You can check
the installed versions like this
$ python3 -c 'from asynciojobs import __version__; print(__version__)' 0.13.1 $ python3 -c 'from apssh import __version__; print(__version__)' 0.14.1
Note that if you need to upgrade in the future, you will need to run
[sudo] pip3 install --upgrade apssh
and that will bring you the latest release published on
Optional - installing the
r2lab python library
[sudo] pip3 install r2lab
and then likewise
$ python3 -c 'from r2lab import __version__; print(__version__)' 0.1.1
ssh and ssh-agent
nepi-ng does not require a native ssh client to be installed on
your laptop, as it uses the great asyncssh
library instead. However, it is
recommended to have one installed, if only for running an ssh agent,
as using ssh repeatedly is almost impossible without an ssh-agent.
You will see that in all the code of these tutorials, there is no option to specify an alternate key. This is because all the examples in this tutorial use the set of keys known to your ssh agent.
You can inspect and manage this set of keys using the
command - at least on unix-based systems.
# inspect current contents ~/.ssh $ ssh-add -l 1024 SHA256:KNm0U4SgFV9bY957hJAIRR68n5AZHQ6e1gbiXrGHuOA /Users/parmentelat/.ssh/id_rsa (RSA) # if the key is not present in the list, just add it ~/.ssh $ ssh-add path/to/the/key/id_rsa.pub # check for the addition ~/.ssh $ ssh-add -l 1024 SHA256:KNm0U4SgFV9bY957hJAIRR68n5AZHQ6e1gbiXrGHuOA /Users/parmentelat/.ssh/id_rsa (RSA)
In your ssh agent, the keys you add are kept in memory. This means that they can only be added for the lifespan of the agent, and need to be added again if, for example, you log out of your session, or otherwise reboot your laptop.
other means to deal with keys
The reasons we use keys from an ssh agent in the tutorial are:
first it makes code a little simpler
second, first in standard situations a private key is password protected. And when a private key indeed is password-protected, then using an ssh agent really becomes almost mandatory, because otherwise you get prompted your password every single time you run an ssh command.
However if you prefer, you can as well run without an ssh agent, and tweak your script so that a specific key be used instead.
xxx we cannot give details at this point because it is too early; to be added somewhere else towards the end.