This guide should help get your environment setup to use SAFE. Please follow the instructions in the respective section below, depending on how you will be using SAFE.
The server is the heart of the SAFE framework. It contains the database, the Experiment Execution Manager (EEM), user compartments on disk, and (eventually) the termination detector. The following steps outline the setup of all of the necessary server components.
First, it is necessary to download the most recent version of SAFE. To do so, clone our Mercurial repository:
hg clone http://code.nsnam.org/safe/safe
It is recommended to create a virtualenv before installing all required dependecies. The advantages are that it will not be require root access to be install SAFE, and it avoids possible conflicts with other python programs that maybe using distinct libraries versions.
To setup virtualenv, inside the safe directory use:
virtualenv -p $(which python2.7) virtualenv
The -p flag will make sure that virtualenv installs python 2.7, not the python 3.x that is not yet supported.
Then, activate it:
source virtualenv/bin/activate
It is necessary to activate the virtualenv in every session that will possibly execute the server.
The following libraries and applications are required on the server:
To install all requirements, use:
pip install django django-model-utils twisted sphinx fabric South djangorestframework requests
The database is a fundamental piece of this framework, as it keeps track of the current state of all experiments executions and also store its results. To simplify the database management, all server programs use the same Django database layer.
This layer of abstranction provides object-relational mapping (ORM), what makes easier to manipulate the database. Also, it makes the framework independent of a specific database software.
To configure the database, it is necessary to edit Django configuration file. This file is located at server/web/source/settings.py, and it is important to edit the DATABASES parameter.
Django has built-in support for SQLite. To use it, just specify the database engine to be django.db.backends.sqlite3. However, in a production enviroment it is recommended to use a more robust engine as MySQL or Postgres. Using them may require the installation of specific adaptors to Django. Please see Django documentation for more information.
After the settings are properly configured, it is necessary to setup the database schema. This is can be easily done by executing in the server/web folder:
./manage.py syncdb --all
./manage.py migrate --fake
After executing the syncdb command for the first time django will ask you to set up an Auth model. Enter yes and provide the information requested. This will create a super user, which will be used to perform any other configuration, as well as for running the simulation and creating new users.
The previous commands will not populate the database for you. You will need to use a database manager as to configure the database properly before the first execution of SAFE. Examples of these softwares are PHPMyAdmin (for PHP), or SQLite Manager Firefox Plugin. We are working to allow this setup be done by the normal user interface with SAFE.
To populate the database, add rows with proper information to these tables:
That would be enough for a first simulation run. Other tables like Result and Metric are going to be automatically filled by the server.
A client machine can be thought of as a worker machine. In a MRIP scenario their will be numerous clients all carrying out simulations in parallel and marshalling simulation data back to the EEM over a network. Each machine can be set up as follows.
The following libraries and applications are required on each client:
At this time SAFE assumes that, before experiment execution, clients will have the necessary dependencies to run both SAFE and your ns-3 script. This means that if you were to manually take the tar file packaged by the user and unpack it on a client, you would have no problem building and running that ns-3 script.