ns3 , The Network Simulator: WNS2 Tutorial October 23, 2008 - - PowerPoint PPT Presentation

ns3 the network simulator wns2 tutorial
SMART_READER_LITE
LIVE PREVIEW

ns3 , The Network Simulator: WNS2 Tutorial October 23, 2008 - - PowerPoint PPT Presentation

ns3 , The Network Simulator: WNS2 Tutorial October 23, 2008 Overview Introduction to ns3 Design goals and Motivation Simulated Entities Nodes Applications Packets Protocols NetDevices Channels The Simulator Attributes Getting Started


slide-1
SLIDE 1

ns3, The Network Simulator: WNS2 Tutorial

October 23, 2008

slide-2
SLIDE 2

Overview

Introduction to ns3 Design goals and Motivation Simulated Entities

Nodes Applications Packets Protocols NetDevices Channels The Simulator Attributes

Getting Started Obtaining ns3 Compiling/Building ns3 First Example Simulation Scripts Running Scripts Logging Helpers Tracing Second Example More Advanced Features Command-line arguments

slide-3
SLIDE 3

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator

slide-4
SLIDE 4

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator ◮ Written in C++ and released under the terms of the GNU

GPLv2

slide-5
SLIDE 5

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator ◮ Written in C++ and released under the terms of the GNU

GPLv2

◮ User scripts are written in C++, or via Python bindings

provided to C++ APIs

slide-6
SLIDE 6

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator ◮ Written in C++ and released under the terms of the GNU

GPLv2

◮ User scripts are written in C++, or via Python bindings

provided to C++ APIs

◮ Simuator entities are analogous to the real world (sockets,

applications, channels, etc.)

slide-7
SLIDE 7

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator ◮ Written in C++ and released under the terms of the GNU

GPLv2

◮ User scripts are written in C++, or via Python bindings

provided to C++ APIs

◮ Simuator entities are analogous to the real world (sockets,

applications, channels, etc.)

◮ Modular simulator core

slide-8
SLIDE 8

Introduction to ns3

ns3 is a network simulator for research simulation purposes.

◮ Discrete event simulator ◮ Written in C++ and released under the terms of the GNU

GPLv2

◮ User scripts are written in C++, or via Python bindings

provided to C++ APIs

◮ Simuator entities are analogous to the real world (sockets,

applications, channels, etc.)

◮ Modular simulator core ◮ Redsigned from scratch (only a spiritual sucessor to ns2)

slide-9
SLIDE 9

Design goals and Motivation

slide-10
SLIDE 10

Design goals and Motivation

◮ Easy extensibility

slide-11
SLIDE 11

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers.

slide-12
SLIDE 12

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom).

slide-13
SLIDE 13

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom). ◮ Multi-platform (*NIX systems, including Windows via

cygwin)

slide-14
SLIDE 14

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom). ◮ Multi-platform (*NIX systems, including Windows via

cygwin)

◮ Ease of contributing, open development community.

slide-15
SLIDE 15

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom). ◮ Multi-platform (*NIX systems, including Windows via

cygwin)

◮ Ease of contributing, open development community. ◮ Use of real world concepts

slide-16
SLIDE 16

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom). ◮ Multi-platform (*NIX systems, including Windows via

cygwin)

◮ Ease of contributing, open development community. ◮ Use of real world concepts

◮ Real code integration (real linux stacks, real sockets

application binaries)

slide-17
SLIDE 17

Design goals and Motivation

◮ Easy extensibility ◮ Understandibility for programmers. ◮ Open source and free (as in freedom). ◮ Multi-platform (*NIX systems, including Windows via

cygwin)

◮ Ease of contributing, open development community. ◮ Use of real world concepts

◮ Real code integration (real linux stacks, real sockets

application binaries)

◮ Emulation mode - inject real packets into real networks

slide-18
SLIDE 18

Simulated Entities

slide-19
SLIDE 19

Simulated Entities

◮ Nodes

slide-20
SLIDE 20

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

