NS3 Tech Talk
in1010 - Redes de Computadores 2015.1 [email protected]
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
NS3● extensive parameterization system● embedded tracing system● standards outputs
○ txt logs○ PCAPs
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
NS3● NS3 vs NS2
○ not a extension○ does not have an OTcl API
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
NS3
NS3
NS3● Internet Stacks
○ Provides IPv4/IPv6 models● Routing
○ implement the routing protocol class, like Ipv4RoutingProtocol
NS3
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
NS3
NS3● Mobility
○ could set the mobility, position, direction and velocity
NS3
NS3
NS3
NS3● everything is object
○ similar objects can be grouped in containers○ every object can have attributes
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/
NS3● waf key commands
○ configure■ ./waf -d [optimized|debug] configure
○ make■ ./waf
○ run programs■ ./waf --run simple-point-to-point
○ run visualizer■ ./waf --run <program_name> --vis
NS3● Pyviz Visualizer
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
NS3● Debugging
○ Assertions: NS_ASSERT(expression)■ aborts the program if expression evaluates to
false■ unconditional breakpoints: NS_BREAKPOINT();
○ GDB commands
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.
NS3● Future Read
○ ns-3 overview■ http://www.nsnam.org/docs/ns-3-overview.ppt■ http://www.nsnam.org/docs/ns-3-overview.pdf
○ ns-3 Tutorial■ http://www.nsnam.org/docs/release/3.13/tutorial/ns-3-
tutorial.pdf○ ns-3 Manual
■ http://www.nsnam.org/docs/release/3.13/manual/ns-3-manual.pdf
Q&ARodrigo Melo (@rodrigodma)
http://www.slideshare.net/rodrigodma/ns3-tech-talk
Recommended