Unformatted text preview:

NS Tutorial, Class 10ns-2, the network simulatorns goalsns history“ns” componentsns modelsns statusOutlinesDiscrete Event SimulationDiscrete Event Examplesns Software Structure: object orientationns Software Structure: C++ and Otclotcl and C++: The DualitySlide 14Installation and DocumentationHello WorldHello World, DeconstructedSlide 18Basic TclBasic otclBasic ns-2Creating Event SchedulerCreating NetworkComputing routesTrafficCreating Connection: UDPCreating Connection: TCPCreating Traffic: On Top of TCPCreating Traffic: On Top of UDPCreating Traffic: Trace DrivenCompare to Real WorldInserting ErrorsTracingSlide 3410b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 1NS Tutorial, Class 10CSci551: Computer NetworksSP2002 Friday SectionJohn Heidemann10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 2ns-2, the network simulator•a discrete event simulator–simple model•focused on modeling network protocols–wired, wireless, satellite–TCP, UDP, multicast, unicast–web, telnet, ftp–ad hoc routing, sensor networks–infrastructure: stats, tracing, error models, etc.10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 3ns goals•support networking research and education–protocol design, traffic studies, etc.–protocol comparison•provide a collaborative environment–freely distributed, open source•share code, protocols, models, etc.–allow easy comparision of similar protocols–increase confidence in results•more people look at models in more situations•experts develop models•multiple levels of detail in one simulator10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 4ns history•Began as REAL in 1989•ns by Floyd and McCanne at LBL•ns-2 by McCanne and the VINT project (LBL, PARC, UCB, USC/ISI)•currently maintained at USC/ISI, with input from Floyd et al.10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 5“ns” components•ns, the simulator itself•nam, the Network AniMator–visualize ns (or other) output–GUI input simple ns scenarios•pre-processing:–traffic and topology generators•post-processing:–simple trace analysis, often in Awk, Perl, or Tcl10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 6ns models•Traffic models and applications:–web, FTP, telnet, constant-bit rate, Real Audio•Transport protocols:–unicast: TCP (Reno, Vegas, etc.), UDP–multicast: SRM•Routing and queueing:–wired routing, ad hoc rtg and directed diffusion–queueing protocols: RED, drop-tail, etc.•Physical media:–wired (point-to-point, LANs), wireless (multiple propagation models), satellite10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 7ns status•platforms: basically all Unix and Windows•size: about 200k loc each C++ and Tcl, 350 page manual•user-base: >1k institutions, >10k users•releases about every 6 months, plus daily snapshots10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 8Outlines•Concepts•Essentials•Getting Started•Fundamental tcl, otcl and ns•Case Studies–Web, TCP, Routing, Queuing10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 9Discrete Event Simulation•model world as events–simulator has list of events–process: take next one, run it, until done–each event happens in an instant of virtual (simulated) time, but takes an arbitrary amount of real time•ns uses simple model: single thread of control => no locking or race conditions to worry about (very easy)10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 10Discrete Event ExamplesConsider two nodeson an Ethernet:A Bsimplequeuingmodel:t=1, A enqueues pkt on LANt=1.01, LAN dequeues pktand triggers BdetailedCSMA/CDmodel:t=1.0: A sends pkt to NICA’s NIC starts carrier senset=1.005: A’s NIC concludes cs,starts txt=1.006: B’s NIC begins reciving pktt=1.01: B’s NIC concludes pktB’s NIC passes pkt to app10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 11ns Software Structure: object orientation•Object oriented:–lots of code reuse (ex. TCP + TCP variants)•Some important objects:–NsObject: has recv() method–Connector: has target() and drop()–BiConnector: uptarget() & downtarget()10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 12ns Software Structure: C++ and Otcl•Uses two languages•C++ for packet-processing–fast to run, detailed, complete control•OTcl for control–simulation setup, configuration, occasional actions–fast to write and change•pros: trade-off running vs. writing speed, powerful/documented config language•cons: two languages to learn and debug in10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 13otcl and C++: The Duality•OTcl (object variant of Tcl) and C++ share class hierarchy•TclCL is glue library that makes it easy to share functions, variables, etc.C++otcl10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 14Outlines•Essentials•Getting Started•Fundamental tcl, otcl and ns•Case Studies–Web, TCP, Routing, Queuing10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 15Installation and Documentation•http://www.isi.edu/nsnam/ns/–download ns-allinone–includes Tcl, OTcl, TclCL, ns, nam, etc.•mailing list: [email protected]•documentation (see url above)–Marc Gries tutorial–ns manual10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 16Hello Worldsimple.tcl: set ns [new Simulator]$ns at 1 “puts \“Hello World!\””$ns at 1.5 “exit”$ns runswallow 74% ns simple.tclHello World!swallow 75%10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 17Hello World, Deconstructedset ns [new Simulator]create a simulator, put in var ns$ns at 1 “puts \“Hello World!\””schedule an event at time t=1to print HW$ns at 1.5 “exit”and exit at a later time$ns runrun time simulator10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 18Outlines•Essentials•Getting Started•Fundamental tcl, otcl and ns•Case Studies–Web, TCP, Routing, Queuing, Wireless10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 19Basic Tclvariables:set x 10puts “x is $x”functions and expressions:set y [pow x 2]set y [expr x*x]control flow:if {$x > 0} { return $x } else {return [expr -$x] }while { $x > 0 } {puts $xincr x –1}procedures:proc pow {x n} {if {$n == 1} { return $x }set part [pow x [expr $n-1]]return [expr $x*$part]}Also lists, associative arrays, etc.=> can use a real programming language to build network topologies, traffic models, etc.10b_ns: CSci551 SP2002 Friday © 2002 John Heidemann 20Basic otclClass Person# constructor:Person instproc init {age} {$self


View Full Document

UHCL CSCI 5931 - NS Tutorial

Documents in this Course
Load more
Download NS Tutorial
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view NS Tutorial and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view NS Tutorial 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?