NS2 Chapter 5. Node A node is an OTcl class, but most of its components are TclObjects. All node contain at least the following components An address.

Slides:



Advertisements
Similar presentations
1 ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides)
Advertisements

1 NS Fundamentals (contd..) Padma Haldar USC/ISI.
Network Simulation One tool to simulation network protocols for the Internet is the network simulator (NS) The simulation environment needs to be set-
NS-2 Shahin Shayandeh December 2004 Session 2. Ns programming  Create the event scheduler  Turn on tracing  Create network  Setup routing  Insert.
Ns-2 Tutorial Exercise (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Adopted from Nicolas’s slides Jianping Wang,
How to Add a New Protocol in NS2 Xu Leiming CSCW Lab. at CS Dept., Tsinghua Univ. June 1, 2001.
Introduction to NS. Information Main website Documentation, mailing list archive, tutorial Location of Source codes –C++ files.
Chapter 9: Access Control Lists
Packet Switching COM1337/3501 Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie, Morgan Kaufmann Chapter 3.
1 Chapter 5 Nodes and Packet Forward Reporters:m 林青 m 曾慶昌.
1 Chapter 3 TCP and IP. Chapter 3 TCP and IP 2 Introduction Transmission Control Protocol (TCP) Transmission Control Protocol (TCP) User Datagram Protocol.
Copyright: RSVP The ReSerVation Protocol by Sujay koduri.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2003) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
COS 420 Day 18. Agenda Group Project Discussion Program Requirements Rejected Resubmit by Friday Noon Protocol Definition Due April 12 Assignment 3 Due.
CSCI 4550/8556 Computer Networks Comer, Chapter 19: Binding Protocol Addresses (ARP)
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Delivery, Forwarding, and Routing
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
COE 342: Data & Computer Communications (T042) Dr. Marwan Abu-Amara Chapter 2: Protocols and Architecture.
Data Structures Using C++ 2E
Connecting LANs, Backbone Networks, and Virtual LANs
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
1 Internet Protocol: Forwarding IP Datagrams Chapter 7.
LAN Overview (part 2) CSE 3213 Fall April 2017.
Chapter 4: Managing LAN Traffic
CEN Network Fundamentals Chapter 19 Binding Protocol Addresses (ARP) To insert your company logo on this slide From the Insert Menu Select “Picture”
Integrated Services (RFC 1633) r Architecture for providing QoS guarantees to individual application sessions r Call setup: a session requiring QoS guarantees.
22.1 Chapter 22 Network Layer: Delivery, Forwarding, and Routing Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Protocols and the TCP/IP Suite
ATM SWITCHING. SWITCHING A Switch is a network element that transfer packet from Input port to output port. A Switch is a network element that transfer.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 9: Access Control Lists Routing & Switching.
10/8/2015CST Computer Networks1 IP Routing CST 415.
Chapter 22 Network Layer: Delivery, Forwarding, and Routing Part 5 Multicasting protocol.
1 Network Simulator Tutorial. 2 Network Simulation * Motivation: Learn fundamentals of evaluating network performance via simulation Overview: fundamentals.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Data Communications and Networking Chapter 11 Routing in Switched Networks References: Book Chapters 12.1, 12.3 Data and Computer Communications, 8th edition.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Institute of Technology Sligo - Dept of Computing Sem 2 Chapter 12 Routing Protocols.
The Design and Implementation of Firewall, NAT, Traffic Shaper on FreeBSD.
NS2 Chapter 5.  A node is an OTcl class, but most of its components are TclObjects.  All node contain at least the following components ◦ An address.
1 Introduction to NS-2 r Tutorial overview of NS m Create basic NS simulation r Walk-through a simple example m Model specification m Execution and trace.
Routing and Routing Protocols
STORE AND FORWARD & CUT THROUGH FORWARD Switches can use different forwarding techniques— two of these are store-and-forward switching and cut-through.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Connecting Devices CORPORATE INSTITUTE OF SCIENCE & TECHNOLOGY, BHOPAL Department of Electronics and.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Switching Topic 2 VLANs.
The Creation of NS2 Simulated Environment ( 1 ) LI Chengbo
Ad Hoc On-Demand Distance Vector Routing (AODV) ietf
CHAPTER 3 Router CLI Command Line Interface. Router User Interface User and privileged modes User mode --Typical tasks include those that check the router.
Ch7: Link and Buffer Management. 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier:
J. Halpern (Ericsson), C. Pignataro (Cisco)
Sem 2 v2 Chapter 12: Routing. Routers can be configured to use one or more IP routing protocols. Two of these IP routing protocols are RIP and IGRP. After.
Virtual Local Area Networks In Security By Mark Reed.
ECE 544 Protocol Design Project 2016 Kiran Jatty Lasya Nandamuri Varun Vinnakota.
(Modified from Polly Huang’s and last year’s original)
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
NS2_Trace and Monitoring support 報告者:羅士捷
Introduction to ns-2: “The” Network Simulator
Chapter 4 Data Link Layer Switching
Chapter 6 Delivery & Forwarding of IP Packets
BOOTP and DHCP Objectives
CCNA 2 v3.1 Module 6 Routing and Routing Protocols
Chapter 4: Access Control Lists (ACLs)
ECE 544 Protocol Design Project 2016
(How the routers’ tables are filled in)
Setting Up Firewall using Netfilter and Iptables
Delivery, Forwarding, and Routing of IP Packets
Chapter 10 IGMP Prof. Choong Seon HONG.
Delivery, Forwarding, and Routing of IP Packets
Ch 17 - Binding Protocol Addresses
Presentation transcript:

