Professional Documents
Culture Documents
Lab Exercices Modeler
Lab Exercices Modeler
OPNET Modeler
Development of laboratory exercises based
on OPNET Modeler
Tommy Svensson
Alex Popescu
This thesis is presented as a part of the Master of Science Degree in Electrical Engineering with emphasis
on Telecommunications and Signal Processing.
Blekinge Institute of Technology
June 2003
Abstract
The primary purpose of this thesis is to develop laboratory exercises for use with several
courses at the Blekinge Institute of Technology and to offer an insight in how real
networks and protocols behave. All laboratories are developed in OPNET Modeler 9.0
simulation environment which is a network simulator that offers the tools for model
design, simulation, data mining and analysis.
The software package is licensed by OPNET technologies Inc [1].
The instructional material consists of a set of laboratory exercises, namely: Introduction
to OPNET Modeler 9.0 environment, M/M/1, Aloha, CSMA, CSMA-CD, Slow Start,
Congestion Avoidance, Fast Retransmit, Fast Recovery and OSPF, Queuing policies
, Selfsimilar.
Keywords: OPNET Modeler, Lab, M/M/1, Aloha, CSMA, CSMA-CD, Slow Start,
Congestion Avoidance, Fast Retransmit, Fast Recovery, OSPF, Areas, Balanced traffic
flow, Ethernet, FIFO, Preemptive priority queuing, Non preemptive queuing, WFQ,
Selfsimilar.
Tommy Svensson
Alex Popescu
Table of contents
Abstract ...........................................................................................................................................................2
Introduction .....................................................................................................................................................6
General ........................................................................................................................................................6
Purpose ........................................................................................................................................................6
Laboratory 1 ....................................................................................................................................................7
Introduction to Opnet ......................................................................................................................................7
Objective .....................................................................................................................................................7
Overview .....................................................................................................................................................7
Preparations .................................................................................................................................................8
Project Editor...........................................................................................................................................9
The Process Model Editor .....................................................................................................................11
The Link Model Editor ..........................................................................................................................12
The Path Editor......................................................................................................................................13
The Packet Format Editor......................................................................................................................14
The Probe Editor....................................................................................................................................15
The Simulation Sequence Editor ...........................................................................................................16
The Analysis Tool .................................................................................................................................17
The Project Editor Workspace...............................................................................................................18
Begin the laboratory ..................................................................................................................................20
Laboratory 2 ..................................................................................................................................................41
M/M/1 Queue simulation ..............................................................................................................................41
Objective ...................................................................................................................................................41
Overview ...................................................................................................................................................41
Procedure...................................................................................................................................................42
Creation of the node model ...................................................................................................................43
Laboratory 3 ..................................................................................................................................................62
Ethernet simulation........................................................................................................................................62
Objective ...................................................................................................................................................62
Overview ...................................................................................................................................................62
Procedure...................................................................................................................................................63
Designing the Aloha Transmitter Process Model ......................................................................................63
Creating the Aloha Transmitter Node Model ............................................................................................70
Creating the Generic Receiver Node Process Model.................................................................................73
Creating the Generic Receiver Node Model..............................................................................................77
Creating a new link model.........................................................................................................................79
Creating the network model ......................................................................................................................80
Executing the Aloha Simulation................................................................................................................83
Creating the CSMA transmitter process model .........................................................................................87
Creating the CSMA transmitter node model .............................................................................................89
Redefining the network model ..................................................................................................................91
Configuring CSMA Simulations ...............................................................................................................92
Analyzing the CSMA results.....................................................................................................................93
Viewing Both Results on the Same Graph ................................................................................................94
Ethernet network model.............................................................................................................................97
Laboratory 4 ................................................................................................................................................104
TCP simulation............................................................................................................................................104
Objective .................................................................................................................................................104
Overview .................................................................................................................................................104
Procedure.................................................................................................................................................104
Slow start and congestion avoidance ...................................................................................................104
Slow start and congestion avoidance simulation .................................................................................106
Create the network...............................................................................................................................107
Create the Paris subnet ........................................................................................................................110
Tommy Svensson
Alex Popescu
Tommy Svensson
Alex Popescu
Introduction
General
Today the field of computer networks all over the world has entered an exponential
growth phase. These demands have made the necessity of capable network engineers
extremely covet. It is therefore crucial for universities to offer networking courses that
are both educational and up to date. Due to different obstacles it is unpractical for a
university to be able to offer several types of networks to its students. An invaluable tool
in this case consists of the network simulator OPNET Modeler that offers the tools for
model design, simulation, data mining and analysis for, considering the alternatives, a
reasonable cost. OPNET Modeler can simulate a wide variety of different networks
which are link to each other. The students can therefore just by sitting at their
workstations exercise various options available to network nodes and visually see the
impact of their actions. Data message flows, packet losses, control/routing message
flows, link failures, bit errors; etc can be seen by the students at visible speed. This is the
most cost effective solution for universities to demonstrate the behavior of different
networks and protocols.
Purpose
This thesis will implement five laboratory exercises using the OPNET Modeler
simulation environment, namely:
Tommy Svensson
Alex Popescu
Laboratory 1
Introduction to Opnet
Objective
This laboratory is about basics of using Optimized Network Engineering Tools (OPNET).
Overview
The OPNET is a very powerful network simulator. Main purposes are to optimize cost,
performance and availability.
The goal of this laboratory is to learn the basics of how to use Modeler interface, as well
as some basic modeling theory. The following tasks are considered:
Build and analyze models.
Configure the object palette with the needed models.
Set up application and profile configurations.
Model a LAN as a single node.
Specify background utilization that changes over a time on a link.
Simulate multiple scenarios simultaneously.
Apply filter to graphs of results and analyze the results.
Before starting working on the Exercise part of this laboratory, one has to read the
Preparations part.
Tommy Svensson
Alex Popescu
Preparations
To build a network model the workflow centers on the Project Editor. This is used to
create network models, collect statistics directly from each network object or from the
network as a hole, execute a simulation and view results. See Fig.1.
Figure 1 - Workflow
Tommy Svensson
Alex Popescu
Project Editor
The main staging area for creating a network simulation is the Project Editor. This is used
to create a network model using models from the standard library, collect statistics about
the network, run the simulation and view the results. Using specialized editors accessible
from the Project Editor via File New one can create node and process models, build
packet formats and create filters and parameters.
Depending on the type of network being modeled, a network model may consist of
subnetworks and nodes connected by point-to-point, bus, or radio links. Subnetworks,
nodes, and links can be placed within subnetworks, which can then be treated as single
objects in the network model. This is useful for separating the network diagram into
manageable pieces and provides a quick way of duplicating groups of nodes and links.
Tommy Svensson
Alex Popescu
10
Tommy Svensson
Alex Popescu
11
Tommy Svensson
Alex Popescu
12
Tommy Svensson
Alex Popescu
13
Tommy Svensson
Alex Popescu
14
Tommy Svensson
Alex Popescu
15
Tommy Svensson
Alex Popescu
16
Tommy Svensson
Alex Popescu
17
Buttons
Several of the more commonly used menu bar can also be activated through buttons.
Each editor has its own set of buttons. The buttons shown below appear in the Project
Editor.
Tommy Svensson
Alex Popescu
18
10
11
Occasionally, the messages Modeler generates may be larger than the message area. You
next to the message area to open the message buffer, where
can left-click on the icon
the entire message displays.
Tool tips
If you place your cursor over a button or a menu selection, a help balloon soon appears.
Tommy Svensson
Alex Popescu
19
Tommy Svensson
Alex Popescu
20
To work with Modelers full set of node and link models would be overwhelming, so the
object palette can be configured to show only a specific subset, or model list. Further you
can use the standard model list, adapt them for your own needs, or make your own list.
For this lab we created LAN_Mod_Model_List. Now you will adapt that model list by
adding the LAN node model to it.
9) To open the Configure Palette dialog box click the Configure Palette button in the
object palette.
The Configure Palette dialog box lets you change the object palette and then save it
10) Click the Node Models button in the Configure Palette dialog box.
Select Included Entries dialog box appears.
11) Find 10BaseT_LAN in the list and change its status from not included to included.
Tommy Svensson
Alex Popescu
21
Tommy Svensson
Alex Popescu
22
You will now configure the Application Configuration Object and the Profile
Configuration Object. Before you begin constructing the network its a good idea to
predefine the profiles and applications that will be used by the LAN.
14) To configure the Application Configuration Object, open the object palette in the
case it is not already open and drag an Application Config object to the project
workspace.
15) Right click and select Edit Attributes from the pop up menu.
15) Click on the question mark next to the name attribute to see a description of the
attribute. When done close the attribute description dialog box.
Tommy Svensson
Alex Popescu
23
Selecting Default configures the application definition object to have the eight standard
applications which are: Database Access, Email, File Transfer, File Print, Telnet Session,
Video conferencing, Voice over IP Call and Web Browsing.
18) Close the Attributes dialog box by clicking OK.
Now you will configure the Profile Configuration Object.
19) Drag a Profile Configuration object from the object palette to project workspace.
20) Right-click on the object and select Edit Attributes.
21) Set the name attribute to Profile Configuration as shown in the box above.
Tommy Svensson
Alex Popescu
24
22) Change now the Profile Configuration attribute by clicking in its value column
and selecting Edit from the drop down menu.
The Profile Configuration Table box appears.
25
33) Click OK to close the Profile Configuration Table, then click OK once again to
close the Attributes dialog box.
You are now ready to begin the construction of the WAN. In this scenario the network
contains 2 identical subnets in Karlskrona and Karlshamn. You can create the first subnet
in Karlskrona , with its nodes inside it, and then copy the subnet to Karlshamn. You will
also copy it to Ronneby and modify it further.
Tommy Svensson
Alex Popescu
26
Hint: A subnet is a single network object that contains other network objects (links,
nodes and other subnets). Subnetworks allow you to simplify the display of a complex
network through abstraction.
Subnets are useful when organizing your network model. Subnets can be nested within
subnets to an unlimited degree.
34) Open the object palette.
35) Place a subnet over Karlskrona, Right-click to turn off node creation.
36) Right-click on the subnet and select set name. Change the name to Karlskrona.
The extent of the subnet needs to be modified. The subnet extent is the geographic area
covered by the subnet, which may be much larger than the actual area you wish to model.
37) Right-click on the Karlskrona subnet and select Advanced Edit Attributes.
38) Change the x span and y span attributes to 0,25.
The unit of measure of these attributes is determined by the unit of measure of the toplevel area, degrees in this case.
39) Click OK.
In order to see whats inside subnets just double-click on that subnet icon and the
Modeler will change the view.
By default a subnets grid properties is based on its parent subnet. You can change them
to fit your network.
40) Double-click on the Karlskrona Subnet.
41) Select View => Set View Properties
42) Set units to Meters.
43) Set resolution to 10 pixels/m.
45) Uncheck the Visible checkbox for Satellite orbits.
46) Verify that Drawing is set to Dashed.
47) Set division to 10.
Tommy Svensson
Alex Popescu
27
28
55) Change the Number of Workstations attribute to 10, then click OK.
56) Close the Edit Attributes dialog box.
You have now modeled a 10 workstation LAN inside the Karlskrona subnet. Further
because this LAN model is composed of workstations and links only, it must be
connected to a router. The router can then be connected to other routers in the network.
57) To create an router drag a BN_BLN_4s_e4_f_sl8_tr4 node from the object palette to
the workstation near the Office_LAN node.
58) After naming the new node router connect it to the Office_LAN nodes with a
10BaseT link. Right click to turn off link creation.
The Karlskrona subnet is now configured. Because the subnets in Karlshamn and
Ronneby are identical, you can copy the Karlskrona subnet and place it appropriately.
59) To copy the subnet you must first return to the parent subnet, this is done either by
clicking on the Go to Parent Subnetwork button
or right click on the workspace
to bring up the workspace pop-up menu, then choose Go to Parent subnetwork from the
menu.
60) After returning to the parent subnet, select the subnet and copy it, this is done either
by clicking Edit=>Copy or by pressing <Control>+c.
61) Now paste the subnet to Karlshamn and Ronneby by selecting Edit=>Paste or by
pressing <Control>+v and then click on the Karlshamn and Ronneby region. When done
the new subnets appears.
62) You will now have to rename the subnets. To do so right-click on each of the two
subnets and choose set name.
63) Next you should connect the Karlshamn and the Karlskrona subnets to Ronneby.
To do so select the LAN_Mod_PPP_DS0 link in the object palette.
64) Draw a LAN_Mod_PPP_DS0 link from Karlskrona to Ronneby.
Next a Select Nodes dialog box appears asking which nodes in each subnet are to be
endpoints of the link.
65) For node a, choose the Karlskrona.router node.
66) For node b, choose the Ronneby.router node.
Tommy Svensson
Alex Popescu
29
68) Repeat this process, drawing link from Karlshamn to Ronneby as well. Specify the
citys router as the links endpoints.
69) When done right-click to turn of link creation.
The network should resemble the one shown in the picture below.
Tommy Svensson
Alex Popescu
30
To complete the network, the main office in Ronneby needs to have a switch and a server
added to it.
70) To configure the network in Ronneby double-click on the Ronneby subnet to enter its
subnet view.
71) Place one <Bay Network Accelar1050> switch and one ethernet_server node in the
workspace.
72) Rename the <Bay Network Accelar1050> node to switch.
This is done by right-clicking on each icon and select Set name from the menu.
73) Rename the ethernet_server to FTP.
74) Connect the router and the server to the switch with 10BaseT links. Right-click to
turn off link creation, and close the object palette.
The Server needs to be configured to support the FTP Application.
75) Open the Attributes dialog box for the FTP server.
76) Choose Edit for the Application: Supported Services
77) Change number of rows to 1.
78) Select File Transfer (Heavy) from the Name column pop-up menu.
79) Click OK to close the Supported Services dialog box, and then click OK to close the
FTP Attributes dialog box.
Tommy Svensson
Alex Popescu
31
Tommy Svensson
Alex Popescu
32
84) Select the link between Karlskrona-Ronneby. Right-click on the link and choose
Similar Links from the pop-up menu.
85) Display the Edit Attributes dialog box for the link between Karlskrona-Ronneby.
86) Click in the Value cell for the Background Utilization attribute and select Edit...
from the pop-up menu.
87) Click on the Rows value and change it to 3. Press Return.
Network studies show that traffic rises gradually over the course of the day as
employees/students arrive.
88) Complete the dialog box as shown. Then Click OK.
The last step in setting background utilization is to apply the changes made to the
Karlskrona-Ronneby link to all the selected links.
89) Check the Apply Changes to Selected objects check box in the Karlskorna-Ronneby
Attributes dialog box.
Tommy Svensson
Alex Popescu
33
Tommy Svensson
Alex Popescu
34
94) Select the Link Statistics => point-to-point => untilization --> Statistic.
35
97) Collect the same statistics that you did in the back_util scenario:
Global Statistics => Ftp => Download Response Time (sec)
Link Statistics => point-to-point => untilization -->
98) Close the Choose Results dialog box.
99) Save the project.
The statistics are now ready to be collected by running the simulations. Instead of running
each simulation separately, you can batch them together to run consecutively.
100) Select Scenarios => Manage Scenarios
101) Click on the Results value for the no_back_util and back_util scenarios and
change the value to <collect>.
102) Set the Sim Duration value for each scenario to 30 and the Time Units to minutes.
Tommy Svensson
Alex Popescu
36
Tommy Svensson
Alex Popescu
37
107) Click Show to display the graph. The graph should resemble the one below, though
it will not match exactly.
Tommy Svensson
Alex Popescu
38
You may want to look at the utilization of other links to determine the maximum
utilization of any link.
Lets look at Global FTP response time.
108) Click the Unselect button in the Compare Results dialog box.
109) Check the Global Statistics => FTP => Download Response Time statistic in the
Compare Statistics dialog box.
110) Verify that the filter menu shows time_average, then click Show.
The graph should resemble the one below, though it will not match exactly.
Tommy Svensson
Alex Popescu
39
Tommy Svensson
Alex Popescu
40
Laboratory 2
M/M/1 Queue simulation
Objective
This laboratory is important for understanding OPNET system and user interface. The lab
contains a step-by-step example that shows how to use OPNET to construct an M/M/1
queue design and analysis.
Overview
The task is to construct an M/M/1 queue model and observe the performance of the
queuing system as the packet arrival rates, packet sizes, and service capacities change.
Two classes of statistics will be measured, Queue Delay and Queue Size. A graph of the
confidence interval will also be produced.
This laboratory also introduces the use of:
Node Model
Probe Model
Simulation Tool
Analysis Tool
Tommy Svensson
Alex Popescu
41
Procedure
An M/M/1 queue consists of a First-in First-Out (FIFO) buffer (queue) with packet
arriving randomly according to a Poisson arrival process, and a processor, that retrieves
packets from the buffer at a specified service rate. Three main parameters affects the
performance of an M/M/1 queue, namely:
Packet arrival rate,
Packet size, 1/
Service capacity, C
[7]
OPNET models are hierarchical. At the lowest level, the behavior of an algorithm or a
protocol is encoded by a state/transition diagram, called state machine, with embedded
code based on C-type language constructs. At the middle level, discrete functions such as
buffering, processing, transmitting and receiving data packets are performed by separate
objects. Some of these objects rely on underlying process models. In OPNET, these
objects are called modules and they are created, modified and edited in the Node Editor.
Modules are connected to form a higher-level node model. At the highest level, node
objects are deployed and connected by links to form a network model. The network
model defines the purpose of the simulation.
The lower-level objects for M/M/1 queue are provided by OPNET, but they need to be
combined to form a node model.
Tommy Svensson
Alex Popescu
42
Tommy Svensson
Alex Popescu
43
13) Change the Packet Size attribute so that Distribution Name is exponential and
Mean Outcome is 1024. Click OK.
Tommy Svensson
Alex Popescu
44
Indicates
Active, acts as its own server
Concentrates multiple incoming packet
streams into its single internal queuing
resource
B
Service time is a function of the number of
bits in the packet
fifo
First in first out service ordering discipline
20) Right click on service rate in the attribute column.
21) Select Promote attribute to higher level. The value for this will be set later in
the Simulation Set dialog box.
22) Click OK to close the dialog box.
Further a sink module should be used although it is not a part of the M/M/1 queue
system. The reason for using a sink is for proper memory management, packets should be
Tommy Svensson
Alex Popescu
45
destroyed when no longer needed. The OPNET-supplied sink process module destroys
the packet sent to it.
23) To create the sink module, activate the Create Processor Module button and then
place a processor module to the right of the queue model on the workspace.
24) Open the attribute box for the processor module by right clicking the icon.
25) Change the name attribute to sink. Notice that the default value for the process
model attribute is sink.
26) Close the dialog box.
To transfer packets between the generator module, the queue module and the sink
module, it will be necessary to connect them together. This is done by packet streams that
provide a path for the transfer of packets between modules. They serve as one-way paths
and are depicted by solid arrowed lines.
27) Activate the Create Packet Stream button.
28) Connect the source module with the queue module by clicking the source icon,
then clicking the queue icon. Remember that the first module you click becomes
the source, and the second one the destination.
29) Connect the queue module and the sink module. Remember to end the Create
Packet Stream operation by right-clicking anywhere in the window.
30) Select Interface => Node Interfaces.
Tommy Svensson
Alex Popescu
46
31) In the Node Types table, click in the Supported cell for the fixed node type. This
toggles the value to yes. Make sure mobile and satellite nodes are not supported.
32) Click OK to close the Node Interfaces dialog box.
The M/M/1 node model definition is complete. You are now ready to create the network
model, but first you should save your work.
33) To save select File => Save. Name the node <initials>_mm1, then click OK and
close the Node Editor.
The first step in creating the network model is to create a new model list. You can
customize the palette to display only the models needed.
34) Click on Open Object Palette button.
35) Click on the Configure Palette button in the object palette.
36) Click on the Model List radio button.
37) Click on the Clear button.
38) Click on the Node Models button.
A list on available node models appears.
39) Scroll in the table until you find the <initials>_mm1 node model. Change the
status from not included to included.
40) Click OK to close the table.
41) Click the Save button. Enter the name <initials>_mm1_palette.
42) Click OK.
Tommy Svensson
Alex Popescu
47
The node model you created is now included in the object palette.
Now you can create the network model.
43) Click and drag the <initials>_mm1 node model to the workspace. Right-click to
end the operation.
44) Change the name. Right-click and select Set Name.
45) Enter the name m1 and choose OK.
We will use the automatic selection method to type in the attributes for the probe.
Tommy Svensson
Alex Popescu
48
51) Right-click on the probe and select Choose Probed Object from the pop-up
menu.
52) Expand the m1 node.
53) Select the queue module and click OK.
54) Right click on the probe and select Edit Attributes from the pop-up menu.
55) Set the name to Queue Delay.
56) Set the submodule attribute to Subqueue[0].
57) Left-click in the Value column of the statistics row.
The Available Statistics dialog box shows the statistics, the group it belongs to and a
description.
58) Select queue.queuing delay from the list and click OK.
The group attributes changes to queue and the statistics attribute changes to queuing
delay in the Edit Attributes dialog box.
59) Set scalar data to enable.
60) Set scalar type to sample mean.
61) Set scalar start to 14400. This is done to eliminate the unwanted initial
oscillations.
62) Set scalar stop to 18000. This equals one hour.
Tommy Svensson
Alex Popescu
49
66) You will now have to set new values to the attributes of the probe, to do so right
click on the new probe and select Edit Attributes.
The values should be set as follows:
name = Queue Size
subnet = top
node = mm1
module = queue
submodule = subqueue [0]
group = queue
statistic = queue size (packets)
scalar data = enabled
scalar start = 14400
scalar stop = 18000
capture mode = all values
67) When done close the probes Attribute dialog box by clicking OK. The changes
will then appear in the Probe Editor.
69) Right click and select choose attributed object in the pop-up menu.
Tommy Svensson
Alex Popescu
50
51
52
Tommy Svensson
Alex Popescu
53
Tommy Svensson
Alex Popescu
54
The large deviations early in the simulation depends on the sensitivity of averages to the
relatively small number of samples collected, as you can see the average stabilizes
towards the end of the simulation.
The results need to be validated.
Calculate the following:
Mean arrival rate, =
1
=
meanint erarrivaltime
Service capacity, C =
Mean service rate, C =
Mean Delay, W =
1
=
C
55
56
From this graph we can draw the conclusion that the system is stable. It reaches steady
state after about 2 hours.
Validate the result.
Calculate the following:
Ratio of Load to Capacity =
Average Queue Size
=
C
Tommy Svensson
Alex Popescu
57
Its important to know the confidence intervals of the simulation results. We will now
graph the confidence interval.
115) Load the Scalar file. File => Load output scalar file
116) Select <initials>_mm1scalar.
117) Click the Create graph of two scalars button.
118) Select top.queue.service_rate on the Horizontal roll-down menu.
119) Select top.queue.subqueue[0].queue.queue size (packets).mean on the
Vertical roll-down menu.
120) Right click on the graph and select Edit Graph Properties.
Tommy Svensson
Alex Popescu
58
Tommy Svensson
Alex Popescu
59
Tommy Svensson
Alex Popescu
60
In order to get better confidence intervals you need to run more scenarios. The graph
below shows the confidence interval of 40 scenarios. The service rate is between 1024
and 1300 with step size 10.
Congratulations!
You have finished the lab.
Tommy Svensson
Alex Popescu
61
Laboratory 3
Ethernet simulation
Objective
Networks can be generally divided into two broad categories, which are based on using
point-to-point connections and on using broadcast channels. In the broadcast channel
case, there could be competition for the use of the channel between two or more stations.
In the common literature, broadcast channels are referred to as multi-access channels, or
random-access channels. The problem of media access is therefore the most important
one for this case.
Multiple access protocols are implemented primarily in Local Area Networks (LANs).
Todays personal computers and workstations are connected by Local Area Networks
(LANs), which use a multi-access channel as the basis of their communication.
An example of a popular LAN is the Ethernet which uses a random-access scheme for
media access. The random-access technique was first used by the ALOHA protocol
developed at the University of Hawaii in the 1970s. Another popular random-access
protocol is the Carrier Sensing Multiple Access (CSMA) scheme which was developed
by XEROX Parc. Further the Ethernet, which is using the Carrier Sensing Multiple
Access with Collision Detection (CSMA-CD) scheme, was developed by Dr. Robert M.
Metcalfe in 1978. [4]
Overview
In this laboratory we will study Multiple Access Protocols. We will look at the ALOHA,
CSMA and Ethernet (CSMA-CD) protocols. The ALOHA is the simplest Multiple
Access Protocol and implements therefore only the most basic functionality, which is to
send packets. ALOHA has no built mechanism to check if the channel is free before it
continues transmitting packets, neither the possibility to detect any collisions on the
channel. These flaws limit the use of the bus.
By adding carrier sense capability to the Aloha random access protocol the performance
is improved. The carrier sense capability is employed in the CSMA (Carrier Sense
Multiple Access) protocol. The process waits until the channel is free before transmitting
a packet. Because of finite signal propagation times, it is possible for a node to be
transmitting before it detects an existing transmission signal. This results in some
collisions. [4]
Finally the Ethernet protocol implements the capability of both transmitting and
monitoring a connected bus link at the same time. It has fullduplex capability. By
monitoring the bus link it can determine whether a collision condition exists. If that is the
Tommy Svensson
Alex Popescu
62
Procedure
OPNET uses the Finite State Machine (FSM) to implement the behavior of a module.
FSMs determine a modules behavior when an event occurs, detailing the actions taken
in response to every possible event.
A process model is a Finite State Machine (FSM). It represents a modules logic and
behavior. An FSM consists of any number of states that a module may be in and the
necessary criteria for changing states.
A state is the condition of a module. For example the module may be waiting for a link to
recover.
A transition is a change of state in response of an event.
Tommy Svensson
Alex Popescu
63
The first state created is automatically the initial state and indicated by a heavy black
arrow pointed towards it (figure 60). Any state can be changed to initial state by right
clicking on the state and choose Make Initial state in the pop-up menu.
Tommy Svensson
Alex Popescu
64
13) Create two transitions, one from idle state to tx_pkt state and the second one from
tx_pkt state to idle state. Use the create transition button.
14) Right click on the idle tx_pkt transition and select edit attributes.
15) Change the condition attribute to PKT_ARVL.
The finished configuration should look like in figure 62.
Tommy Svensson
Alex Popescu
65
The condition PKT_ARVL is the macro that just has been defined in the header block.
The next step is to create state executives needed in the FSM. OPNET allows one to
attach code to each part of an FSM. This code is called Proto-C. There are three primary
places to use Proto-C, namely:
Enter Executives: Code executed when the module moves into a state.
Exit Executives: Code executed when the module leaves a state.
Transition Executives: Code executed in response to a given event.
Although the enter executives and exit executives of forced states are executed without
interruption, standard practice is to place all forced state executives in the enter
executives block.
To bring up the enter executives editor one double clicks on the upper half of the state.
Double clicking on the lower half of the state will bring up the exit executives editor.
(figure 63)
Tommy Svensson
Alex Popescu
66
The max_packet_count variable is not yet defined. The variable will hold the maximum
number of packets to be processed in the simulation before it terminates. Variables can be
declared in two places. Variables declared in the temporary variables block do not
retain their values between invocations of the FSM. Variables declared in the state
variables block retain their values from invocation to invocation. The
max_packet_count variable value should be retained between invocations and therefore
declared in the state variable block.
Tommy Svensson
Alex Popescu
67
This value is set later in the simulation attributes. To be able to set the value at simulation
run-time it needs to be defined.
21) Select Interface Simulation Attributes and enter an attribute into the dialog
box table.
Tommy Svensson
Alex Popescu
68
The out_pkt variable is a packet pointer. This variable has not been declared yet. Since
the process model acquires packets from the generator stream and immediately transmits
them, it is not necessary to retain the packet pointer between process invocations. This
variable will be declared in the temporary variable block.
Enter the temporary variable block and state variables.
69
30) Verify that the Initial Value for each of the following attributes is set to disabled.
endsim intrpt
failure intrpts
intrpt interval
recovery intrpts
super priority
31) Verify that the Initial value of the priority attribute is 0.
32) Change the status attribute to hidden for all attributes
39) Create one bus transmitter by using the bus transmitter action button
Tommy Svensson
Alex Popescu
.
70
40) Connect the modules with packet streams using the packet stream action button.
41) Right click on the first processor module and select Edit attribites.
42) Set the name to gen and process model to simple_source.
The value for the generators interarrival time needs to be promoted to make it possible to
assign different values at simulation time.
43) Click on Packet Interarrival Time in the left column to highlight the Attribute
name, then right-click and select Promote Attribute to Higher Level from the
pop-up menu.
44) Click OK.
45) Right click on the second processor module and select Edit attributes
46) Set the name to tx_proc and process model to <initials>_aloha_tx.
47) Click OK.
48) Change the bus transmitters name to bus_tx.
Tommy Svensson
Alex Popescu
71
Double check the module connectivity to make sure all objects in the model has been
connected in the correct order.
49) Right click on the tx_proc module and choose Show Connectivity from the
Object pop-up menu. The objects should be connected as shown in figure 70.
Figure 70 Connectivity
Tommy Svensson
Alex Popescu
72
58) Right click on the initial state and choose Edit attributes.
59) Change the name to init and the status to forced. Click OK.
60) Right click on the second state and choose Edit attributes.
61) Change the name to idle and leave the status as unforced. Click OK.
62) Draw the transitions as shown below.
73
74
72) Open the function block and enter the following code.
/* This function gets the received packet, destroys it, */
/* and then logs the incremented received packet total. */
void proc_pkt ()
{
Packet* in_pkt;
/* Get packet from bus receiver input stream */
in_pkt = op_pk_get (IN_STRM);
/* Destroy the received packet */
op_pk_destroy (in_pkt);
/* Increment the count of received packets */
++rcvd_pkts;
}
/* This function writes the end-of-simulation channel */
/* traffic and channel throughput statistics to a */
/* scalar file */
void record_stats ()
{
/* Record final statistics */
op_stat_scalar_write ("Channel Traffic G",
(double) subm_pkts / op_sim_time ());
op_stat_scalar_write ("Channel Throughput S",
(double) rcvd_pkts / op_sim_time ());
}
The proc_pkt() function acquires each received packet as it arrives, destroys it, and
increments the count of received packets.
The record_stats() function is called when the simulation terminates.
The op_stat_scalar_write function sends the channel throughput and traffic data to a
scalar file that is specified in the simulation attributes.
The macro definitions and the functions have been defined. There is now a good idea to
change the transition conditions.
73) For the first transition between the states, change the condition attribute to
PKT_RCVD and the executive attribute to proc_pkt().
74) For the second transition between the states, change the condition attribute to
END_SIM and the executive attribute to record_stats().
75) For the first transition from idle back to itself, change the condition attribute to
PKT_RCVD and the executive attribute to proc_pkt().
76) For the second transition from idle back to itself, change the condition attribute to
default.
Tommy Svensson
Alex Popescu
75
77) For the third transition from idle back to itself, change the condition attribute to
END_SIM and the executive attribute to record_stats().
Define the process interfaces.
78) Select Interfaces Process Interfaces
79) Change the Initial value of the endsim intrpt attribute to enabled.
80) Change the status of all the attributes to hidden.
Tommy Svensson
Alex Popescu
76
88) Connect the two modules from the bus receiver to the processor by using a packet
stream.
89) Change the name of the processor to rx_proc and the name of the bus receiver to
bus_rx.
The finished configuration should look like the picture below:
90) Open the processors attribute dialog box and set the process model attribute to
<initials>_cct_rx. Close the dialog box when finished.
The interface attributes remains to be set before the node model is completed.
91) Select Interfaces Node Interfaces.
92) The supported value should be changed to no for the mobile and satellite types
in the Node types table.
Tommy Svensson
Alex Popescu
77
93) Further, in the Attributes table change the status to hidden for all the attributes.
94) Close the node model editor after saving the node model as <initials>_cct_rx.
Tommy Svensson
Alex Popescu
78
95) Select File New then choose Link model. Click OK.
This link model supports only the bus and bus tap types.
96) In the Link Types table, change the Supported value to no for the ptsimp and
ptdup types.
97) Save the file as <initials>_cct_link and close the Link Model Editor.
Tommy Svensson
Alex Popescu
79
Value
Default value: Create Empty Scenario
Office (Use Metric Units enabled)
700 m x 700 m
None
Check values, then click OK
In order to easily build your network, one needs a custom palette that contains the
necessary objects for your network.
101) Open the Object palette if its not already opened.
102) Click on the Configure Palette button.
103) Click on the Clear button in the Configure Palette dialog.
104) Click on the Node Models button and add <initials>_cct_tx and
<initials>_cct_rx from the list of available node models.
105) Click OK.
106) Click on the Link Models button and add <initials>_cct_link from the list of
available link models.
Tommy Svensson
Alex Popescu
80
Tommy Svensson
Alex Popescu
81
All the transmitter nodes have been created. The network needs a receiver node.
121) Click and drag the receiver node <initials>_cct_rx from the palette into the left
side of the tool area.
Tommy Svensson
Alex Popescu
82
Tommy Svensson
Alex Popescu
83
131) Set the value 1000 by replacing mean with the value. (see figure 79)
132) Repeate the last 2 steps to enter the following values: 200, 150, 100, 80, 50, 35,
30, 25, 20, 18,15
Tommy Svensson
Alex Popescu
84
If the output scalar file <initials>_cct_a does not exist when the simulation sequence
begins, it will be created so that scalar results may be recorded. If the file already exists,
the simulation executables will append their scalar results to this file. To avoid
viewing obsolete results which may already exist in a similarly named file, the output
scalar file <initials>_cct_a must be deleted if it exists.
139) Select File Model Files Delete Model Files....
A list of delete able file types appears.
140) Select the Output Scalars item.
A list of available scalar files appears.
141) If the list contains the output scalar file <initials>_cct_a, select the entry to
delete the file.
142) Close the open dialog boxes.
The simulation is now ready for execution.
143) Click on the Execute Simulation Sequence action button.
144) Click OK to confirm execution.
145) When the simulations are complete, close the Simulation Sequence dialog box
and the Simulation Sequence editor.
Aloha channel performance can be measured according to the number of successfully
received packets as a function of the number of packets submitted. In this network,
channel throughput is a typical measurement of network performance.
The results of each simulation are stored as two scalar values in the output scalar file.
That allows us to view the networks performance as a function of an input parameter
rather than a function of time. The channel throughput as a function of the channel traffic
across all simulations can be viewed in the Analysis Configuration Editor.
146) Select File New and then choose Analysis Configuration. Click OK.
147) Select File Load Output Scalar File.
148) Select <initials>_cct_a.
149) Click on the Create graph of two scalars file action button.
Tommy Svensson
Alex Popescu
85
Tommy Svensson
Alex Popescu
86
The Macro FREE makes the process verify that the channel is free before transmitting.
The Macro PKTS_QUEUED checks if the queue is empty.
The Macro CH_GOES_FREE keeps track of when the channel becomes empty and
ready for a new transmission.
157) Select File Save to save and exit the Header Block.
158) Now create a new state in the Process Model and name it wt_free.
159) Create a transition from wt_free to tx_pkt, and change the condition to
CH_GOES_FREE.
160) Create a transition from the wt_free state back to itself and set the condition to
default.
161) Create a transition from the idle state to wt_free and change the condition to
PKT_ARVL && !FREE.
Tommy Svensson
Alex Popescu
87
162) Add a transition from the idle state back to itself with a condition of default.
163) Change the condition on the transition from idle state to the tx_pkt state to
PKT_ARVL && FREE.
164) Change the unconditional transition from tx_pkt to idle to conditional by
setting the condition attribute to default.
165) Create a transition from tx_pkt back to itself, and set the condition to
PKTS_QUEUED && FREE.
166) Finally, create a transition from tx_pkt to wt_free and set the condition to
PKTS_QUEUED && !FREE.
The finished configuration should look like in the picture below.
88
Tommy Svensson
Alex Popescu
89
182) Right click on the tx_proc module and choose Edit attributes...
183) Change the process model attribute to <initials>_csma_tx. Click OK.
The processor now uses the CSMA process model created previously.
184) Select File Save As... and rename the model <initials>_cct_csma_tx.
185) Close the Node Editor.
Tommy Svensson
Alex Popescu
90
Tommy Svensson
Alex Popescu
91
Tommy Svensson
Alex Popescu
92
The goal is to compare the Aloha and CSMA protocols. The easiest way to do so is to
display both traces on the same graph.
Tommy Svensson
Alex Popescu
93
Tommy Svensson
Alex Popescu
94
224) Right-click on the multiple vector graph and select Edit Graph Properties.
Notice the pop-up menu of active traces in the top section of the dialog box.
Click and hold this menu to see the list of active traces. Both are named Channel
Throughput S. Which is the CSMA trace and which the Aloha trace?
In this pop-up menu, traces are listed in the order in which they were added to the multitrace graph. The first trace listed in the pop-up menu is the CSMA trace.
Change the labels for the CSMA trace.
225) Change the Custom Title to CSMA Channel Throughput.
Tommy Svensson
Alex Popescu
95
The CSMA protocol is shown to be superior to the Aloha protocol at all channel traffic
loads.
230) Close the graphs and the Analysis Configuration Editor.
Tommy Svensson
Alex Popescu
96
The bus_tx and bus_rx modules serve as the bus link interface. These modules are set to
transmit and receive at a data rate of 10 Mbits/second by default.
Tommy Svensson
Alex Popescu
97
Tommy Svensson
Alex Popescu
98
Tommy Svensson
Alex Popescu
99
245) Check the Apply Changes to Selected Objects check box. (figure 95)
246) Save the project with the default name. File Save.
The network model is completed. To gather the statistics of interest a probe model is
needed.
247) Select File New and choose probe model from the menu. Click OK.
The statistic of interest is the bus utilization.
248) Add a link statistic probe. Click on the add link statistic probe action button.
249) Choose network model to probe. Select Object Set Network Model.
250) Click on <initials>_ethernet-bus in the list.
Tommy Svensson
Alex Popescu
100
251) Right click on the link probe and select choose probed link.
252) Expand the tree and then select top.Office Network.bus 0. Click OK.
253) Right click on the link probe and choose edit attributes.
254) Set the name attribute to Bus Utilization.
255) Set the statistic attribute to bus.utilization.
256) Save the probe as <initials>_ethernet-probe.
The probe model is now completed. Proceed by executing the simulation.
257) In the project window, select Simulation Configure Discrete Event
Simulation (Advanced).
258) Right click on the scenario and select edit attributes.
259) In the common tab set:
Duration: 60 seconds
Seed: Any arbitrary integer.
260) In the advanced tab set:
Network: <initials>_ethernet-bus
Probe file: <initials>_ethernet-probe
Vector file: <initials>_ethernet-vector
261) Click on the Run action button to execute the simulation.
262) Close the simulation sequence window when the simulation is completed.
263) Open the Analysis Configuration tool. File New and then Analysis
Configuration.
264) Click on the create graph of a statistic action button.
265) Expand File statistic.<initials>_ethernet-vector.object statistics.Office
Network.bus_0 [0].bus.
266) Check the utilization statistic.
Tommy Svensson
Alex Popescu
101
Tommy Svensson
Alex Popescu
102
As you can see, the throughput after 30 seconds of simulation stabilizes near
5.5 Mbps/sec. This demonstrates the superiority of the carrier-sensing, collisiondetection, and backoff strategies used by Ethernet over the less sophisticated methods
used by the pure Aloha and CSMA protocols.
The lab is now completed.
Tommy Svensson
Alex Popescu
103
Laboratory 4
TCP simulation
Objective
The purpose of this lab is to demonstrate the functioning of TCP, and particularly the four
algorithms used for congestion control: slow start, congestion avoidance, fast retransmit
and fast recovery. The lab provides a number of scenarios to simulate and compare these
algorithms.
Overview
In this lab we will study TCPs four intertwined congestion control algorithms, namely:
slow start, congestion avoidance, fast retransmit and fast recovery.
The objectives are:
To study the behavior and implementation of slow start and congestion avoidance
algorithms.
To study modifications to the congestion avoidance algorithm, namely fast
retransmit and fast recovery.
Procedure
Slow start and congestion avoidance
Previous versions of TCP start a connection with the sender injecting multiple segments
into the network, up to the windows size advertised by the receiver. This is ok when the
hosts are placed on the same LAN. But if there are routers and slower links between the
sender and the receiver different problems can arise. Some intermediate router must
queue the packets and it is possible for the router to run out of space in the queue. The
algorithm to avoid this is called slow start.
Beginning transmission into a network with unknown conditions requires TCP to slowly
probe the network to determine the available capacity, in order to avoid congesting the
network with an inappropriate large burst of data.
Slow start adds another window to the senders TCP: the congestion window, called
cwnd. When a new connection is established with a host on another network, the
congestion window is initialized to one segment (typically 536 bytes or 512 bytes). The
sender starts by transmitting one segment and waiting for its ACK. When that ACK is
received, the congestion window is increased from one to two, and two segments can be
sent. When each of those two segments is acknowledged, the congestion window is
increased to four. This provides an exponential growth, although it is not exactly
exponential because the receiver may delay its ACKs, typically sending one ACK every
two segments that it receives. The sender can transmit up to the minimum of the
congestion window and the advertised window. The congestion window is flow control
Tommy Svensson
Alex Popescu
104
imposed by the sender, while the advertised window is flow control imposed by the
receiver.
At some point the capacity of the internet can be reached and an intermediate router will
start discarding packets. This tells the sender that its congestion window has gotten too
large.
Congestion avoidance is a way to deal with lost packets. Congestion can occur when data
arrives on a big pipe (a fast LAN) and outputs on a smaller pipe (a slower WAN).
Congestion can also occur when multiple input streams arrive at a router whose output
capacity is less than the sum of the inputs. There are two indications of packet loss at a
sender: a timeout occurring and the receipt of duplicate ACKs. However, the overall
assumption of the algorithm is that packet loss caused by damage is very small (much
less than 1%), therefore the loss of a packet signals congestion somewhere in the network
between the source and destination.
Although congestion avoidance and slow start are independent algorithms with different
objectives, in practice they are implemented together. When congestion occurs TCP must
slow down its transmission rate of packets into the network, and then invokes slow start
to get things going again. [3]
The combined congestion avoidance and slow start algorithms require that two variables
are maintained for each connection:
Tommy Svensson
Alex Popescu
105
was when congestion occurred, and then congestion avoidance takes over. This is done
due to the recorded half of the window size that caused the problem.
As mentioned earlier slow start increases congestion window (cwnd) exponentially.
Congestion avoidance on the other hand dictates that congestion window (cwnd) be
incremented by segsize * segsize / cwnd each time an ACK is received, where segsize is
the segment size and cwnd is maintained in bytes. This results in a linear growth of
cwnd, compared to slow starts exponential growth. The increase in cwnd should be at
most one segment each round-trip time (regardless how many ACKs are received in
that RTT) whereas slow start increments cwnd by the number of ACKs received in a
round-trip time. [2]
Tommy Svensson
Alex Popescu
106
107
Attribute
Command Mix (Get/Total)
Inter-Request Time (seconds)
File Size (bytes)
Symbolic Server Name
Type of service
RSVP Parameters
Back-End Custom Application
Value
100%
constant (3600)
constant (9000000)
FTP Server
Best Effort (0)
None
Not Used
108
Tommy Svensson
Alex Popescu
109
Tommy Svensson
Alex Popescu
110
Tommy Svensson
Alex Popescu
111
112
Tommy Svensson
Alex Popescu
113
Tommy Svensson
Alex Popescu
114
Choose Statistics
79) Enter the Paris Subnet.
80) Right click on Server_Paris and select Choose Indivitual Statistics from
the pop-up menu.
81) Expand Node Statistics TCP Connection and select Congestion
Windows Size (bytes)
82) Right click on the Congestion Window Size (bytes) and select Change
Collection mode.
83) Check the Advanced checkbox in the pop-up dialog.
84) Change Capture mode to all values.
85) Click OK to close the dialog.
Tommy Svensson
Alex Popescu
115
Tommy Svensson
Alex Popescu
116
Tommy Svensson
Alex Popescu
117
Fast retransmit
Fast retransmit is a modification to the congestion avoidance algorithm.
The TCP sender should use fast retransmit algorithm to detect and repair loss, based on
incoming duplicate ACKs. The fast retransmit algorithm uses the arrival of 3 duplicate
ACKs (4 identical ACKs without the arrival of any other intervening packets) as an
indication that a segment has been lost. After receiving 3 duplicate ACKs, TCP
performs a retransmission of what appears to be the missing segment, without waiting for
the retransmission timer to expire. The fast retransmit algorithm first appeared in the
4.3BSD Tahoe release.
Fast recovery
Congestion avoidance without slow start is performed after fast retransmit sends what
appears to be the missing segment. It is an improvement that allows high throughput
under moderate congestion, especially for large windows.
In this case the reason for not performing slow start is that the receipt of duplicate
ACKs tells TCP that more than just one packet has been lost. Since the receiver can
only generate the duplicate ACK when another segment is received, that segment has left
the network and is in the receivers buffer. In other words there is still data flowing
between the two ends, and TCP does not want to reduce the flow abruptly by going into
slow start. The fast recovery algorithm appeared in the 4.3BSD Reno release.
The fast retransmit and fast recovery algorithms are usually implemented together as
follows:
a) When the third duplicate ACK is received, set ssthresh to no more than one-half the
current congestion window, cwnd, but no less than two segments. Retransmit the missing
segment, and then set cwnd to ssthresh plus 3 times the segment size. This increases the
congestion window by the number of segments that have left the network and which the
other end has cached.
b) Each time another duplicate ACK arrives, increment cwnd by the segment size. This
inflates the congestion window for the additional segment that has left the network.
c) Transmit a segment (packet) if allowed by the new value of cwnd and the receivers
advertised window.
d) When the next ACK arrives that acknowledges new data, set cwnd to ssthresh. This
ACK should be the acknowledgment of the retransmission from step a, one round-trip
time after the retransmission. Additionally, this ACK should acknowledge all the
intermediate segments sent between the lost packet and the receipt of the first duplicate
ACK. This step is congestion avoidance, since TCP is down to one-half the rate it was at
when the packet was lost.
Tommy Svensson
Alex Popescu
118
119
View results
117) Right click on the workspace and choose Compare Results.
118) Expand Object statistics Choose From Maps Network Paris
Server Paris TCP Connection.
119) Check Congestion Window size (bytes).
120) Select Statistics Stacked in the bottom left roll-down menu.
Tommy Svensson
Alex Popescu
120
The first graph illustrates the NoDrop scenario which has no packet loss.
Tommy Svensson
Alex Popescu
121
The second graph illustrates the Tahoe scenario which has 0.5% packet loss. When
congestion is indicated by a timeout, cwnd is set to one segment. In other words, slow
start is performed.
The third graph illustrates the Reno scenario which also has 0.5% packet loss. The
congestion window size does not drop to zero as in the Tahoe graph. Fast recovery is
performed instead of slow start.
The lab is completed.
Tommy Svensson
Alex Popescu
122
Laboratory 5
OSPF simulation
Objective
The purpose of this lab is to demonstrate the behavior of OSPF routing protocol.
Overview
In this lab we will study the OSPF routing protocol. The objective is to construct a
network and configure it with all the necessary parameters for OSPF routing. Using this
network we will analyze the behavior of the OSPF routing protocol.
Procedure
The Open Shortest Path First (OSPF) protocol is an interior gateway protocol (IGP) used
for routing in Internet Protocol (IP) networks. As a link state routing protocol, OSPF is
more robust against network topology changes than distance vector protocols such as
RIP, IGRP, and EIGRP. OSPF can be used to build large scale networks consisting of
hundreds or thousands of routers.
Open Shortest Path First (OSPF) uses the Dijkstras algorithm to compute the shortest
path to a destination. The algorithm calculates the shortest path to each destination based
on the cumulative cost required to reach that destination. The cumulative cost is a
function of the cost of the various interfaces needed to be traversed in order to reach that
destination.
The cost (or the metric) of an interface in OSPF is an indication of the overhead required
to send packets across that interface. The cost of an interface is calculated based on the
bandwidth -- it is inversely proportional to the bandwidth of that specific interface (i.e., a
higher bandwidth indicates a lower cost). For example, the cost of a T1 interface is much
higher than the cost of a 100Mbit Ethernet interface because there is more overhead (e.g.,
time delays) involved in crossing a T1 interface.[5]
Characteristic features of OSPF
Link State Based
Runs directly over IP
Interior or border gateway protocol
Multiple paths to each destination. Load balancing.
Link-attribute based costing. Costing is statically assigned.
[6]
Tommy Svensson
Alex Popescu
123
9. Click OK.
10. Place ten slip8_gtwys in the workspace as in figure 117.
11. Change the object palette to internet_toolbox.
12. Connect all the routers using PPP_DS3 link as in figure 117.
Tommy Svensson
Alex Popescu
124
13. Rename all the routers as in figure 117. Right click on each router and
select Set Name from the pop up menu.
Tommy Svensson
Alex Popescu
125
Method
Characteristics
When to Use
Protocols IP
Routing Configure
Routing Protocols menu
operation
In most cases.
IP Routing Parameters
Interface Information
Routing Protocols
IP Dynamic Routing
Protocol simulation
attribute
The easiest way to designate routing protocols is the Configure Routing Protocols
operation from the Protocols IP Routing menu. This operation has the same effect
as manually setting the interface routing protocol attributes, but with the added advantage
of being able to configure multiple interfaces at the same time. The previous setting on
the interface is overwritten each time this operation is used.
1. Open the Protocols IP Routing Configure Routing Protocols
menu.
Tommy Svensson
Alex Popescu
126
Tommy Svensson
Alex Popescu
127
A Routing Domain Legend appears in the bottom left corner on the workspace. All links
should have a green O attached to it. This indicates that OSPF routing protocol is used
over that link. Figure 119.
Tommy Svensson
Alex Popescu
128
Tommy Svensson
Alex Popescu
129
B. Globally for all interfaces: If wanted to change the interface cost across all
interfaces, then, rather than individually setting them on each interface, one can
use the model-wide cost configuration option using the following menu option:
Protocols OSPF Configure Interface Cost. This operation will allow for
choosing one of the following two cost configuration options:
B1) The Reference Bandwidth will be set for all routers. All interfaces will be
set with a cost value of Auto Calculate.
B2) All interfaces will be set with the specified cost value. The
interface/bandwidth settings will be ignored.
In this lab we use different bandwidths on the links to set different costs.
1. Select the links between:
Router A Router B
Router B Router D
Router D Router C
Router C Router A
Router B Router C
by shift clicking on them.
2. Open the Configure Interface Metric Information dialog. Protocols IP
Routing Configure Interface Metric Information.
3. Set the Bandwidth value to 5000 kbps.
4. Select Interfaces across selected links radio button. Click OK.
5. Select the links between:
Router B Router E
Router E Router G
Router I Router F
Router F Router D
Router E Router F
by shift clicking on them.
Tommy Svensson
Alex Popescu
130
Tommy Svensson
Alex Popescu
131
Configure Simulation
1.
2.
3.
4.
Areas scenario
The major addition in OSPF configuration, relative to other protocols, is that the OSPF
routing domain can be divided into smaller segments called areas. This reduces memory
and computational load on the routers. Each area is numbered and there must always be
an area zero, which is the backbone. All other areas attach to the backbone either
directly or via virtual links. An area should contain no more than about 50-100 routers
for optimum performance. A router that connects to more than one area is called an Area
Border Router (ABR).
1. Duplicate the scenario. Scenarios Duplicate scenario
2. Name the scenario Areas.
Partition the network into areas. This is a physical partitioning in the sense that an
interface can belong to only one area. The distinct interfaces of the same router may still
belong to separate areas.
Tommy Svensson
Alex Popescu
132
Balanced Scenario
Load balancing is a concept that allows a router to take advantage of multiple best paths
(routes) to a given destination. If two routes to the same destination have the same cost,
the traffic will be distributed half to each.
Tommy Svensson
Alex Popescu
133
Tommy Svensson
Alex Popescu
134
Tommy Svensson
Alex Popescu
135
6.
7.
8.
9.
Tommy Svensson
Alex Popescu
136
Areas scenario
1. Switch to the Areas scenario. Scenarios Switch to Scenario Areas.
2. Open the Route Report for IP Traffic Flows dialog. Protocols IP
Demands Display Routes for Configured Demands
3. Expand Sources Router B Router D.
4. Select Router B Router D.
5. Change the Display attribute to Yes.
The traffic flow should look like figure 130.
Tommy Svensson
Alex Popescu
137
Balanced scenario
1. Switch to the Balanced scenario. Scenarios Switch to Scenario Balanced.
2. Open the Route Report for IP Traffic Flows dialog. Protocols IP Demands
Display Routes for Configured Demands
3. Expand Sources Router C Router J.
4. Select Router C Router J.
5. Change the Display attribute to Yes.
Tommy Svensson
Alex Popescu
138
Laboratory 6
Queuing policies
Objective
The purpose of this lab is to demonstrate the behavior of different queuing disciplines.
Overview
In this lab we will look at one aspect of the DS (Differentiated Services) architecture
which is queue management and traffic shaping. The simulation package OPNET has
been used in this study. Based on the DS value, packets may be put in separate queues,
and various forwarding policies can be used to favor high priority packets in different
ways. The policies that are studied here are: FIFO (First In First Out), PQ (Priority
Queuing), WFQ (Weighted Fair Queuing).
Procedure
Originally, the Internet was designed for data processing applications where delays were
relatively unimportant. In most cases a best effort delivery service was adequate, and in
case of loss or corruption of data, the TCP protocol would take care of the necessary
retransmission and recovery. Nowadays these requirements have been changed due to the
growth of multimedia application which are bandwidth hungry and require megabits per
second rather than the kilobits per second required for traditional data processing
applications. Todays application are more or less sensitive for the delays experienced
when transmitting over Internet. It is therefore important to keep track of the delay and
delay variation or jitter and insure that they dont grow to big. There is thus a need to
support a variety of traffic with different quality of service (QoS). The central issue is
how to share available resources in times of congestion. For doing this, diverse
mechanisms are needed to differentiate between different types of traffic (priority).
Tommy Svensson
Alex Popescu
139
Copy files
1. Copy the model files from the CD-ROM and place them on the hard drive.
2. Edit the Opnet environment file, env_db9.0. On Windows XP it is located in
C:\Documents and Settings\<profile>\op_admin
3. Add the path where the files are placed to mod_dirs.
Tommy Svensson
Alex Popescu
140
FIFO queuing
First-in-first-out (FIFO) is the simplest type of queuing. The incoming packets are placed
in a single queue and are served in the order as they where received. This queuing policy
requires very little computation and its behavior is very predicable, i.e. packet delay is a
direct function of the queue size.
There are many undesirable properties related to this queuing policy, due to the simplistic
nature.
It is impossible to offer different services for different packet classes since all
packets are inserted into the same queue.
If an incoming flow suddenly becomes bursty, then it is possible for the entire
buffer space to be filled by this single flow and other flows will not be serviced
until the buffer is emptied.
Tommy Svensson
Alex Popescu
141
9. Click SAVE in the Configure Palette dialog. Use the default filename.
10. Click OK to close the Configure Palette dialog.
11. Click and drag ta_fifo node model from the Object palette to the workspace.
12. Right click on node model in the workspace and choose set name. Set the name
to fifo_infinite_buffer.
13. Double click on the fifo node model.
The node model that appears should resemble the one in figure 135.
The model has three packet sources which generates packets to the fifo_queue. The
packets in the queue are served by fifo (First In First Out) queue discipline and sent to the
sink, where they are destroyed.
Tommy Svensson
Alex Popescu
142
Tommy Svensson
Alex Popescu
143
Tommy Svensson
Alex Popescu
144
Duplicate scenario
26. Duplicate the scenario. Choose scenarios duplicate Scenario (Figure 139)
or use shortcut key Ctrl + Shift + D.
Tommy Svensson
Alex Popescu
145
Collect statistics
32. Right click on the fifo node.
33. Select Choose individual statistics.
34. Expand Module statistics fifo_queue queue.
35. Check overflow, queue size and queue delay statistics.
36. Right click on the overflow statistic and choose Change collection mode.
146
Tommy Svensson
Alex Popescu
147
Tommy Svensson
Alex Popescu
148
Figure 147 - Fifo Queue size (packet) for infinite and finite buffers
Tommy Svensson
Alex Popescu
149
Figure 148 - Fifo queue delay for infinite and finite buffers
Tommy Svensson
Alex Popescu
150
Tommy Svensson
Alex Popescu
151
Priority queuing
A simple way of offering different services to different classes of packets is Priority
Queuing. Its operation involves classifying each incoming packet into different priorities
and placing them into separate queues accordingly. The packets that have the highest
priority are transmitted on the output port before the packets with lower priority. Even
though this queuing policy is a good way of providing differentiated service, it also has
some shortcomings, like large continuous flow of high priority traffic into the queue,
equals excessive delay, and perhaps even service starvation for lower priority packets.
Further, in our case we make use of both a non-preemptive priority network and a
preemptive priority network. The difference between a so-called non-preemptive priority
queuing discipline and a preemptive priority queuing discipline is that the transmission of
a packet in a non-preemptive queuing discipline is not interrupted once it has begun.
5.
6.
7.
8.
9.
Tommy Svensson
Alex Popescu
152
Tommy Svensson
Alex Popescu
153
25. Set:
Processing_rate to 30000
Subqueue rows to 3
Subqueue row 0 bit capacity to infinity
Subqueue row 0 pk capacity to infinity
Subqueue row 1 bit capacity to infinity
Subqueue row 1 pk capacity to infinity
Subqueue row 2 bit capacity to infinity
Subqueue row 2 pk capacity to infinity
Tommy Svensson
Alex Popescu
154
Tommy Svensson
Alex Popescu
155
Tommy Svensson
Alex Popescu
156
Tommy Svensson
Alex Popescu
157
Tommy Svensson
Alex Popescu
158
61. Choose Statistics Overlaid and time_average in the pull down menus at the
bottom.
Tommy Svensson
Alex Popescu
159
Tommy Svensson
Alex Popescu
160
65. Choose Statistics Overlaid and time_average in the pull down menus at the
bottom.
Tommy Svensson
Alex Popescu
161
Tommy Svensson
Alex Popescu
162
163
Tommy Svensson
Alex Popescu
164
99. Choose Statistics Overlaid and differentiator in the pull down menus at the
bottom.
Tommy Svensson
Alex Popescu
165
Tommy Svensson
Alex Popescu
166
103. Choose Statistics Overlaid and differentiator in the pull down menus at the
bottom.
167
Tommy Svensson
Alex Popescu
168
Tommy Svensson
Alex Popescu
169
9. Click OK.
10. Click Save and use the default filename.
11. Click OK.
12. Click on ta_wfq_node_model in the object palette and drag it into the workspace.
13. Right click on the node and choose Set name.
14. Set the name wfq and click OK.
15. Enter the wfq node. Double click on it.
16. Right click on source_1 and choose Edit Attributes
ia_time to 1
17. Set
instruction_range to 1
priority_range to 0
18. Click OK.
19. Right click on source_2 and choose Edit Attributes
ia_time to 1
20. Set
instruction_range to 1
priority_range to 1
21. Click OK.
22. Right click on source_3 and choose Edit Attributes
ia_time to 1
23. Set
instruction_range to 9600
priority_range to 2
24. Click OK.
25. Right click on wfq_queue and choose Edit Attributes
processing_rate to 30000
26. Set
queue_weight0 to 50
queue_weight1 to 30
queue_weight2 to 20
27. Set the rows attribute value to 3
28. Set
Row 0 Bit capacity to infinity.
Tommy Svensson
Alex Popescu
170
Tommy Svensson
Alex Popescu
171
Tommy Svensson
Alex Popescu
172
Tommy Svensson
Alex Popescu
173
Tommy Svensson
Alex Popescu
174
Tommy Svensson
Alex Popescu
175
Tommy Svensson
Alex Popescu
176
Tommy Svensson
Alex Popescu
177
Laboratory 7
Self-Similar
Objective
The purpose of this lab is to understand self-similarity on physical grounds in a realistic
network environment. This understanding is important when developing efficient and
integrated network frameworks within which end-to-end QoS guarantees are fully
supported.
Overview
Self-similar traffic has been shown to exist in networks and it seems to be a ubiquitous
phenomenon that is independent of technology, protocol and environment.
In this laboratory moment we will study and compare the performance of an Ethernet
segment run with heavy-tail traffic and with exponential traffic. The performance
parameters considered here are link utilization and e2e delay. The laboratory moments
are as follows:
Creation of the network model
Running the simulation with different ON-OFF models
Plotting and comparing the results
Tommy Svensson
Alex Popescu
178
Procedure
A self-similar phenomenon represents a process displaying structural similarities across a
wide range of scales of a specific dimension. In other words, the reference structure is
repeating itself over a wide range of scales and the (main) statistics of the process do not
change. However, these properties do not hold indefinitely for real phenomena and at
some point, this structure breaks down. Self-similarity can therefore be associated with
fractals which are objects with unchanged appearances over different scales.
A stochastic process is called fractal when a number of relevant statistics exhibit scaling
with related scaling exponents. Since scaling leads mathematically to power-law
relationships in the scaled quantities the conclusion is therefore that the traffic shows
fractal properties when several estimated statistics exhibit power-law behaviour over a
wide range of time scales [8].
A continuous-time stochastic process X(t) is considered to be statistical self-similar with
parameter H(0.5 H 1.0) if, for any real positive a, the process a-Hx(at) has the same
statistical properties as x(t). This relationship may be expressed by the following three
conditions:
E[x(t)] = E[x(at)] / aH
mean
variance
autocorrelation
The parameter H is known as the Hurst parameter, or the self-similarity meter, and it is a
key measure of self-similarity. More precisely H is a measure of the persistence of a
statistical phenomenon and it is the measure of the length of the long-range dependence
of a stochastic process. A value of H=0.5 indicates the absence of long-range
dependence. The closer H is to 1 the greater the degree of persistence or long-range
dependence.
Tommy Svensson
Alex Popescu
179
10. Name the first node model PowOn-PowOff source and the second one PowOnPowOff receiver. Right click and choose Set Name.
11. Change the Object palette to ethernet_advanced. Figure 183.
Tommy Svensson
Alex Popescu
180
13. Name the first node model Exponential source and the second one
Exponential_receiver. Right click and choose Set Name.
14. Place two ethernet16_hub_adv in the workspace.
15. Name the first hub PowON-PowOFF Hub and the second hub Exponential
Hub. Right click and choose Set Name.
16. Use 10BaseT_int link model to the following connections.
PowOn-PowOff_source PowON-PowOFF Hub
PowON-PowOFF Hub PowOn-PowOff receiver
Exponential source Exponential Hub
Exponential Hub Exponential_receiver
Tommy Svensson
Alex Popescu
181
Tommy Svensson
Alex Popescu
182
183
Tommy Svensson
Alex Popescu
184
Tommy Svensson
Alex Popescu
185
Tommy Svensson
Alex Popescu
186
Tommy Svensson
Alex Popescu
187
Tommy Svensson
Alex Popescu
188
44. Right click on the workspace and choose Select Individual Statistics.
45. Expand Node statistics Ethernet.
46. Choose Delay (sec) and Utilization statistics.
Tommy Svensson
Alex Popescu
189
Tommy Svensson
Alex Popescu
190
Tommy Svensson
Alex Popescu
191
Tommy Svensson
Alex Popescu
192
Tommy Svensson
Alex Popescu
193
Tommy Svensson
Alex Popescu
194
Conclusions throughput
ExpON-PowOff
Fluctuations are much higher at traffic with heavytail than at traffic with exponential
only.
Exponential
Average throughput is more variable at ExpOn-PowOff. It is seen that OFF is heavytail.
Conclusions delay
ExpON-PowOff
It is clear that we have PowOff, long periods with very small delays
Exponential
It is clear that it is exponential only, small variations.
Tommy Svensson
Alex Popescu
195
Concluding Remarks
This thesis consists of five laboratory exercises that cover a range of important topics in
networking and telecommunications. The students are provided an opportunity to
experience the behavior of different networks and protocols but also a chance to learn the
basic procedures of network simulation by using the OPNET Modeler simulation
environment.
This is today the most cost effective solution for universities to demonstrate the behavior
of different networks and protocols.
Acknowledgments
We would like to take this opportunity and thank the Department of
Telecommunications and Signal Processing at the Blekinge Institute of Technology.
We would also especially like to thank Prof: Arne Nilsson and Docent: Adrian Popescu
for giving us the opportunity to work with such interesting and challenging topics.
Finally we would like to give special thanks to the Ph.D. students: Doro Constantinescu,
Dragos Ilie, David Erman and Lennart Isaksson for their help and support.
Tommy Svensson
Alex Popescu
196
Glossary
ACK - Acknowledge
ATM Asynchronous Transfer Mode
CSMA - Carrier Sensing Multiple Access
CSMA-CD - Carrier Sensing Multiple Access with Collision Detection
cwnd - congestion window
EIGRP Enhanced Interior Gateway Routing Protocol
E-mail Electronic mail
FIFO First in First Out
FSM - Finite State Machines
FTP File Transfer Protocol
IGP Interior Gateway Protocol
IGRP Interior Gateway Routing Protocol
IP Internet Protocol
LAN Local Area Network
M/M/1 Markov/Markov/1 queue
MAC - Medium Access Control
MPLS Multiprotocol Label Switching
OPNET - Optimized Network Engineering Tools
OSPF Open Shortest Path First
RIP Routing Internet Protocol
RTT Round Trip Time
Segsize Segment Size
SMSS - Sender Maximum Segment Size
ssthresh - slow start threshold
TCP Transmission control protocol
WAN Wide Area Network
Tommy Svensson
Alex Popescu
197
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
Tommy Svensson
Alex Popescu
198
Appendix 1
/* Process model C form file: jsd_prio.pr.c */
/* This variable carries the header into the object file */
static const char jsd_prio_pr_c [] = "MIL_3_Tfile_Hdr_ 90A 30A modeler 7
3F55FAD2 3F55FAD2 1 its-2503-5 exjobb 0 0 none none 0 0 none 0 0 0 0 0 0
";
#include <string.h>
/* atoi(), atof() */
typedef struct {
int
job_type;
double
job_size;
} JsdT_Job_Desc;
#define QUEUE_EMPTY
#define ARRIVAL
#define SVC_COMPLETION
op_q_empty ()
op_intrpt_type () == OPC_INTRPT_STRM
op_intrpt_type () == OPC_INTRPT_SELF
#define GET_INST_SUCCESS
get_instructions () function */
#define GET_INST_NO_JOB_TYPE -1
#define GET_INST_NO_JOB_TABLE -2
#define GET_INST_NO_ENTRY
-3
#include "jsd_win_avg.ex.h"
int
void
jsd_prio_get_instructions ();
jsd_prio_error ();
199
((jsd_prio_state*)
pr_state_ptr->server_busy
pr_state_ptr->table_exists
pr_state_ptr->num_lines
pr_state_ptr->processing_rate
pr_state_ptr->last_update_time
pr_state_ptr->total_busy_time
pr_state_ptr->work_left_last
pr_state_ptr->total_work
pr_state_ptr->total_delay
pr_state_ptr->num_pks_serviced
pr_state_ptr->win_size
pr_state_ptr->Util_Stat_Hndl
200
pr_state_ptrpr_state_ptr->own_id
pr_state_ptr->svc_complete
pr_state_ptr->Job_Desc_Table
pr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptr-
Tommy Svensson
Alex Popescu
201
}
void
jsd_prio_error (msg)
char*
msg;
{
/** Print an error message and exit the simulation. **/
FIN (jsd_prio_error (msg));
op_sim_end ("Error in JSD priority process (jsd_prio):",
msg, OPC_NIL, OPC_NIL);
FOUT;
}
/* End of Function Block */
/* Undefine optional tracing in FIN/FOUT/FRET */
/* The FSM has its own tracing code and the other */
/* functions should not have any tracing.
*/
#undef FIN_TRACING
#define FIN_TRACING
#undef FOUTRET_TRACING
#define FOUTRET_TRACING
#if defined (__cplusplus)
extern "C" {
#endif
void jsd_prio (void);
Compcode jsd_prio_init (void **);
void jsd_prio_diag (void);
void jsd_prio_terminate (void);
void jsd_prio_svar (void *, const char *, char **);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif
202
pkptr;
low_pkptr;
orig_id;
orig_port;
insert_ok;
svc_time_determined;
success_code;
i;
pkid;
num_pkts;
position;
sub_q_no;
pk_instructions;
pk_svc_time;
low_pk_svc_time;
time_in_processor;
svc_start;
original_svc_time;
processing_delay;
mean_util;
avg_throughput;
mean_proc_delay;
Objid
Objid
char
char*
int
int
double
double
job_type_table_id;
line_id;
err_str [256];
line;
dval;
job_type;
instructions;
pk_prio;
FSM_ENTER (jsd_prio)
-----*/
FSM_BLOCK_SWITCH
{
/*----------------------------------------------------
203
*/
if (op_ima_obj_attr_get (own_id,
"processing_rate", &processing_rate) == OPC_COMPCODE_FAILURE)
jsd_prio_error ("Unable to get processing
rate from attribute.");
windowed stats. */
stats. */
204
execs]")
exit execs]")
205
server_busy);
Tommy Svensson
Alex Popescu
206
*/
*/
input stream.");
incoming packet. **/
we can
it.
*/
*/
the packet. */
Tommy Svensson
Alex Popescu
207
success_code = jsd_prio_get_instructions
/* If the number of instructions was
*/
/* compute the service time of the packet.
*/
successfully determined,
if (success_code == GET_INST_SUCCESS)
{
pk_svc_time = pk_instructions /
processing_rate;
previously set,
*/
reference.
*/
if (op_pk_nfd_set (pkptr,
"svc_time", pk_svc_time) == OPC_COMPCODE_FAILURE)
jsd_prio_error ("Unable to set
service time in packet.");
/* Set a success flag to be used
later. */
else
svc_time_determined = 1;
}
{
/* It was not possible to get the
number of instructions from the packet. */
svc_time_determined = 0;
determine mumber of instructions.");
deallocate the packet. */
the packet and continuing.");
the packet. */
if (op_pk_nfd_set (pkptr,
"svc_time_remain", pk_svc_time) == OPC_COMPCODE_FAILURE)
jsd_prio_error ("Unable to set
remaining service time in packet.");
Tommy Svensson
Alex Popescu
208
*/
type is double! */
/*
pk_prio=op_pk_priority_get (pkptr);
*/
lowest priority. */
else
inserted packet to
*/
*/
statistical use.
work_left_last += pk_svc_time;
}
{
/* Insertion was successful */
insert_ok = 1;
/* Add the service time of the
*/
*/
{
/* Insertion was successful */
insert_ok = 1;
/* Add the service time of the
else
inserted packet to
insert_ok = 0;
}
work_left_last += pk_svc_time;
}
210
-----------*/
OPC_QPOS_HEAD);
at head of subqueue.");
packet. */
if (pkptr == OPC_NIL)
jsd_prio_error ("Unable to access packet
/* Extract the remaining service time of the
Tommy Svensson
Alex Popescu
211
completing service.
the service */
Tommy Svensson
Alex Popescu
212
position);
(pkptr) == pkid)
success_code=1;
break;
}
}
if (success_code==1)
break;
}
in fact obtained. */
if (position == num_pkts)
op_sim_message ("Error: could not find
packet in queue at svc_comp state.", "");
else
{
/* Extract the packet just finishing
service.
*/
pkptr = op_subq_pk_remove (sub_q_no,
position);
if (pkptr == OPC_NIL)
jsd_prio_error ("Unable to get
packet from subqueue.");
Tommy Svensson
Alex Popescu
213
*/
*/
processing_delay = time_in_processor -
original_svc_time;
*/
op_stat_write (inst_delay_shandle,
processing_delay);
*/
*/
*/
Tommy Svensson
Alex Popescu
214
op_stat_write (avg_thruput_shandle,
/* Convert the job packet to a job
completion ack. */
OPC_COMPCODE_FAILURE)
*/
originator. */
}
FSM_PROFILE_SECTION_OUT ("jsd_prio [svc_comp
enter execs]", state4_enter_exec)
/** state (svc_comp) exit executives **/
FSM_STATE_EXIT_FORCED (4, "svc_comp", "jsd_prio
[svc_comp exit execs]")
FSM_PROFILE_SECTION_IN ("jsd_prio [svc_comp exit
execs]", state4_exit_exec)
{
}
FSM_PROFILE_SECTION_OUT ("jsd_prio [svc_comp
exit execs]", state4_exit_exec)
/** state (svc_comp) transition processing **/
FSM_PROFILE_SECTION_IN ("jsd_prio [svc_comp trans
conditions]", state4_trans_conds)
FSM_INIT_COND (!QUEUE_EMPTY)
FSM_DFLT_COND
FSM_TEST_LOGIC ("svc_comp")
FSM_PROFILE_SECTION_OUT ("jsd_prio [svc_comp trans
conditions]", state4_trans_conds)
FSM_TRANSIT_SWITCH
{
Tommy Svensson
Alex Popescu
215
FSM_EXIT (0,jsd_prio)
}
216
FRET (OPC_COMPCODE_SUCCESS)
}
void
jsd_prio_diag (void)
{
/* No Diagnostic Block */
}
void
jsd_prio_terminate (void)
{
int _block_origin = __LINE__;
FIN (jsd_prio_terminate (void))
Vos_Catmem_Dealloc (pr_state_ptr);
FOUT
}
/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in jsd_prio_svar function. */
#undef server_busy
#undef table_exists
#undef num_lines
#undef processing_rate
#undef last_update_time
#undef total_busy_time
#undef work_left_last
#undef total_work
#undef total_delay
#undef num_pks_serviced
#undef win_size
#undef Util_Stat_Hndl
#undef Work_Left_Stat_Hndl
#undef own_id
#undef svc_complete
#undef Job_Desc_Table
#undef busy_signal_shandle
#undef inst_delay_shandle
#undef inst_wk_left_shandle
#undef normalized_delay_shandle
#undef mean_util_shandle
#undef avg_thruput_shandle
#undef mean_delay_shandle
Tommy Svensson
Alex Popescu
217
218
if
if
if
if
if
if
if
if
if
if
if
Tommy Svensson
Alex Popescu
219
Tommy Svensson
Alex Popescu
220
Appendix 2
/* Process model C form file: jsd_prmpt_res.pr.c */
/* This variable carries the header into the object file */
static const char jsd_prmpt_res_pr_c [] = "MIL_3_Tfile_Hdr_ 90A 30A
modeler 7 3EF9869E 3EF9869E 1 its-2503-5 exjobb 0 0 none none 0 0 none 0
0 0 0 0 0
";
#include <string.h>
/* atof(), atoi() */
typedef struct {
int
job_type;
double
job_size;
} JsdT_Job_Desc;
#define QUEUE_EMPTY
#define ARRIVAL
#define SVC_COMPLETION
op_q_empty ()
op_intrpt_type () == OPC_INTRPT_STRM
op_intrpt_type () == OPC_INTRPT_SELF
#define GET_INST_SUCCESS
get_instructions () function */
#define GET_INST_NO_JOB_TYPE -1
#define GET_INST_NO_JOB_TABLE -2
#define GET_INST_NO_ENTRY
-3
#include "jsd_win_avg.ex.h"
static int jsd_prmpt_res_get_instructions (Packet * pkptr, double *
pk_inst_ptr);
static void jsd_prmpt_res_error (const char * msg);
/* End of Header Block */
Tommy Svensson
Alex Popescu
221
Tommy Svensson
Alex Popescu
Work_Left_Stat_Hndl;
own_id;
svc_complete;
Job_Desc_Table;
job_type_table_id;
busy_signal_shandle;
inst_delay_shandle;
inst_wk_left_shandle;
normalized_delay_shandle;
mean_util_shandle;
avg_thruput_shandle;
mean_delay_shandle;
current_subq;
((jsd_prmpt_res_state*)
pr_state_ptr->server_busy
pr_state_ptr->table_exists
pr_state_ptr->num_lines
pr_state_ptr->processing_rate
222
pr_state_ptr->current_priority
#define last_update_time
#define total_busy_time
#define work_left_last
#define total_work
#define total_delay
#define num_pks_serviced
#define win_size
#define Util_Stat_Hndl
#define Work_Left_Stat_Hndl
>Work_Left_Stat_Hndl
#define own_id
#define svc_complete
#define Job_Desc_Table
#define job_type_table_id
>job_type_table_id
#define busy_signal_shandle
>busy_signal_shandle
#define inst_delay_shandle
>inst_delay_shandle
#define inst_wk_left_shandle
>inst_wk_left_shandle
#define normalized_delay_shandle
>normalized_delay_shandle
#define mean_util_shandle
>mean_util_shandle
#define avg_thruput_shandle
>avg_thruput_shandle
#define mean_delay_shandle
>mean_delay_shandle
#define current_subq
pr_state_ptr->last_update_time
pr_state_ptr->total_busy_time
pr_state_ptr->work_left_last
pr_state_ptr->total_work
pr_state_ptr->total_delay
pr_state_ptr->num_pks_serviced
pr_state_ptr->win_size
pr_state_ptr->Util_Stat_Hndl
pr_state_ptrpr_state_ptr->own_id
pr_state_ptr->svc_complete
pr_state_ptr->Job_Desc_Table
pr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptrpr_state_ptr->current_subq
223
file
/** type of the job from the job_type field of the packet, and
**/
/** looking up the number of instructions for that type of job in
**/
/** the Job_Desc_Table, which has been read in from an external
**/
/** in the init state.
**/
FIN (jsd_prmpt_res_get_instructions (pkptr, pk_inst_ptr))
Tommy Svensson
Alex Popescu
224
head_pkptr;
low_pkptr;
orig_id;
orig_port;
insert_ok;
svc_time_determined;
success_code;
i;
sub_q_no;
pk_instructions;
pk_svc_time;
low_pk_svc_time;
old_svc_time;
time_processed;
time_in_processor;
svc_start;
original_svc_time;
processing_delay;
mean_util;
avg_throughput;
mean_proc_delay;
pk_prio;
job_type_filename [64];
err_str [256];
line;
line_id;
job_type;
instructions;
FSM_ENTER (jsd_prmpt_res)
-----*/
FSM_BLOCK_SWITCH
{
/*----------------------------------------------------
225
if (op_ima_obj_attr_get (own_id,
"processing_rate", &processing_rate) == OPC_COMPCODE_FAILURE)
jsd_prmpt_res_error ("Unable to get
processing rate from attribute.");
windowed stats. */
stats. */
Util_Stat_Hndl = jsd_win_avg_create
("Jsd.Windowed Utilization", win_size, OPC_STAT_LOCAL);
Work_Left_Stat_Hndl = jsd_win_avg_create
("Jsd.Windowed Work Left (sec)", win_size, OPC_STAT_LOCAL);
/* Register Statistics. */
busy_signal_shandle
= op_stat_reg
("Jsd.Busy Signal", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
inst_delay_shandle
= op_stat_reg
("Jsd.Instantaneous Delay (sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
Tommy Svensson
Alex Popescu
226
exit execs]")
227
server_busy);
228
*/
*/
*/
*/
229
instructions */
/* in the packet. */
else
{
/* Determine the number of instructions in
the packet. */
success_code =
jsd_prmpt_res_get_instructions (pkptr, &pk_instructions);
successfully determined,
processing_rate;
previously set,
*/
reference.
*/
if (op_pk_nfd_set (pkptr,
"svc_time", pk_svc_time) == OPC_COMPCODE_FAILURE)
jsd_prmpt_res_error ("Unable
to get service time from packet.");
/* Set a success flag to be used
later. */
else
svc_time_determined = 1;
}
{
/* It was not possible to get the
number of instructions from the packet. */
svc_time_determined = 0;
job_type field was not set.");
deallocate the packet. */
the packet and continuing.");
Tommy Svensson
Alex Popescu
230
the packet. */
if (op_pk_nfd_set (pkptr,
"svc_time_remain", pk_svc_time) == OPC_COMPCODE_FAILURE)
jsd_prmpt_res_error ("Unable to set
remaining service time in packet.");
time, to keep track of
*/
*/
*/
(current_subq , OPC_QPOS_HEAD);
{
/* If so, preemption of the
/* Get a pointer to the packet
head_pkptr = op_subq_pk_access
if (head_pkptr == OPC_NIL)
jsd_prmpt_res_error
("Unable to get packet from head of subqueue.");
processing time the packet required */
231
if (op_intrpt_cancel
*/
}
type is double! */
jsd_prmpt_res_error
/*
server_busy = 0;
}
pk_prio=op_pk_priority_get (pkptr);
Tommy Svensson
Alex Popescu
*/
232
lowest priority. */
op_pk_destroy (low_pkptr);
this state.
else
inserted packet to
*/
*/
statistical use.
work_left_last += pk_svc_time;
}
{
/* Insertion was successful */
insert_ok = 1;
/* Add the service time of the
*/
*/
{
/* Insertion was successful */
insert_ok = 1;
/* Add the service time of the
else
inserted packet to
work_left_last += pk_svc_time;
}
233
OPC_QPOS_HEAD);
if (pkptr == OPC_NIL)
jsd_prmpt_res_error ("Unable to access
packet at head of subqueue.");
Tommy Svensson
Alex Popescu
234
FSM_PROFILE_SECTION_OUT ("jsd_prmpt_res
[svc_start enter execs]", state3_enter_exec)
/** state (svc_start) exit executives **/
FSM_STATE_EXIT_FORCED (3, "svc_start", "jsd_prmpt_res
[svc_start exit execs]")
FSM_PROFILE_SECTION_IN ("jsd_prmpt_res
[svc_start exit execs]", state3_exit_exec)
{
}
FSM_PROFILE_SECTION_OUT ("jsd_prmpt_res
[svc_start exit execs]", state3_exit_exec)
/** state (svc_start) transition processing **/
FSM_TRANSIT_FORCE (1, state1_enter_exec, ;, "default",
"", "svc_start", "idle")
/*--------------------------------------------------------*/
235
*/
*/
OPC_QPOS_HEAD);
if (pkptr == OPC_NIL)
jsd_prmpt_res_error ("Unable to get packet
from head of subqueue.");
processor
*/
*/
*/
the queue.
*/
processing_delay);
236
num_pks_serviced);
the queue
*/
*/
op_sim_time ());
ack. */
OPC_COMPCODE_FAILURE)
FSM_PROFILE_SECTION_OUT ("jsd_prmpt_res
[svc_comp enter execs]", state4_enter_exec)
Tommy Svensson
Alex Popescu
237
FSM_EXIT (0,jsd_prmpt_res)
}
238
0;
}
{
/* Initialize FSM handling */
((jsd_prmpt_res_state *)(*gen_state_pptr))->current_block =
FRET (OPC_COMPCODE_SUCCESS)
}
void
jsd_prmpt_res_diag (void)
{
/* No Diagnostic Block */
}
void
jsd_prmpt_res_terminate (void)
{
int _block_origin = __LINE__;
FIN (jsd_prmpt_res_terminate (void))
Vos_Catmem_Dealloc (pr_state_ptr);
FOUT
}
/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in jsd_prmpt_res_svar function. */
Tommy Svensson
Alex Popescu
239
server_busy
table_exists
num_lines
processing_rate
current_priority
last_update_time
total_busy_time
work_left_last
total_work
total_delay
num_pks_serviced
win_size
Util_Stat_Hndl
Work_Left_Stat_Hndl
own_id
svc_complete
Job_Desc_Table
job_type_table_id
busy_signal_shandle
inst_delay_shandle
inst_wk_left_shandle
normalized_delay_shandle
mean_util_shandle
avg_thruput_shandle
mean_delay_shandle
current_subq
void
jsd_prmpt_res_svar (void * gen_ptr, const char * var_name, char **
var_p_ptr)
{
jsd_prmpt_res_state
*prs_ptr;
FIN (jsd_prmpt_res_svar (gen_ptr, var_name, var_p_ptr))
if (var_name == OPC_NIL)
{
*var_p_ptr = (char *)OPC_NIL;
FOUT
}
prs_ptr = (jsd_prmpt_res_state *)gen_ptr;
if (strcmp ("server_busy" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->server_busy);
FOUT
}
if (strcmp ("table_exists" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->table_exists);
FOUT
}
if (strcmp ("num_lines" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->num_lines);
Tommy Svensson
Alex Popescu
240
if
if
if
if
if
if
if
if
if
if
if
FOUT
}
(strcmp ("processing_rate" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->processing_rate);
FOUT
}
(strcmp ("current_priority" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->current_priority);
FOUT
}
(strcmp ("last_update_time" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->last_update_time);
FOUT
}
(strcmp ("total_busy_time" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->total_busy_time);
FOUT
}
(strcmp ("work_left_last" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->work_left_last);
FOUT
}
(strcmp ("total_work" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->total_work);
FOUT
}
(strcmp ("total_delay" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->total_delay);
FOUT
}
(strcmp ("num_pks_serviced" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->num_pks_serviced);
FOUT
}
(strcmp ("win_size" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->win_size);
FOUT
}
(strcmp ("Util_Stat_Hndl" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->Util_Stat_Hndl);
FOUT
}
(strcmp ("Work_Left_Stat_Hndl" , var_name) == 0)
{
*var_p_ptr = (char *) (&prs_ptr->Work_Left_Stat_Hndl);
FOUT
}
Tommy Svensson
Alex Popescu
241
242
Tommy Svensson
Alex Popescu
243
Appendix 3
/* Process model C form file: ta_gen.pr.c */
/* This variable carries the header into the object file */
static const char ta_gen_pr_c [] = "MIL_3_Tfile_Hdr_ 90A 30A modeler 7
3EF84C02 3EF84C02 1 its-2503-5 exjobb 0 0 none none 0 0 none 0 0 0 0 0 0
";
#include <string.h>
#define JSDC_RCV_IN_STRM
#define JSDC_XMT_OUT_STRM
#define JSDC_CREATE_INTRPT
creation */
/* Transition macros */
#define CREATE
(op_intrpt_type () == OPC_INTRPT_SELF && \
op_intrpt_code () == JSDC_CREATE_INTRPT)
#define ARRIVAL
void
void
jsd_gen_request_creation ();
jsd_gen_error ();
244
((ta_gen_state*)
pr_state_ptr->own_id
pr_state_ptr->active
pr_state_ptrpr_state_ptr->priority_range
pr_state_ptr->next_dist
pr_state_ptr->ia_time
*/
*/
*/
/* Function Block */
enum { _block_origin = __LINE__ };
void
jsd_gen_request_creation ()
{
double
next_creation_time;
Evhandle
evh;
/** This function computes the time until the next packet creation
**/
/** from an exponential distribution based on the value of
**/
Tommy Svensson
Alex Popescu
245
if (active)
{
/* Determine the next packet creation time. */
next_creation_time = op_dist_outcome (next_dist);
if (next_creation_time == OPC_DBL_INVALID)
jsd_gen_error ("Unable to get next packet creation
time from distribution.");
/* Schedule an interrupt for that time. */
evh = op_intrpt_schedule_self (op_sim_time () +
next_creation_time, JSDC_CREATE_INTRPT);
if (op_ev_valid (evh) == OPC_FALSE)
jsd_gen_error ("Unable to schedule self interrupt for
next packet creation.");
}
FOUT;
}
void
jsd_gen_error (msg)
char*
msg;
{
/** Print an error message and exit the simulation. **/
FIN (jsd_gen_error (msg));
op_sim_end ("Error in JSD traffic generation process (jsd_gen):",
msg, OPC_NIL, OPC_NIL);
FOUT;
}
/* End of Function Block */
/* Undefine optional tracing in FIN/FOUT/FRET */
/* The FSM has its own tracing code and the other */
/* functions should not have any tracing.
*/
#undef FIN_TRACING
#define FIN_TRACING
#undef FOUTRET_TRACING
#define FOUTRET_TRACING
#if defined (__cplusplus)
extern "C" {
#endif
void ta_gen (void);
Compcode ta_gen_init (void **);
Tommy Svensson
Alex Popescu
246
= 0;
pkptr;
dval;
svc_time;
instructions;
priority;
FSM_ENTER (ta_gen)
-----*/
FSM_BLOCK_SWITCH
{
/*----------------------------------------------------
interarrival times. */
Tommy Svensson
Alex Popescu
247
execs]")
Tommy Svensson
Alex Popescu
248
execs]")
Tommy Svensson
Alex Popescu
249
*/
*/
*/
This
not an ack. */
**/
(instruction_range);
from distribution.");
/* instructions = op_dist_uniform
*/
instructions = instruction_range;
if (instructions == OPC_DBL_INVALID)
jsd_gen_error ("Unable to get instructions
packet. */
Tommy Svensson
Alex Popescu
250
*/
from distribution.");
priority = priority_range;
if (priority == OPC_DBL_INVALID)
jsd_gen_error ("Unable to get priority
op_pk_priority_set (pkptr, priority);
/* Send the packet over the XMT_OUT stream. */
op_pk_send (pkptr, JSDC_XMT_OUT_STRM);
}
execs]")
251
execs]")
-----------*/
FSM_EXIT (0,ta_gen)
}
252
FRET (OPC_COMPCODE_FAILURE)
}
FRET (OPC_COMPCODE_SUCCESS)
}
void
ta_gen_diag (void)
{
/* No Diagnostic Block */
}
void
ta_gen_terminate (void)
{
int _block_origin = __LINE__;
FIN (ta_gen_terminate (void))
Vos_Catmem_Dealloc (pr_state_ptr);
FOUT
}
/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in ta_gen_svar function. */
#undef own_id
#undef active
#undef instruction_range
#undef priority_range
#undef next_dist
#undef ia_time
void
ta_gen_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
{
Tommy Svensson
Alex Popescu
253
*prs_ptr;
Tommy Svensson
Alex Popescu
254
Appendix 4
/* Process model C form file: ta_wfq.pr.c */
/* atof(), atoi() */
#define QUEUE_EMPTY
op_q_empty ()
#define SUBQ_EMPTY
#define SERVER_FREE
#define SERVER_BUSY
0
1
double VT (void);
void ta_wfq_error (char * msg);
double retmaximum (double val1,double val2);
double SoQ_calc(int sq);
double get_VFT (int sq);
/* End of Header Block */
#if !defined (VOSD_NO_FIN)
#undef
BIN
Tommy Svensson
Alex Popescu
255
((ta_wfq_state*)
pr_state_ptr->processing_rate
pr_state_ptr->own_id
pr_state_ptr->weight
pr_state_ptr->active_queues
pr_state_ptr->server_busy
*/
*/
*/
/* Function Block */
enum { _block_origin = __LINE__ };
double VT (void)
{
int no_active_q;
int i;
double virtual_time;
/** This function returns the virtual time **/
/* Determine number of active queues */
for (i=0;i<3;i++)
{
no_active_q += active_queues[i];
}
Tommy Svensson
Alex Popescu
256
257
{
/* Get a handle to the tail packet */
pkptr = op_subq_pk_access (sq,OPC_QPOS_TAIL);
if (pkptr == OPC_NIL)
ta_wfq_error ("Unable to access packet in subqueue.");
/* Determine VFT */
if (op_pk_nfd_get (pkptr, "svc_time_remain", &prev_pk_vft)
== OPC_COMPCODE_FAILURE)
ta_wfq_error ("Unable to get remaining service time
from packet.");
return prev_pk_vft;
}
}
void
ta_wfq_error (msg)
char*
msg;
{
/** Print an error message and exit the simulation. **/
FIN (ta_wfq_error (msg));
op_sim_end ("Error in WFQ process (ta_wfq):",
msg, OPC_NIL, OPC_NIL);
FOUT
}
/* End of Function Block */
/* Undefine optional tracing in FIN/FOUT/FRET */
/* The FSM has its own tracing code and the other */
/* functions should not have any tracing.
*/
#undef FIN_TRACING
#define FIN_TRACING
#undef FOUTRET_TRACING
#define FOUTRET_TRACING
#if defined (__cplusplus)
extern "C" {
#endif
void ta_wfq (void);
Compcode ta_wfq_init (void **);
void ta_wfq_diag (void);
void ta_wfq_terminate (void);
void ta_wfq_svar (void *, const char *, char **);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif
Tommy Svensson
Alex Popescu
258
-----*/
FSM_BLOCK_SWITCH
{
/*----------------------------------------------------
if (op_ima_obj_attr_get (own_id,
"processing_rate", &processing_rate) == OPC_COMPCODE_FAILURE)
ta_wfq_error ("Unable to get processing
rate from attribute.");
weight. */
Tommy Svensson
Alex Popescu
for(i=0;i<3;i++)
{
/* Get assigned value of the queue0-queue2
259
execs]")
Tommy Svensson
Alex Popescu
260
input stream.");
*/
Tommy Svensson
Alex Popescu
261
*/
*/
== OPC_COMPCODE_FAILURE)
packet.");
subqueue pk_prio. */
exit execs]")
262
*/
*/
OPC_QPOS_HEAD);
if (pkptr == OPC_NIL)
ta_wfq_error ("Unable to extract packet to
service from subqueue.");
packet. */
Tommy Svensson
Alex Popescu
263
packets in subqueue.");
system */
264
(i,OPC_QPOS_HEAD);
/* Determine VFT */
if (op_pk_nfd_get (pkptr,
"svc_time_remain", &VFT) == OPC_COMPCODE_FAILURE)
ta_wfq_error ("Unable to get
VFT from packet.");
if (min_VFT==0.0)
{
min_VFT=VFT;
subq_no=i;
}
else if (min_VFT>VFT)
{
min_VFT=VFT;
subq_no=i;
}
(subq_no,OPC_QPOS_HEAD);
subqueue.");
== OPC_COMPCODE_FAILURE)
from packet.");
SVC_TIME, subq_no);
Tommy Svensson
Alex Popescu
265
FSM_EXIT (0,ta_wfq)
}
266
FRET (OPC_COMPCODE_FAILURE)
}
FRET (OPC_COMPCODE_SUCCESS)
}
void
ta_wfq_diag (void)
{
/* No Diagnostic Block */
}
void
ta_wfq_terminate (void)
{
int _block_origin = __LINE__;
FIN (ta_wfq_terminate (void))
Vos_Catmem_Dealloc (pr_state_ptr);
FOUT
}
/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in ta_wfq_svar function. */
#undef processing_rate
#undef own_id
#undef weight
#undef active_queues
#undef server_busy
void
ta_wfq_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
{
ta_wfq_state
*prs_ptr;
Tommy Svensson
Alex Popescu
267
Tommy Svensson
Alex Popescu
268