slide-21
SLIDE 21

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

slide-22
SLIDE 22

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

slide-23
SLIDE 23

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

slide-24
SLIDE 24

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

slide-25
SLIDE 25

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

slide-26
SLIDE 26

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity

slide-27
SLIDE 27

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity A sockets like API exists for Applications to send and receive data through protocols

slide-28
SLIDE 28

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity A sockets like API exists for Applications to send and receive data through protocols

◮ NetDevices

slide-29
SLIDE 29

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity A sockets like API exists for Applications to send and receive data through protocols

◮ NetDevices

Interfaces protocol stack with channels/physical tranmission medium

slide-30
SLIDE 30

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity A sockets like API exists for Applications to send and receive data through protocols

◮ NetDevices

Interfaces protocol stack with channels/physical tranmission medium

◮ Channels

slide-31
SLIDE 31

Simulated Entities

◮ Nodes

Entities which form the network, connected by channels

◮ Applications

Typically the final data sending/receiving entities, exist on nodes

◮ Packets

What is sent across networks

◮ Protocols

Manage connectivity A sockets like API exists for Applications to send and receive data through protocols

◮ NetDevices

Interfaces protocol stack with channels/physical tranmission medium

◮ Channels

Medium of transmission

slide-32
SLIDE 32

Simulated Entities

slide-33
SLIDE 33

Nodes

slide-34
SLIDE 34

Nodes

◮ Abstraction of the "boxes" in your network

slide-35
SLIDE 35

Nodes

◮ Abstraction of the "boxes" in your network ◮ Basically function as a collection of applications, protocol

stacks, and netdevices

slide-36
SLIDE 36

Nodes

◮ Abstraction of the "boxes" in your network ◮ Basically function as a collection of applications, protocol

stacks, and netdevices

◮ In the internet, these are the end hosts, routers, servers,

etc.

slide-37
SLIDE 37

Nodes

◮ Abstraction of the "boxes" in your network ◮ Basically function as a collection of applications, protocol

stacks, and netdevices

◮ In the internet, these are the end hosts, routers, servers,

etc.

◮ In MANETs, these are the mobile hosts, in WSNs, sensors,

in cell networks, phones, etc.

slide-38
SLIDE 38

Nodes

◮ Abstraction of the "boxes" in your network ◮ Basically function as a collection of applications, protocol

stacks, and netdevices

◮ In the internet, these are the end hosts, routers, servers,

etc.

◮ In MANETs, these are the mobile hosts, in WSNs, sensors,

in cell networks, phones, etc.

slide-39
SLIDE 39

Applications

slide-40
SLIDE 40

Applications

◮ These generate and consume traffic in the networks

slide-41
SLIDE 41

Applications

◮ These generate and consume traffic in the networks ◮ Simple sending applications such as bulk data transfer,

constant bitrate transfer, random on-off transfer, and echo are supported presently out of the box

slide-42
SLIDE 42

Applications

◮ These generate and consume traffic in the networks ◮ Simple sending applications such as bulk data transfer,

constant bitrate transfer, random on-off transfer, and echo are supported presently out of the box

◮ Simple consuming application which sinks Packets is also

currently supported

slide-43
SLIDE 43

Applications

◮ These generate and consume traffic in the networks ◮ Simple sending applications such as bulk data transfer,

constant bitrate transfer, random on-off transfer, and echo are supported presently out of the box

◮ Simple consuming application which sinks Packets is also

currently supported

◮ Researchers will develop application models as their work

will require

slide-44
SLIDE 44

Packets

slide-45
SLIDE 45

Packets

◮ Actual network traffic

slide-46
SLIDE 46

Packets

◮ Actual network traffic ◮ "Packet" refers to this data at all layers of the protocol stack

slide-47
SLIDE 47

Packets

◮ Actual network traffic ◮ "Packet" refers to this data at all layers of the protocol stack ◮ Very smart byte buffers; all packet data is internally

represented as a serialized string of bytes. Contrast with

  • ther simulators which use a list of header objects.
