Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 49 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
49
Dung lượng
466,5 KB
Nội dung
NS-2 Tutorial
Motivation
What’s NS-2
•
Network simulator
–
Discrete event simulator
•
It covers multiple layers
–
Application layer, transport layer, network layer and
link layer.
•
Supports the simulation of
–
intserv/diffserv, Multicast, Transport,
Applications, Wireless (fixed, mobile, satellite)
•
Packet level
Model world as
Model world as
events
events
–
–
simulator has list of events ordered by simulation time
simulator has list of events ordered by simulation time
–
–
process: take next one, run it, until done
process: take next one, run it, until done
–
–
each event happens in an instant of
each event happens in an instant of
virtual (simulated)
virtual (simulated)
time
time
, but takes an arbitrary amount of
, but takes an arbitrary amount of
real
real
time
time
NS uses simple model
NS uses simple model
: single thread of control =>
: single thread of control =>
no locking or race conditions to worry about (very
no locking or race conditions to worry about (very
easy)
easy)
Discrete Event Simulation
Discrete Event Simulation
History and Status
•
REAL variant (1989)DARPA (LBL, Xerox PARC, UCB,
and USC/ISI) (1995)
•
Currently; DARPA; NSF; collaboration with researchers:
ACIRI, UCB Daedelus, CMU, Sun Microsystems, NORTEL,
Cisco
•
ns-1
•
ns-2
–
100K lines of C++
–
70K lines of OTcl
–
30K lines of test suite
–
20K lines of documentation
•
Current version is 2.28
ns-2 Programming Languages
•
NS-2 is an object oriented simulator, written in
NS-2 is an object oriented simulator, written in
C++
C++
,
,
with an
with an
OTcl
OTcl
(Object Tool Command Language)
(Object Tool Command Language)
interpreter as a front-end.
interpreter as a front-end.
•
Back-end C++
–
Defining new agents, protocols and framework.
–
Manipulations at the byte/bit levels.
–
if you have to change the behaviour of an existing C++ class in
if you have to change the behaviour of an existing C++ class in
ways that weren't anticipated
ways that weren't anticipated
•
Front-end Otcl Topologies, scenarios, simulations, …
–
Script language (easy topology modifications)
–
if you can do what you want by manipulating existing C++
if you can do what you want by manipulating existing C++
objects
objects
Why Two Languages
•
Simulator had two distinct requirements
Simulator had two distinct requirements
–
Detailed simulation of Protocol(Run-time speed)
Detailed simulation of Protocol(Run-time speed)
–
Varying parameters or configuration(Change model &
Varying parameters or configuration(Change model &
rerun)
rerun)
•
C++ is fast to run but slower to change
C++ is fast to run but slower to change
•
Otcl runs much slower but can be changed
Otcl runs much slower but can be changed
quickly
quickly
OTcl and C++: The Duality
C++
OTcl
Pure C++
objects
Pure OTcl
objects
C++/OTcl split objects
ns
Split Object:
Object created in Otcl has a corresponding object in C++.
ns Directory Structure
TK8.0 OTcl tclclTcl8.0 ns-2 nam-1
tcl
ex test
lib
examples
validation tests
C++ code
OTcl code
ns-allinone
mcast
Network Topology: Node
Network Topology: Node
n0 n1
Addr
Classifier
Port
Classifier
classifier_
dmux_
entry_
Node entry
Unicast
Node
Multicast
Classifier
classifier_
dmux_
entry_
Node entry
Multicast
Node
multiclassifier_
Classifier : Address, Multicast, Multipath, Hash
Classifier : Address, Multicast, Multipath, Hash
[...]... n1-n0 1 0 0 dst_=0.0 Agent/TCPSink Running NS-2 Program Resources • http://www.isi.edu/nsnam/ns • Tcl (Tool Command Language) – http://dev.scriptics.com/scripting • OTcl (MIT Object Tcl) – ~otcl/doc /tutorial. html (in distribution) • ns manual – Included in distribution: ~ns/doc – http://www.isi.edu/nsnam/ns/nsdocumentation.html Outline • • • • • What’s NS-2NS-2 Structures TCL(Tool Command Language) .
NS-2 Tutorial
Motivation
What’s NS-2
•
Network simulator
–
Discrete event simulator
•
It covers.
Cisco
•
ns-1
•
ns-2
–
100K lines of C++
–
70K lines of OTcl
–
30K lines of test suite
–
20K lines of documentation
•
Current version is 2.28
ns-2 Programming