Files
unison/doc/tutorial/source/getting-started.rst

634 lines
24 KiB
ReStructuredText
Raw Normal View History

2011-01-02 22:57:32 -08:00
.. include:: replace.txt
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
Getting Started
---------------
2013-05-05 22:42:12 -07:00
This section is aimed at getting a user to a working state starting
with a machine that may never have had |ns3| installed. It covers
supported platforms, prerequisites, ways to obtain |ns3|, ways to
build |ns3|, and ways to verify your build and run simple programs.
Overview
********
|ns3| is built as a system of software libraries that work together.
User programs can be written that links with (or imports from) these
libraries. User programs are written in either the C++ or Python
programming languages.
|ns3| is distributed as source code, meaning that the target system
needs to have a software development environment to build the libraries
first, then build the user program. |ns3| could in principle be
distributed as pre-built libraries for selected systems, and in the
future it may be distributed that way, but at present, many users
actually do their work by editing |ns3| itself, so having the source
code around to rebuild the libraries is useful. If someone would like
to undertake the job of making pre-built libraries and packages for
operating systems, please contact the ns-developers mailing list.
2011-01-02 22:57:32 -08:00
Downloading ns-3
****************
The |ns3| system as a whole is a fairly complex system and has a
number of dependencies on other components. Along with the systems you will
2012-06-04 07:21:57 -07:00
most likely deal with every day (the GNU toolchain, Mercurial, a text
editor) you will need to ensure that a number of additional libraries are
2011-01-02 22:57:32 -08:00
present on your system before proceeding. |ns3| provides a wiki
2013-05-05 22:42:12 -07:00
page that includes pages with many useful hints and tips.
2011-01-02 22:57:32 -08:00
One such page is the "Installation" page,
http://www.nsnam.org/wiki/index.php/Installation.
2011-01-02 22:57:32 -08:00
The "Prerequisites" section of this wiki page explains which packages are
required to support common |ns3| options, and also provides the
commands used to install them for common Linux variants. Cygwin users will
have to use the Cygwin installer (if you are a Cygwin user, you used it to
install Cygwin).
2011-01-02 22:57:32 -08:00
You may want to take this opportunity to explore the |ns3| wiki
a bit since there really is a wealth of information there.
2008-06-30 11:42:38 -07:00
From this point forward, we are going to assume that the reader is working in
Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU
toolchain installed and verified along with the prerequisites mentioned
above. We are also going to assume that you have Mercurial and Waf installed
2011-06-23 12:41:51 -07:00
and running on the target system.
2011-01-02 22:57:32 -08:00
The |ns3| code is available in Mercurial repositories on the server
http://code.nsnam.org. You can also download a tarball release at
http://www.nsnam.org/releases/, or you can work with repositories
2009-03-24 00:51:10 -07:00
using Mercurial. We recommend using Mercurial unless there's a good reason
not to. See the end of this section for instructions on how to get a tarball
release.
The simplest way to get started using Mercurial repositories is to use the
2011-01-02 22:57:32 -08:00
``ns-3-allinone`` environment. This is a set of scripts that manages the
downloading and building of various subsystems of |ns3| for you. We
2013-05-05 22:42:12 -07:00
recommend that you begin your |ns3| work in this environment.
Downloading ns-3 Using a Tarball
++++++++++++++++++++++++++++++++
A tarball is a particular format of software archive where multiple
files are bundled together and the archive possibly compressed.
|ns3| software releases are provided via a downloadable tarball.
The process for downloading |ns3| via tarball is simple; you just
have to pick a release, download it and decompress it.
Let's assume that you, as a user, wish to build |ns3| in a local
directory called ``workspace``.
If you adopt the ``workspace`` directory approach, you can
get a copy of a release by typing the following into your Linux shell
(substitute the appropriate version numbers, of course):
::
cd
mkdir workspace
cd workspace
wget http://www.nsnam.org/releases/ns-allinone-3.17.tar.bz2
tar xjf ns-allinone-3.17.tar.bz2
If you change into the directory ``ns-allinone-3.17`` you should see a
number of files:
::
bake constants.py ns-3.17 README
build.py netanim-3.103 pybindgen-0.16.0.825 util.py
You are now ready to build the |ns3| distribution.
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
Downloading ns-3 Using Mercurial
++++++++++++++++++++++++++++++++
2013-05-05 22:42:12 -07:00
|ns3| can also be fetched from the project's master code repositories
using a tool called Mercurial.
2011-01-02 22:57:32 -08:00
One practice is to create a directory called ``repos`` in one's home
2009-03-24 00:51:10 -07:00
directory under which one can keep local Mercurial repositories.
2011-01-02 22:57:32 -08:00
*Hint: we will assume you do this later in the tutorial.* If you adopt
that approach, you can get a copy of ``ns-3-allinone`` by typing the
2009-03-24 00:51:10 -07:00
following into your Linux shell (assuming you have installed Mercurial):
2011-01-02 22:57:32 -08:00
::
2009-03-24 00:51:10 -07:00
cd
mkdir repos
cd repos
2013-05-05 22:42:12 -07:00
hg clone http://code.nsnam.org/bake
2009-03-24 00:51:10 -07:00
As the hg (Mercurial) command executes, you should see something like the
following displayed,
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
destination directory: bake
2009-03-24 00:51:10 -07:00
requesting all changes
adding changesets
adding manifests
adding file changes
2013-05-05 22:42:12 -07:00
added 252 changesets with 661 changes to 62 files
2011-12-23 12:00:12 -08:00
updating to branch default
2013-05-05 22:42:12 -07:00
45 files updated, 0 files merged, 0 files removed, 0 files unresolved
2009-03-24 00:51:10 -07:00
After the clone command completes, you should have a directory called
2013-05-05 22:42:12 -07:00
``bake``, the contents of which should
2009-03-24 00:51:10 -07:00
look something like the following:
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
bake bakeconf.xml doc generate-binary.py TODO
bake.py examples test
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
Notice that you really just downloaded some Python scripts and a Python
module called ``bake``. The next step
2011-01-02 22:57:32 -08:00
will be to use those scripts to download and build the |ns3|
2009-03-24 00:51:10 -07:00
distribution of your choice.
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
If you go to the following link: http://code.nsnam.org/,
2008-06-28 19:46:55 -07:00
you will see a number of repositories. Many are the private repositories of
2011-01-02 22:57:32 -08:00
the |ns3| development team. The repositories of interest to you will
be prefixed with "ns-3". Official releases of |ns3| will be
numbered as ``ns-3.<release>.<hotfix>``. For example, a second hotfix to a
2011-05-25 08:57:47 +04:00
still hypothetical release forty two of |ns3| would be numbered as
``ns-3.42.2``.
2011-01-02 22:57:32 -08:00
The current development snapshot (unreleased) of |ns3| may be found
at http://code.nsnam.org/ns-3-dev/. The
2009-03-24 00:51:10 -07:00
developers attempt to keep these repository in consistent, working states but
they are in a development area with unreleased code present, so you may want
to consider staying with an official release if you do not need newly-
introduced features.
2008-06-28 19:46:55 -07:00
2013-05-05 22:42:12 -07:00
Since the release numbers are going to be changing, we will stick with
2008-06-28 19:46:55 -07:00
the more constant ns-3-dev here in the tutorial, but you can replace the
2013-05-05 22:42:12 -07:00
string "ns-3-dev" with your choice of release (e.g., ns-3.17) in the
2010-10-15 16:31:32 -07:00
text below. You can find the latest version of the
2009-06-15 15:22:33 -07:00
code either by inspection of the repository list or by going to the
2011-06-23 12:41:51 -07:00
`"ns-3 Releases"
<http://www.nsnam.org/releases>`_
web page and clicking on the latest release link.
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
Go ahead and change into the ``ns-3-allinone`` directory you created when
2013-05-05 22:42:12 -07:00
you cloned that repository. We are now going to use the bake tool
to pull down the various pieces of |ns3| you will be using.
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
Go ahead and type the following into your shell:
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
./bake.py configure -e ns-3.17
2008-06-28 19:46:55 -07:00
2013-05-05 22:42:12 -07:00
Next, we'l ask bake to check whether we have enough tools to download
various components. Type:
2009-07-01 23:08:07 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
./bake.py check
2009-07-01 23:08:07 -07:00
2013-05-05 22:42:12 -07:00
You should see something like the following,
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
> Python - OK
> GNU C++ compiler - OK
> Mercurial - OK
> CVS - OK
> GIT - OK
> Bazaar - OK
> Tar tool - OK
> Unzip tool - OK
> Unrar tool - is missing
> 7z data compression utility - OK
> XZ data compression utility - OK
> Make - OK
> cMake - OK
> patch tool - OK
> autoreconf tool - OK
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
> Path searched for tools: /usr/lib64/qt-3.3/bin /usr/lib64/ccache /usr/local/bin /bin /usr/bin /usr/local/sbin /usr/sbin /sbin /home/tomh/bin bin
2011-01-02 22:57:32 -08:00
2013-05-05 22:42:12 -07:00
In particular, download tools such as Mercurial, CVS, GIT, and Bazaar
are our principal concerns at thi spoint, since they allow us to fetch
the code. Please install missing tools at this stage if you are able to.
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
Next, try to download the software:
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
python ./bake.py download
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
should yield something like:
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
>> Searching for system dependency pygoocanvas - OK
>> Searching for system dependency python-dev - OK
>> Searching for system dependency pygraphviz - OK
>> Downloading pybindgen-0.16.0.825 - OK
>> Searching for system dependency g++ - OK
>> Searching for system dependency qt4 - OK
>> Downloading netanim-3.103 - OK
>> Downloading ns-3.17 - OK
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
The above suggests that three sources have been downloaded. Check the
``source`` directory now and type ``ls``; one should see:
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
::
2008-09-15 21:37:40 -07:00
2013-05-05 22:42:12 -07:00
netanim-3.103 ns-3.17 pybindgen-0.16.0.825
2008-06-29 21:16:35 -07:00
2011-01-02 22:57:32 -08:00
You are now ready to build the |ns3| distribution.
2008-06-29 21:16:35 -07:00
2011-01-02 22:57:32 -08:00
Building ns-3
*************
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
Building with build.py
++++++++++++++++++++++
2013-05-05 22:42:12 -07:00
When working from a released tarball, the first time you build the
|ns3| project you can build using a convenience program found in the
``allinone`` directory. This program is called ``build.py``. This
program will get the project configured for you
in the most commonly useful way. However, please note that more advanced
configuration and work with |ns3| will typically involve using the
native |ns3| build system, Waf, to be introduced later in this tutorial.
2009-03-24 00:51:10 -07:00
2013-05-05 22:42:12 -07:00
If you downloaded
2009-03-24 00:51:10 -07:00
using a tarball you should have a directory called something like
2013-05-05 22:42:12 -07:00
``ns-allinone-3.17`` under your ``~/workspace`` directory.
Type the following:
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
::
2011-04-12 14:35:16 -07:00
./build.py --enable-examples --enable-tests
2011-04-06 10:13:04 -07:00
2011-04-12 14:35:16 -07:00
Because we are working with examples and tests in this tutorial, and
because they are not built by default in |ns3|, the arguments for
build.py tells it to build them for us. The program also defaults to
building all available modules. Later, you can build
|ns3| without examples and tests, or eliminate the modules that
are not necessary for your work, if you wish.
2009-03-24 00:51:10 -07:00
You will see lots of typical compiler output messages displayed as the build
script builds the various pieces you downloaded. Eventually you should see the
following magic words:
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
Waf: Leaving directory `/path/to/workspace/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (6m25.032s)
2011-04-19 10:30:50 -07:00
2013-05-05 22:42:12 -07:00
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr emu
energy fd-net-device flow-monitor
internet lte mesh
mobility mpi netanim (no Python)
network nix-vector-routing olsr
point-to-point point-to-point-layout propagation
spectrum stats tap-bridge
test (no Python) tools topology-read
uan virtual-net-device wifi
wimax
2012-12-05 20:45:38 -08:00
2013-05-05 22:42:12 -07:00
Modules not built (see ns-3 tutorial for explanation):
brite click openflow
visualizer
Leaving directory `./ns-3.17`
Regarding the portion about modules not built:
2012-12-05 20:45:38 -08:00
::
Modules not built (see ns-3 tutorial for explanation):
2013-05-05 22:42:12 -07:00
brite click openflow
visualizer
2012-12-05 20:45:38 -08:00
This just means that some ns-3 modules that have dependencies on
outside libraries may not have been built, or that the configuration
specifically asked not to build them. It does not mean that the
simulator did not build successfully or that it will provide wrong
results for the modules listed as being built.
2013-05-05 22:42:12 -07:00
Building with bake
++++++++++++++++++
If you used bake above to fetch source code from project repositories, you
may continue to use it to build |ns3|. Type
::
python bake.py build
and you should see something like:
::
>> Building pybindgen-0.16.0.825 - OK
>> Building netanim-3.103 - OK
>> Building ns-3.17 - OK
If there happens to be a failure, please have a look at what the following
command tells you; it may give a hint as to a missing dependency:
2009-03-24 00:51:10 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
python bake.py show
This will list out the various dependencies of the packages you are
trying to build.
2011-01-02 22:57:32 -08:00
Building with Waf
+++++++++++++++++
2013-05-05 22:42:12 -07:00
Up to this point, we have used either the `build.py` script, or the
`bake` tool, to get started with building |ns3|. These tools are useful
for building |ns3| and supporting libraries, and they call into
the |ns3| directory to call the Waf build tool to do the actual building.
Most users quickly transition to using Waf directly to configure and
build |ns3|. So, to proceed, please change your working directory to
the |ns3| directory that you have initially built.
It's not
2009-03-24 00:51:10 -07:00
strictly required at this point, but it will be valuable to take a slight
detour and look at how to make changes to the configuration of the project.
Probably the most useful configuration change you can make will be to
build the optimized version of the code. By default you have configured
2011-04-06 10:13:04 -07:00
your project to build the debug version. Let's tell the project to
2009-03-24 00:51:10 -07:00
make an optimized build. To explain to Waf that it should do optimized
2011-04-12 14:35:16 -07:00
builds that include the examples and tests, you will need to execute the
following commands,
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
./waf clean
2011-04-12 14:35:16 -07:00
./waf -d optimized --enable-examples --enable-tests configure
2008-06-28 19:46:55 -07:00
2008-06-29 21:16:35 -07:00
This runs Waf out of the local directory (which is provided as a convenience
for you). The first command to clean out the previous build is not
typically strictly necessary but is good practice; it will remove the
previously built libraries and object files found in directory ``build/``.
When the project is reconfigured and the build system checks for various
dependencies, you should see
2008-06-29 21:16:35 -07:00
output that looks similar to the following,
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
2009-07-01 23:08:07 -07:00
Checking for program g++ : ok /usr/bin/g++
Checking for program cpp : ok /usr/bin/cpp
Checking for program ar : ok /usr/bin/ar
Checking for program ranlib : ok /usr/bin/ranlib
Checking for g++ : ok
Checking for program pkg-config : ok /usr/bin/pkg-config
Checking for -Wno-error=deprecated-declarations support : yes
Checking for -Wl,--soname=foo support : yes
Checking for header stdlib.h : ok
Checking for header signal.h : ok
Checking for header pthread.h : ok
Checking for high precision time implementation : 128-bit integer
Checking for header stdint.h : ok
Checking for header inttypes.h : ok
Checking for header sys/inttypes.h : not found
Checking for library rt : ok
Checking for header netpacket/packet.h : ok
Checking for pkg-config flags for GSL : ok
Checking for header linux/if_tun.h : ok
Checking for pkg-config flags for GTK_CONFIG_STORE : ok
Checking for pkg-config flags for LIBXML2 : ok
Checking for library sqlite3 : ok
Checking for NSC location : ok ../nsc (guessed)
Checking for library dl : ok
Checking for NSC supported architecture x86_64 : ok
Checking for program python : ok /usr/bin/python
Checking for Python version >= 2.3 : ok 2.5.2
Checking for library python2.5 : ok
Checking for program python2.5-config : ok /usr/bin/python2.5-config
Checking for header Python.h : ok
Checking for -fvisibility=hidden support : yes
Checking for pybindgen location : ok ../pybindgen (guessed)
Checking for Python module pybindgen : ok
Checking for pybindgen version : ok 0.10.0.640
Checking for Python module pygccxml : ok
Checking for pygccxml version : ok 0.9.5
Checking for program gccxml : ok /usr/local/bin/gccxml
Checking for gccxml version : ok 0.9.0
Checking for program sudo : ok /usr/bin/sudo
Checking for program hg : ok /usr/bin/hg
Checking for program valgrind : ok /usr/bin/valgrind
---- Summary of optional NS-3 features:
Threading Primitives : enabled
Real Time Simulator : enabled
Emulated Net Device : enabled
GNU Scientific Library (GSL) : enabled
Tap Bridge : enabled
GtkConfigStore : enabled
XmlIo : enabled
SQlite stats data output : enabled
Network Simulation Cradle : enabled
Python Bindings : enabled
Python API Scanning Support : enabled
Use sudo to set suid bit : not enabled (option --enable-sudo not selected)
2011-04-19 10:30:50 -07:00
Build tests : enabled
Build examples : enabled
2009-07-01 23:08:07 -07:00
Static build : not enabled (option --enable-static not selected)
'configure' finished successfully (2.870s)
2008-06-28 19:46:55 -07:00
2009-03-24 00:51:10 -07:00
Note the last part of the above output. Some ns-3 options are not enabled by
2009-06-15 15:22:33 -07:00
default or require support from the underlying system to work properly.
2009-03-24 00:51:10 -07:00
For instance, to enable XmlTo, the library libxml-2.0 must be found on the
2011-01-02 22:57:32 -08:00
system. If this library were not found, the corresponding |ns3| feature
2009-07-01 23:08:07 -07:00
would not be enabled and a message would be displayed. Note further that there is
2011-01-02 22:57:32 -08:00
a feature to use the program ``sudo`` to set the suid bit of certain programs.
This is not enabled by default and so this feature is reported as "not enabled."
2008-09-15 21:37:40 -07:00
2011-04-12 14:35:16 -07:00
Now go ahead and switch back to the debug build that includes the examples and tests.
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
./waf clean
2011-04-12 14:35:16 -07:00
./waf -d debug --enable-examples --enable-tests configure
2008-06-28 19:46:55 -07:00
2009-03-24 00:51:10 -07:00
The build system is now configured and you can build the debug versions of
2011-12-23 12:00:12 -08:00
the |ns3| programs by simply typing
2011-01-02 22:57:32 -08:00
::
2008-06-28 19:46:55 -07:00
2009-03-24 00:51:10 -07:00
./waf
2008-06-28 19:46:55 -07:00
Okay, sorry, I made you build the |ns3| part of the system twice,
but now you know how to change the configuration and build optimized code.
Here are a few more introductory tips about Waf.
2009-03-25 09:34:39 -07:00
Some waf commands are meaningful during the build phase and some commands are valid
in the configuration phase. For example, if you wanted to use the emulation
2011-04-06 10:13:04 -07:00
features of |ns3|, you might want to enable setting the suid bit using
2009-07-01 23:08:07 -07:00
sudo as described above. This turns out to be a configuration-time command, and so
2011-04-12 14:35:16 -07:00
you could reconfigure using the following command that also includes the examples and tests
2009-03-25 09:34:39 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
./waf configure -d debug --enable-sudo --enable-examples --enable-tests
2009-03-25 09:34:39 -07:00
2009-07-01 23:08:07 -07:00
If you do this, waf will have run sudo to change the socket creator programs of the
emulation code to run as root. There are many other configure- and build-time options
2009-03-25 09:34:39 -07:00
available in waf. To explore these options, type:
2011-01-02 22:57:32 -08:00
::
2009-06-15 15:22:33 -07:00
./waf --help
2009-03-25 09:34:39 -07:00
We'll use some of the testing-related commands in the next section.
Finally, as an aside, it is possible to specify that waf builds the
project in
a directory different than the default ``build/`` directory by passing
the ``-o`` option to configure; e.g.
::
2013-05-05 22:42:12 -07:00
./waf configure -d debug -o build/debug --enable-examples --enable-tests
This allows users to work with multiple builds rather than always
overwriting the last build.
2009-03-24 00:51:10 -07:00
In the examples above, waf uses GCC C++ compiler, command ``g++``, for
building ns-3. However, it's possible to change C++ compiler used by waf.
Say one wants to use Clang C++ compiler, command ``clang++``; it's done by
::
CXX="clang++" ./waf configure
./waf build
One can also set up waf to do distributed compilation with ``distcc`` in
a similar way:
::
CXX="distcc g++" ./waf configure
./waf build
More info on distcc and distributed compilation can be found on it's
`project page
<http://code.google.com/p/distcc/>`_
under Documentation section.
2011-01-02 22:57:32 -08:00
Testing ns-3
************
2008-06-29 21:16:35 -07:00
2011-01-02 22:57:32 -08:00
You can run the unit tests of the |ns3| distribution by running the
"./test.py -c core" script,
2008-06-29 21:16:35 -07:00
2011-01-02 22:57:32 -08:00
::
2008-06-28 19:46:55 -07:00
./test.py -c core
2008-06-28 19:46:55 -07:00
These tests are run in parallel by waf. You should eventually
2009-07-01 23:08:07 -07:00
see a report saying that,
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
2011-12-23 12:00:12 -08:00
92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors)
2009-07-01 23:08:07 -07:00
This is the important message.
You will also see output from the test runner and the output will actually look something like,
2009-07-01 23:08:07 -07:00
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
Waf: Entering directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (1.799s)
2011-04-19 10:30:50 -07:00
Modules built:
2011-05-25 08:57:47 +04:00
aodv applications bridge
click config-store core
csma csma-layout dsdv
emu energy flow-monitor
internet lte mesh
mobility mpi netanim
network nix-vector-routing ns3tcp
ns3wifi olsr openflow
point-to-point point-to-point-layout propagation
spectrum stats tap-bridge
template test tools
topology-read uan virtual-net-device
visualizer wifi wimax
2011-04-19 10:30:50 -07:00
PASS: TestSuite ns3-wifi-interference
PASS: TestSuite histogram
PASS: TestSuite sample
PASS: TestSuite ipv4-address-helper
PASS: TestSuite devices-wifi
PASS: TestSuite propagation-loss-model
2009-07-01 23:08:07 -07:00
...
PASS: TestSuite attributes
PASS: TestSuite config
PASS: TestSuite global-value
PASS: TestSuite command-line
PASS: TestSuite basic-random-number
PASS: TestSuite object
PASS: TestSuite random-number-generators
2011-12-23 12:00:12 -08:00
92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors)
2008-06-28 19:46:55 -07:00
2011-12-23 12:00:12 -08:00
This command is typically run by users to quickly verify that an
2011-01-02 22:57:32 -08:00
|ns3| distribution has built correctly.
2008-06-29 21:16:35 -07:00
2011-01-02 22:57:32 -08:00
Running a Script
****************
2008-06-28 19:46:55 -07:00
We typically run scripts under the control of Waf. This allows the build
system to ensure that the shared library paths are set correctly and that
the libraries are available at run time. To run a program, simply use the
2011-01-02 22:57:32 -08:00
``--run`` option in Waf. Let's run the |ns3| equivalent of the
2008-06-29 21:16:35 -07:00
ubiquitous hello world program by typing the following:
2008-06-28 19:46:55 -07:00
2011-01-02 22:57:32 -08:00
::
2008-06-28 19:46:55 -07:00
./waf --run hello-simulator
Waf first checks to make sure that the program is built correctly and
2009-06-15 15:22:33 -07:00
executes a build if required. Waf then executes the program, which
2008-06-28 19:46:55 -07:00
produces the following output.
2011-01-02 22:57:32 -08:00
::
2008-06-28 19:46:55 -07:00
Hello Simulator
2011-01-02 22:57:32 -08:00
*Congratulations. You are now an ns-3 user.*
2008-06-30 11:42:38 -07:00
2011-01-02 22:57:32 -08:00
*What do I do if I don't see the output?*
2012-10-09 12:47:50 -07:00
If you see ``waf`` messages indicating that the build was
2011-01-02 22:57:32 -08:00
completed successfully, but do not see the "Hello Simulator" output,
chances are that you have switched your build mode to "optimized" in
the "Building with Waf" section, but have missed the change back to
"debug" mode. All of the console output used in this tutorial uses a
special |ns3| logging component that is useful for printing
user messages to the console. Output from this component is
automatically disabled when you compile optimized code -- it is
2011-01-02 22:57:32 -08:00
"optimized out." If you don't see the "Hello Simulator" output,
type the following,
2011-01-02 22:57:32 -08:00
::
2013-05-05 22:42:12 -07:00
./waf configure -d debug --enable-examples --enable-tests
2011-01-02 22:57:32 -08:00
to tell ``waf`` to build the debug versions of the |ns3|
2011-04-12 14:35:16 -07:00
programs that includes the examples and tests. You must still build
2011-04-06 10:13:04 -07:00
the actual debug version of the code by typing,
2011-01-02 22:57:32 -08:00
::
./waf
2011-01-02 22:57:32 -08:00
Now, if you run the ``hello-simulator`` program, you should see the
expected output.
2008-06-28 19:46:55 -07:00
If you want to run programs under another tool such as gdb or valgrind,
2011-01-02 22:57:32 -08:00
see this `wiki entry
<http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_run_NS-3_programs_under_another_tool>`_.
2008-06-28 19:46:55 -07:00