slide-48
SLIDE 48

Packets

◮ Actual network traffic ◮ "Packet" refers to this data at all layers of the protocol stack ◮ Very smart byte buffers; all packet data is internally

represented as a serialized string of bytes. Contrast with

  • ther simulators which use a list of header objects.

◮ Header object concept retained, but headers are serialized

transparently into the Packet when added.

slide-49
SLIDE 49

Packets

◮ Actual network traffic ◮ "Packet" refers to this data at all layers of the protocol stack ◮ Very smart byte buffers; all packet data is internally

represented as a serialized string of bytes. Contrast with

  • ther simulators which use a list of header objects.

◮ Header object concept retained, but headers are serialized

transparently into the Packet when added.

◮ Optimized with the copy-on-write (COW) technique;

copying/passing packets as parameters isn’t as memory/time consuming.

slide-50
SLIDE 50

Packets

slide-51
SLIDE 51

Packets

◮ Overall benefit: packet internal representation is the same

as the real world. Means easy support of e.g. PCAP traces, emulation mode.

slide-52
SLIDE 52

Packets

◮ Overall benefit: packet internal representation is the same

as the real world. Means easy support of e.g. PCAP traces, emulation mode.

◮ Optionally has a non-serialized "metadata" which keeps

track of headers and trailers for easy printing.

slide-53
SLIDE 53

Packets

◮ Overall benefit: packet internal representation is the same

as the real world. Means easy support of e.g. PCAP traces, emulation mode.

◮ Optionally has a non-serialized "metadata" which keeps

track of headers and trailers for easy printing.

◮ Supports "tag" objects which can be used for e.g. flow ID,

cross-layer info, delay/jitter calculation, etc. Contrast with hacking extra fields into ns2 headers.

slide-54
SLIDE 54

Packets

◮ Overall benefit: packet internal representation is the same

as the real world. Means easy support of e.g. PCAP traces, emulation mode.

◮ Optionally has a non-serialized "metadata" which keeps

track of headers and trailers for easy printing.

◮ Supports "tag" objects which can be used for e.g. flow ID,

cross-layer info, delay/jitter calculation, etc. Contrast with hacking extra fields into ns2 headers.

slide-55
SLIDE 55

Protocols

slide-56
SLIDE 56

Protocols

◮ Sit between Applications and NetDevices, broker

connections, medium access, addressing, routing, etc

slide-57
SLIDE 57

Protocols

◮ Sit between Applications and NetDevices, broker

connections, medium access, addressing, routing, etc

◮ Full internet-stack supported, with IPv4, v6 on the way,

TCP , UDP , ARP

slide-58
SLIDE 58

Protocols

◮ Sit between Applications and NetDevices, broker

connections, medium access, addressing, routing, etc

◮ Full internet-stack supported, with IPv4, v6 on the way,

TCP , UDP , ARP

◮ Also uses Network Simulation Cradle technology to allow

the use of unmodified Linux kernel network stack code, with similar support for BSD on the way

slide-59
SLIDE 59

Protocols

◮ Sit between Applications and NetDevices, broker

connections, medium access, addressing, routing, etc

◮ Full internet-stack supported, with IPv4, v6 on the way,

TCP , UDP , ARP

◮ Also uses Network Simulation Cradle technology to allow

the use of unmodified Linux kernel network stack code, with similar support for BSD on the way

◮ Global static precomputed routing available for wired type

  • f topologies, OLSR for wireless
slide-60
SLIDE 60

NetDevices

slide-61
SLIDE 61

NetDevices

◮ Actual interface between the protocol stack and the

Channel

slide-62
SLIDE 62

NetDevices

◮ Actual interface between the protocol stack and the

Channel

◮ Modelizes e.g. the ethernet card of your PC

slide-63
SLIDE 63

NetDevices

◮ Actual interface between the protocol stack and the

Channel

◮ Modelizes e.g. the ethernet card of your PC ◮ ns3 inherently supports multiple interfaces per node, of

