performing rwa simulation with ns n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Performing RWA Simulation With NS PowerPoint Presentation
Download Presentation
Performing RWA Simulation With NS

Loading in 2 Seconds...

play fullscreen
1 / 37

Performing RWA Simulation With NS - PowerPoint PPT Presentation


  • 69 Views
  • Uploaded on

Performing RWA Simulation With NS. An introduction to NS & RWA simulation constructs. Outline. Part I: NS Programming Basics Object oriented mechanisms Overview of NS Simulator The Lamp Example Packet Handling in NS—from a transport protocol’s perspective

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Performing RWA Simulation With NS' - gene


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
performing rwa simulation with ns

Performing RWA Simulation With NS

An introduction to NS &

RWA simulation constructs

outline
Outline
  • Part I: NS Programming Basics
    • Object oriented mechanisms
    • Overview of NS Simulator
    • The Lamp Example
    • Packet Handling in NS—from a transport protocol’s perspective
  • Part II: Build in NS a platform for RWASimulation
    • Network Model
    • Architectural Overview
    • Internals…
what s object oriented
What’s Object Oriented…
  • Object An object is a software bundle of variables and related methods.[java.sun.com]
    • Variable => State
    • Methods => Behavior
  • OOP. A software design method that models the characteristics of abstract or real objects using classes.[java.sun.com]
why object oriented
Why Object Oriented…
  • Modularity
    • Easy for maintenance
    • Easy for code Reuse
  • Information hiding
    • Transparency
    • Security
  • Inheritance
    • Structuring and Organizing Software
object oriented programming
Object Oriented Programming

structa

Classa

member v1;member v2;method m1;method m2;

variable v1;variable v2;

Classbbase class a

member v2b;method m2b;

procedurep

Some operation on instances of struct a

ns a schematic overview1
NS – A Schematic Overview
  • C++ /OTcl Implementation
  • C++ and OTcl Interaction
  • OTcl
    • Object Implementation
    • Simulation Scripts
  • What to do?
    • For ordinary users
    • For Advanced users
an example lamp
An Example -- Lamp
  • May change ON/OFF Status
  • May change brightness
  • Status and Brightness may be monitored
from this example you will know how to
From this example,You will know how to…
  • Implement a class in C++
  • Implement a class in OTcl
  • Combine OTcl and C++ codes
  • Write simple simulation scripts
an example lamp1
An Example: Lamp
  • Interfaces:

switch: switch the ON/OFF status of the lamp object

show_status: Show the current ON/OFF status of the lamp object

brighten: make the lamp object brighter

darken: make the lamp object darker

  • Member variables

status: current status of the lamp object, {ON, OFF}

brightness: current brightness of the lamp object in integer

voltage, current, resistance: electro. character. of the lamp object

OTcl

C++

OTcl

C++

lamp implementation in c
Lamp Implementation in C++

class Lamp_C: public TclObject {

private:

real resistance, current, voltage;

int brightness;

public:

Lamp_C(real r) {resistance = r;}

void brighten(int step);

void darken(int step);

}

void Lamp_C::brighten(int step) {

resistance -= log(step); //need check here!!!

current = voltage/resistance;

brightness = C*pow (current, 2);

}

void Lamp_C::darken(int step) {

resistance +=log(step); //need check here!!!

current = voltage/resistance;

brightness = C*pow (current, 2);

}

Lamp_C mylamp = newLamp_C(50.0);

mylamp.brighten(10);

mylamp.darken(30);

lamp implementation in otcl
Lamp Implementation in OTcl

Class Lamp_TCL

Lamp_TCL set status OFF

Lamp_TCL set brightness 0

Lamp_TCL instproc switch { state } {

$self instvar status

if {$state != “”} {

set status $state

}

return $status

}

Lamp_TCL instproc show_status { } {

$self instvar status

puts “Current status is :$status”

puts “Current brightness is :$brightness”

}

C:\ns-2.1b8win\ns↲

%

% set mylamp [new Lamp_TCL]

% $mylampshow_status

% $mylampswitch ON

% $mylampshow_status

Result:

Current status is :OFF

Current brightness is : 0

Current status is :ON

Current brightness is : 0

comparing c and otcl
Comparing C++ and OTcl
  • Class Lamp_TCL
  • Lamp_TCL set status OFF
  • Lamp_TCL set brightness 0
  • Lamp_TCL instproc switch { state } {
  • #...
  • }
  • Lamp_TCL instproc show_status { } {
  • #...
  • }
  • class Lamp_C: public TclObject {
  • private:
  • real resistance, current, voltage;
  • int brightness;
  • public:
  • Lamp_C(real r) {resistance = r;}
  • void brighten(int step);
  • void darken(int step);
  • }
  • void Lamp_C::brighten(int step) {
  • // …
  • }
  • void Lamp_C::darken(int step) {
  • //…
  • }
ns otcl and c combined
NS: OTcl and C++ Combined

Static class LampClass:public TclClass

{

public:

LampClass::TclClass(“Lamp_TCL”) {}

TclObject * create(int, const char * const *)

{

return (new Lamp_C( ));

}

}class_Lamp;

Int Lamp_C::init( ){

bind(“brightness”,&brightness);

}

  • int Lamp_C::command(int ac, const char*const* av){
    • if (strcmp(av[1], “brighten") == 0){
    • int step = atoi(av[2]);
    • brighten(step);
    • return TCL_OK;
    • }
    • if (strcmp(av[1], “darken”) == 0) {
    • int step = atoi(av[2]);
    • darken(step);
    • return TCL_OK;
    • }
  • return TclObject::command(ac,av);
  • }
ns otcl and c combined1
NS: OTcl and C++ Combined
  • if (strcmp(av[1], “darken”) == 0) {
  • int step = atoi(av[2]);
  • Tcl & tcl = Tcl::instance();
  • char cmd[50],ret[10];
  • sprintf(cmd, “%s switch”, name());
  • tcl.eval(cmd);
  • if(strcmp(tcl.result(), “OFF”)){
  • return TCL_OK;
  • }
  • darken(step);
  • return TCL_OK;
  • }
ns otcl and c combined2
NS: OTcl and C++ Combined

C:\NetSim\ns-2.1b8a-win\ns↲

%

%set mylamp [new Lamp_TCL]

% $mylampshow_status

% $mylampswitch ON

% $mylampbrighten 100

% $mylampshow_status

%

Result:

Current status is :OFF

Current brightness is : 0

Current status is :ON

Current brightness is : 32

  • Use OTcl –magic of manipulating:
  • Configuration, setup and one-time stuff
  • Manipulating existing C++ objects
  • Use C++ –power of Computing:
  • Packet processing
  • Computational complex jobs
  • Anything you like !
lamp conclusion
Lamp Conclusion
  • Interfaces:

switch, show_status, brighten, darken

brighten, darken

  • Member variables

status

brightness, voltage, current, resistance

  • Implementation
    • C++/OTcl
    • OTcl Invocation in C++ : tcl.eval(...), tcl.result(...);
    • C++ Invocation in OTcl : Lamp::command(...);
    • Variable binding: bind(...);
packet handling in ns from a protocol s perspective
Packet Handling in NS:From A Protocol’s Perspective

int RWAAgent::command(int argc, const char * const * argv){

if (strcmp(argv[1],”get-connect-request”) = = 0){

Packet *pkt = allocpkt();

hdr_rwa *hdrrwa = hdr_rwa::access(pkt);

hdrrwa->msg_type = CONNECTION_REQUEST;

send(pkt,0);

}

}

>>>

packet handling in ns from a protocol s perspective1
Packet Handling in NS:From A Protocol’s Perspective

void RWAAgent::recv(Packet* pkt, Handler*){

hdr_rwa *hdrrwa = hdr_rwa::access(pkt);

int msgtype = hdrrwa->msg_type;

switch (msgtype){

case CONNECTION_REQUEST:

//process this packet

break;

}

Packet::free(pkt);

}

build in ns a platform for rwa simulation
Build in NS a platform for RWA Simulation
  • Extensions to Class Simulator
  • Extensions to Class Node
  • RWA Agents new!
  • Connection Request Generator new!
components
Components
  • DWDM Node
    • Interfaces , Fibers, Wavelengths
    • Wavelength Converter
  • RWA Agent
    • Simple Signaling(Connection Setup/Teardown)
    • Routing (Fixed, Explicit Routing)
  • Connection Request Generator
    • Arrival Rate
    • Hold Time
architectural overview
Architectural Overview

Linked_DWDM_nodes_

Linked_interfaces_

Linked_RWA_Agents_

architectural overview1
Architectural Overview

RWA Agent

DWDM Node

  • Edge Node
  • Transit Node

Connect Request Generator

RWA Peer

internals of connection request generator
Internals of Connection Request Generator
  • Descriptions
    • Base Class: TrafficGenerator
    • Functionality: generating connection request
      • Hold time …
      • Destination node…
      • Wavelength change allowed ?
      • “$agent get-connect-request $ht $dst $change_allow”
  • Configurable Parameters:
    • Mean arrival rate
    • Mean hold time
internals of rwa agent
Internals of RWA Agent
  • Descriptions:
    • Base Class: Agent
    • Functionality:
      • Packet processing
      • Connection request/setup/release
      • Route lookups
      • Change node status
  • A list of timers
    • Connection timeouts …
internals of rwa agent1
Internals of RWA Agent
  • OTcl part
    • Route lookups
    • Interfacing with Node
  • C++ Part
    • Receiving/processing/sending packets
    • Connection timeouts
structure of a rwa packet
Structure of A RWA Packet

struct hdr_rwa{

int src, dst;

int sid;

int msg_type;

int fid, lambda;

char er[MAX_HOPS*5];

int rtptr;

}

  • Message Types:
  • CONNECTION_REQUEST_MSG
  • CONNECTION_RELEASE_MSG
  • CONNECTION_CONFIRM_MSG
  • CONNECTION_BLOCKED_MSG
  • EXPLICIT_ROUTE_MSG
  • Global Session ID:
  • NODEID * CONST + local_sid …
finding rwa peers
Finding RWA Peers

Node/DWDM instproc get-rwa-agent {peer_node} {

$self instvar linked_rwa_agents_

set na [llength $linked_rwa_agents_]

for {set i 0} {$i < $na } {incr i} {

set rwa_agent [lindex $linked_rwa_agents_ $i]

if {[$rwa_agent set peer_node_] == $peer_node} {

return $rwa_agent

}

}

return -1

}

internals of dwdm node
Internals of DWDM Node
  • Descriptions
    • Base class: Node
    • Functionality
      • Management of physical resources
    • Data structures
      • Lambda_table
      • Converter_table
      • ER_routing_table
      • Connection_table
internals of dwdm node1
Internals of DWDM Node
  • OTcl part
    • Attaching RWA agents/Traffic generator
    • Interfacing with RWA
    • Physical interface mapping (objectindex)
  • C++ Part
    • A Lambda table /converter table /connection table
    • Connection query interface
    • Nodal statistics
    • Static Routes
connection table structure
struct connect_struct{

short src, dst;

int global_sid_;

short in_lambda, out_lambda;

short in_inf, out_inf;

short in_fid, out_fid;

short prevhop;

int holdtime;

int er_entry;

entry_status status;

};

Connection Table Structure

sid = NODEID * CONST + local_sid

[Prefix][local]

[Globally Unique]

to start simulation
To Start Simulation…
  • Create Network Topology
    • Create DWDM Nodes
    • Build Links between Nodes
  • Configure RWA Agents on every node
  • Install Traffic Generator on Edge Nodes
    • Configure Traffic Generators
  • Install Static Routes On Edge Nodes
  • Start Traffic and do an “$ns run”
thank you
Thank You!

Questions are welcome…