NS2 Chapter 5

Node A node is an OTcl class, but most of its components are TclObjects. All node contain at least the following components An address or an id (id_) A list of neighbors (neighbor_) A list of agents (agent_) A node type identifier (nodetype_) A routing module

Figure 5.1 : Structure of a Unicast Node

Figure 5.2 : Internal Structure of a Multicast Node

Node config Control functions Address and port number management, unicast routing functions Agent management Adding neighbors

Control functions $node entry is the first element which will handle packets arriving at that node $node reset will reset all agents at the node

Address & Port management $node id returns the node number $node agent [port] returns the handle of the agent at the specified port alloc-port returns the next available port number add-route and add-routes, are used by unicast routing to add routes to populate the classifier_ delete-routes{} takes the id, a list of TclObjects, and a reference to the simulator’s nullagent

Address & Port management init-routing{} sets the instance variable multiPath_ to be equal to the class variable of the same name intf-changed{} is invoked by the network dynamics code if a link incident on the node changes state

Agent management Procedure attach{} will add the agent to its list of agents_ detach{} will remove the agent from agents_

Tracking neighbors Add-neighbor{} adds a neighbor Neighbors{} returns this list

Node config interface Simulator::node-config{} accommodates flexible and modular construction of different node definitions within the same base Node class $ns_ node-config -adhocRouting dsdv $ns_ node-config -reset The config command can be broken down into separate lines $ns_ node-config -addressingType hier $ns_ node-config -macTrace ON

Table 5.1: Available options for node configuration

5.4.1 Address Classifiers Multicast Classifiers Multipath Classifier hash Classifier Replicator

Classifier When a node receives a packet, classifier examines the packet’s fields, usually its destination address, and on occasion, its source address A classifier provides a way to match a packet against some logical criteria and retrieve a reference to another simulation object based on the match results

class Classifier class Classifier : public NsObject { public: ~Classifier(); void recv(Packet*, Handler* h = 0); protected: Classifier(); void install(int slot, NsObject*); void clear(int slot); virtual int command(int argc, const char*const* argv); virtual int classify(Packet *const) = 0; void alloc(int); NsObject** slot_; /* table that maps slot number to a NsObject */ int nslot_; int maxslot_; };

recv() & classify() When a classifier recv()’s a packet, it hands it to the classify() method. This is defined differently in each type of classifier derived from the base class The usual format is for the classify() method to determine and return a slot index into the table of slots

Address classifiers 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 The slot number is returned from the classify() method