different types

slide-64
SLIDE 64

NetDevices

◮ Actual interface between the protocol stack and the

Channel

◮ Modelizes e.g. the ethernet card of your PC ◮ ns3 inherently supports multiple interfaces per node, of

different types

◮ Currently types include 802.11, ethernet-like CSMA,

serial-like point-to-point

slide-65
SLIDE 65

NetDevices

◮ Actual interface between the protocol stack and the

Channel

◮ Modelizes e.g. the ethernet card of your PC ◮ ns3 inherently supports multiple interfaces per node, of

different types

◮ Currently types include 802.11, ethernet-like CSMA,

serial-like point-to-point

◮ Also some bridging code which allows traffic to flow across

devices types on a node, e.g.wired ⇔ wireless

slide-66
SLIDE 66

Channels

slide-67
SLIDE 67

Channels

◮ Model for the transmission medium

slide-68
SLIDE 68

Channels

◮ Model for the transmission medium ◮ Typically have a data capacity, transmission delay, loss

characteristics, etc.

slide-69
SLIDE 69

Channels

◮ Model for the transmission medium ◮ Typically have a data capacity, transmission delay, loss

characteristics, etc.

◮ Connects two or more NetDevices together such that

Packets can be transmitted and received.

slide-70
SLIDE 70

Channels

◮ Model for the transmission medium ◮ Typically have a data capacity, transmission delay, loss

characteristics, etc.

◮ Connects two or more NetDevices together such that

Packets can be transmitted and received.

◮ Typicaly implemented as a list of connected NetDevices,

with APIs for sending and receiving on the medium

slide-71
SLIDE 71

Channels

◮ Model for the transmission medium ◮ Typically have a data capacity, transmission delay, loss

characteristics, etc.

◮ Connects two or more NetDevices together such that

Packets can be transmitted and received.

◮ Typicaly implemented as a list of connected NetDevices,

with APIs for sending and receiving on the medium

◮ ns3 has models for both point-to-point and multipoint

channels (simple serial channel, ethernet-like CSMA, and 802.11)

slide-72
SLIDE 72

Channels

◮ Model for the transmission medium ◮ Typically have a data capacity, transmission delay, loss

characteristics, etc.

◮ Connects two or more NetDevices together such that

Packets can be transmitted and received.

◮ Typicaly implemented as a list of connected NetDevices,

with APIs for sending and receiving on the medium

◮ ns3 has models for both point-to-point and multipoint

channels (simple serial channel, ethernet-like CSMA, and 802.11)

◮ NetDevice types are tied to the Channel types, i.e. wifi

devices must be on wifi channel

slide-73
SLIDE 73

The Simulator

slide-74
SLIDE 74

The Simulator

◮ Simulation time moves discretely from event to event

slide-75
SLIDE 75

The Simulator

◮ Simulation time moves discretely from event to event ◮ Simulation schedules events to occur at specific times, e.g.

"Schedule the receipt of this packet after some delay".

slide-76
SLIDE 76

The Simulator

◮ Simulation time moves discretely from event to event ◮ Simulation schedules events to occur at specific times, e.g.

"Schedule the receipt of this packet after some delay".

◮ Scheduler priority queue; events are ordered by time of

execution

slide-77
SLIDE 77

The Simulator

◮ Simulation time moves discretely from event to event ◮ Simulation schedules events to occur at specific times, e.g.

"Schedule the receipt of this packet after some delay".

◮ Scheduler priority queue; events are ordered by time of

execution

◮ Events invoke a function; implemented using callbacks

slide-78
SLIDE 78

The Simulator

◮ Simulation time moves discretely from event to event ◮ Simulation schedules events to occur at specific times, e.g.

"Schedule the receipt of this packet after some delay".

◮ Scheduler priority queue; events are ordered by time of

execution

◮ Events invoke a function; implemented using callbacks ◮ Simulator::Run() method starts processing events from the

queue one by one

slide-79
SLIDE 79

The Simulator

