Chapter 5 Nodes and Packet Forward Reporters m

  • Slides: 31
Download presentation
Chapter 5 Nodes and Packet Forward Reporters: m 9056001 m 9056005 林青 曾慶昌 1

Chapter 5 Nodes and Packet Forward Reporters: m 9056001 m 9056005 林青 曾慶昌 1

Outline n n n 5. 1 Node Basics 5. 2 Node Methodes: Configuring the

Outline n n n 5. 1 Node Basics 5. 2 Node Methodes: Configuring the Node 5. 3 Node Configuration Interface 5. 4 The Classifier 5. 5 Routing Module and Classifier Organization 5. 6 Commands at glance 2

5. 1 Node Basics n The basic primitive for creating a node: n n

5. 1 Node Basics n The basic primitive for creating a node: n n This simple structure consists of two Tcl. Objects: n n set ns [new Simulator] $ns node an address classifer(classifer_) and a port classifier (dmux_) All nodes contain at least the following components: n n n an address or id_ (initial value 0) a list of neighbors (neighbor_) a list of agents (agent_) a node type identifier (nodetype_) a routing module 3

5. 1 Structure of a Unicast Node 4

5. 1 Structure of a Unicast Node 4

5. 1 Structure of a Unicast Node(Cont. ) n n Nodes in ns are

5. 1 Structure of a Unicast Node(Cont. ) n n Nodes in ns are constructed for unicast simulations. The simulation should be created with an option “multicast on” n n set ns [new Simulator -multicast on] The highest bit of the address indicates whether the particular address is a multicast address or an unicast address. n the bit is 0, the address represents a unicast address 5

5. 1 Internal Structure of a Multicast Node 6

5. 1 Internal Structure of a Multicast Node 6

5. 2 Node Methods: Configuring the Node n Procedures to configure an individual node

5. 2 Node Methods: Configuring the Node n Procedures to configure an individual node can be classified into: n n Control functions Address and Port number management, unicast routing functions Agent management Adding neighbors 7

5. 2 Control functions n n $node entry returns the entry point for a

5. 2 Control functions n n $node entry returns the entry point for a node. The Node instance variable, entry_, stores the reference this element. n Unicast nodes(classifier_) n n this is the address classifier that looks at the higher bits of the destination address. Multicast nodes(switch_) n the entry point is the switch_ which looks at the first bit to decide whether it should forward the packet to the unicast classifier, or the multicast classifier as appropriate. 8

5. 2 Address and Port number management n n n Procedure $node id returns

5. 2 Address and Port number management n n n Procedure $node id returns the node number of the node. Procedure $node agent (port) returns the handle of the agent at the specified port. Procedure alloc-port returns the next available port number. 9

5. 2 Address and Port number management(Cont. ) n Procedures, add-route and add-routes, are

5. 2 Address and Port number management(Cont. ) n Procedures, add-route and add-routes, are used by unicast routing to add routes to populate the classifier_ n n $node add-route <destination id> <Tcl. Object> $node add-routes <destination id> <Tcl. Object> : used to add multiple routes to the same destination that must be used simultaneously in round robin manner to spread the bandwidth. n delete-routes{} 10

5. 2 Agent management n Given an <agent>, the procedure attach{} n n n

5. 2 Agent management n Given an <agent>, the procedure attach{} n n n Add the agent to its list of agents_ Assign a port number the agent Set its source address, the target of the agent to be its entry{}, Add a pointer to the port demultiplexer at the node (dmux_) to the agent at the corresponding slot in the dmux_ classifier. detach{} neighbor_: Each node keeps a list of its adjacent neighbors in its instance variable. n The procedure add-neighbor 11

5. 3 Node Configuration Interface n Simulator: : node-config{} accommodates flexible and modular construction

5. 3 Node Configuration Interface n Simulator: : node-config{} accommodates flexible and modular construction of different node definitions within the same base Node class. n n For instance, to create a mobile node capable of wireless communication, $ns node-config -adhoc. Routing dsdv 12

5. 3 Node Configuration Interface(Cont. ) n The node configuration interface consists of two

5. 3 Node Configuration Interface(Cont. ) n The node configuration interface consists of two parts. n n n Node configuration, Actually creates nodes of the specified type. EX: node-configuration for a wireless, mobile node that runs AODV as its adhoc routing protocol in a hierarchicaltopology would be as shown below. 13

5. 3 Node Configuration Interface(Cont. ) 14

5. 3 Node Configuration Interface(Cont. ) 14

5. 3 Node Configuration Interface(Cont. ) n The config command can be broken down

5. 3 Node Configuration Interface(Cont. ) n The config command can be broken down into separate lines like n n $ns_ node-config -addressing. Type hier $ns_ node-config -mac. Trace ON $ns_ node-config –reset: it can be used to reset all node-config parameters to their default value 15

5. 4 The Classifier n n n It should then map the values to

5. 4 The Classifier n n n It should then map the values to an outgoing interface object that is the next downstream recipient of this packet. In ns, this task is performed by a simple classifier object. The job of a classifier : n n To determine the slot number associated with a received packet and forward that packet to the object referenced by that particular slot. The C++ class Classifier provides a base class. 16

5. 4 The Classifier(Cont. ) n The command() method provides the following instproc-likes to

