NS3 is an open source discrete event network simulator for networking research and education. It is written in C++ and supports Python scripting. It simulates networking by scheduling discrete events to occur at specific simulation times. NS3 models nodes, net devices, channels, internet stacks, routing, mobility, and applications. Everything in NS3 is modeled as an object with attributes. Scripts are used to configure simulations by creating nodes and network components, installing protocols, and running applications over time.
2. NS3
● Open source simulator for networking
research and education
● Core is written entirely in C++
● User code (protocols and scenarios)
○ C++
○ Python wrappers
● Library-based usage
○ http://www.nsnam.org/getting_started.html
4. NS3
● Discrete event simulator
○ Simulation time moves discretely from event to event
○ Schedule events to occur at specific simulation times
○ A simulation scheduler orders the event execution
○ Simulator execute events one by one
○ Simulation stops at specific time or when events end
5. NS3
● NS3 vs NS2
○ not a extension
○ does not have an OTcl API
6. NS3
● Nodes
○ Contains Applications, Stacks and NetDevices
● NetDevices
○ represents the technology used to communication
● Channels
○ NetDevices are strongly bound to Channels of a
matching type
11. NS3
● Applications
○ a list of application is stored in the Node
○ applications are like processes
○ make use of a sockets-like API
■ Application::Start() may call ns3::
Socket::SendMsg() in a lower layer
17. NS3
● everything is object
○ similar objects can be grouped in containers
○ every object can have attributes
18. NS3
● Waf build system
○ is a python-based framework for configuring,
compiling and installing applications.
○ similar to other tools such as Autotools, CMake, Ant
○ http://code.google.com/p/waf/
21. NS3
● Writing scripts
○ Create nodes
○ Create netDevices with MAC and PHY
○ Attach netDevices to nodes and set interconnections
○ install protocol stack in nodes
○ set network address for interfaces
○ setup routing
○ install applications in nodes
○ set application start and stop time
○ set simulation start time
○ run simulation
22. NS3
● Debugging
○ Assertions: NS_ASSERT(expression)
■ aborts the program if expression evaluates to
false
■ unconditional breakpoints: NS_BREAKPOINT();
○ GDB commands
23. NS3
● Logging
NS_LOG_ERROR — Log error messages;
NS_LOG_WARN — Log warning messages;
NS_LOG_DEBUG — Log relatively rare, ad-hoc debugging messages;
NS_LOG_INFO — Log informational messages about program progress;
NS_LOG_FUNCTION — Log a message describing each function called;
NS_LOG_LOGIC – Log messages describing logical flow within a function;
NS_LOG_ALL — Log everything.
NS_LOG_UNCOND – Log the associated message unconditionally.