cnet v4.0.4 | |
home topology files command‑line options the core API FAQ download and install |
Topology filescnet accepts (many) command line options to control its execution. However, more important is cnet's use of a topology file to define the nodes, links, and attributes in each network simulation. If the name of the topology file is "-", then the topology will be read from standard input. Consider the following simple topology file which defines a 2-node network. An implementation of the stopandwait protocol is being developed over a single bidirectional WAN link which experiences dataframe corruption. cnet keywords are case-sensitive and are presented here in bold font.
// A simple 2-node WAN topology
compile = "stopandwait.c"
mapimage = "australia.gif"
messagerate = 500ms
probframecorrupt = 4
host Perth {
wan to Melbourne
}
host Melbourne {
east of Perth
}
If necessary,
the topology file is first preprocessed by the C-preprocessor,
enabling the use of
Global attributes
may be defined in each topology file
and affect the execution of the whole simulation.
They may not be redefined on a per-node or per-link basis.
In the above topology,
the Node attributes and link attributes that are defined before any node definitions define the default attributes for any following node and link definitions. These will be the defaults unless redefined locally within a node or link definition.
Local attributes are defined within a new "block",
by opening a curly bracket (as in C).
The following example topology file extends the previous one.
The (global) default
// A more complex 2-node WAN topology
compile = "stopandwait.c"
mapimage = "australia.gif"
messagerate = 500ms
probframecorrupt = 4
host Perth {
messagerate = 1000ms
wan to Melbourne {
probframecorrupt = 2
probframeloss = 2
}
}
host Melbourne {
east of Perth
}
However, the network interface at Perth is more unreliable,
and has a Defining different node typesEach node in cnet is either a host (such as a workstation), a router, a mobile node (such as a wireless PDA), or a wireless accesspoint. We indicate its type in the topology file with a keyword before the node's name, as in the following incomplete example:
host Perth {
....
}
router gateway1 {
....
}
mobile laptop {
....
}
accesspoint endrun {
....
}
Defining WAN links
Nodes of all types, except mobile nodes,
may have one or more point-to-point WAN (wide-area network) links.
All WAN links are bidirectional and, by default, their attributes of
frame loss and corruption, etc, are the same in both directions.
Link attribute names specific to WAN links are prefixed with Because each WAN link has exactly two endpoints, only one node (end) needs to explicitly declare the link. The other node may also explicitly declare the link for clarity, but usually only does so if it wishes to define link attributes that are specific for that end. Consider the following example with 3 nodes and 2 WAN links:
compile = "protocol.c"
wan-bandwidth = 128Kbps
wan-mtbf = 3600sec
wan-mttr = 60sec
host Perth {
wan to Melbourne
}
host Melbourne {
wan-mtbf = 10000sec
wan to Perth {
wan-mttr = 30sec
}
wan to Sydney {
wan-mttr = 10sec
}
}
host Sydney {
// I have a WAN link to Melbourne
}
Defining LAN segments and LAN interfaces
Nodes of all types, except mobile nodes,
may have one or more LAN (local-area network) links.
Each LAN link connects to exactly one named lan segment,
and all LAN links share their segment's bandwidth to transmit data frames
to other nodes on the same segment.
Link attribute names specific to LAN segments and links are prefixed
with Each LAN link's Network Interface card (NIC) requires a NIC address, and this is usually defined as a local LAN attribute of each LAN link when it is defined inside a node's definition. Consider the following topology file connecting 3 nodes with a single 10Mbps LAN segment:
compile = "ethertest.c"
lansegment LAB1 {
lan-bandwidth = 10Mbps
lan-mtbf = 3600sec
lan-mttr = 60sec
x=100, y=200
}
host budgie {
lan to LAB1 {
nicaddr = 00:90:27:62:58:84
}
}
host koala {
lan to LAB1 {
nicaddr = 00:90:27:41:B0:BE
}
}
host wombat {
lan to LAB1 {
nicaddr = 00:A0:C9:AF:9E:81
}
}
Defining WLAN interfaces
Nodes of all types may have one or more WLAN (wireless local-area network)
links.
Mobile nodes may only have WLAN links,
and accesspoints must have at least one WLAN link.
Link attribute names specific to WLAN links are prefixed with WLAN links are each owned by a node and are not "connected" to any named endpoint. Each WLAN link's Network Interface card (NIC) requires a NIC address, and this must be defined as a local attribute inside the WLAN's definition. Consider the following topology file permitting two mobile computers to communicate via an accesspoint (if all are within range):
compile = "cafe.c"
mapwidth = 700
mapheight = 600
accesspoint toISP {
wlan {
wlan-txpower = 500mW
nicaddr = 00:0A:27:7D:41:C6
}
}
mobile laptop1 {
wlan {
nicaddr = 00:90:27:62:83:F5
}
}
mobile laptop2 {
wlan {
nicaddr = 00:90:27:34:B6:D8
}
}
|