-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NEPI, a framework to manage network experiments
% Copyright (C) 2013 INRIA
%
% This program is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
+% it under the terms of the GNU General Public License version 2 as
+% published by the Free Software Foundation;
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
Mandatory dependencies:
\begin{itemize}
\item Python 2.6+
- \item Mercurial
+ \item Mercurial
+ \item python-ipaddr
+ \item python-networkx
+ \item python-pygraphviz
+ \item python-matplotlib
\end{itemize}
Optional dependencies:
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
- $ sudo aptitude install -y python mercurial
+ $ sudo apt-get -y install python mercurial python-ipaddr python-networkx python-pygraphviz python-matplotlib
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
- $ sudo yum install -y python mercurial
+ $ sudo yum -y install python mercurial python-ipaddr python-networkx graphviz-python python-matplotlib
\end{verbatim}
\endgroup
\subsection{Install dependencies on Mac}
First install homebrew (\url{http://mxcl.github.io/homebrew/}),
-then install Python.
+then you can install Python and the rest of the dependencies as follows:
+
+\begingroup
+ \fontsize{10pt}{12pt}\selectfont
+
+\begin{verbatim}
+ $ brew install python
+ $ sudo port install mercurial
+ $ sudo easy_install pip
+ $ sudo pip install ipaddr
+ $ sudo pip install networkx
+ $ sudo pip install pygraphviz
+ $ sudo pip install matplotlib
+\end{verbatim}
+
+\endgroup
+
+To use Python you will need to set the PATH environmen variable as:
\begingroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
- $ brew install python
+ $ export PATH=$PATH:/usr/local/share/python
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
-$ hg clone http://nepi.inria.fr/code/nepi -r nepi-3.0-release
+$ hg clone http://nepi.inria.fr/code/nepi -r nepi-3.2.0
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
- $ PYTHONPATH=$PYTHONPATH:<path-to-nepi>/src python experiment.py
+ $ export PYTHONPATH=$PYTHONPATH:<path-to-nepi>/src
\end{verbatim}
\endgroup
Writing a simple NEPI expeiment script is easy.
Take a look at the example in the FAQ section \ref{faq:ping_example}.
Once you have written down the script, you can run it using
-Python. Note that since NEPI is not yet installed in your system,
+Python. If NEPI is not installed in your system,
you will need to export the path to NEPI's source code to
the PYTHONPATH environment variable, so that Python can find
NEPI's libraries.
\begin{verbatim}
$ export PYTHONPATH=<path-to-nepi>/src:$PYTHONPATH
- $ python first-experiment.py
+ $ cd <path-to-nepi>
+ $ python examples/linux/ping.py -a localhost
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
-
-$ sudo apt-get install ipython
-
+ $ sudo apt-get install ipython
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
-
-$ sudo yum install ipython
-
+ $ sudo yum install ipython
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
-
-$ pip install ipython
-
+ $ pip install ipython
\end{verbatim}
\endgroup
\fontsize{10pt}{12pt}\selectfont
\begin{verbatim}
-
-$ export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python:/usr/local/share/python/ipython
-
+ $ export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python:/usr/local/share/python/ipython
\end{verbatim}
\endgroup
\end{lstlisting}
Next we will define two Python functions: \emph{add\_node} and \emph{add\_app}.
-The first one to register \textit{LinuxNodes} resources and the second one to
-register LinuxApplications resources.
+The first one to register linux::Node resources and the second one to
+register linux::Application resources.
\begin{lstlisting}[language=Python]
%cpaste
def add_node(ec, hostname, username, ssh_key):
- node = ec.register_resource("LinuxNode")
+ node = ec.register_resource("linux::Node")
ec.set(node, "hostname", hostname)
ec.set(node, "username", username)
ec.set(node, "identity", ssh_key)
- ec.set(node, "cleanHome", True)
+ ec.set(node, "cleanExperiment", True)
ec.set(node, "cleanProcesses", True)
return node
def add_app(ec, command, node):
- app = ec.register_resource("LinuxApplication")
+ app = ec.register_resource("linux::Application")
ec.set(app, "command", command)
ec.register_connection(app, node)
return app
The actual deployment of the experiment requires the method \textit{deploy} to
be invoked.
-The \textit{LinuxNode} resource exposes the hostname, username and identity
+The linux::Node resource exposes the hostname, username and identity
attributes. This attributes provide information about the SSH credentials
needed to log in to the Linux host.
The \textit{hostname} is the one that identifies the physical host you want
'absolute' path to the SSH private key in your local computer that allows you
to log in to the host.
-The \textit{command} attribute of the \textit{LinuxApplication} resource
+The \textit{command} attribute of the linux::Application resource
expects a BASH command line string to be executed in the remote host.
-Apart from the \emph{command} attribute, the \emph{LinuxApplication}
+Apart from the \emph{command} attribute, the linux::Application
resource exposes several other attributes that allow to upload,
compile and install arbitrary sources.
-The add\_app function registers a connection between a \textit{LinuxNode} and a
-\textit{LinuxApplication}.
+The add\_app function registers a connection between a linux::Node and a
+linux::Application.
Lets now use these functions to describe a simple experiment.
Choose a host where you have an account, and can access using SSH
\begin{lstlisting}[language=Python]
-hostname = "<the-hostname>"
-username = "<my-username>"
-identity = "</home/myuser/.ssh/id_rsa>"
+hostname = <the-hostname>
+username = <my-username>
+identity = </home/myuser/.ssh/id_rsa>
node = add_node(ec, hostname, username, ssh_key)
app = add_app(ec, "ping -c3 nepi.inria.fr", node)
one directory named node-1 which will contain the files (e.g. result traces)
associated to the LinuxNode reosurce you just deployed.
In fact for every resource deployed associated to that host (e.g. each
-LinuxApplication), NEPI will create a directory to place files related to it.
+linux::Application), NEPI will create a directory to place files related to it.
The name of the directory identifies the type of resources (e.g. 'node',
'app', etc) and it is followed by the global unique identifier (guid).
\end{lstlisting}
-Once a \textit{LinuxApplication} has reached the state 'STARTED',
+Once a linux::Application has reached the state 'STARTED',
we can retrieve the 'stdout' trace, which should contain the output
of the PING command.