cnet Network Simulator - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

cnet Network Simulator

Description:

... click on both node and link icons to display their output and attribute windows. ... Check out this site for further cnet information ... – PowerPoint PPT presentation

Number of Views:274
Avg rating:3.0/5.0
Slides: 29
Provided by: johnga88
Category:
Tags: check | cnet | icons | network | out | simulator

less

Transcript and Presenter's Notes

Title: cnet Network Simulator


1
cnet Network Simulator - Overview
2
The cnet network simulator enables
experimentation with various networking protocols
and topologies. cnet was developed by Chris
McDonald at the University of Western
Australia. With reference to the protocol stack,
cnet provides only the application and physical
layers - Many interesting simulations may be
run by just adding a simple data link layer Code
may be written to fill-in' any necessary
internal protocol layers and, in particular, to
overcome the corrupted and lost frames that
cnet's physical layer gratuitously and randomly
introduces.
3
  • Simulation sizes may range from two nodes to a
    few hundred nodes.
  • Networks may consist of any combination of
    point-to-point links and Ethernet segments
  • Simulation is organized via two user-supplied
    files
  • - network topology file
  • - protocol layer(s) source code
  • - The topology file is a text file that
    describes the layout of the network nodes,
    links, errors, etc.
  • - The source code must be written in C. The
    source code is not compiled directly, but
    automatically compiled and linked by the cnet
    simulator.

4
  • A number of library functions are available in
    the simulator to enable the behaviour of a
    network to be studied.
  • For example, data link layer code may make calls
  • - to read from and write to the application
    layer
  • - to read from and write to the physical layer
  • The simulator maintains information about the
    state of all nodes, links, errors, etc. in the
    network.
  • This information may be accessed from the
    protocol code.

5
cnets protocol model
6
An event-driven organization is used - The
simulation responds to a series of events The
same protocol (as defined in your protocol layer
source code) runs at every node in the network -
The code has access to a node's attributes and
link information generated by the simulator
7
typedef struct CnetNodeinfo
CnetNodeinfo nodeinfo
Node attributes
May include in your protocol file,
pre-defined structs that describe Node and
Link attributes
typedef struct CnetLinkinfo CnetLin
kinfo linkinfo include ltcnet.hgt
Link attributes
Header file
8
/ A simple 2-node point-to-point network
topology / compile "stopandwait.c"
drawframes true messagerate 500ms,
propagationdelay 700ms, probframecorrupt 3,
host Perth x100, y100 messagerate
1000ms, link to Melbourne host Melbourne
east of Perth link to Perth
Perth
Melbourne
Protocol file
An example topology file
9
include ltcnet.hgt static void
application_ready(CnetEvent ev, CnetTimer timer,
CnetData data) ... success
CNET_read_application( ... ) ... static
void physical_ready(CnetEvent ev, CnetTimer
timer, CnetData data) ... success
CNET_read_physical( ... ) ... Etc.
Called when application layer message arrives at
data link layer, for example
Called when physical layer message arrives at
data link layer, for example
Protocol template
10
Inform cnet what functions will handle which
events - this function must be present
void reboot_node(CnetEvent ev, CnetTimer timer,
CnetData data) ... success
CNET_set_handler(EV_APPLICATIONREADY,
application_ready, 0) success
CNET_set_handler(EV_PHYSICALREADY,
physical_ready, 0) ...
The above code informs cnet that user-supplied
function application_ready will handle messages
being passed down from the application layer
while user-supplied function physical_ready will
handle messages being passed up by the physical
layer. Also need functions to transmit messages
from physical layer and to pass up received
messages to application.
11
A simplified cnet example
include ltcnet.hgt include ltstdlib.hgt include
ltstring.hgt
It is not this simple!
12
static void application_ready() char
msgbuffer MAX_MESSAGE_SIZE CnetAddr
destaddr int length length
sizeof(msgbuffer) / get message from
application layer / result
CNET_read_application(destaddr, msgbuffer,
length) / prepare message for transmission
... / transmit_frame()
13
static void transmit_frame() char myframe
MAX_MESSAGE_SIZE MY_OVERHEAD int
length / prepare frame contents for
transmission / length ... result
CNET_write_physical(link, myframe, length)
Construct data link frame add header and
trailer compute CRC
14
static void physical_ready() char
msgbuffer MAX_MESSAGE_SIZE char myframe
MAX_MESSAGE_SIZE MY_OVERHEAD int link,
length / receive message from another node
/ length sizeof(myframe) result
CNET_read_physical(link, myframe, length)
/ process frame contents / / give
to application layer / result
CNET_write_application(msgbuffer, length)
Deconstruct data link frame remove header and
trailer check CRC
15
A number of example topology files and
corresponding C source code files are supplied as
examples - click - keyboard - linkcrash -
protocol - ticktock - flooding - stopandwait
16
cnet provides a graphical representation of the
network under execution and permits a number of
attributes of the network to be modified while
the simulation is running. - Nodes may be
re-positioned and selected which results in a
sub-window being displayed containing the output
and statistics of that node. - The node's
attributes of message rates and sizes may be
modified while the network is running by
selecting choice buttons. - Similarly, the
default attributes of all nodes in the network
may be simultaneously modified by selecting and
changing global attributes
17
The current node and link attributes may be
modified via the windowing interface menus
18
Simple two node simulation, implementing the
stop-and-wait protocol. The simulation is
currently running, but we could pause and then
single-step through our protocol using the menu
buttons. A total of 1622 messages have so far
been delivered, and the Application Layer has not
been presented with any incorrect messages. The
protocol is thus reported as being 100 correct.
19
It is possible to click on both node and link
icons to display their output and attribute
windows.
Node windows
20
Link window
21
An automatic debugging feature opens a window to
illustrate where a coding error has been
discovered.
22
cnet is able to present a limited visualization
of data frames traversing the physical layer -
data frames and acknowledgements - frame loss
and corruption
23
Over the top?
24
cnet runs on Unix platforms and is best used with
a windowing interface for greater clarity. It is
available on each computer in the Unix lab. The
url of the home cnet site is http//www.cs.uwa.e
du.au/cnet/ Check out this site for further cnet
information Need to be familiar with the
sections Getting Started and Greater Detail.
Number of examples explained.
25
Setting up cnet Select the Fedora Core 4 option
(1) from the menu selection when you boot PC in
Unix Lab. Login stud\your_userid Password
your_Windows_password You have access to your
Windows Q drive as the Q directory.
26
You need to copy the cnet examples to your Q
directory. Develop all your cnet assignments in
the Q directory otherwise your work will be
available to other students using the same PC
later! You can run cnet from your Q
directory. Your Q directory is accessible via
the path /Q/your_userid Note the path of
your home directory from the root directory
is /home/ADS/your_userid
27
In your Q directory, make a directory called
cnet md cnet In directory cnet, make a
directory called examples cd cnet md
examples Copy all files from /home/cnet to your
examples directory cd /home/cnet/examples cp
/Q/your_userid/cnet/examples
28
Check out cnet by running an example. cd
/Q/your_userid/cnet/examples cnet STOPANDWAIT
Topology file. There must be a corresponding
protocol file
Note cnet convention is that filenames of
topology files are in uppercase, while filenames
of the protocol files are in lowercase. E.g.
STOPANDWAIT, stopandwait.c
Write a Comment
User Comments (0)
About PowerShow.com