You are on page 1of 23

1502 Debugging Simulation Models -- Introduction

The following exercises are simple, hands-on examples of some of the subjects discussed during the lecture. If you need help If you get stuck during a lab, raise your hand, and one of the teaching assistants (TAs will help you. Also, there is a set of models with all of the lab steps completed that you may inspect. These files end in the suffix !"ref# (reference .

Lab 1: Using the DES log to fix a configuration problem


Purpose of the exercise This lab exercise introduces a configuration error into a scenario. $e will in%estigate the resulting log messages, and use the information to do a detailed in%estigation into the configuration problem. O er ie! of model architecture This scenario doesn&t ha%e any custom code in it---all the underlying models are part of the '()*T +odel ,ibrary. A simple client-ser%er topology has been configured. Application re-uests are sent from the client to the ser%er, and the ser%er sends responses. .ut there is something wrong with this model/ it doesn&t produce any application results0 The following steps will guide you through the debugging process. Run the simulation 1. 2ouble-click the +odeler icon on your desktop. +odeler opens. 3. 'pen the !lab1# project. a. 4elect File 5 Open from the menu. b. 2ouble-click the !lab1# project to open it. 6. 7lick the !running man# icon. The Configure/Run DES window opens. 8. 7lick on the Run button to start the simulation. The Simulation Sequence window opens. After a moment, the simulation completes. 9. )ote that the 2*4 ,og (4imulation ,og contains entries (see :ig. 1 . ;. 7lick the Close button to close the Simulation Sequence window.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ * o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 1: The simulation completes without errors, ut the DES !og contains man" messages

<. =iew the results. a. 4elect the DES > Results > #iew Statistics menu item. The #iew Results window opens with the 2iscrete *%ent ?raphs tab displayed. b. 7lick on the @eport *mail > ?lobal 4tatistics > *mail > Traffic @ecei%ed statistic in the tree%iew, then click the Show button in the lower right corner. An analysis panel appears. c. )ote that there was no email traffic recei%ed (see :ig. 3 . d. $hen you are ready, close the analysis panel by clicking on the $ button in the upper righthand corner. $hen prompted, click on the Delete button to permanently delete this analysis panel. e. $hen you are ready, close the =iew @esults window by clicking on the Close button.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ ! o+ !,

1502 Debugging Simulation Models -- Introduction

Figure %: &ne'pecte( results)our first in(ication that something is wrong*

View the DES Log messages A. 'pen the 2*4 ,og to see if it helps explain the results. There are two ways to open the 2*4 ,og. 4elect DES > Open DES !og from the menu. The !og +rowser opens. @ight-click on a blank area in the project workspace and select Open DES !og (see :ig. 6 . The !og +rowser opens.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ , o+ !,

1502 Debugging Simulation Models -- Introduction

Figure ,: Opening the DES !og " right-clic.ing in the pro/ect wor.space

B. =iew the first message in the 2*4 ,og in detail. a. At what simulation time did the first message occurC b. At what e%ent did the first message occurC c. $hat is the message&s categoryC $hat is its class and subclassC d. 7lick on the !+essage# field of first line to expand the message. The ,og *ntry window opens (see :ig. 8 . e. $hat changes do you think would fix this problemC f. $hen you are done, close the ,og *ntry and .rowser ,og windows.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ # o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 0: The first message in the DES !og

Fix the misconfiguration 1D. The applications are configured on the client, but not on the ser%er. +odify the ser%er&s attributes so that it can respond to client re-uests. a. @ight-click on the !ser%er# node and select E(it 1ttri utes. The *dit Attributes window opens. b. 7lick on the !E# symbol next to the !Applications# group to expand the applications-related attributes. c. 7hange the %alue of the !ApplicationF 4upported 4er%ices# attribute from the symbol !)one# to the symbol !All#. This ser%er will now respond to client re-uests for all applications.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ - o+ !,

1502 Debugging Simulation Models -- Introduction

d. 7lick on the O2 button to retain your changes. Test if the fix worked 11. @un the simulation again. )ote that this time the 2*4 ,og has only one message (see :ig. 9 . As is often the case, fixing one warning had the effect of fixing subse-uent warnings, too.

Figure 3: 1fter ena ling application ser4ices, the simulation completes with fewer messages to the DES !og

13. 'pen the 2*4 ,og to find out what the remaining message is. a. At what simulation time did the first message occurC b. At what e%ent did the first message occurC c. $hat is the message&s categoryC $hat is its class and subclassC d. 7lick on the !+essage# field of first line to expand the message. The ,og *ntry window opens. e. 2oes the network configuration need to be adjusted in order to produce the correct beha%iorC 16. If desired, %iew the results using the same procedure as in step < abo%e. 4uccess0 If this were a real project, you would now analyGe the meaning of the results collected.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ . o+ !,

1502 Debugging Simulation Models -- Introduction

"urther tips for using the DES Log @emember, the presence of a 2*4 ,og does not necessarily indicate a problem. Hou need to read it to find out if it contains errors, warnings, or simply messages. It may contain information about the state of objects in the network (such as routing tables or remind you of any interesting e%ents that will affect your simulation results (such as efficiency modes . Exit the software 18. $hen you are done/ a. 7lick on the Close button to close the 4imulation 4e-uence window. b. 4elect the File 5 E'it menu item to close +odeler. If prompted, click on the Sa4e button to sa%e your changes. If there is time left o%er, check with a TA to find out when the class will resume, then take a break.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ / o+ !,

1502 Debugging Simulation Models -- Introduction

Lab #: Debugging a structural problem using $e stop% and $fulltrace% OD& commands
$hen you first started using +odeler, you may ha%e studied the !(acket 4witching I# tutorial. ,abs 3 and 6 use the !(acket 4witching I# tutorial with a few mistakes introduced into the process model code. $e will use the debugging concepts discussed in the lecture to find and correct these mistakes. Purpose of the exercise This lab exercise introduces a structural error that must be debugged. $e will in%estigate the resulting error messages, and use the information to in%estigate in detail the e%ent where the program abort occurs. O er ie! of model architecture The network topology consists of four peripheral nodes, and a central packet-switching node (see :ig. ; . *ach peripheral node acts as both a !source# and a !sink#. The central node deli%ers packets to the appropriate interface.

Figure 6: Topolog" of scenario 137%-la %

Pac'et creation and destination addressing

(ackets are created from each peripheral node at a user-specified rateI for our exercises, this is a constant rate of 1 packet per second. After creation, each packet is assigned a destination address of D, 1, 3, 6, where an address of D corresponds to node"D, an address of 1 corresponds to node"1, and so on. The destination address is chosen from a uniform distribution, so each peripheral node should recei%e a similar number of packets. 4ee :igs. < and A.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ 0 o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 8: 9o(e mo(el structure of a peripheral (e4ice

Figure :: p.sw;n(;proc, the heart of the peripheral no(es

Pac'et s!itching

(ackets are then sent to the central packet-switching node, which reads the destination address and sends the packet to the correct peripheral node. 4ee :igs. B and 1D.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ 1 o+ !,

1502 Debugging Simulation Models -- Introduction

Figure <: 9o(e mo(el structure of the central =hu = no(e

Figure 17: p.sw;hu ;proc, the process mo(el responsi le for (eli4ering pac.ets to the proper interface

(raffic reception and destruction

$hen a peripheral node recei%es a packet, it records a single statistic, !*T* 2elay# and then destroys the packet. Explore the topology 1. 4tart +odeler by double-clicking the >o(eler icon on the desktop. 3. 'pen the !lab3# project. a. 4elect File > Open from the pull-down menu. The Open dialog box opens. b. 4elect the !lab3# project from the list.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *" o+ !,

1502 Debugging Simulation Models -- Introduction

c. 7lick the O2 button. The (roject *ditor opens with the !baseline# scenario displayed. 6. *xplore the project, node models, and process models used in the scenario. a. 2ouble-click on the nodes to %iew their node models. The )ode *ditor opens. b. $ithin the )ode *ditor, double-click on the processor modules to %iew their process models. The (rocess *ditor opens. c. $ithin the (rocess *ditor, double-click on the top or bottom of a state to %iew its *nter *xecuti%es or *xit *xecuti%es, respecti%ely. If you wish, %iew the Jeader .lock, 4tate =ariables .lock, Temporary =ariable .lock, ?lobal and ,ocal 4tatistics, and other process components. 8. $hen you are finished exploring, close all instances of the )ode and (rocess editors by clicking on the $ button in the upper-right corner. 2o not sa%e any changes you may ha%e made during your exploration. Run the simulation 9. In the (roject *ditor, click the !running man# button (see :ig. 11 . The Configure/Run DES window opens.

Figure 11: The =Configure/Run Discrete E4ent Simulation ?DES@= utton

;. 7lick on the Run button. The !4imulation 4e-uence# window opens. <. )ote that the simulation does not complete (see :ig. 13 . )ote the text that appears in the >essages tab of the 4imulation 4e-uence window. A. $hen you are done, close the simulation se-uence window by clicking the Close button.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ ** o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 1%: =Arogram 1 ort= messages generate( " la %- aseline

In estigate the error messages B. *rrors and significant e%ents that occurred during this simulation are recorded in the 2*4 ,og. 'pen the 2*4 ,og to get a better %iew. a. 4elect the DES > Open DES !og menu item. The !og +rowser window opens. b. 2ouble-click on the first entry in the 2*4 ,og to get a detailed %iew. 1D. Interpret the information in the 2*4 ,og. a. The error message is a (rogram Abort. $hat does that meanC b. $hat was the text of the error messageC c. At what simulation time was the error message recordedC d. At which e%ent number was the error message recordedC e. $hich module is the error message associated withC

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *! o+ !,

1502 Debugging Simulation Models -- Introduction

f.

$hat was the name of the most recent process model in use when the error message was recordedC

g. $hich Kernel (rocedure was in%oked incorrectly to produce the error messageC $hat does this K( doC h. 7lose the 2*4 log when you are ready. 11. The 2*4 log only records the header of the error message. 'pen the error log to see the function call stack (:74 recorded along with the error message. a. 4elect the Belp > Error !og > Open menu item. The error log opens. b. $hich state or transition of the process model did the error occur inC c. $hich function did the error occur inC d. Jow many times had the K( op"pk"nfd"set"int63 ( been called during the simulation when the error was recordedC e. 7lose the error log when you are ready. )hat additional information is needed to diagnose the problem* At this point, we know that in no(e;7 in the proc module in the p.sw;n(;proc process during a transition from i(le i(le, the function 'mt ( was called for the first time. 2uring this function call, a )I, packet pointer was passed to op;p.;nf(;set;int,% ( . ?ood -uestions to ask includeF Jow was the )I, packet pointer obtained in the first placeC $hat field was being setC $hat happened right before the call to op"pk"nfd"set"int63 ( C These are -uestions that are difficult to answer analytically, but that '()*T 2ebugger ('2. can determine -uite easily. Start the simulation in !D" 13. 7onfigure the simulation to run in '2. (see :ig 16 . a. In the (roject *ditor, click on the !running man# button. The Configure/Run DES window opens, displaying the contents of the Common branch. b. 7onfirm that the Simulation 2ernel field is set to !2e%elopment#. c. 7lick on the E'ecution > OA9ET De ugger branch on the left side of the window and select the &se OA9ET Simulation De ugger ?OD+@ checkbox. d. 4elect the Aause for user input efore closing OA9ET Console when simulation en(s checkbox. This will pre%ent the console with the '2. information in it from closing immediately when the simulation ends. 16. 7lick on the Run button to run the simulation. A console window opensI after a moment, the !odb># prompt opens.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *, o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 1,: The OA9ET De ugger ranch in the Configure/Run DES win(ow

#se !D" to set a $reakpoint 18. *nter the command e4stop 1,. This sets a breakpoint that will stop the simulation just before the error takes place. a. If you wish, enter the command status to %iew what breakpoints ha%e been set. b. If you wish, enter the command help e4stop to learn more about the !e%stop# command. 19. *nter the command cont. The simulation continues, stopping just before e%ent 16. The e%ent banner for the next e%ent is displayed.
____________________________ (ODB 11.0.A: Event) ____________________________ * * * * Time : 10 sec, [00d 00h 00m 10s . 000ms 000us 000ns 000ps] Event : executi n !D (1"), schedu#e !D ($1"), t%pe (st&e'm int&pt) ( u&ce : executi n !D ()), t p.p*s+1.n de_0.s&c [O,-id.11] (p& cess &) D't' : inst&m (1), p'c*et !D (0)

/ 0 du#e : t p.p*s+1.n de_0.p& c [O,-id.11] (p& cess &) ,&e'*p int t&'pped : 2st p 't event (1")2

Inspect the e ent $anner 1;. ,ook at the e%ent banner for e%ent 16. a. $hat is the current simulation timeC b. This e%ent is of type !stream intrpt#. $hat does that meanC
P)g$ *# o+ !,

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

1502 Debugging Simulation Models -- Introduction

c. $hich module generated this e%entC $hat kind of module is itC d. In which module will the e%ent take placeC $hat kind of module is itC e. The data associated with this e%ent is !instrm (1 , packet I2 (D #. $hat does that meanC f. 'pen the !pksw"node# node model and find the object representing !instrm (1 #. JintF @ight-click on each stream and select E(it 1ttri utes. @ight-click on the !proc# module and select !Show Connecti4it"#.

Figure 10: &se the no(e e(itor to i(entif" which stream is =instrm 1= with respect to the =proc= mo(uleC

#se !D" to trace the %&s called $efore the error occurs 1<. *nter the command fulltrace at the !odb># prompt. This enables all simulation traces, so you can see as much information as possible. In a complex simulation, this amount of information can be o%erwhelming. a. If you wish, enter the command status to %iew enabled traces. )ote that since the original breakpoint has been passed, it is no longer listed. b. If you wish, enter the command help fulltrace to learn more. 1A. *nter the command ne't. The next e%ent executes, displaying all tracing information. )ote that before the e%ent completes, the simulation aborts with the same error message we saw before. Inspect the tracing information 1B. In '2., when transitioning from the !idle# state to the next state/ a. $hich transition condition was trueC b. Is that expected beha%iorC In other words, did the simulation transition as intendedC c. $hat transition executi%e function was calledC d. $here is that function definedC 3D. 'pen the !pksw"nd"proc# process model, so that you can compare the results of the trace in '2. with the structure of the process model.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *- o+ !,

1502 Debugging Simulation Models -- Introduction

a. In +odeler, select the File > Open menu item. The Open window appears. b. 7hange the Files of T"pe field to !(rocess +odel#. 31. 2ouble-click on !pksw"nd"proc#. The (rocess *ditor opens. 7lick the F+ button. The Function +loc. opens. )ote that the first K( called is op"pk"get ( . a. $hat does that K( doC $hat are its arguments and how are they usedC b. $hat argument(s were passed into the call to op"pk"get ( C c. $hat was the resultC $as that the expected resultC Putting the pieces together In step 1; abo%e, we learned that a packet was arri%ing to the module !proc# on incoming packet stream 1. ,ater, in step 31, we see that the call to retrie%e the packet is performed on incoming packet stream 0---the wrong stream0 '2. has gi%en us %ery detailed information about what went wrong, as well as where and when. $e can now inspect the rele%ant code to determine how the wrong stream was used. Exit !D" 33. $hen you are done inspecting the trace information, press the Enter key to exit the simulation, and then click the Close button in the (roject *ditor to close the 4imulation 4e-uence window. Inspect the code and fix the pro$lem 36. 'pen the code block where op"pk"get ( was called incorrectly. a. In the (roject *ditor, double-click on !node"D#. The )ode *ditor opens. b. 2ouble-click on the !proc# module. The (rocess *ditor opens. c. 7lick the F+ button. The :unction .lock opens. 38. )ote that op"pk"get ( is called with the macro !@7="I)"4T@+#. In order to understand what this macro means, explore the area where it is declared. a. 7lick the B+ button. The Jeader .lock opens. b. $hat does that macro expand toC c. $hich macro should ha%e been used as an argument to op"pk"get ( in this situationC d. $hen you are done, close the Jeader .lock. 2o not sa%e any changes you may ha%e made while inspecting the Jeader .lock. 39. :ix the problem. This packet was generated at a higher-layer and is about to be transmitted. a. @eturn to the :unction .lock. b. 7hange the %alue @7="I)"4T@+ to SRC;D9;STR>.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *. o+ !,

1502 Debugging Simulation Models -- Introduction

c. 7lose the :unction .lock by clicking on the $ button in the upper right. $hen prompted, click the Sa4e button to retain your changes. d. 4a%e and compile the !pksw"nd"proc# process model. i. 7lick on the File > Sa4e menu item ii. 7lick on the yellow Compile Arocess >o(el button to compile the process model. 7lick on the Close button when the compilation is complete. 3;. 7lose all (rocess *ditor and )ode *ditor windows. Test if the change worked 3<. 7onfigure the simulation to run normally (outside of '2. . a. In the (roject *ditor, click the !running man# button. The Configure/Run DES window opens, displaying the contents of the Common branch. b. 7lear the Aause for user input efore closing OA9ET Console when simulation en(s checkbox. c. 7lick on the E'ecution > OA9ET De ugger branch on the left side of the window and clear the &se OA9ET Simulation De ugger ?OD+@ checkbox. 3A. 7lick on the Run button. The 4imulation 4e-uence window opens. After a moment, the simulation runs and completes. 3B. )ote that the simulation runs to completion without any error messagesL1 hour (6;DD seconds simulated time (see :ig. 19 . 7ongratulations0 Hou identified, in%estigated, fixed, and tested the problem.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ */ o+ !,

1502 Debugging Simulation Models -- Introduction

Figure 13: Simulation complete( without error messages

6D. *xit +odeler. If prompted, you may click on the Sa4e button to sa%e your changes. If there is time left o%er, check with a TA to find out when the class will resume, then take a break.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *0 o+ !,

1502 Debugging Simulation Models -- Introduction

Lab +: Debugging a beha ioral problem using pac'et,related commands


Purpose of the exercise In ,ab 3, we fixed a structural problem and confirmed that the simulation runs to completion, but we didn&t check if the simulation results were as expected. Msing the same network we will identify and fix a beha%ioral problem in the underlying process model code. -alidating .esults In ,ab 3, we made sure that the simulation ran to completion, but we did not %alidate the results. ,et&s do that now. View and e aluate simulation results 1. 'pen the project. a. @un +odeler. b. 'pen the la , project. This project is identical to !lab3#, but the program abort has been fixed for you. 3. This simulation has already been run, and results ha%e been collected for you. 7lick the Bi(e/Show Eraph Aanels button (see :ig 1; . 4e%eral analysis panels appear.

Figure 16: The Bi(e/Show Eraph Aanels utton

6. Inspect the panel on the left. a. *ach of its four stacked graphs shows utiliGation of a link in the scenario, from the peripheral nodes toward the central node. b. )ote that the links ha%e identical utiliGation. c. This is expected beha%ior, since each node is generating the same amount of traffic (a constant rate of 1 packet per second . 8. Inspect the panel on the right. a. *ach of its four stacked graphs also shows utiliGation of a link in the scenario, this time from the central node toward the peripheral nodes. b. )ote that three of the links are not utiliGed, but the link !hub -> node"D# is highly utiliGed. In fact, it looks like all of the packets are going to the same destinationLnode D. c. This is not intended beha%ior. (acket destinations are selected based on a uniform distributionI i.e. each destination should see similar throughput. 9. $hen you are ready, click the Bi(e/Show Eraph Aanels button again to hide the panels.

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ *1 o+ !,

1502 Debugging Simulation Models -- Introduction

De elop a hypothesis All packets are being sent to the same destination. $ith our knowledge of the model architecture, possible reasons for this include the following (perhaps you can think of more . The same destination address (D is being set on e%ery packet The destination address is set correctly, but is later o%erwritten The central packet-switching node is obtaining the destination for each packet from the wrong source.

'ne debugging approach is to follow the life cycle of a packet, from its creation until its destruction. #se !D" to trace a packet ;. @un the simulation in '2. (see :ig. 1< . After a moment, a console with the !odb># prompt opens.

Figure 18: The 1(4ance( / OA9ET De ugger ta of the Configure/Run DES win(ow

<. *nter the command p.trace 1. This command will issue tracing information for any K(s that access packet I2 1. a. )ote that at the beginning of the simulation, no packets ha%e been created yet. Hes, you can set traces and breakpoints for entities that don&t yet exist. If you want, enter the command status to confirm that your trace information is set. b. If you want, enter the command help p.trace to learn more

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ !" o+ !,

1502 Debugging Simulation Models -- Introduction

A. *nter the command p.stop 1. This command issues a breakpoint anytime packet I2 1 is accessed. If we didn&t add any breakpoints, then the trace information would go by too -uickly to read0 a. If you want, enter the command status. b. If you want, enter the command help p.stop to learn more. B. *nter the cont command. An e%ent banner appears. a. $hat type of e%ent is thisC b. In which module will the e%ent take placeC 'reation and initiali(ation 1D. 7ontinue to enter the command cont, and note as K(s are in%oked during this e%ent. JintF Hou&ll know the e%ent is o%er when a new e%ent banner appears. a. $hich K( is used to create the packetC b. $hich K( is used to set the packet&s siGeC c. At the end of the e%ent, which K( is used to send the packet on to another moduleC $hich module is the packet being sent toC 11. The next e%ent is N18. This may look familiar - it&s the same process we inspected in ,ab 3. a. $hat destination address is set on the packetC b. $hich node should packet to be deli%ered toC 13. *nter the command p.print 1 to confirm that the packet was modified as expected. Through the pipeline stages 16. 7ontinue to enter the command cont (JintF Hou can also abbre%iate this command as c . a. The next se%eral breakpoints and trace information show the packet&s tra%ersal through the Transcei%er (ipeline 4tages. b. 4ince the pipeline stage code in this model is standard from the '()*T +odel ,ibrary, it is unlikely that the packet is being modified unexpectedly in the pipeline stages. c. 7ontinue until you see the e%ent banner that precedes e%ent 68. The banner informs us that the !hub# processor within the !hub# node is recei%ing the packet.
____________________________ (ODB 11.0.A: Event) ____________________________ * Time : 10.11 sec, [00d 00h 00m 10s . 110ms 000us 000ns 000ps] * Event : executi n !D ("3), schedu#e !D ($"4), t%pe (st&e'm int&pt) * ( u&ce : executi n !D (14), t p.p*s+1.hu,.&cv1 (pt5pt &eceive&) * D't' : inst&m (1), p'c*et !D (1) / 0 du#e : t p.p*s+1.hu,.hu, (p& cess &)

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ !* o+ !,

1502 Debugging Simulation Models -- Introduction

In the central node)s processor 18. *nter the command p.print 1 to confirm that the destination address is still 1, as it should be. 19. *nter the cont command 6 times to see how the packet is manipulated in e%ent N68. 1;. Take note of the different K(s that were used to access the packet in e%ent N68. a. $hat is the K( op"pk"get ( used forC b. $hat is the K( op"pk"nfd"set"int63 ( used forC c. $hat destination is the packet sent to with op"pk"send ( C 1<. *nter the command p.print 1, and note that the packet&s destination address field has changed. /ha0 2id you catch itC The use of op"pk"nfd"set"int63 ( is suspicious. The central hub should only get the %alue of packet fields, not set them. ,ooks like the de%eloper may ha%e made a typographical error0 'onfirm and fix the pro$lem 1A. 4top '2. with the e'it or quit command (enter the commands help e'it and help quit, if you want, to recall what the difference is . 7lose the Simulation Sequence window. 1B. ,ocate the code that calls op"pk"nfd"set"int63 ( Lrecall that we disco%ered that code in the top.pksw1.hub.hub module. a. 2ouble-click on the !hub# node. The )ode *ditor opens. b. 2ouble-click on the !hub# processor. The !pksw"hub"proc# process model opens. c. 7lick the F+ button. The Function +loc. opens. d. Inspect the code. Jow would you fix the problemC 3D. :ind the line containing op"pk"nfd"set"int63 ( and fix it as shown in the diagram below. )ote that there are two changes re-uired. a. $hat does this algorithm do nowC b. $hy are both changes re-uiredC
op_pk_nf d_g et_i nt 32 ( pkpt r, "dest _address", & dest_address) ;

Test the fix 31. 4a%e your changes and recompile the process model. 7lose any open instances of the )ode and (rocess *ditors. 33. @un the simulation normally (not in '2. .

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ !! o+ !,

1502 Debugging Simulation Models -- Introduction

36. =iew the results by clicking on the Bi(e/Show Eraph Aanels button. (reconfigured analysis panels appear, but they still display the same images as before. @eload the new results into each panel. a. @ight-click on the gray area of each panel (on the panel itself, not on a graph and select >a.e Aanel Template. b. @ight-click on the panel again, and select !oa( Data Dnto Template. c. )ote that the %alues are approximately e-ual. This is as expected. d. $hy aren&t the utiliGation %alues identicalC Extra 'redit 7reate a new analysis panel that shows the link utiliGation from the hub to peripheral nodes all on a single graph, as shown in :ig. 1A.

Figure 1:: The correcte( simulation eha4ior

CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART. Copyrigh !""# OPNET T$%h&o'ogi$(, I&%.

P)g$ !, o+ !,

You might also like