◮ Simulation time moves discretely from event to event ◮ Simulation schedules events to occur at specific times, e.g.

"Schedule the receipt of this packet after some delay".

◮ Scheduler priority queue; events are ordered by time of

execution

◮ Events invoke a function; implemented using callbacks ◮ Simulator::Run() method starts processing events from the

queue one by one

◮ Simulation is over when event queue is empty, or at a

scheduled stop event at user specified time

slide-80
SLIDE 80

Getting Started With ns3

slide-81
SLIDE 81

Obtaining ns3

slide-82
SLIDE 82

Obtaining ns3

◮ Distributed as source code (no binaries maintained by the

ns3 core developers)

slide-83
SLIDE 83

Obtaining ns3

◮ Distributed as source code (no binaries maintained by the

ns3 core developers)

◮ Via mercurial repository: http://code.nsnam.org/

slide-84
SLIDE 84

Obtaining ns3

◮ Distributed as source code (no binaries maintained by the

ns3 core developers)

◮ Via mercurial repository: http://code.nsnam.org/

◮ All previous releases are kept here, as well as experimental

and developmental branches

slide-85
SLIDE 85

Obtaining ns3

◮ Distributed as source code (no binaries maintained by the

ns3 core developers)

◮ Via mercurial repository: http://code.nsnam.org/

◮ All previous releases are kept here, as well as experimental

and developmental branches

◮ Tarball source releases http://www.nsnam.org

slide-86
SLIDE 86

Compiling/Building ns3

slide-87
SLIDE 87

Compiling/Building ns3

◮ Prerequisites:

slide-88
SLIDE 88

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

slide-89
SLIDE 89

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

slide-90
SLIDE 90

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

◮ ns3 uses the waf build system based on Python (instead of

the GNU autotools configure, make, etc)

slide-91
SLIDE 91

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

◮ ns3 uses the waf build system based on Python (instead of

the GNU autotools configure, make, etc)

◮ Just run ./waf in the source directory; this is like ./configure

&& make

slide-92
SLIDE 92

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

◮ ns3 uses the waf build system based on Python (instead of

the GNU autotools configure, make, etc)

◮ Just run ./waf in the source directory; this is like ./configure

&& make

◮ waf not only builds ns3 , it can be used to run example

programs

slide-93
SLIDE 93

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

◮ ns3 uses the waf build system based on Python (instead of

the GNU autotools configure, make, etc)

◮ Just run ./waf in the source directory; this is like ./configure

&& make

◮ waf not only builds ns3 , it can be used to run example

programs

◮ Now you are ready for your first example program, found in

examples/first.cc

slide-94
SLIDE 94

Compiling/Building ns3

◮ Prerequisites:

◮ GNU compiler toolchain on Linux, Mac OS, or Windows (via

Cygwin or MinGW)

◮ Python 2.4 or newer

◮ ns3 uses the waf build system based on Python (instead of

the GNU autotools configure, make, etc)

◮ Just run ./waf in the source directory; this is like ./configure

&& make

◮ waf not only builds ns3 , it can be used to run example

programs

◮ Now you are ready for your first example program, found in

examples/first.cc

◮ Copy this file into the scratch directory and run with the

command ./waf --run scratch/first

slide-95
SLIDE 95

Example Code: first.cc

slide-96
SLIDE 96

Running Examples and Scripts

slide-97
SLIDE 97

Running Examples and Scripts

◮ All of the *.cc files in the examples directory can be run

with ./waf –run ...

slide-98
SLIDE 98

Running Examples and Scripts

◮ All of the *.cc files in the examples directory can be run

with ./waf –run ...

◮ In addition, you can drop simulation scripts into the scratch

directory, and they will be built automatically (what we did with first.cc)

slide-99
SLIDE 99

Running Examples and Scripts

◮ All of the *.cc files in the examples directory can be run

with ./waf –run ...

◮ In addition, you can drop simulation scripts into the scratch

directory, and they will be built automatically (what we did with first.cc)

