From d402b356871fc8cb8af86f47146eabeb09668574 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 16 Dec 2011 09:54:28 -0800 Subject: [PATCH 01/34] click installation hint --- src/click/doc/click.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/click/doc/click.rst b/src/click/doc/click.rst index 70efe9778..6af1e254b 100644 --- a/src/click/doc/click.rst +++ b/src/click/doc/click.rst @@ -89,6 +89,12 @@ configure ns-3 with Click Integration support:: $: ./waf configure --enable-examples --enable-tests --with-nsclick=/path/to/click/source +Hint: If you have click installed one directory above ns-3 (such as in the +ns-3-allinone directory), and the name of the directory is 'click' (or +a symbolic link to the directory is named 'click'), then the --with-nsclick +specifier is not necessary; the ns-3 build system will successfully find +the directory. + If it says 'enabled' beside 'NS-3 Click Integration Support', then you're good to go. Note: If running modular ns-3, the minimum set of modules required to run all ns-3-click examples is wifi, csma and config-store. Next, try running one of the examples:: From 67a5c739d9e2d99d6540f048ad0140717cd9ea88 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 16 Dec 2011 13:49:35 -0800 Subject: [PATCH 02/34] update CHANGES.html --- CHANGES.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.html b/CHANGES.html index 56489da3c..c95704381 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -76,7 +76,10 @@ instead of CXXDEFINES

New API:

Changes to existing API:

