Python bindings

From Nsnam
Revision as of 12:07, 21 April 2008 by GustavoCarneiro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Python bindings for NS-3 will primarily allow the programmer to write complete simulation scripts in Python. In addition, writing new models (e.g. routing protocols) in Python will also be possible, although this second goal may take a bit longer to achieve.

Python bindings for NS-3 are being developed using a new tool called PyBindGen. This tool uses gccxml to scan header files and extract API definitions in a semi-automatic way.

Build instructions

  1. Install the CVS version of GCC-XML. Instructions are to be found here;
  2. Download and install pygccxml, version 0.9.5 or greater;
  3. Get the PyBindGen bzr branch; instructions here.
    1. Note: the bzr branch does not come with a waf script, but the one from NS-3 (1.3.2) works fine (waf trunk may or not work);
  4. Finally, get the ns-3-pybindgen-notracing branch: http://code.nsnam.org/gjc/ns-3-pybindgen-notracing/

Testing

./waf --shell
python examples/udp-echo.py

Note: some of the python scripts ported over from C++ may not work due to lack of NS-3 API stability.