5. 4 The Classifier(Cont. ) n The command() method provides the following instproc-likes to the interpreter: n n clear{<slot>}: clears the entry in a particular slot. install. Next{<object> }: installs the object in the next available slot, and returns the slot number. slot{<index>}: returns the object stored in the specified slot. install{<index>, <object>}: installs the specified object at the slot index. 17

5. 4. 1 Address Classifiers n n n An address classifier is used in

5. 4. 1 Address Classifiers n n n An address classifier is used in supporting unicast packet forwarding. It applies a bitwise shift and mask operation to a packet’s destination address to produce a slot number. It returns some number of bits from the packet’s dst_ field as the slot number used in the Classifier: : recv() method. 18

5. 4. 2 Multicast Classifier n n n The Multicast classifier classifies packet accroding

5. 4. 2 Multicast Classifier n n n The Multicast classifier classifies packet accroding to both source an destination(group) address. When a packet arrives containing a source. group unknown to the classifier, it invokes an Otcl procedure Node : : new-group{} to add an entry to its table. This Otcl procedure may use the method set-hash to add new (source, group, slot) 3 -tuples to the classifier’s table. 19

5. 4. 3 Multipath Classifier n This object is to support equal cost multipath

5. 4. 3 Multipath Classifier n This object is to support equal cost multipath forwarding, where the node has multiple equal cost routes to the same destination, and would like to use all of them simultaneously. 20

5. 4. 4 Hash Classifier n n This object is used to classify a

5. 4. 4 Hash Classifier n n This object is used to classify a packet as a member of a particular flow. As the name indicates, hash classifier use a hash table internally to assign packets to flow. Packets may be assigned to flow based on flow ID, destination address, source/destination address, or the combination of source/destination plus flow ID. 21

Hash Classifier(Cont. ) n n n The methods for a hash classifier are as

Hash Classifier(Cont. ) n n n The methods for a hash classifier are as follows: $hashcl set-hash buck src dst fid slot $hashcl lookup buck src dst fid $hashcl del-hash src dst fid $hashcl resize nbuck 22

5. 4. 5 Replicator n In multicast delivery, the packet must be copied once

5. 4. 5 Replicator n In multicast delivery, the packet must be copied once for each link leading to node subscribed to G minus one. Production of additional copies of the packet is performed by a Replicator class. 23

5. 5 Routing Module and Classifier Organization n n The base node needs to

5. 5 Routing Module and Classifier Organization n n The base node needs to define a set of interfaces for classifier access and organization. These interfaces should 1. allow individual routing modules that implement their own classifier to insert their classifiers into the node. 2. allow route computation block to populate routes to classifiers in all routing modules that need this information. 3. provide a single point of management for existing routing modules 24

5. 5. 1 Routing Module n n In general, every routing implementation in ns

5. 5. 1 Routing Module n n In general, every routing implementation in ns consists of three function block. 1. Routing agent exchange routing packet with neighbors. 2. Route logic uses the information gathered by routing agent to perform the actual route computation. 3. Classifiers sit inside a Node. They use the computed routing table to perform packet forwarding. 25

5. 5. 1 Routing Module(Cont. ) n Interaction among node, routing module, and routing.

5. 5. 1 Routing Module(Cont. ) n Interaction among node, routing module, and routing. 26

5. 5. 1 Routing Module(Cont. ) Module Name Functionality Rt. Module/Base Interface to unicast

5. 5. 1 Routing Module(Cont. ) Module Name Functionality Rt. Module/Base Interface to unicast routing protocols. Provide basic functionality to ass/delete route and attach/detach agnet. Rt. Module/Mcast Interface to multicast routing protocols. Its only purpose is establishes multicast classifiers. All other multicast functionalities are implemented as instprocs of Node. The should be converted in the future. Rt. Module/Hierarchical routing. It’s a wrapper for management hierarchical classifiers and route installation. Can be combined with other routing protocols. E. g: ad hoc routing. Rt. Module/Manual routing. Rt. Module/VC Uses virtual classifier instead of vanilla classifier. Rt. Module/MPLS Implement MPLS functionality. This is the only existing module that is completely self contained and does not pollute the Node namespace. 27

5. 5. 2 Node Interface n n n To connect to the Above interface

5. 5. 2 Node Interface n n n To connect to the Above interface of routing module, a node provides a similar set of interface. In order to know which module to reister during creation, the Node class keeps a list of modules as a class variable. Node : : enable-module{[name]} Node : : disable-module{[name]} Node : : list-module{} Node : : get-module{[name]} To allow routing modules register their interest of routing update, a node object provide the following instproc. Node : : route-notify{module} Node : : unreg-port-notify{module} 28

5. 5. 2 Node Interface(Cont. ) n n Node provides the following instproc to

5. 5. 2 Node Interface(Cont. ) n n Node provides the following instproc to manipulate address and port classifiers: Node : : insert-entry{module, clsfr, hook} Node : : install-demux{dmux, port} 29

Commands at a glance n n n Following is a list of command used

Commands at a glance n n n Following is a list of command used in simulation scripts: $ns_node [<hier_addr>] $ns_node_config -<config-parameter> <optional-val> $node id $node-addr $node agent <port_num> $node entry $node attach <agent> <optional: port_num> $node detach <agent><null_agent> $node neighbors $node add-neighbor <neighbor_node> 30

5. 6 Commands at a glance(Cont. ) n n Following is a list of

5. 6 Commands at a glance(Cont. ) n n Following is a list of internal node methods: $node add-route <destination_id> <target> $node alloc-port <null_agent> $node incr-rtgtable-size 31