https://www.nsnam.org/mediawiki/api.php?action=feedcontributions&user=TrtroCnovi&feedformat=atomNsnam - User contributions [en]2024-03-29T01:24:27ZUser contributionsMediaWiki 1.24.1https://www.nsnam.org/mediawiki/index.php?title=User_FAQ&diff=1465User FAQ2008-01-02T22:22:24Z<p>TrtroCnovi: deltrocca</p>
<hr />
<div>getacelrolge<br />
ligetgetchi<br />
{{TOC}}<br />
<center><big>The Network Simulator ns-3: Frequently Asked Questions (FAQ)</big> </center><br />
<br />
This wiki page is devoted to questions for <b>users</b> of the simulator. There is a similar [[Developer_FAQ]] page for ns-3 <b>software developers and maintainers</b>.<br />
<br />
__TOC__<br />
<br />
== What is the difference between ns-2 and ns-3? ==<br />
<br />
[http://www.isi.edu/nsnam/ns ns-2] is a popular discrete-event network simulator developed under several previous research grants and activities. It remains in active use and will continue to be maintained.<br />
<br />
[http://www.nsnam.org ns-3] is a new software development effort focused on improving upon the core architecture, software integration, models, and educational components of ns-2. The project commenced in July 2006 and there have not yet been any releases (pre-alpha stage).<br />
<br />
If you are looking for a simulator to currently use for research, please use ns-2.<br />
<br />
== Will ns-2 scripts run on ns-3? ==<br />
No. ns-2 uses OTcl as its scripting environment. ns-3 will use C programs or python scripts to define simulations.<br />
<br />
== I found a bug in ns-3. How do I report it? ==<br />
<br />
Please consult [http://www.nsnam.org/contributing.html#bugs this page]. Also, please consider fixing the bug, not just reporting it :)<br />
<br />
== Mercurial ==<br />
<br />
=== merging a separate repository with a main repository ===<br />
<br />
Q. I want to incorporate some code from a mercurial branch (repository) that is off the main repository.<br />
<br />
A. (from Mathieu Lacage)<br />
<br />
You can create a local clone of the repository and pull into it from the main repository: <br />
you can push these yourself by creating a<br />
local clone of that repo and then pushing it back to the main repo. It<br />
will keep the original history; e.g.:<br />
<br />
<pre><br />
hg clone http://code.nsnam.org/mathieu/ns-3-ptr<br />
cd ns-3-ptr<br />
# merge from main ns-3 repository into this other repository<br />
hg pull http://code.nsnam.org/ns-3<br />
hg merge<br />
</pre><br />
<br />
Pushing this new merged repository into another repository will then keep the original change history:<br />
<pre><br />
# push back-- must have privileges to push to the repository<br />
hg push ssh://code@code.nsnam.org/repos/ns-3<br />
</pre><br />
<br />
=== working with subsets of repositories ===<br />
<br />
Q. Is there a way with mercurial to pull/merge/push subsets of the repositories? For instance, suppose I wanted only to grab the samples directory from a repo and merge that alone.<br />
<br />
A. (from Mathieu Lacage) You cannot cherry-pick individual changesets other than by exporting<br />
them to patches first. The reason is that each Changeset contains a<br />
single hash which is, among others, based on the hash of the 'parent'<br />
changeset hash. So, if you 'reparent' a changeset, you change its hash<br />
id because the id of the parent changes. If the hash id of a changeset<br />
changes, it is a different changeset so, mercurial cannot really manage<br />
these individual changesets. There is, however, the [http://www.selenic.com/mercurial/wiki/index.cgi/TransplantExtension transplant extension] that lets you do just that.<br />
<br />
So, the idea is that merging happens from one repo to another, and<br />
cannot be done on a sub-dir basis. The other alternatives are:<br />
<br />
1) the latest mercurial has support for in-repo branches: you can<br />
maintain multiple branches within a single repository but each branch<br />
represents a branch for the whole repository. <br />
<br />
2) the latest mercurial contains the [http://www.selenic.com/mercurial/wiki/index.cgi/ForestExtension forest extension] which is a way<br />
to make mercurial manage a 'forest' of repos: each repo is independent<br />
but they also behave as a single big repo through the forest extension.<br />
<br />
== WAF (new build process) ==<br />
See also the [http://www.nsnam.org/wiki/index.php/Developer_FAQ#The_WAF_build_system WAF developers FAQ]<br />
=== How to build NS-3 ===<br />
First choose the debug level that you want. To select the debug level, you have to ''configure'' NS-3 first with the command:<pre><br />
./waf configure -d debuglevel<br />
</pre><br />
Where ''debuglevel'' is one of:<br />
* ''debug'' (the default): builds NS-3 with the most suited options for debugging. This includes disabling of all optimization, since it confuses the debugger and makes debugging very difficult. It also activates NS-3 internal assertions to catch all programming errors, as well as enabling support for debugging messages (NS_DEBUG and NS_DEBUG_UNCONDITIONAL). This mode should be used initially for development, until you are happy that the code runs correctly and does not contain any serious programming mistake.<br />
* ''optimized'': this compiles NS-3 with optimization, but disabled assertions and debugging messages. Use this when the program is correct and you just want to extrat results.<br />
<br />
It is also possible to customize the C compilation flags through the CXXFLAGS environment variable. Example:<br />
<pre><br />
CXXFLAGS='-O3' ./waf configure -d optimized<br />
</pre><br />
<br />
See [http://code.google.com/p/waf/wiki/EnvironmentVariables here] for a list of additional environment variables that can be used to control waf configure. After configuration, NS-3 can be built with the command:<br />
<pre><br />
./waf build<br />
</pre><br />
[ The waf command ''build'' can be omitted, since it is the default command. ]<br />
<br />
'''WARNING''': even though the -d option is accepted outside "waf configure", it is completely ignored unless applied together with the configure command.<br />
<br />
=== How to run NS-3 programs ===<br />
First, the builtin NS-3 [http://en.wikipedia.org/wiki/Unit_test unit tests] can be executed with the command:<br />
<pre><br />
./waf check<br />
</pre><br />
<br />
To run the remaining programs, there are three different ways to do it.<br />
# The hard way: because NS-3 is built as a set of shared library (dll) files, it requires you to manually configure LD_LIBRARY_PATH, PATH, or DYLD_LIBRARY_PATH, depending on your platform, to make them point to each ns-3 module directory. Only then can you run the programs that were built as <code>build/<debuglevel>/path/to/program</code>.<br />
# Easy way #2: run <code>./waf --shell</code>. You will then have a new nested shell from which programs can be run, e.g. <code>gdb ./build/debug/examples/simple-p2p</code>.<br />
# Easy way #1: <code>./waf --run programname</code>, or <code>./waf --run "programname args"</code>. To find out available program names, run <code>./waf --run non-existent-program-name</code>.<br />
<br />
=== How to run NS-3 programs under another tool ===<br />
For running ns-3 programs with gdb or valgrind, try the following:<br />
* Use the "command-template" argument; e.g. <br />
** <code> waf --run csma-cd-one-subnet --command-template="gdb %s"</code><br />
** <code> waf --run csma-cd-one-subnet --command-template="valgrind %s"</code><br />
<br />
== Scons (old build process) ==<br />
<br />
=== Library not loaded error ===<br />
Question: On Apple osX, I built ns-3 successfully, but when I try to run a sample program I get something like:<br />
<pre><br />
> ./sample-packet<br />
dyld: Library not loaded: build-dir/dbg-shared/lib/libcommon.dylib<br />
Referenced from: /tmp/ns-3/build-dir/dbg-shared/bin/./sample-packet<br />
Reason: image not found<br />
Trace/BPT trap<br />
</pre><br />
<br />
Answer: This is because the library path variable of your environment does not include the location where the ns-3 modules (libraries) are located.<br />
<br />
In OS X, you need to set the DYLD_LIBRARY_PATH variable to include the library directory. These need to include the lib/ directory where these ns-3 libraries are built. On Linux and Solaris systems, you should never warnings of this kind. If you do, please, report a bug.<br />
<br />
In this example, setting<br />
DYLD_LIBRARY_PATH=/tmp/ns-3/build-dir/dbg-shared/lib/<br />
will work.<br />
<br />
=== How do I do the equivalent of a "make clean"? ===<br />
<pre><br />
scons -c<br />
</pre></div>TrtroCnovi