150 likes | 313 Views
Chapter 6 Links: Simple Links. Reporter: 林峰正 Date: 2002/5/14. Outline. Review Simple link example Instance Procedures for Links and SimpleLinks Connectors Object hierarchy Commands at a glance. Review. Chapter 5 : Described how to create the nodes in ns
E N D
Chapter 6 Links: Simple Links Reporter: 林峰正 Date: 2002/5/14
Outline • Review • Simple link example • Instance Procedures for Links and SimpleLinks • Connectors • Object hierarchy • Commands at a glance
Review • Chapter 5 : Described how to create the nodes in ns • Chapter 6 : Describes how to create the links to connect the nodes and complete the topology
Simple Links Example • Nodes are composed of classifiers. • Simple link is built up from a sequence of connectors. • Simplex link Example: • Set ns [new Simulator] • $ns simplex-link <node0> <node1> <bandwidth> <delay> <queue type> • #Create links between the nodes Example • $ns simplex-link $n0 $n2 2Mb 10ms DropTail • $ns duplex-link $n1 $n2 2Mb 10ms DropTail • $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
Instance Procedures for Links and SimpleLinks • Link procedures : • The class Link is implemented in Otcl. • The Otcl SimpleLink class use the C++ LinkDelay class to simulate packet delivery delays. • Instance:p.62 • head{} – return the handle for head_ • queue{} – return the handle for queue_ • Link{} , up{}, down{}, up?{}, all-connectors{}, cost{}, cost?{} .. etc.
Instance Procedures for Links and SimpleLinks (cont.) • SimpleLink procedures : simple point-to-point link with an associated queue and delay. • It’s derived from the base Otcl class Link. • Instance: p.62 • Class SinpleLink –superclass Link • SimpleLink instproc init {src dst bw*delay q{lltype “DelayLink”}} • { $self next $src $dst • $self instvar link_ queue_ head_ toNode_ ttl • …. • }
Connector • A connector will receive a packet, perform some function, and deliver the packet to its neighbor, or drop the packet • Each connector performs a different function • - networkinterface (chapter26) • - DynaLink(chapter27) • - DelayLink(chapter8) • - Queues(chapter7) • - TTLChecker
Object hierarchy • The base class used to present links is called Link. • Methods for this class are listed in the next section. • Derived from the base class are given as follow: • -SimpleLink object • -DelayLink object
Object hierarchy (cont.) • SimpleLink object • - $simplelink enable-mcast <src> <dst> • - $simplelink trace <ns> <file> <optional:op> • - $simplelink nam-trace <ns> <file> • - $simplelink trace-dynamics <ns> <file> <optional:op>
Object hierarchy (cont.) • SimpleLink object • - $simplelink init-motor <ns> <qtrace> <sampleInterval> • - $simplelink attach-monitors <insnoop> <outsnoop> <dropsnoop> <qmon> • - $simplelink dynamic • - $simplelink errormodule <args> • - $simplelink insert-linkloss <args>
Object hierarchy (cont.) • DelayLink Object – determine the amount of time required for a packet to traverse a link. • Configuration Parametets are: • - bandwith_ Link bandwidth in bits per second • - delay_ Link propagation delay in seconds.
Commands at a glance • $ns_ simplex-link <node1> <node2> <bw> <delay> <qtype> <args> • $ns_ duplex-link <node1> <node2> <bw> <delay> <qtype> <args> • $ns_ duplex-intserv-link <n1> <n2> <bw> <dly> <sched><signal> <adc><args> • $ns_ simplex-link-op <n1> <n2> <op> <args> • $ns_ duplex-link-op <n1> <n2> <op> <args>
Commands at a glance (cont.) • $ns_ link-lossmodel <lossobj> <from> <to> • $ns_ lossmodel <lossobj> <from> <to>
Link-related procedures • $ns_ register-nam-linkconfig <link> • $ns_ remove-nam-linkconfig <id1> <id2> • $link head • $link add-to-head <connector> • $link link • $link queue • $link cost <c>
Link-related procedures (cont.) • $link cost? • $link if-label? • $link up • $link down • $link up? • $link all-connectors op