Downloading ns-3 Using a Tarball
$ cd $ mkdir workspace $ cd workspace $ wget http://www.nsnam.org/release/ns-allinone-3.26.tar.bz2 $ tar xjf ns-allinone-3.26.tar.bz2
If you change into the directory ns-allinone-3.26 you should see a
number of files and directories:
$ ls
bake constants.py ns-3.26 README
build.py netanim-3.107 pybindgen-0.17.0.post57+nga6376f2 util.py
Downloading ns-3 Using Bake
$ cd$ mkdir workspace
$ cd workspace
$ hg clone http://code.nsnam.org/bake
As the hg (Mercurial) command executes, you should see something like the following displayed,
destination directory: bake requesting all changes adding changesets adding manifests adding file changes added 339 changesets with 796 changes to 63 files updating to branch default 45 files updated, 0 files merged, 0 files removed, 0 files unresolved
After the clone command completes, you should have a directory called bake, the contents of which should look something like the following:
$ ls bake bakeconf.xml doc generate-binary.py TODO bake.py examples test
Then type this one
$ ./bake.py configure -e ns-3.26
after that check what are the packages we have or not.To look that we want to type
this one
$ ./bake.py check
after that You should see something like the following,
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
> 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
Assume you haven't some packages then you want to install them for that we use
yum install package name
e.g:- yum install CVS
next we want to download software. For that
$ ./bake.py download
should yield something like:
>> Downloading gccxml-ns3 (target directory:gccxml) - OK >> Searching for system dependency python-dev - OK >> Searching for system dependency pygraphviz - OK >> Searching for system dependency pygoocanvas - OK >> Searching for system dependency setuptools - OK >> Searching for system dependency g++ - OK >> Searching for system dependency qt4 - OK >> Downloading pygccxml - OK >> Downloading netanim-3.107 - OK >> Downloading pybindgen-0.17.0.post57+nga6376f2 (target directory:pybindgen) - OK >> Downloading ns-3.26 - OK
The above suggests that five sources have been downloaded. Check the source directory now and type ls; one should see:
$ ls
gccxml netanim-3.107 ns-3.26 pybindgen pygccxml pygccxml-1.0.0.zip
You are now ready to build the ns-3 distribution.
Building ns-3
Building with build.py
If you downloaded using a tarball you should have a directory called something like ns-allinone-3.26 under your ~/workspace directory. Type the following:
$ ./build.py --enable-examples --enable-tests
Because we are working with examples and tests in this tutorial, and
because they are not built by default in ns-3, 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
ns-3 without examples and tests, or eliminate the modules that
are not necessary for your work, if you wish.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:
Waf: Leaving directory `/path/to/workspace/ns-allinone-3.26/ns-3.26/build'
'build' finished successfully (6m25.032s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility mpi
netanim (no Python) network nix-vector-routing
olsr openflow (no Python) point-to-point
point-to-point-layout propagation sixlowpan
spectrum stats tap-bridge
test (no Python) topology-read traffic-control
uan virtual-net-device visualizer
wave wifi wimax
Modules not built (see ns-3 tutorial for explanation):
brite click
Testing ns-3
You can run the unit tests of the ns-3 distribution by running the ./test.py -c core script:$ ./test.py -c core
92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors)
You will also see the summary output from Waf and the test runner executing each test, which will actually look something like:
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)
Modules built:
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
PASS: TestSuite ns3-wifi-interference
PASS: TestSuite histogram
...
PASS: TestSuite object
PASS: TestSuite random-number-generators
Running a Script
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 --run option in Waf. Let’s run the ns-3 equivalent of the ubiquitous hello world program by typing the following:$ ./waf --run hello-simulator
Hello Simulator
No comments:
Post a Comment