Sunday, March 21, 2010

Classifiers and Routing Modules: Configuration

Note: This is a detailed note for the book, Introduction to Network Simulator NS2. You may have to read the book for better understanding.

Introduction
This post is a sequel of the previous post, which demonstrated the relationship of classifiers, routing modules, and nodes: What are they, their purposes, and their relationship.
Great! Now that you know the relationship of classifiers, routing modules, and nodes. Let see how NS2 actually do it in Tcl! 


A Sample Configuration
A sample configuration of routing modules and classifiers is illustrated below:

In this post, I will show you how these complex structure is created.

Configuring of Routing Modules and Classifiers
In the book, I show the step-by-step process when $ns node is invoked. Within the statement $ns node, a default classifier is created and associated with a routing module. The resulting configuration is similar to the above figure. In this post, I will focus on how the above figure is created.

Main 7 Steps
Here are the key steps to put a classifier into a node:

1. Create a node (e.g., set n [$ns node])
2. Create a classifier (e.g., set c1 [new Classifier/Hash/Dst 32])
3. Create a routing module (e.g., set rm1 [new RtModule/Base])
4. Invoke one of the two following instprocs to insert classifiers (e.g., $n insert-entry $c $rm)

Node instproc insert-entry { module clsfr {hook ""} } { ... }
Node instproc install-entry { module clsfr {hook ""} } { ... }

These two instprocs insert a classifier "clsfr" into the node and associated it to the routing modules "module". The details of these two instprocs can be found in Chapter 6 of the book.

Inserting More Classifier
Let say you would like to insert another classifier c0 in front of c1. You will need a routing module rm0 associated with c0. Suppose further that the classifier c1 will be connected to the "slot_" number 777 of the classifier c0. Then, you would do the following

5. Create a classifier (e.g., set c0 [new Classifier/Hash/Dst 32])
6. Create a routing module (e.g., set rm0 [new RtModule/Base])
7. Invoke one of the two following instprocs to insert classifiers (e.g., $n insert-entry $c0 $rm0 777)

For more information about classifiers and slot_, please read chapter 6 of the book.

Note on inserting classifier

Class Node provides limited instprocs to insert classifiers. A new classifier must be inserted at the first position only. If you would like to create a chain of classifier into a node. You should begin doing so with the last classifier, and proceed in a reverse order.

Final Note of this Post
The above is the simple demonstration of how to connect classifiers and associated them with routing modules. However, NS2 does not do it this way. In the next post, I will show you how NS2 do it.

---------------------------------------------------------------------------------------------------------
For more information about classifiers and routing module, see Chapter 6 in the following book from Springer:
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. Buy it now from

You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

No comments: