Search This Blog

Monday, March 17, 2008

SYSTEM DESIGN

4.1 Architecture

4.1.1 Drawing the network topology
The network devices are drawn on the work panel by clicking on the appropriate network device in the toolbox provided at the top of the editor.
As we see in other editing software’s, the SNiP Network Simulator provides a toolbox containing the network devices such as node, router, switch etc to draw the network topology.
The network devices are drawn on a work panel by clicking on the appropriate device icon from the toolbox and on the work panel. The properties are set by selecting the properties option from the context menu, which can be invoked by right clicking the network device icon drawn on the work panel.

4.1.2 Setting up properties
The properties are the characteristics associated with the network devices. All the network devices are set to the default property when it is drawn. The properties of different types of network devices are maintained differently in structure and all the objects which represent the same network device are stored in the same array. The properties of a network device are displayed by just right clicking on the appropriate device and selecting properties option from the context menu. The properties then changed and saved. The saved properties overwrite the existing value and the array list is updated.

4.1.3 Compiler: To compile the topology
The compilation unit compiles the topology drawn. Two different branches are used for the compilation of algorithmic simulation and real world simulation. The compiler checks for the syntax error in the properties of all the network devices and connection errors if any mismatch occurred in connection.




The compilation unit further generates warnings and messages. Warnings are not errors but some cautions generated may be remembering the user to set some properties for network devices or remembering to connect the network device if any connection is left out. Once the topology becomes error free, then the compiler translates all the properties set to the network topology to commands for the simulation engine.

4.1.4 Command Prompt
The command prompt is used to enter commands to set the properties of network entities and replaces all GUI interfaces with commands. As shown in the above figure, the command prompt interacts with network topology and compiler.
Example “add node 1 stcp 127.0.0.1” adds the “stcp 127.0.0.1” to node 1.
The user can use to compile the simulation by the command “compile”. The connection establishment details can be entered directly into the command prompt. The sequence of connection establishment is dumped by the simulation engine to the command prompt.



















4.1.5 Simulation engine
The simulation engine does data transfer as simulation. It establishes the connection, generates the packets, sends them to the router, and forwards to the other network devices and thus controls the data transfer. It also logs all the packets sent to the network.
The simulation engine is associated with the algorithms. It calculates the shortest path for the connection establishment, generates the packets in constant rate from a sender and sends through the link in link speed, stores in router buffer and does the data transfer as data transfer occurs in real network.

Elements of simulation engine are
• Packet generator
• Data transfer unit
• Timer.











4.1.6 Packet generator
The packet generator generates the packets. The packet size is pre defined in the properties of a node. The packet generator is associated with the timer. The packet generator generates the packets in a definite time intervals.
The packet generator generates TPDUs for the acknowledgements from a active sender or receiver.

4.1.7 Data transfer unit
The data transfer unit transfers the data packets in the network. Path for the packet transfer, speed of connection, and the packet itself is the input to the data transfer unit. The data transfer unit is synchronized with the timer. Depending on the bandwidth and time the data transfer unit transmits the packet as it occurs in real network.

4.1.8 Timer
The timer gives the timing signals to the simulation engine. When it updates the time, it gives the signal to the simulation engine. The simulation calls the packet generator and transmits the generated packets to the network.

4.1.9 Stack Trace: Packet details
The stack trace gives the details of all packets. It has the following fields
Time: Gives the exact time in which the packet is transmitted.
Size: Gives the size of the packet.
From: Gives the source host name from where the packet is transferred.
To: Gives the destination host number to where the packet is transferred.
Route: Gives the route for the packet transfer.
Status: Contains the status of the packet. If the packet is dropped it contains “dropped” else “transmitted”.

4.1.10 Graph Plotting: Selecting log details for graph plotting
Graph of transmitted and dropped packet can be plotted using graph plot tool. The graph plot tool takes the stack trace as input. Depending on the status in stack trace, the graph plot tool divides the entire packet history into transmitted and dropped packets and thus plots the graph.