Multicast classifiers The multicast classifier classifies packets according to both source and destination (group) addresses It maintains a (chained hash) table mapping source/group pairs to slot numbers

Multipath classifiers This object is devised 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 This object does not look at any field in the packet. With every succeeding packet, it simply returns the next filled slot in round robin fashion

Hash classifier This object is used to classify a packet as a member of a particular flow Hash classifiers use a hash table internally to assign packets to flows

Replicator Replicator does not use the classify function Simply uses the classifier as a table of n slots; it overloads the recv() method to produce n copies of a packet, that are delivered to all n objects referenced in the table Replicator replicates a packet, one for each entry in its table, and delivers the copies to each of the nodes listed in the table. The last entry in the table gets the “original” packet

n0n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ Node entry Unicast Node Multicast Classifier classifier_ dmux_ entry_ Node entry Multicast Node multiclassifier_ Node – Unicast vs Multicast

5.5.1 Routing Module Node Interface

NS routing function blocks Routing agent Exchange routing packet with neighbors Routing logic Uses the information gathered by routing agents (or the global topology database in the case of static routing) to perform the actual route computation Classifiers Use the computed routing table to perform packet forwarding

Figure 5.3: Interaction among node, routing, mobile

Routing module of own Declare the C++ part of your routing module Decide which one you’ll inherit, which one you’ll override, and put thanter faces of your own module.em in OTcl

Table 5.2: Available routing modules

Commands Common and useful $ns_ node [ ] $ns_ node-config - $node id $node node-addr $node reset $node agent $node entry $node attach $node detach $node neighbors $node add-neighbor

NS2 Chapter 6

Link syntax set ns [new Simulator] $ns simplex-link [node0] [node1] [bandwidth] [delay] [queue_type]

Figure 6.1: Composite Construction of a Unidirectional Link

Instance variables head_ Entry point to the link, it points to the first object in the link queue_ Reference to the main queue element of the link. Simple links usually have one queue per link. Other more complex types of links may have multiple queue elements in the link link_ A reference to the element that actually models the link, in terms of the delay and bandwidth characteristics of the link ttl_ Reference to the element that manipulates the ttl in every packet

Instance variables drophead_ Reference to an object that is the head of a queue of elements that process link drops enqT_ Reference to the element that traces packets entering queue_ deqT_ Reference to the element that traces packets leaving queue_ drpT_ Reference to the element that traces packets dropped from queue_ rcvT_ Reference to the element that traces packets received by the next node

Link if the user enable tracing multiple times on the link, these instance variables will only store a reference to the last elements inserted The instance procedure duplex-link{} constructs a bi- directional link from two simplex links

n0n1 enqT_queue_deqT_ drophead_ drpT_ link_ttl_ n1 entry_ head_ tracing simplex link duplex link Duplex link

Routing n0n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ Node entry 0 1 enqT_queue_deqT_ drophead_drpT_ link_ttl_ n1 entry _ head_

Routing n0n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 0 1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 0 Link n0-n1 Link n1-n0

Packet Flow 0 1 n0n1 Addr Classifier Port Classifier entry_ 0 Agent/TCP Addr Classifier Port Classifier entry_ 1 0 Link n0-n1 Link n1-n0 0 Agent/TCPSink dst_=1.0 dst_=0.0 Application/FTP

Link procedures head{} returns the handle for head_ queue{} returns the handle for queue_ link{} returns the handle for the delay element, link_ up{} set link status to “up” in the dynamics_ element. Also, writes out a trace line to each filespecified through the procedure trace-dynamics{}

Link procedures down{} As with up{}, set link status to “down” in the dynamics_ element. Also, writes out a trace line to each file specified through the procedure trace-dynamics{} up?{} returns status of the link. Status is “up” or “down”; status is “up” if link dynamics is not enabled all-connectors{} Apply specified operation to all connectors on the link.p An example of such usage is link all-connectors reset. cost{} set link cost to value specified. cost?{} returns the cost of the link. Default cost of link is 1, if no cost has been specified earlier

