user manual
[nepi.git] / doc / user_manual / getting_started.tex
index 904e112..c9e667f 100644 (file)
@@ -1,12 +1,11 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 %    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
@@ -33,7 +32,11 @@ before using NEPI. \\
 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:
@@ -47,7 +50,7 @@ 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
@@ -58,7 +61,7 @@ Optional dependencies:
     \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
@@ -66,13 +69,30 @@ Optional dependencies:
 \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
@@ -105,7 +125,7 @@ control system. The Mercurial NEPI repo can also be browsed online at: \\
     \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
@@ -139,7 +159,7 @@ environmental variable, when you run a NEPI script.
     \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
@@ -156,7 +176,7 @@ The second one is in interactive mode by using Python console.
 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.
@@ -166,7 +186,8 @@ 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
@@ -186,9 +207,7 @@ You can easily install IPython on Debian, Ubuntu, Fedora or Mac as follows:\\
     \fontsize{10pt}{12pt}\selectfont
 
 \begin{verbatim}
-
-$ sudo apt-get install ipython
-
+    $ sudo apt-get install ipython
 \end{verbatim}
 
 \endgroup
@@ -199,9 +218,7 @@ $ sudo apt-get install ipython
     \fontsize{10pt}{12pt}\selectfont
 
 \begin{verbatim}
-
-$ sudo yum install ipython
-
+    $ sudo yum install ipython
 \end{verbatim}
 
 \endgroup
@@ -212,9 +229,7 @@ $ sudo yum install ipython
     \fontsize{10pt}{12pt}\selectfont
 
 \begin{verbatim}
-
-$ pip install ipython
-
+    $ pip install ipython
 \end{verbatim}
 
 \endgroup
@@ -226,9 +241,7 @@ path to the PYTHONPATH environment variable
     \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
@@ -276,23 +289,23 @@ ec = ExperimentController(exp_id = "<your-exp-id>")
 \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
@@ -308,7 +321,7 @@ than informing the EC about the resources that will be used during the experimen
 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
@@ -317,13 +330,13 @@ valid account on that host, and the \textit{identity} attribute is the
 '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
@@ -331,9 +344,9 @@ key authentication.
 
 \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)
@@ -382,7 +395,7 @@ the <exp-id> assigned to your EC, and inside that directory you should find
 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).
 
@@ -394,7 +407,7 @@ ec.state(app, hr=True)
 
 \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.