4.1.11 Play back of the data transfer
After the simulation is finished, the simulation server will send back the simulation result files to the GUI program. A log file is created and the file will be the input for playback. The playback gives the packet transfer information in GUI.

The packet animation trace file can be replayed later by the packet animation player. The performance curve of these log files can be plotted by the performance monitor.

4.2 Features
The SNiP Network Simulator has many useful features listed as follows:

• Its simulation speed is high and its simulation results are repeatable.
• The SNiP Simulator runs on windows platform.
• There is no need for kernel up-gradation and manual invocation of external processes.
• It provides a highly integrated and professional GUI environment. This GUI can help a user

 Draw network topologies.
 Configure the protocol modules used inside a node.
 Specify the moving paths of nodes.
 Plot network performance graphs.
 Playing back the animation of a logged packet transfer trace, etc. All these operations can be easily and intuitively done with the GUI.

SNiP uses a simple but effective syntax to describe the settings and configurations of a simulation job. These descriptions' are generated by the GUI and stored in a file. Normally the GUI will automatically transfer the file to the simulation engine for execution. However, if a researcher wants to try his (her) novel device or network configurations that the current GUI does not support, he (she) can totally bypass the GUI and generate the suite of description file by himself (herself) using the command prompt . The commands entered in the command prompt are directly transferred to the simulation engine for execution.



Chapter 5
DETAILED DESIGN

5.1 Front end design
The front end is designed using .NET and visual C#. The front end includes a network editor and GUI design. The network editor contains toolbox and menus.
The SNiP Simulator model contains 32 windows forms and 7 separate code files. The starting Windows form is SimCont.cs which is a Multiple Document Interface (MDI) parent. The SimCont form holds the instance of WorkPanel form as MDI child. The SimCont form contains a toolbox, which contains different icons for network devices. SimCont also contains a menu strip. The menu strip holds File, Edit, Tools, Simulate and Help menus and submenus.
The first form which loads into the memory is loadingfrm.cs. It calls SimCont.cs and further AObj.cs. The AObj.cs allocates objects and memory for those objects.
Network devices are drawn by clicking on the toolbar and then Work Panel. Every network device is associated with a form and some procedures inside the form for construction of new devices, to set the properties. When the new devices are created default properties are set. All the network devices including link are associated with different structure and an array list. The structure maintains the behavior of the device whereas the array list contains instances of those structures.
Every Network device is linked with a context menu strip. Right-clicking the device invokes the menu. The menu contains items such as Cut, Copy, Delete, Properties etc. Clicking on the properties invoke the form associated with the network device which contains the characteristics of the device. Lines can be drawn from one network device to other. Line drawing procedure is written in LineFrm.cs. The line drawing is done by calling DrawALine function inside the LineFrm.cs. The DrawALine function calls midpoint line algorithm written inside Midline.cs code module, to find out all points of the line for packet transfer animation.
The CompPro.cs windows form contains the definition for errors and warnings. It contains definition for 7 errors and 3 warnings. All the errors and warnings are associated with an ID.
ConnectionFrm.cs establishes the connection. It establishes a path from an active sender to receiver. It finds a shortest path among them and establishes the connection and makes the sender and receiver ready for packet transfer.
It contains a structure STCP which contains three fields. The first field represents the active sender of the connection. Second field gives the active receiver. The last field gives the path for data transfer.
LineFrm.cs, RouterFrm.cs, NodeFrm.cs, HubFrm.cs, SwitchFrm.cs are the Windows forms for the represents the characteristics of Network Connector, Router, Node, Hub and Switch respectively. Selecting properties of the respective device by right clicking on it invokes particular Windows form associated with it.
Other windows forms
Windows Forms Description
SettingsFrm.cs This is designed for the customization of the simulator. The form contains options to set the colors in playback, data and time limit for simulation etc
StackTrace.cs is designed to display a stack trace window after the simulation. The form contains a listbox which contains ID, Size, Source, Destination and for status of the packet.