SimpleLink procedures The Otcl class SimpleLink implements a simple point- to-point link with an associated queue and delay Notice that when a SimpleLink object is created, new Delay/Link and TTLChecker objects are also created. Note also that, the Queue object must have already been created

Connectors A connector will receive a packet, perform some function, and deliver the packet to its neighbor, or drop the packet Connectors, unlike classifiers, only generate data for one recipient; either the packet is delivered to the target_ neighbor, or it is sent to he drop-target_

Types of connectors Networkinterface labels packets with incoming interface identifier DynaLink Object that gates traffic depending on whether the link is up or down DelayLink Object that models the link’s delay and bandwidth characteristics Queues model the output buffers attached to a link in a “real” router in a network TTLChecker decrement the ttl in each packet that it receives

The base class used to represent links is called Link SimpleLink Object A SimpleLink object is used to represent a simple unidirectional link DelayLink Object The DelayLink Objects determine the amount of time required for a packet to traverse a link. This is defined to be size/bw + delay where size is the packet size, bw is the link bandwidth and delay is the link propagation delay

SimpleLink Object $simplelink enable-mcast This turns on multicast for the link by creating an incoming network interface for the destination and adds an outgoing interface for the source. $simplelink trace Build trace objects for this link and update object linkage. If op is specified as "nam" create nam trace files. $simplelink nam-trace Sets up nam tracing in the link. $simplelink trace-dynamics This sets up tracing specially for dynamic links. allows setting up of nam tracing as well

SimpleLink Object $simplelink init-monitor Insert objects that allow us to monitor the queue size of this link. Return the name of the object that can be queried to determine the average queue size. $simplelink attach-monitors This is similar to init-monitor, but allows for specification of more of the items. $simplelink dynamic Sets up the dynamic flag for this link. $simplelink errormodule Inserts an error module before the queue. $simpleilnk insert-linkloss Inserts the error module after the queue

Commands $ns_ simplex-link This command creates an unidirectional link between node1 and node2 with specified bandwidth (BW) and delay characteristics. The link uses a queue type of and depending on the queue type different arguments are passed through $ns_ duplex-link This creates a bi-directional link between node1 and node2. This procedure essentially creates a duplex-link from two simplex links, one from node1 to node2 and the other from node2 to node1

Commands $ns_ duplex-intserv-link This creates a duplex-link between n1 and n2 with queue type of intserv, with specified BW and delay. This type of queue implements a scheduler with two level services priority. The type of intserv queue is given by, with admission control unit type of and signal module of type

Commands $ns_ simplex-link-op This is used to set attributes for a simplex link. The attributes may be the orientation, color, label, or queue- position. $ns_ duplex-link-op This command is used to set link attributes

Commands $ns_ link-lossmodel This function generates losses (using the loss model inserted in the link between node and node) in the link that can be visualized by nam. $ns_ lossmodel This is used to insert a loss module in regular links

Procedures $ns_ register-nam-linkconfig This is an internal procedure used by "$link orient" to register/update the order in which links should be created in nam $ns_ remove-nam-linkconfig This procedure is used to remove any duplicate links (duplicate links may be created by GT-ITM topology generator). $link head Returns the instance variable head_ for the link. The head_ is the entry pont to the link and it points to the first object in the link $link add-to-head This allows the object to be now pointed by the head_ element in the link, i.e, now becomes the first object in the link

Procedures $link link Returns the instance variable link_. The link_ is the element in the link that actually models the link in terms of delay and bandwidth characteristics of the link $link queue Returns the instance variable queue_. queue_ is queue element in the link. There may be one or more queue elements in a particular link $link cost This sets a link cost of. $link cost? Returns the cost value for the link. Default cost of link is set to 1. $link if-label? Returns the network interfaces associated with the link (for multicast routing)

Procedures $link up This sets the link status to "up". This command is a part of network dynamics support in ns. $link down Similar to up, this command marks the link status as "down". $link up? Returns the link status. The status is always "up" as default, if link dynamics is not enabled. $link all-connectors op This command applies the specified operation to all connectors in the link. Like, $link all-connectors reset or $link all- connectors isDynamic $link install-error This installs an error module after the link_ element