◮ Run things from the scratch directory with ./waf --run

scratch/...

slide-100
SLIDE 100

Running Examples and Scripts

◮ All of the *.cc files in the examples directory can be run

with ./waf –run ...

◮ In addition, you can drop simulation scripts into the scratch

directory, and they will be built automatically (what we did with first.cc)

◮ Run things from the scratch directory with ./waf --run

scratch/...

◮ Advanced users can write their simulations scripts, include

the ns3 headers, and link against the ns3 library, bypassing waf for their simulations altogether

slide-101
SLIDE 101

Logging

slide-102
SLIDE 102

Logging

◮ Runtime messages indicating debugging info, and soft

errors/warnings

slide-103
SLIDE 103

Logging

◮ Runtime messages indicating debugging info, and soft

errors/warnings

◮ Provide understanding the internals of model

slide-104
SLIDE 104

Logging

◮ Runtime messages indicating debugging info, and soft

errors/warnings

◮ Provide understanding the internals of model ◮ Can be runtime enabled with LogComponentEnable

slide-105
SLIDE 105

Logging

◮ Runtime messages indicating debugging info, and soft

errors/warnings

◮ Provide understanding the internals of model ◮ Can be runtime enabled with LogComponentEnable ◮ Should not necessarily be used to trace the simulation,

there is separate tracing functionality

slide-106
SLIDE 106

Logging

◮ Runtime messages indicating debugging info, and soft

errors/warnings

◮ Provide understanding the internals of model ◮ Can be runtime enabled with LogComponentEnable ◮ Should not necessarily be used to trace the simulation,

there is separate tracing functionality

◮ UDP echo example: logging output the "Sent 1024 bytes to

10.1.1.2..." messages

slide-107
SLIDE 107

Helpers

slide-108
SLIDE 108

Helpers

◮ Entities are not directly manipulated by the user one by

  • ne.
slide-109
SLIDE 109

Helpers

◮ Entities are not directly manipulated by the user one by

  • ne.

◮ Overlay API which allows manipulating these in groups.

slide-110
SLIDE 110

Helpers

◮ Entities are not directly manipulated by the user one by

  • ne.

◮ Overlay API which allows manipulating these in groups. ◮ Allows for quick scenario / topology construction.

slide-111
SLIDE 111

Helpers

◮ Entities are not directly manipulated by the user one by

  • ne.

◮ Overlay API which allows manipulating these in groups. ◮ Allows for quick scenario / topology construction. ◮ Saw in first.cc

slide-112
SLIDE 112

Tracing

slide-113
SLIDE 113

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

slide-114
SLIDE 114

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

slide-115
SLIDE 115

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame

slide-116
SLIDE 116

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes

slide-117
SLIDE 117

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes ◮ Random sending application sends a packet

slide-118
SLIDE 118

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes ◮ Random sending application sends a packet ◮ A Queue drops a packet

slide-119
SLIDE 119

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes ◮ Random sending application sends a packet ◮ A Queue drops a packet ◮ etc.

slide-120
SLIDE 120

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes ◮ Random sending application sends a packet ◮ A Queue drops a packet ◮ etc.

◮ Can use these "hooks" can be used to generate PCAP

  • utput, collect statistics, results, etc.
slide-121
SLIDE 121

Tracing

◮ Tracing system allows simulation writers access to exactly

the interesting simulation info

◮ Lowest level functionality: a user specified callback is

invoked when a particular event occurs

◮ NetDevice recieves a frame ◮ TCP congestion window changes ◮ Random sending application sends a packet ◮ A Queue drops a packet ◮ etc.

◮ Can use these "hooks" can be used to generate PCAP

  • utput, collect statistics, results, etc.

◮ Primary method of data collection for analysis

slide-122
SLIDE 122

Tracing

slide-123
SLIDE 123

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

slide-124
SLIDE 124

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx

slide-125
SLIDE 125

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

slide-126
SLIDE 126

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

◮ These trace sources are connected to trace sinks, user

provided methods using Config::Connect, e.g.

slide-127
SLIDE 127

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

◮ These trace sources are connected to trace sinks, user

provided methods using Config::Connect, e.g.

◮ Config::Connect ("/NodeList/*/DeviceList/*/Tx",

MakeCallback (&DevTxTrace));

slide-128
SLIDE 128

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

◮ These trace sources are connected to trace sinks, user

provided methods using Config::Connect, e.g.

◮ Config::Connect ("/NodeList/*/DeviceList/*/Tx",

MakeCallback (&DevTxTrace));

◮ This gets the user provided function DevTxTrace a

notification whenever any node, any NetDevices transmits a packet

slide-129
SLIDE 129

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

◮ These trace sources are connected to trace sinks, user

provided methods using Config::Connect, e.g.

◮ Config::Connect ("/NodeList/*/DeviceList/*/Tx",

MakeCallback (&DevTxTrace));

◮ This gets the user provided function DevTxTrace a

notification whenever any node, any NetDevices transmits a packet

◮ User provided function can log this to file, output to screen,

calculate some statistics, etc.

slide-130
SLIDE 130

Tracing

◮ Uses a namespace resemebling operating system paths to

connect a callback to an event, e.g.

◮ /NodeList/[i]/DeviceList/[j]/$ns3::WifiNetDevice/Rx ◮ Refers to Rx event on the jth NetDevice of the ith node

◮ These trace sources are connected to trace sinks, user

provided methods using Config::Connect, e.g.

◮ Config::Connect ("/NodeList/*/DeviceList/*/Tx",

MakeCallback (&DevTxTrace));

◮ This gets the user provided function DevTxTrace a

notification whenever any node, any NetDevices transmits a packet

◮ User provided function can log this to file, output to screen,

calculate some statistics, etc.

◮ Complete list can be found in the Doxygen documentation

slide-131
SLIDE 131

Attributes

slide-132
SLIDE 132

Attributes

◮ The tracing namespace is reused for simulation

configuration

slide-133
SLIDE 133

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

slide-134
SLIDE 134

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

slide-135
SLIDE 135

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

slide-136
SLIDE 136

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

slide-137
SLIDE 137

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

◮ etc.

slide-138
SLIDE 138

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

◮ etc.

◮ Uses the Config::Set and Config::SetDefault APIs

slide-139
SLIDE 139

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

◮ etc.

◮ Uses the Config::Set and Config::SetDefault APIs

◮ "ns3::WifiRemoteStationManager::RtsCtsThreshold"; used

to set RTS/CTS behavior in Wifi

slide-140
SLIDE 140

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

◮ etc.

◮ Uses the Config::Set and Config::SetDefault APIs

◮ "ns3::WifiRemoteStationManager::RtsCtsThreshold"; used

to set RTS/CTS behavior in Wifi

"/NodeList/5/$ns3::MobilityModel/$ns3::RandomWaypointMobilityModel/Speed"; change the random waypoint mobility model on node 5 to use a uniform distribution random number generator to generate the speeds

slide-141
SLIDE 141

Attributes

◮ The tracing namespace is reused for simulation

configuration

◮ Attributes system allows you to change individual

parameters on many simulations entities

◮ Also allows setting of global defaults for these parameters

◮ Tweak the SIFS, DIFS, PIFS intervals for a specific

NetDevice’s MAC

◮ Set the initial congestion window size for all created TCP

instances

◮ etc.

◮ Uses the Config::Set and Config::SetDefault APIs

◮ "ns3::WifiRemoteStationManager::RtsCtsThreshold"; used

to set RTS/CTS behavior in Wifi

"/NodeList/5/$ns3::MobilityModel/$ns3::RandomWaypointMobilityModel/Speed"; change the random waypoint mobility model on node 5 to use a uniform distribution random number generator to generate the speeds

◮ More info in the doxygen documentation

slide-142
SLIDE 142

Example Code: second.cc

slide-143
SLIDE 143
slide-144
SLIDE 144

Command-line arguments