From 1c5c4cc698f04230b6d8a7d644705240bc9121be Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 16 Dec 2011 14:02:31 -0800 Subject: [PATCH 03/34] update AUTHORS for ns-3.13 --- AUTHORS | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/AUTHORS b/AUTHORS index afda58ee6..320c14d7a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,4 @@ +Alexander Afanasyev Kirill Andreev (andreev@iitp.ru) Dean Armstrong (deanarm@gmail.com) Nicola Baldo (nbaldo@cttc.es) @@ -6,6 +7,7 @@ Ramon Bauza (monbauza@gmail.com) Mehdi Benamor (mehdi.benamor@telecom-bretagne.eu) Raj Bhattacharjea (raj.b@gatech.edu) Timo Bingmann (timo.bingmann@student.kit.edu) +Julien Boite Elena Borovkova (borokovaes@iitp.ru) Pavel Boyko (boyko@iitp.ru) Dan Broyles (muxman@sbcglobal.net) @@ -25,9 +27,13 @@ Martin Giachino (martin.giachino@gmail.com,giachino@fing.edu.uy) Charline Taibi Guguen (charline.guguen@gmail.com) Tom Goff (tgoff@tgoff.net) David Gross (gdavid.devel@gmail.com) +Daniel Halperin Tom Henderson (tomhend@u.washington.edu) Blake Hurd (naimorai@gmail.com) +ishan Mohamed Amine Ismail (amine.ismail@inria.fr, iamine@udcast.com) +Atishay Jain +Sascha Alexander Jopen Sam Jansen (sam.jansen@gmail.com) Liu Jian (liujatp@gmail.com) Joe Kopena (tjkopena@cs.drexel.edu) @@ -35,12 +41,14 @@ Flavio Kobuta (flaviokubota@gmail.com) Aleksey Kovalenko (kovalenko@iitp.ru) Mathieu Lacage (mathieu.lacage@inria.fr) Emmanuelle Laprise (emmmanuelle.laprise@bluekazoo.ca) +Björn Lichtblau (lichtbla@informatik.hu-berlin.de) Keith Ma (keith.nwsuaf@gmail.com) Federico Maguolo (maguolof@dei.unipd.it) Antti Makela (zarhan@cc.hut.fi) Francesco Malandrino (francesco.malandrino@gmail.com) Fabian Mauchle (f1mauchl@hsr.ch) Andrey Mazo (mazo@iitp.ru) +Vedran Miletić Faker Moatamri (faker.moatamri@inria.fr) Sidharth Nabar (snabar@uw.edu) Hemanth Narra (hemanth@ittc.ku.edu) @@ -48,9 +56,11 @@ Michael Nowatkowski (nowatkom@gmail.com) Duy Nguyen (duy@soe.ucsc.edu) Tommaso Pecorella (tommaso.pecorella@unifi.it) Josh Pelkey (jpelkey@gatech.edu) +Colin Perkins Giuseppe Piro (g.piro@poliba.it) Yana Podkosova (yanapdk@rambler.ru) Guangyu Pei (guangyu.pei@boeing.com) +Andrea Ranieri Bruno Ranieri (Yrrsinn@googlemail.com) Ken Renard (kenneth.renard@arl.army.mil) George F. Riley (riley@ece.gatech.edu) @@ -61,13 +71,17 @@ Florian Schmidt (Florian.Schmidt@cs.rwth-aachen.de) Guillaume Seguin (guillaume.seguin@inria.fr) Kulin Shah (m.kulin@gmail.com) Phillip Sitbon (phillip.sitbon@gmail.com) +Anirudh Sivaraman Ewgenij Starostin (estar@cs.tu-berlin.de) +YunQiang Su Lalith Suresh (suresh.lalith@gmail.com) +Marcos Talau Adrian S. W. Tam (adrian.sw.tam@gmail.com) Hajime Tazaki (tazaki@sfc.wide.ad.jp) Wilson Thong (wilsonwk@ee.cityu.edu.hk) Mauro Tortonesi (mauro.tortonesi@unife.it) Quincy Tse (quincy.tse@gmail.com) +Frederic Urbani (frederic.urbani@inria.fr) Andras Varga (andras@omnetpp.org) Sebastien Vincent (vincent@clarinet.u-strasbg.fr) Guillaume Vu-Brugier (gvubrugier@gmail.com) From 5668e2b361c8115064cf03e92b6a7790bada6713 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 16 Dec 2011 18:10:03 -0800 Subject: [PATCH 04/34] suppress list of modules built when running program from waf --- wscript | 1 + 1 file changed, 1 insertion(+) diff --git a/wscript b/wscript index 93fbaa9f5..a44152493 100644 --- a/wscript +++ b/wscript @@ -801,6 +801,7 @@ def build(bld): for gen in bld.all_task_gen: if type(gen).__name__ in ['ns3header_taskgen', 'ns3moduleheader_taskgen']: gen.post() + bld.env['PRINT_BUILT_MODULES_AT_END'] = False if Options.options.doxygen_no_build: _doxygen(bld) From 9f61bc316bc82eb90db7b67abbad53277492f3de Mon Sep 17 00:00:00 2001 From: Mitch Watrous Date: Fri, 16 Dec 2011 18:11:42 -0800 Subject: [PATCH 05/34] make create-module.py generate a test skeleton --- src/create-module.py | 86 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/src/create-module.py b/src/create-module.py index 38622662b..f1fb486ce 100755 --- a/src/create-module.py +++ b/src/create-module.py @@ -19,6 +19,11 @@ def build(bld): 'helper/%(MODULE)s-helper.cc', ] + module_test = bld.create_ns3_module_test_library('%(MODULE)s') + module_test.source = [ + 'test/%(MODULE)s-test-suite.cc', + ] + headers = bld.new_task_gen(features=['ns3header']) headers.module = %(MODULE)r headers.source = [ @@ -135,6 +140,76 @@ main (int argc, char *argv[]) ''' +TEST_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ + +// Include a header file from your module to test. +#include "ns3/%(MODULE)s.h" + +// An essential include is test.h +#include "ns3/test.h" + +// Do not put your test classes in namespace ns3. You may find it useful +// to use the using directive to access the ns3 namespace directly +using namespace ns3; + +// This is an example TestCase. +class %(CAPITALIZED)sTestCase1 : public TestCase +{ +public: + %(CAPITALIZED)sTestCase1 (); + virtual ~%(CAPITALIZED)sTestCase1 (); + +private: + virtual void DoRun (void); +}; + +// Add some help text to this case to describe what it is intended to test +%(CAPITALIZED)sTestCase1::%(CAPITALIZED)sTestCase1 () + : TestCase ("%(CAPITALIZED)s test case (does nothing)") +{ +} + +// This destructor does nothing but we include it as a reminder that +// the test case should clean up after itself +%(CAPITALIZED)sTestCase1::~%(CAPITALIZED)sTestCase1 () +{ +} + +// +// This method is the pure virtual method from class TestCase that every +// TestCase must implement +// +void +%(CAPITALIZED)sTestCase1::DoRun (void) +{ + // A wide variety of test macros are available in src/core/test.h + NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason"); + // Use this one for floating point comparisons + NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance"); +} + +// The TestSuite class names the TestSuite, identifies what type of TestSuite, +// and enables the TestCases to be run. Typically, only the constructor for +// this class must be defined +// +class %(CAPITALIZED)sTestSuite : public TestSuite +{ +public: + %(CAPITALIZED)sTestSuite (); +}; + +%(CAPITALIZED)sTestSuite::%(CAPITALIZED)sTestSuite () + : TestSuite ("%(MODULE)s", UNIT) +{ + AddTestCase (new %(CAPITALIZED)sTestCase1); +} + +// Do not forget to allocate an instance of this TestSuite +static %(CAPITALIZED)sTestSuite %(MODULE)sTestSuite; + +''' + + def main(argv): parser = OptionParser(usage=("Usage: %prog [options] modulename\n" "Utility script to create a basic template for a new ns-3 module")) @@ -174,6 +249,17 @@ def main(argv): + # + # test + # + testdir = os.path.join(moduledir, "test") + os.mkdir(testdir) + test_cc = file(os.path.join(moduledir, "test", "%s-test-suite.cc" % modname), "wt") + test_cc.write(TEST_CC_TEMPLATE % dict(MODULE=modname,CAPITALIZED=modname.capitalize())) + test_cc.close() + + + # # helper # From fe117bd682547173d3886849e16289a85ccb83e3 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 16 Dec 2011 18:12:27 -0800 Subject: [PATCH 06/34] remove src/template --- src/template/examples/wscript | 14 ------ src/template/test/examples-to-run.py | 18 -------- src/template/test/sample-test-suite.cc | 63 -------------------------- src/template/wscript | 51 --------------------- 4 files changed, 146 deletions(-) delete mode 100644 src/template/examples/wscript delete mode 100644 src/template/test/examples-to-run.py delete mode 100644 src/template/test/sample-test-suite.cc delete mode 100644 src/template/wscript diff --git a/src/template/examples/wscript b/src/template/examples/wscript deleted file mode 100644 index 553eab577..000000000 --- a/src/template/examples/wscript +++ /dev/null @@ -1,14 +0,0 @@ -## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -def build(bld): - # Don't build any examples unless they are enabled. - if not bld.env['ENABLE_EXAMPLES']: - return; - - # Uncomment these lines to build this C++ example program. - #program = bld.create_ns3_program('sample-example', ['core']) - #program.source = 'sample-example.cc' - - # Uncomment this line to register the dependencies for this Python - # example script. - #bld.register_ns3_script('sample-example.py', ['core']) diff --git a/src/template/test/examples-to-run.py b/src/template/test/examples-to-run.py deleted file mode 100644 index 156deb8d6..000000000 --- a/src/template/test/examples-to-run.py +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/env python -## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -# A list of C++ examples to run in order to ensure that they remain -# buildable and runnable over time. Each tuple in the list contains -# -# (example_name, do_run, do_valgrind_run). -# -# See test.py for more information. -cpp_examples = [] - -# A list of Python examples to run in order to ensure that they remain -# runnable over time. Each tuple in the list contains -# -# (example_name, do_run). -# -# See test.py for more information. -python_examples = [] diff --git a/src/template/test/sample-test-suite.cc b/src/template/test/sample-test-suite.cc deleted file mode 100644 index 45e1be737..000000000 --- a/src/template/test/sample-test-suite.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ - -// An essential include is test.h -#include "ns3/test.h" - -// Do not put your test classes in namespace ns3. You may find it useful -// to use the using directive to access the ns3 namespace directly -using namespace ns3; - -// This is an example TestCase. -class SampleTestCase1 : public TestCase -{ -public: - SampleTestCase1 (); - virtual ~SampleTestCase1 (); - -private: - virtual void DoRun (void); -}; - -// Add some help text to this case to describe what it is intended to test -SampleTestCase1::SampleTestCase1 () - : TestCase ("Sample test case (does nothing)") -{ -} - -// This destructor does nothing but we include it as a reminder that -// the test case should clean up after itself -SampleTestCase1::~SampleTestCase1 () -{ -} - -// -// This method is the pure virtual method from class TestCase that every -// TestCase must implement -// -void -SampleTestCase1::DoRun (void) -{ - // A wide variety of test macros are available in src/core/test.h - NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason"); - // Use this one for floating point comparisons - NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance"); -} - -// The TestSuite class names the TestSuite, identifies what type of TestSuite, -// and enables the TestCases to be run. Typically, only the constructor for -// this class must be defined -// -class SampleTestSuite : public TestSuite -{ -public: - SampleTestSuite (); -}; - -SampleTestSuite::SampleTestSuite () - : TestSuite ("sample", UNIT) -{ - AddTestCase (new SampleTestCase1); -} - -// Do not forget to allocate an instance of this TestSuite -static SampleTestSuite sampleTestSuite; diff --git a/src/template/wscript b/src/template/wscript deleted file mode 100644 index 787bdb7dd..000000000 --- a/src/template/wscript +++ /dev/null @@ -1,51 +0,0 @@ -## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -def build(bld): - # Create the module with the appropriate name and the list of - # modules it depends on. - module = bld.create_ns3_module('template', ['core']) - - # Set the C++ source files for this module. - module.source = [ - # Uncomment these lines to compile these model source files. - #'model/sample-model-1.cc', - #'model/sample-model-2.cc', - - # Uncomment these lines to compile these helper source files. - #'helper/sample-helper-1.cc', - #'helper/sample-helper-2.cc', - ] - - # Create the module's test library. - module_test = bld.create_ns3_module_test_library('template') - - # Set the C++ source files for the module's test library. - module_test.source = [ - # Uncomment these lines to compile these test suites. - #'test/sample-test-suite-1.cc', - #'test/sample-test-suite-2.cc', - ] - - # Make headers be installed for this module. - headers = bld.new_task_gen(features=['ns3header']) - headers.module = 'template' - - # Set the C++ header files for this module. - headers.source = [ - # Uncomment these lines to install these model header files. - #'model/sample-model-1.h', - #'model/sample-model-2.h', - - # Uncomment these lines to install these helper header files. - #'helper/sample-helper-1.h', - #'helper/sample-helper-2.h', - ] - - # Uncomment these lines if this module needs a library such as the - # real-time (RT) library to be linked in at build time. - #module .uselib = 'RT' - #module_test.uselib = 'RT' - - # Look for examples if they are enabled. - if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') From d31552a5273802eb950c8cf20f94bfa2de76d6ea Mon Sep 17 00:00:00 2001 From: John Abraham Date: Sun, 18 Dec 2011 15:13:05 -0500 Subject: [PATCH 07/34] NetAnim: Doc changes --- src/netanim/doc/animation.rst | 170 ++++++---------------------------- 1 file changed, 30 insertions(+), 140 deletions(-) diff --git a/src/netanim/doc/animation.rst b/src/netanim/doc/animation.rst index c0f833297..37877b94c 100644 --- a/src/netanim/doc/animation.rst +++ b/src/netanim/doc/animation.rst @@ -4,97 +4,45 @@ Animation --------- Animation is an important tool for network simulation. While |ns3| does not -contain a default graphical animation tool, it does provide an animation -interface for use with stand-alone animators. One such animator called NetAnim, -presently supporting packet flow animation for point-to-point links, has been -developed. Other animators and visualization tools are in development; they may -make use of the existing animation interface or may develop new ones, +contain a default graphical animation tool, we currently have two ways to provide +animation, namely using the PyViz method or the NetAnim method. +The PyViz method is described in http://www.nsnam.org/wiki/index.php/PyViz. +The NetAnim method is described in detail at http://www.nsnam.org/wiki/index.php/NetAnim. +We will describe the NetAnim method briefly here. -Animation interface +AnimationInterface ******************* -The animation interface uses underlying |ns3| trace sources to construct a -timestamped ASCII file that can be read by a standalone animator. The animation -interface in |ns3| currently only supports point-to-point links; however, we -hope to support other link types such as CSMA and wireless in the near future. -A snippet from a sample trace file is shown below.:: +The class "AnimationInterface" under "src/netanim" uses underlying |ns3| trace sources +to construct a timestamped ASCII file in XML format that can be read by a standalone animator +named "NetAnim". - 0.0 N 0 4 5.5 - 0.0 N 1 7 5.5 - 0.0 N 2 2.5 2.90192 +Generating XML trace files for use in NetAnim ++++++++++++++++++++++++++++++++++++++++++++++ +Apply the following statements before the "Simulator::Run ()" statement::: - ... + AnimationInterface anim ("animation.xml") - 0.0 L 0 1 - 0.0 L 0 2 - 0.0 L 0 3 +where "animation.xml" is any arbitrary file name. +It is important to ensure that your wscript includes the "netanim" module. +Example as in: src/netanim/examples/wscript. Also include the header +[#include "ns3/netanim-module.h"] in your test program - ... +The examples under "src/netanim/examples" illustrate this. The sample wscript is at +"src/netanim/examples/wscript". - Running the simulation - 0.668926 P 11 1 0.66936 0.669926 0.67036 - 0.67036 P 1 0 0.670794 0.67136 0.671794 - 0.671794 P 0 6 0.672227 0.672794 0.673227 +Lets take an example: "src/netanim/examples/star-animation.cc". To run the example::: - ... + ./waf --run "star-animation" -The tracefile describes where nodes and links should be placed at the top of the -file. Following this placement, the packet events are shown. The format for node -placement, link placement and packet events is shown below. +This will generate an xml file "star-animation.xml" in the same directory. This XML file +contains the information required by the standalone animator "NetAnim" to produce the required +animation. -* Node placement: