1 / 37

Performing RWA Simulation With NS

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

gene
Download Presentation

Performing RWA Simulation With NS

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Performing RWA Simulation With NS An introduction to NS & RWA simulation constructs

  2. 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…

  3. 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]

  4. Why Object Oriented… • Modularity • Easy for maintenance • Easy for code Reuse • Information hiding • Transparency • Security • Inheritance • Structuring and Organizing Software

  5. 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

  6. C++Compiled Hierarchy OTclInterpreted Hierarchy NS – A Schematic Overview

  7. 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

  8. An Example -- Lamp • May change ON/OFF Status • May change brightness • Status and Brightness may be monitored

  9. 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

  10. 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++

  11. 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); …

  12. 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

  13. 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) { • //… • }

  14. 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); • }

  15. 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; • }

  16. 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 !

  17. 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(...);

  18. 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); } … } >>>

  19. 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); }

  20. Build in NS a platform for RWA Simulation • Extensions to Class Simulator • Extensions to Class Node • RWA Agents new! • Connection Request Generator new!

  21. Network Model

  22. 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

  23. Architectural Overview Linked_DWDM_nodes_ Linked_interfaces_ Linked_RWA_Agents_

  24. Architectural Overview RWA Agent DWDM Node • Edge Node • Transit Node Connect Request Generator RWA Peer

  25. 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

  26. 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 …

  27. Internals of RWA Agent • OTcl part • Route lookups • Interfacing with Node • C++ Part • Receiving/processing/sending packets • Connection timeouts

  28. 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 …

  29. Message Processing In RWA Agents

  30. 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 }

  31. Internals of DWDM Node • Descriptions • Base class: Node • Functionality • Management of physical resources • Data structures • Lambda_table • Converter_table • ER_routing_table • Connection_table

  32. 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

  33. 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]

  34. Connection Initiation and confirmation on Nodes

  35. Connection Request Processing on Nodes

  36. 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”

  37. Thank You! Questions are welcome…

More Related