GraphControl.cs Draws a graph. The input for the control is the x co-ordinate and y co-ordinate points and scale for drawing.
GraphFrm.cs This provides a Windows form for GraphControl.cs. Along with this it also mines the data form the simulation to draw the graph and adds GraphControl.cs.

ImgList.cs Contains a list of icons for toolbox.
TransactionLdFrm.cs Displays a loading form signifying the completion of transaction.
GraphSelectFrm.cs Displays all nodes in a combo box and provides options to select the graph type such as transfer graph of drop graph
CmdPromptFrm Invokes the command prompt. The command prompt can be used to interact with all the network devices and used to run the simulation.

5.2 Algorithms
Algorithm/Function Description
MidLine Algorithm Mid Point line algorithm.
Upon drawing every link, this algorithm is called.
Saves all X and Y points of a line in an Arraylist.
FileWrite FileRead Functions Writes and reads the entire network drawn in the WorkPanel. All network devices are written into the file in a format and the same format is used for reading the file.
CompileAll Compiles the simulation. If any syntax error exists in the topology then it displays the error else the simulation is ready to run. The run button is enabled.
TransferData Animation for transfer of data in real time. The procedure takes bandwidth and data size to be transferred and calculates the time required for data transfer.
DrawGraph This function draws the graph. The input is X co-ordinate points and Y co-ordinate points and scale.
StackTrace This function displays the status of every packet transferred from a source to a destination.
CnctNetDFrm Contains information about the network links. The bandwidth and type of the links can be changed here.
GetAIp This function gets a random IP address. The IP address returned from this function contains 4 fields, and all fields within the range 0-255
SimulateAll Simulates the entire network from the connection establishment phase until the end of the data transfer. This procedure creates log files, which gives the details of data transfer.
FlushAll Flushes all the buffer arrays associated with the actual buffer of routers, switches hubs. Also clears all the file transfers.
TCPpiar Finds out shortest path form a source to a destination and stores for shortest path for TCP connection.
FwdRouterToRouter Forwards packets from router to router.
FwdRouterToSwitch Forwards packets from router to switch.
FwdRouterToHub Forwards packets from router to hub.
FwdSwitchToRouter Forwards packets from switch to router.
FwdSwitchToSwitch Forwards packets from switch to switch.
FwdSwitchToHub Forwards packets from switch to hub.
FwdHubToRouter Forwards packets from hub to router.
FwdHubToSwitch Forwards packets from hub to switch.
FwdHubToHub Forwards packets from hub to hub.

STRUCTURES Description

SNODE
To hold the properties of a node. A Node has the following properties.
Node Number: All the nodes are numbered to identify the node.
IP Address: This field holds the IP address of the node
X and Y hold the position of the node icon.
Pb holds the picture box which contains icon of the node.
DCmd holds the command entered into a node.


SROUTER To hold the properties of a router. A router has the following properties.
Router Name: Holds the name of the router.
Router Number: All the routers are numbered to identify the router.
Pb holds the picture box which contains icon of the router.
X and Y hold the position of the node icon.
ConD : Holds the connection information
maxBuf : Holds the buffer size of the router

fillBuf : Holds the filled buffer information
pckTs: Arraylist that holds the packets as a queue.

SLINE Holds the link information. The line link information includes the bandwidth of the link and description about the link.

SHUB Holds the properties of hub. This includes the buffer size of the hub, unique number assigned to the hub for identification.

SPACKET
Holds packet information. Packet information includes size of the packet, source and destination of the packet.

SSTACK Holds a stack entry. The stack entry includes a SPACKET, source and destination of the packet and status of the packet which gives the information about whether the packet is sent successfully or not.

STCP Holds the source, destination and path for TCP connection.

SNODECMD Holds the command entered at the node.
The command includes the command string start time to start the data transfer.